fix: verifying user and contract evaluation options
This commit is contained in:
@@ -90,7 +90,8 @@ describe('Testing unsafe client in nested contracts with "skip" option', () => {
|
|||||||
|
|
||||||
const newSource = fs.readFileSync(path.join(__dirname, '../data/token-pst-unsafe.js'), 'utf8');
|
const newSource = fs.readFileSync(path.join(__dirname, '../data/token-pst-unsafe.js'), 'utf8');
|
||||||
|
|
||||||
const newSrcTxId = await pst.save({ src: newSource }, warp.environment);
|
const srcTx = await warp.createSourceTx({ src: newSource }, wallet);
|
||||||
|
const newSrcTxId = await warp.saveSourceTx(srcTx);
|
||||||
await mineBlock(warp);
|
await mineBlock(warp);
|
||||||
|
|
||||||
const evolveResponse = await pst.evolve(newSrcTxId);
|
const evolveResponse = await pst.evolve(newSrcTxId);
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import { PstContract, PstState } from '../../../contract/PstContract';
|
|||||||
import { Warp } from '../../../core/Warp';
|
import { Warp } from '../../../core/Warp';
|
||||||
import { WarpFactory } from '../../../core/WarpFactory';
|
import { WarpFactory } from '../../../core/WarpFactory';
|
||||||
import { LoggerFactory } from '../../../logging/LoggerFactory';
|
import { LoggerFactory } from '../../../logging/LoggerFactory';
|
||||||
import exp from 'constants';
|
|
||||||
|
|
||||||
describe('Testing unsafe client in nested contracts with "skip" option', () => {
|
describe('Testing unsafe client in nested contracts with "skip" option', () => {
|
||||||
let safeContractSrc, unsafeContractSrc: string;
|
let safeContractSrc, unsafeContractSrc: string;
|
||||||
@@ -146,7 +145,8 @@ describe('Testing unsafe client in nested contracts with "skip" option', () => {
|
|||||||
});
|
});
|
||||||
await mineBlock(warp);
|
await mineBlock(warp);
|
||||||
|
|
||||||
const unsafeSrcTxId = await foreignSafePst.save({ src: unsafeContractSrc }, warp.environment);
|
const srcTx = await warp.createSourceTx({ src: unsafeContractSrc }, wallet);
|
||||||
|
const unsafeSrcTxId = await warp.saveSourceTx(srcTx);
|
||||||
await mineBlock(warp);
|
await mineBlock(warp);
|
||||||
|
|
||||||
await foreignSafePst.evolve(unsafeSrcTxId);
|
await foreignSafePst.evolve(unsafeSrcTxId);
|
||||||
|
|||||||
@@ -123,16 +123,13 @@ describe('Testing unsafe client in nested contracts with "skip" option', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should block write from foreign unsafe contract (1)', async () => {
|
it('should block write from foreign unsafe contract (1)', async () => {
|
||||||
console.log('======= FIRST WRITE =====');
|
|
||||||
const unsafeWriteTx = await foreignUnsafePst.writeInteraction({
|
const unsafeWriteTx = await foreignUnsafePst.writeInteraction({
|
||||||
function: 'writeForeign',
|
function: 'writeForeign',
|
||||||
contractTxId: contractTxId
|
contractTxId: contractTxId
|
||||||
});
|
});
|
||||||
await mineBlock(warp);
|
await mineBlock(warp);
|
||||||
|
|
||||||
console.log('======= Read main contract =======');
|
|
||||||
const result = await pst.readState();
|
const result = await pst.readState();
|
||||||
console.log(result.cachedValue.validity);
|
|
||||||
expect(result.cachedValue.validity[unsafeWriteTx.originalTxId]).toBeFalsy();
|
expect(result.cachedValue.validity[unsafeWriteTx.originalTxId]).toBeFalsy();
|
||||||
// should not change from previous test
|
// should not change from previous test
|
||||||
expect((result.cachedValue.state as any).foreignCallsCounter).toEqual(1);
|
expect((result.cachedValue.state as any).foreignCallsCounter).toEqual(1);
|
||||||
@@ -141,23 +138,21 @@ describe('Testing unsafe client in nested contracts with "skip" option', () => {
|
|||||||
// this does not work properly. Second write from the unsafe contract
|
// this does not work properly. Second write from the unsafe contract
|
||||||
// makes the previous write valid.
|
// makes the previous write valid.
|
||||||
it('should block write from foreign unsafe contract (2)', async () => {
|
it('should block write from foreign unsafe contract (2)', async () => {
|
||||||
console.log('======= NEXT WRITE =====');
|
|
||||||
const unsafeWriteTx = await foreignUnsafePst.writeInteraction({
|
const unsafeWriteTx = await foreignUnsafePst.writeInteraction({
|
||||||
function: 'writeForeign',
|
function: 'writeForeign',
|
||||||
contractTxId: contractTxId
|
contractTxId: contractTxId
|
||||||
});
|
});
|
||||||
await mineBlock(warp);
|
await mineBlock(warp);
|
||||||
|
|
||||||
console.log('======= Read main contract =======');
|
|
||||||
const result = await pst.readState();
|
const result = await pst.readState();
|
||||||
console.log(result.cachedValue.validity);
|
|
||||||
expect(result.cachedValue.validity[unsafeWriteTx.originalTxId]).toBeFalsy();
|
expect(result.cachedValue.validity[unsafeWriteTx.originalTxId]).toBeFalsy();
|
||||||
// should not change from previous test
|
// should not change from previous test
|
||||||
expect((result.cachedValue.state as any).foreignCallsCounter).toEqual(1);
|
expect((result.cachedValue.state as any).foreignCallsCounter).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should block write from foreign safe contract that evolved to unsafe', async () => {
|
it('should block write from foreign safe contract that evolved to unsafe', async () => {
|
||||||
const unsafeSrcTxId = await foreignSafePst.save({ src: unsafeContractSrc }, warp.environment);
|
const srcTx = await warp.createSourceTx({ src: unsafeContractSrc }, wallet);
|
||||||
|
const unsafeSrcTxId = await warp.saveSourceTx(srcTx);
|
||||||
await mineBlock(warp);
|
await mineBlock(warp);
|
||||||
|
|
||||||
await foreignSafePst.evolve(unsafeSrcTxId);
|
await foreignSafePst.evolve(unsafeSrcTxId);
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
import { EvaluationOptionsEvaluator } from '../../contract/EvaluationOptionsEvaluator';
|
import {EvaluationOptionsEvaluator} from '../../contract/EvaluationOptionsEvaluator';
|
||||||
import { WarpFactory } from '../../core/WarpFactory';
|
import {WarpFactory} from '../../core/WarpFactory';
|
||||||
|
|
||||||
describe('Evaluation options evaluator', () => {
|
describe('Evaluation options evaluator', () => {
|
||||||
const warp = WarpFactory.forLocal();
|
const warp = WarpFactory.forLocal();
|
||||||
|
|
||||||
it('should properly set root evaluation options', async () => {
|
it('should properly set root evaluation options', async () => {
|
||||||
const contract = warp.contract(null).setEvaluationOptions({
|
const contract = warp.contract(null);
|
||||||
internalWrites: false,
|
|
||||||
useVM2: true,
|
|
||||||
unsafeClient: 'skip'
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(new EvaluationOptionsEvaluator(contract.evaluationOptions(), {}).rootOptions).toEqual({
|
expect(new EvaluationOptionsEvaluator(contract.evaluationOptions(), {}).rootOptions).toEqual({
|
||||||
allowBigInt: false,
|
allowBigInt: false,
|
||||||
@@ -25,13 +21,20 @@ describe('Evaluation options evaluator', () => {
|
|||||||
saveState: false
|
saveState: false
|
||||||
},
|
},
|
||||||
throwOnInternalWriteError: true,
|
throwOnInternalWriteError: true,
|
||||||
unsafeClient: 'skip',
|
unsafeClient: 'throw',
|
||||||
updateCacheForEachInteraction: false,
|
updateCacheForEachInteraction: false,
|
||||||
useVM2: true,
|
useVM2: false,
|
||||||
waitForConfirmation: false,
|
waitForConfirmation: false,
|
||||||
walletBalanceUrl: 'http://nyc-1.dev.arweave.net:1984/'
|
walletBalanceUrl: 'http://nyc-1.dev.arweave.net:1984/'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
contract.setEvaluationOptions({
|
||||||
|
allowBigInt: true,
|
||||||
|
useVM2: true,
|
||||||
|
internalWrites: true,
|
||||||
|
gasLimit: 3453453
|
||||||
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
new EvaluationOptionsEvaluator(contract.evaluationOptions(), {
|
new EvaluationOptionsEvaluator(contract.evaluationOptions(), {
|
||||||
allowBigInt: true,
|
allowBigInt: true,
|
||||||
@@ -53,7 +56,7 @@ describe('Evaluation options evaluator', () => {
|
|||||||
saveState: false
|
saveState: false
|
||||||
},
|
},
|
||||||
throwOnInternalWriteError: true,
|
throwOnInternalWriteError: true,
|
||||||
unsafeClient: 'skip',
|
unsafeClient: 'throw',
|
||||||
updateCacheForEachInteraction: false,
|
updateCacheForEachInteraction: false,
|
||||||
useVM2: true,
|
useVM2: true,
|
||||||
waitForConfirmation: false,
|
waitForConfirmation: false,
|
||||||
@@ -90,32 +93,12 @@ describe('Evaluation options evaluator', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
new EvaluationOptionsEvaluator(contract2.evaluationOptions(), {
|
function () {
|
||||||
allowBigInt: true,
|
const result = new EvaluationOptionsEvaluator(contract2.evaluationOptions(), {
|
||||||
useVM2: false,
|
useVM2: false
|
||||||
internalWrites: true,
|
}).rootOptions
|
||||||
gasLimit: 3453453
|
}
|
||||||
}).rootOptions
|
).toThrow("Option {useVM2} differs, user: [true], manifest: [false]");
|
||||||
).toEqual({
|
|
||||||
allowBigInt: true,
|
|
||||||
cacheEveryNInteractions: -1,
|
|
||||||
gasLimit: 3453453,
|
|
||||||
ignoreExceptions: true,
|
|
||||||
internalWrites: true,
|
|
||||||
maxCallDepth: 5,
|
|
||||||
maxInteractionEvaluationTimeSeconds: 60,
|
|
||||||
mineArLocalBlocks: true,
|
|
||||||
sequencerUrl: 'https://d1o5nlqr4okus2.cloudfront.net/',
|
|
||||||
stackTrace: {
|
|
||||||
saveState: false
|
|
||||||
},
|
|
||||||
throwOnInternalWriteError: true,
|
|
||||||
unsafeClient: 'allow',
|
|
||||||
updateCacheForEachInteraction: false,
|
|
||||||
useVM2: false,
|
|
||||||
waitForConfirmation: false,
|
|
||||||
walletBalanceUrl: 'http://nyc-1.dev.arweave.net:1984/'
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should properly set foreign evaluation options - unsafeClient - allow', async () => {
|
it('should properly set foreign evaluation options - unsafeClient - allow', async () => {
|
||||||
@@ -124,9 +107,9 @@ describe('Evaluation options evaluator', () => {
|
|||||||
});
|
});
|
||||||
const eoEvaluator = new EvaluationOptionsEvaluator(contract.evaluationOptions(), {});
|
const eoEvaluator = new EvaluationOptionsEvaluator(contract.evaluationOptions(), {});
|
||||||
|
|
||||||
expect(eoEvaluator.forForeignContract({ unsafeClient: 'allow' })['unsafeClient']).toEqual('allow');
|
expect(eoEvaluator.forForeignContract({unsafeClient: 'allow'})['unsafeClient']).toEqual('allow');
|
||||||
expect(eoEvaluator.forForeignContract({ unsafeClient: 'skip' })['unsafeClient']).toEqual('skip');
|
expect(eoEvaluator.forForeignContract({unsafeClient: 'skip'})['unsafeClient']).toEqual('skip');
|
||||||
expect(eoEvaluator.forForeignContract({ unsafeClient: 'throw' })['unsafeClient']).toEqual('skip');
|
expect(eoEvaluator.forForeignContract({unsafeClient: 'throw'})['unsafeClient']).toEqual('skip');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should properly set foreign evaluation options - unsafeClient - skip', async () => {
|
it('should properly set foreign evaluation options - unsafeClient - skip', async () => {
|
||||||
@@ -135,9 +118,9 @@ describe('Evaluation options evaluator', () => {
|
|||||||
});
|
});
|
||||||
const eoEvaluator = new EvaluationOptionsEvaluator(contract.evaluationOptions(), {});
|
const eoEvaluator = new EvaluationOptionsEvaluator(contract.evaluationOptions(), {});
|
||||||
|
|
||||||
expect(eoEvaluator.forForeignContract({ unsafeClient: 'allow' })['unsafeClient']).toEqual('skip');
|
expect(eoEvaluator.forForeignContract({unsafeClient: 'allow'})['unsafeClient']).toEqual('skip');
|
||||||
expect(eoEvaluator.forForeignContract({ unsafeClient: 'skip' })['unsafeClient']).toEqual('skip');
|
expect(eoEvaluator.forForeignContract({unsafeClient: 'skip'})['unsafeClient']).toEqual('skip');
|
||||||
expect(eoEvaluator.forForeignContract({ unsafeClient: 'throw' })['unsafeClient']).toEqual('skip');
|
expect(eoEvaluator.forForeignContract({unsafeClient: 'throw'})['unsafeClient']).toEqual('skip');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should properly set foreign evaluation options - unsafeClient - throw', async () => {
|
it('should properly set foreign evaluation options - unsafeClient - throw', async () => {
|
||||||
@@ -146,9 +129,9 @@ describe('Evaluation options evaluator', () => {
|
|||||||
});
|
});
|
||||||
const eoEvaluator = new EvaluationOptionsEvaluator(contract.evaluationOptions(), {});
|
const eoEvaluator = new EvaluationOptionsEvaluator(contract.evaluationOptions(), {});
|
||||||
|
|
||||||
expect(eoEvaluator.forForeignContract({ unsafeClient: 'allow' })['unsafeClient']).toEqual('throw');
|
expect(eoEvaluator.forForeignContract({unsafeClient: 'allow'})['unsafeClient']).toEqual('throw');
|
||||||
expect(eoEvaluator.forForeignContract({ unsafeClient: 'skip' })['unsafeClient']).toEqual('throw');
|
expect(eoEvaluator.forForeignContract({unsafeClient: 'skip'})['unsafeClient']).toEqual('throw');
|
||||||
expect(eoEvaluator.forForeignContract({ unsafeClient: 'throw' })['unsafeClient']).toEqual('throw');
|
expect(eoEvaluator.forForeignContract({unsafeClient: 'throw'})['unsafeClient']).toEqual('throw');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should properly set foreign evaluation options - internalWrites - true', async () => {
|
it('should properly set foreign evaluation options - internalWrites - true', async () => {
|
||||||
@@ -157,8 +140,8 @@ describe('Evaluation options evaluator', () => {
|
|||||||
});
|
});
|
||||||
const eoEvaluator = new EvaluationOptionsEvaluator(contract.evaluationOptions(), {});
|
const eoEvaluator = new EvaluationOptionsEvaluator(contract.evaluationOptions(), {});
|
||||||
|
|
||||||
expect(eoEvaluator.forForeignContract({ internalWrites: true })['internalWrites']).toEqual(true);
|
expect(eoEvaluator.forForeignContract({internalWrites: true})['internalWrites']).toEqual(true);
|
||||||
expect(eoEvaluator.forForeignContract({ internalWrites: false })['internalWrites']).toEqual(false);
|
expect(eoEvaluator.forForeignContract({internalWrites: false})['internalWrites']).toEqual(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should properly set foreign evaluation options - internalWrites - false', async () => {
|
it('should properly set foreign evaluation options - internalWrites - false', async () => {
|
||||||
@@ -167,8 +150,8 @@ describe('Evaluation options evaluator', () => {
|
|||||||
});
|
});
|
||||||
const eoEvaluator = new EvaluationOptionsEvaluator(contract.evaluationOptions(), {});
|
const eoEvaluator = new EvaluationOptionsEvaluator(contract.evaluationOptions(), {});
|
||||||
|
|
||||||
expect(eoEvaluator.forForeignContract({ internalWrites: true })['internalWrites']).toEqual(true);
|
expect(eoEvaluator.forForeignContract({internalWrites: true})['internalWrites']).toEqual(true);
|
||||||
expect(eoEvaluator.forForeignContract({ internalWrites: false })['internalWrites']).toEqual(false);
|
expect(eoEvaluator.forForeignContract({internalWrites: false})['internalWrites']).toEqual(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should properly set foreign evaluation options - throwOnInternalWriteError - true', async () => {
|
it('should properly set foreign evaluation options - throwOnInternalWriteError - true', async () => {
|
||||||
@@ -177,10 +160,10 @@ describe('Evaluation options evaluator', () => {
|
|||||||
});
|
});
|
||||||
const eoEvaluator = new EvaluationOptionsEvaluator(contract.evaluationOptions(), {});
|
const eoEvaluator = new EvaluationOptionsEvaluator(contract.evaluationOptions(), {});
|
||||||
|
|
||||||
expect(eoEvaluator.forForeignContract({ throwOnInternalWriteError: true })['throwOnInternalWriteError']).toEqual(
|
expect(eoEvaluator.forForeignContract({throwOnInternalWriteError: true})['throwOnInternalWriteError']).toEqual(
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
expect(eoEvaluator.forForeignContract({ throwOnInternalWriteError: false })['throwOnInternalWriteError']).toEqual(
|
expect(eoEvaluator.forForeignContract({throwOnInternalWriteError: false})['throwOnInternalWriteError']).toEqual(
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -191,10 +174,10 @@ describe('Evaluation options evaluator', () => {
|
|||||||
});
|
});
|
||||||
const eoEvaluator = new EvaluationOptionsEvaluator(contract.evaluationOptions(), {});
|
const eoEvaluator = new EvaluationOptionsEvaluator(contract.evaluationOptions(), {});
|
||||||
|
|
||||||
expect(eoEvaluator.forForeignContract({ throwOnInternalWriteError: true })['throwOnInternalWriteError']).toEqual(
|
expect(eoEvaluator.forForeignContract({throwOnInternalWriteError: true})['throwOnInternalWriteError']).toEqual(
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
expect(eoEvaluator.forForeignContract({ throwOnInternalWriteError: false })['throwOnInternalWriteError']).toEqual(
|
expect(eoEvaluator.forForeignContract({throwOnInternalWriteError: false})['throwOnInternalWriteError']).toEqual(
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -205,8 +188,8 @@ describe('Evaluation options evaluator', () => {
|
|||||||
});
|
});
|
||||||
const eoEvaluator = new EvaluationOptionsEvaluator(contract.evaluationOptions(), {});
|
const eoEvaluator = new EvaluationOptionsEvaluator(contract.evaluationOptions(), {});
|
||||||
|
|
||||||
expect(eoEvaluator.forForeignContract({ ignoreExceptions: true })['ignoreExceptions']).toEqual(true);
|
expect(eoEvaluator.forForeignContract({ignoreExceptions: true})['ignoreExceptions']).toEqual(true);
|
||||||
expect(eoEvaluator.forForeignContract({ ignoreExceptions: false })['ignoreExceptions']).toEqual(true);
|
expect(eoEvaluator.forForeignContract({ignoreExceptions: false})['ignoreExceptions']).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should properly set foreign evaluation options - ignoreExceptions - false', async () => {
|
it('should properly set foreign evaluation options - ignoreExceptions - false', async () => {
|
||||||
@@ -215,7 +198,7 @@ describe('Evaluation options evaluator', () => {
|
|||||||
});
|
});
|
||||||
const eoEvaluator = new EvaluationOptionsEvaluator(contract.evaluationOptions(), {});
|
const eoEvaluator = new EvaluationOptionsEvaluator(contract.evaluationOptions(), {});
|
||||||
|
|
||||||
expect(eoEvaluator.forForeignContract({ ignoreExceptions: true })['ignoreExceptions']).toEqual(false);
|
expect(eoEvaluator.forForeignContract({ignoreExceptions: true})['ignoreExceptions']).toEqual(false);
|
||||||
expect(eoEvaluator.forForeignContract({ ignoreExceptions: false })['ignoreExceptions']).toEqual(false);
|
expect(eoEvaluator.forForeignContract({ignoreExceptions: false})['ignoreExceptions']).toEqual(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { EvaluationManifest } from './deploy/CreateContract';
|
|
||||||
import { EvaluationOptions } from '../core/modules/StateEvaluator';
|
import { EvaluationOptions } from '../core/modules/StateEvaluator';
|
||||||
import { deepCopy } from '../utils/utils';
|
import { deepCopy } from '../utils/utils';
|
||||||
|
|
||||||
@@ -107,11 +106,30 @@ export class EvaluationOptionsEvaluator {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param evaluationOptions evaluation options set via {@link Contract.setEvaluationOptions}
|
* @param userSetOptions evaluation options set via {@link Contract.setEvaluationOptions}
|
||||||
* @param manifestOptions evaluation options from contract's manifest
|
* @param manifestOptions evaluation options from the root contract's manifest (i.e. the contract that
|
||||||
|
* the user is trying to read - e.g. via warp.contract(<txId>).readState();
|
||||||
*/
|
*/
|
||||||
constructor(evaluationOptions: EvaluationOptions, manifestOptions: Partial<EvaluationOptions>) {
|
constructor(userSetOptions: EvaluationOptions, manifestOptions: Partial<EvaluationOptions>) {
|
||||||
this.rootOptions = Object.freeze(Object.assign({}, evaluationOptions, manifestOptions || {}));
|
if (manifestOptions) {
|
||||||
|
for (const k in manifestOptions) {
|
||||||
|
if (userSetOptions[k] !== manifestOptions[k]) {
|
||||||
|
throw new Error(`Option {${k}} differs, user: [${userSetOptions[k]}], manifest: [${manifestOptions[k]}]`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if (userSetOptions.internalWrites !== undefined && (userSetOptions.internalWrites != manifestOptions.internalWrites)) {
|
||||||
|
throw new Error('User and contract manifest not compatible - internalWrites');
|
||||||
|
}
|
||||||
|
if (userSetOptions.unsafeClient && (manifestOptions.unsafeClient != userSetOptions.unsafeClient)) {
|
||||||
|
throw new Error('User and contract manifest not compatible - unsafeClient');
|
||||||
|
}
|
||||||
|
if (userSetOptions.throwOnInternalWriteError && (manifestOptions.throwOnInternalWriteError != userSetOptions.throwOnInternalWriteError)) {
|
||||||
|
throw new Error('User and contract manifest not compatible - throwOnInternalWriteError');
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
this.rootOptions = Object.freeze(Object.assign({}, userSetOptions, manifestOptions || {}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ import {JWKInterface} from 'arweave/node/lib/wallet';
|
|||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
let wallet: JWKInterface = readJSON('./.secrets/33F0QHcb22W7LwWR1iRC8Az1ntZG09XQ03YWuw2ABqA.json');
|
let wallet: JWKInterface = readJSON('./.secrets/33F0QHcb22W7LwWR1iRC8Az1ntZG09XQ03YWuw2ABqA.json');
|
||||||
;
|
LoggerFactory.INST.logLevel('error');
|
||||||
LoggerFactory.INST.logLevel('none');
|
|
||||||
LoggerFactory.INST.logLevel('debug', 'ExecutionContext');
|
LoggerFactory.INST.logLevel('debug', 'ExecutionContext');
|
||||||
const logger = LoggerFactory.INST.create('deploy');
|
const logger = LoggerFactory.INST.create('deploy');
|
||||||
|
|
||||||
@@ -26,7 +25,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, srcTxId} = await warp.createContract.deploy({
|
const {contractTxId, srcTxId} = await warp.deploy({
|
||||||
wallet,
|
wallet,
|
||||||
initState: initialState,
|
initState: initialState,
|
||||||
src: jsContractSrc,
|
src: jsContractSrc,
|
||||||
@@ -64,7 +63,7 @@ async function main() {
|
|||||||
});*/
|
});*/
|
||||||
|
|
||||||
const contract = warp.contract<any>(contractTxId)
|
const contract = warp.contract<any>(contractTxId)
|
||||||
.setEvaluationOptions({sequencerUrl: "http://localhost:5666/", internalWrites: false, unsafeClient: 'throw'})
|
.setEvaluationOptions({internalWrites: false, unsafeClient: 'throw'})
|
||||||
.connect(wallet);
|
.connect(wallet);
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
|||||||
Reference in New Issue
Block a user