renaming in tools directory
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import Arweave from 'arweave';
|
||||
import {
|
||||
LoggerFactory,
|
||||
SmartWeaveNodeFactory
|
||||
WarpNodeFactory
|
||||
} from '../src';
|
||||
import { TsLogFactory } from '../src/logging/node/TsLogFactory';
|
||||
import path from "path";
|
||||
@@ -38,7 +38,7 @@ async function main() {
|
||||
useNullAsDefault: true
|
||||
});
|
||||
|
||||
const smartweave = await SmartWeaveNodeFactory.knexCached(arweave, knexConfig);
|
||||
const warp = await WarpNodeFactory.knexCached(arweave, knexConfig);
|
||||
|
||||
const wallet: JWKInterface = readJSON('.secrets/33F0QHcb22W7LwWR1iRC8Az1ntZG09XQ03YWuw2ABqA.json');
|
||||
|
||||
@@ -46,7 +46,7 @@ async function main() {
|
||||
const initialState = fs.readFileSync(path.join(__dirname, 'data/js/token-pst.json'), 'utf8');
|
||||
|
||||
// case 1 - full deploy, js contract
|
||||
const contractTxId = await smartweave.createContract.deploy({
|
||||
const contractTxId = await warp.createContract.deploy({
|
||||
wallet,
|
||||
initState: initialState,
|
||||
src: jsContractSrc,
|
||||
@@ -55,7 +55,7 @@ async function main() {
|
||||
logger.info("tx id:", contractTxId);
|
||||
|
||||
// connecting to a given contract
|
||||
const token = smartweave
|
||||
const token = warp
|
||||
.contract<any>(contractTxId)
|
||||
// connecting wallet to a contract. It is required before performing any "writeInteraction"
|
||||
// calling "writeInteraction" without connecting to a wallet first will cause a runtime error.
|
||||
@@ -76,10 +76,10 @@ async function main() {
|
||||
target: "33F0QHcb22W7LwWR1iRC8Az1ntZG09XQ03YWuw2ABqA",
|
||||
qty: 10
|
||||
}, [{
|
||||
name: SmartWeaveTags.INTERACT_WRITE,
|
||||
name: WarpTags.INTERACT_WRITE,
|
||||
value: "33F0QHcb22W7LwWR1iRC8Az1ntZG09XQ03YWuw2ABqA"
|
||||
},{
|
||||
name: SmartWeaveTags.INTERACT_WRITE,
|
||||
name: WarpTags.INTERACT_WRITE,
|
||||
value: "4MnaOd-GvsE5iVQD4OhdY8DOrH3vo0QEqOw31HeIzQ0"
|
||||
}
|
||||
]);*/
|
||||
|
||||
@@ -4,7 +4,7 @@ import { LoggerFactory, mapReplacer } from '../src';
|
||||
import { TsLogFactory } from '../src/logging/node/TsLogFactory';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { SmartWeaveWebFactory } from '../src/core/web/SmartWeaveWebFactory';
|
||||
import { WarpWebFactory } from '../src/core/web/WarpWebFactory';
|
||||
|
||||
async function main() {
|
||||
LoggerFactory.use(new TsLogFactory());
|
||||
@@ -20,9 +20,9 @@ async function main() {
|
||||
|
||||
const contractTxId = 'LppT1p3wri4FCKzW5buohsjWxpJHC58_rgIO-rYTMB8';
|
||||
|
||||
const smartweave = SmartWeaveWebFactory.memCached(arweave);
|
||||
const warp = WarpWebFactory.memCached(arweave);
|
||||
|
||||
const contract = smartweave.contract(contractTxId).setEvaluationOptions({
|
||||
const contract = warp.contract(contractTxId).setEvaluationOptions({
|
||||
ignoreExceptions: false,
|
||||
stackTrace: {
|
||||
saveState: false
|
||||
|
||||
@@ -6,7 +6,7 @@ const {TsLogFactory} = require('../lib/cjs/logging/node/TsLogFactory');
|
||||
const fs = require('fs');
|
||||
const path =require('path');
|
||||
const {readContract} = require("smartweave");
|
||||
const {SmartWeaveNodeFactory} = require("../lib/cjs/core/node/SmartWeaveNodeFactory");
|
||||
const {WarpNodeFactory} = require("../lib/cjs/core/node/WarpNodeFactory");
|
||||
|
||||
const logger = LoggerFactory.INST.create('Contract');
|
||||
|
||||
@@ -20,7 +20,7 @@ async function main() {
|
||||
protocol: 'https',
|
||||
port: 443,
|
||||
});
|
||||
/*const result = await SmartWeaveNodeFactory
|
||||
/*const result = await WarpNodeFactory
|
||||
.memCached(arweave)
|
||||
.contract("dKR4CTZUei9Q7L0n37WXs8pOOMP-WOyg0_2DSprdag4")
|
||||
.readState();*/
|
||||
|
||||
@@ -5,8 +5,8 @@ import {
|
||||
BlockHeightInteractionsSorter,
|
||||
Contract, DefaultEvaluationOptions, LexicographicalInteractionsSorter,
|
||||
LoggerFactory,
|
||||
SmartWeave,
|
||||
SmartWeaveNodeFactory
|
||||
Warp,
|
||||
WarpNodeFactory
|
||||
} from '../src';
|
||||
import {TsLogFactory} from '../src/logging/node/TsLogFactory';
|
||||
import fs from 'fs';
|
||||
@@ -16,7 +16,7 @@ import {JWKInterface} from 'arweave/node/lib/wallet';
|
||||
|
||||
async function main() {
|
||||
let wallet: JWKInterface;
|
||||
let smartweave: SmartWeave;
|
||||
let warp: Warp;
|
||||
|
||||
LoggerFactory.use(new TsLogFactory());
|
||||
LoggerFactory.INST.logLevel('error');
|
||||
@@ -34,7 +34,7 @@ async function main() {
|
||||
});
|
||||
|
||||
try {
|
||||
smartweave = SmartWeaveNodeFactory.memCached(arweave);
|
||||
warp = WarpNodeFactory.memCached(arweave);
|
||||
|
||||
wallet = await arweave.wallets.generate();
|
||||
const walletAddress = await arweave.wallets.getAddress(wallet);
|
||||
@@ -44,13 +44,13 @@ async function main() {
|
||||
const initialState = fs.readFileSync(path.join(__dirname, 'data/wasm/counter-init-state.json'), 'utf8');
|
||||
|
||||
|
||||
const contractTxId = await smartweave.createContract.deploy({
|
||||
const contractTxId = await warp.createContract.deploy({
|
||||
wallet,
|
||||
initState: initialState,
|
||||
src: contractSrc
|
||||
});
|
||||
|
||||
const contract = smartweave.contract(contractTxId).connect(wallet).setEvaluationOptions({
|
||||
const contract = warp.contract(contractTxId).connect(wallet).setEvaluationOptions({
|
||||
ignoreExceptions: true,
|
||||
gasLimit: 12000000
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable */
|
||||
import Arweave from 'arweave';
|
||||
import {LoggerFactory, SmartWeaveNodeFactory} from '../src';
|
||||
import {LoggerFactory, WarpNodeFactory} from '../src';
|
||||
import * as fs from 'fs';
|
||||
import knex from 'knex';
|
||||
import os from 'os';
|
||||
@@ -46,9 +46,9 @@ async function main() {
|
||||
},
|
||||
useNullAsDefault: true
|
||||
});
|
||||
const smartweave = (await SmartWeaveNodeFactory.knexCachedBased(arweave, knexConfig, 1))
|
||||
const warp = (await WarpNodeFactory.knexCachedBased(arweave, knexConfig, 1))
|
||||
.useRedStoneGateway().build();
|
||||
const contract = smartweave.contract("3vAx5cIFhwMihrNJgGx3CoAeZTOjG7LeIs9tnbBfL14");
|
||||
const contract = warp.contract("3vAx5cIFhwMihrNJgGx3CoAeZTOjG7LeIs9tnbBfL14");
|
||||
await contract.readState();
|
||||
await contract.readState();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable */
|
||||
import Arweave from 'arweave';
|
||||
import {LoggerFactory, SmartWeaveNodeFactory} from '../src';
|
||||
import {LoggerFactory, WarpNodeFactory} from '../src';
|
||||
import {TsLogFactory} from '../src/logging/node/TsLogFactory';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
@@ -18,28 +18,28 @@ async function main() {
|
||||
});
|
||||
|
||||
try {
|
||||
const smartweave = SmartWeaveNodeFactory.memCached(arweave);
|
||||
const warp = WarpNodeFactory.memCached(arweave);
|
||||
|
||||
const jsContractSrc = fs.readFileSync(path.join(__dirname, 'data/js/token-pst.js'), 'utf8');
|
||||
const wasmContractSrc = fs.readFileSync(path.join(__dirname, 'data/rust/rust-pst_bg.wasm'));
|
||||
const initialState = fs.readFileSync(path.join(__dirname, 'data/js/token-pst.json'), 'utf8');
|
||||
|
||||
// case 1 - full deploy, js contract
|
||||
const contractTxId = await smartweave.createContract.deploy({
|
||||
const contractTxId = await warp.createContract.deploy({
|
||||
wallet,
|
||||
initState: initialState,
|
||||
src: jsContractSrc,
|
||||
}, true);
|
||||
|
||||
// case 2 - deploy from source, js contract
|
||||
/*const contractTxId = await smartweave.createContract.deployFromSourceTx({
|
||||
/*const contractTxId = await warp.createContract.deployFromSourceTx({
|
||||
wallet,
|
||||
initState: initialState,
|
||||
srcTxId: "Hj0S0iK5rG8yVf_5u-usb9vRZg1ZFkylQLXu6rcDt-0",
|
||||
}, true);*/
|
||||
|
||||
// case 3 - full deploy, wasm contract
|
||||
/*const contractTxId = await smartweave.createContract.deploy({
|
||||
/*const contractTxId = await warp.createContract.deploy({
|
||||
wallet,
|
||||
initState: initialState,
|
||||
src: wasmContractSrc,
|
||||
@@ -48,13 +48,13 @@ async function main() {
|
||||
}, true);*/
|
||||
|
||||
// case 4 - deploy from source, wasm contract
|
||||
/*const contractTxId = await smartweave.createContract.deployFromSourceTx({
|
||||
/*const contractTxId = await warp.createContract.deployFromSourceTx({
|
||||
wallet,
|
||||
initState: initialState,
|
||||
srcTxId: "5wXT-A0iugP9pWEyw-iTbB0plZ_AbmvlNKyBfGS3AUY",
|
||||
}, true);*/
|
||||
|
||||
const contract = smartweave.contract(contractTxId).connect(wallet);
|
||||
const contract = warp.contract(contractTxId).connect(wallet);
|
||||
|
||||
await contract.bundleInteraction<any>({
|
||||
function: "storeBalance",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable */
|
||||
import Arweave from 'arweave';
|
||||
import { Contract, LoggerFactory, SmartWeave, SmartWeaveNodeFactory } from '../src';
|
||||
import { Contract, LoggerFactory, Warp, WarpNodeFactory } from '../src';
|
||||
import { TsLogFactory } from '../src/logging/node/TsLogFactory';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
@@ -16,7 +16,7 @@ async function main() {
|
||||
let wallet: JWKInterface;
|
||||
let walletAddress: string;
|
||||
|
||||
let smartweave: SmartWeave;
|
||||
let warp: Warp;
|
||||
let contractA: Contract<any>;
|
||||
let contractB: Contract<any>;
|
||||
let contractC: Contract<any>;
|
||||
@@ -43,7 +43,7 @@ async function main() {
|
||||
});
|
||||
|
||||
try {
|
||||
smartweave = SmartWeaveNodeFactory.memCached(arweave);
|
||||
warp = WarpNodeFactory.memCached(arweave);
|
||||
|
||||
wallet = await arweave.wallets.generate();
|
||||
|
||||
@@ -64,20 +64,20 @@ async function main() {
|
||||
'utf8'
|
||||
);
|
||||
|
||||
contractATxId = await smartweave.createContract.deploy({
|
||||
contractATxId = await warp.createContract.deploy({
|
||||
wallet,
|
||||
initState: contractAInitialState,
|
||||
src: contractASrc
|
||||
});
|
||||
|
||||
contractBTxId = await smartweave.createContract.deploy({
|
||||
contractBTxId = await warp.createContract.deploy({
|
||||
wallet,
|
||||
initState: contractBInitialState,
|
||||
src: contractBSrc
|
||||
});
|
||||
|
||||
contractA = smartweave.contract(contractATxId).setEvaluationOptions({ internalWrites: true }).connect(wallet);
|
||||
contractB = smartweave.contract(contractBTxId).setEvaluationOptions({ internalWrites: true }).connect(wallet);
|
||||
contractA = warp.contract(contractATxId).setEvaluationOptions({ internalWrites: true }).connect(wallet);
|
||||
contractB = warp.contract(contractBTxId).setEvaluationOptions({ internalWrites: true }).connect(wallet);
|
||||
|
||||
await mine();
|
||||
|
||||
@@ -132,11 +132,11 @@ async function main() {
|
||||
logger.info('ContractA -805 :', (await contractA.readState()).state.counter);
|
||||
logger.info('ContractB -2060 :', (await contractB.readState()).state.counter);
|
||||
|
||||
const contractA2 = SmartWeaveNodeFactory.memCached(arweave)
|
||||
const contractA2 = WarpNodeFactory.memCached(arweave)
|
||||
.contract<any>(contractATxId)
|
||||
.setEvaluationOptions({ internalWrites: true })
|
||||
.connect(wallet);
|
||||
const contractB2 = SmartWeaveNodeFactory.memCached(arweave)
|
||||
const contractB2 = WarpNodeFactory.memCached(arweave)
|
||||
.contract<any>(contractBTxId)
|
||||
.setEvaluationOptions({ internalWrites: true })
|
||||
.connect(wallet);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable */
|
||||
import Arweave from 'arweave';
|
||||
import { Contract, LoggerFactory, SmartWeave, SmartWeaveNodeFactory } from '../src';
|
||||
import { Contract, LoggerFactory, Warp, WarpNodeFactory } from '../src';
|
||||
import { TsLogFactory } from '../src/logging/node/TsLogFactory';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
@@ -15,7 +15,7 @@ async function main() {
|
||||
let wallet: JWKInterface;
|
||||
let walletAddress: string;
|
||||
|
||||
let smartweave: SmartWeave;
|
||||
let warp: Warp;
|
||||
let calleeContract: Contract<any>;
|
||||
let callingContract: Contract;
|
||||
let calleeTxId;
|
||||
@@ -38,7 +38,7 @@ async function main() {
|
||||
});
|
||||
|
||||
try {
|
||||
smartweave = SmartWeaveNodeFactory.memCached(arweave);
|
||||
warp = WarpNodeFactory.memCached(arweave);
|
||||
|
||||
wallet = await arweave.wallets.generate();
|
||||
walletAddress = await arweave.wallets.jwkToAddress(wallet);
|
||||
@@ -53,23 +53,23 @@ async function main() {
|
||||
);
|
||||
|
||||
// deploying contract using the new SDK.
|
||||
calleeTxId = await smartweave.createContract.deploy({
|
||||
calleeTxId = await warp.createContract.deploy({
|
||||
wallet,
|
||||
initState: JSON.stringify({ counter: 100 }),
|
||||
src: calleeContractSrc
|
||||
});
|
||||
|
||||
const callingTxId = await smartweave.createContract.deploy({
|
||||
const callingTxId = await warp.createContract.deploy({
|
||||
wallet,
|
||||
initState: JSON.stringify({ ticker: 'WRITING_CONTRACT' }),
|
||||
src: callingContractSrc
|
||||
});
|
||||
|
||||
calleeContract = smartweave.contract(calleeTxId).connect(wallet).setEvaluationOptions({
|
||||
calleeContract = warp.contract(calleeTxId).connect(wallet).setEvaluationOptions({
|
||||
ignoreExceptions: false,
|
||||
internalWrites: true,
|
||||
});
|
||||
callingContract = smartweave.contract(callingTxId).connect(wallet).setEvaluationOptions({
|
||||
callingContract = warp.contract(callingTxId).connect(wallet).setEvaluationOptions({
|
||||
ignoreExceptions: false,
|
||||
internalWrites: true
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
MemCache,
|
||||
RedstoneGatewayContractDefinitionLoader,
|
||||
RedstoneGatewayInteractionsLoader,
|
||||
SmartWeaveNodeFactory
|
||||
WarpNodeFactory
|
||||
} from '../src';
|
||||
import * as fs from 'fs';
|
||||
import knex from 'knex';
|
||||
@@ -34,7 +34,7 @@ async function main() {
|
||||
|
||||
const loader = new FromContractInteractionsLoader(jsContractTxId);
|
||||
|
||||
const smartweave = SmartWeaveNodeFactory.memCachedBased(arweave)
|
||||
const smartweave = WarpNodeFactory.memCachedBased(arweave)
|
||||
.setInteractionsLoader(loader)
|
||||
.build();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable */
|
||||
import Arweave from 'arweave';
|
||||
import {LoggerFactory, SmartWeaveNodeFactory} from '../src';
|
||||
import {LoggerFactory, WarpNodeFactory} from '../src';
|
||||
import {TsLogFactory} from '../src/logging/node/TsLogFactory';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
@@ -20,14 +20,14 @@ async function main() {
|
||||
});
|
||||
|
||||
try {
|
||||
const smartweave = SmartWeaveNodeFactory
|
||||
const warp = WarpNodeFactory
|
||||
.memCachedBased(arweave)
|
||||
.useRedStoneGateway()
|
||||
.build();
|
||||
|
||||
let customSignCalled = false;
|
||||
|
||||
const result = await smartweave.contract("Daj-MNSnH55TDfxqC7v4eq0lKzVIwh98srUaWqyuZtY")
|
||||
const result = await warp.contract("Daj-MNSnH55TDfxqC7v4eq0lKzVIwh98srUaWqyuZtY")
|
||||
.connect(/*wallet*/async (tx) => {
|
||||
logger.info("Custom sign function");
|
||||
customSignCalled = true;
|
||||
|
||||
@@ -5,8 +5,8 @@ import {
|
||||
BlockHeightInteractionsSorter,
|
||||
Contract, DefaultEvaluationOptions, LexicographicalInteractionsSorter,
|
||||
LoggerFactory, RedstoneGatewayInteractionsLoader,
|
||||
SmartWeave,
|
||||
SmartWeaveNodeFactory
|
||||
Warp,
|
||||
WarpNodeFactory
|
||||
} from '../src';
|
||||
import {TsLogFactory} from '../src/logging/node/TsLogFactory';
|
||||
import fs from 'fs';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable */
|
||||
import Arweave from 'arweave';
|
||||
import { Contract, LoggerFactory, SmartWeave, SmartWeaveNodeFactory } from '../src';
|
||||
import { Contract, LoggerFactory, Warp, WarpNodeFactory } from '../src';
|
||||
import { TsLogFactory } from '../src/logging/node/TsLogFactory';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
@@ -21,7 +21,7 @@ async function main() {
|
||||
let wallet: JWKInterface;
|
||||
let walletAddress: string;
|
||||
|
||||
let smartweave: SmartWeave;
|
||||
let warp: Warp;
|
||||
|
||||
LoggerFactory.use(new TsLogFactory());
|
||||
LoggerFactory.INST.logLevel('debug');
|
||||
@@ -42,7 +42,7 @@ async function main() {
|
||||
});
|
||||
|
||||
try {
|
||||
smartweave = SmartWeaveNodeFactory.memCached(arweave);
|
||||
warp = WarpNodeFactory.memCached(arweave);
|
||||
|
||||
wallet = await arweave.wallets.generate();
|
||||
walletAddress = await arweave.wallets.jwkToAddress(wallet);
|
||||
@@ -65,7 +65,7 @@ async function main() {
|
||||
'utf8'
|
||||
);
|
||||
|
||||
tokenContractTxId = await smartweave.createContract.deploy({
|
||||
tokenContractTxId = await warp.createContract.deploy({
|
||||
wallet,
|
||||
initState: JSON.stringify({
|
||||
...JSON.parse(tokenContractInitialState),
|
||||
@@ -74,7 +74,7 @@ async function main() {
|
||||
src: tokenContractSrc
|
||||
});
|
||||
|
||||
stakingContractTxId = await smartweave.createContract.deploy({
|
||||
stakingContractTxId = await warp.createContract.deploy({
|
||||
wallet,
|
||||
initState: JSON.stringify({
|
||||
...JSON.parse(stakingContractInitialState),
|
||||
@@ -83,11 +83,11 @@ async function main() {
|
||||
src: stakingContractSrc
|
||||
});
|
||||
|
||||
tokenContract = smartweave
|
||||
tokenContract = warp
|
||||
.contract(tokenContractTxId)
|
||||
.setEvaluationOptions({ internalWrites: true })
|
||||
.connect(wallet);
|
||||
stakingContract = smartweave
|
||||
stakingContract = warp
|
||||
.contract(stakingContractTxId)
|
||||
.setEvaluationOptions({ internalWrites: true })
|
||||
.connect(wallet);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable */
|
||||
import Arweave from 'arweave';
|
||||
import {LoggerFactory, SmartWeaveNodeFactory} from '../src';
|
||||
import {LoggerFactory, WarpNodeFactory} from '../src';
|
||||
import fs from 'fs';
|
||||
import {JWKInterface} from 'arweave/node/lib/wallet';
|
||||
import {TsLogFactory} from "../src/logging/node/TsLogFactory";
|
||||
@@ -17,7 +17,7 @@ async function main() {
|
||||
});
|
||||
|
||||
try {
|
||||
const contract = await SmartWeaveNodeFactory.memCached(arweave)
|
||||
const contract = await WarpNodeFactory.memCached(arweave)
|
||||
.contract("XIutiOKujGI21_ywULlBeyy-L9d8goHxt0ZyUayGaDg")
|
||||
.syncState("http://134.209.84.136:8080");
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { LoggerFactory } from '../src';
|
||||
import { TsLogFactory } from '../src/logging/node/TsLogFactory';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { SmartWeaveWebFactory } from '../src/core/web/SmartWeaveWebFactory';
|
||||
import { WarpWebFactory } from '../src/core/web/WarpWebFactory';
|
||||
import { FromFileInteractionsLoader } from './FromFileInteractionsLoader';
|
||||
import { readContract } from 'smartweave';
|
||||
import { readJSON } from '../../redstone-smartweave-examples/src/_utils';
|
||||
@@ -21,7 +21,7 @@ async function main() {
|
||||
logging: false // Enable network request logging
|
||||
});
|
||||
|
||||
const smartweave = SmartWeaveWebFactory.memCached(arweave);
|
||||
const smartweave = WarpWebFactory.memCached(arweave);
|
||||
|
||||
const jwk = readJSON('../redstone-node/.secrets/redstone-jwk.json');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user