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