fix: contract manifest when no contract definition error

This commit is contained in:
ppe
2023-01-25 20:58:51 +01:00
committed by just_ppe
parent 10770a795c
commit f475297644
2 changed files with 67 additions and 46 deletions

View File

@@ -1,5 +1,5 @@
/* eslint-disable */
import {defaultCacheOptions, LoggerFactory, Warp, WarpFactory} from '../src';
import {defaultCacheOptions, LoggerFactory, WarpFactory} from '../src';
import os from 'os';
import {JWKInterface} from "arweave/web/lib/wallet";
import fs from "fs";
@@ -9,7 +9,7 @@ const logger = LoggerFactory.INST.create('Contract');
//LoggerFactory.use(new TsLogFactory());
LoggerFactory.INST.logLevel('error');
LoggerFactory.INST.logLevel('debug', 'CacheableStateEvaluator');
LoggerFactory.INST.logLevel('error', 'CacheableStateEvaluator');
async function main() {
printTestInfo();
@@ -18,48 +18,68 @@ async function main() {
const rssUsedBefore = Math.round((process.memoryUsage().rss / 1024 / 1024) * 100) / 100;
const warp = WarpFactory
.forMainnet({...defaultCacheOptions, inMemory: true});
.forMainnet({...defaultCacheOptions, inMemory: false});
let wallet: JWKInterface = readJSON('./.secrets/33F0QHcb22W7LwWR1iRC8Az1ntZG09XQ03YWuw2ABqA.json');
try {
const contract = warp
.contract("UBn9JE5iMyQ-nee7bjoE9oNbgTsHDMT7IfPNzZpvyyU")
.contract("OrO8n453N6bx921wtsEs-0OCImBLCItNU5oSbFKlFuU")
const cacheResult = await contract
.readState('000001105599,1674667555600,3ffc7b84a6ea98d21fe13a773ad17d051d2aaa402b229d01acd189b4431085fa');
console.log(cacheResult.cachedValue.validity);
.setEvaluationOptions({
allowBigInt: true,
internalWrites: true,
unsafeClient: "allow",
})
.readState('000000910492,1649597937854,be3250a325c520e72f6301ea7eee0e554d54b3c74778c11a7af72dd5988049dd');
console.log(cacheResult.sortKey);
const result2 = await contract.readStateFor('000001105599,1674667555600,3ffc7b84a6ea98d21fe13a773ad17d051d2aaa402b229d01acd189b4431085fa',
const result2 = await contract.readStateFor('000000910492,1649597937854,be3250a325c520e72f6301ea7eee0e554d54b3c74778c11a7af72dd5988049dd',
[{
"id": "-HX10_iGrTRb1iKRoQYrm_RvXfP9plsyyJANa_kXybw",
"fee": {"winston": "72600854"},
"vrf": null,
"tags": [{"name": "App-Name", "value": "SmartWeaveAction"}, {
"name": "App-Version",
"value": "0.3.0"
}, {"name": "SDK", "value": "Warp"}, {
"name": "Contract",
"value": "UBn9JE5iMyQ-nee7bjoE9oNbgTsHDMT7IfPNzZpvyyU"
}, {
"name": "Input",
"value": "{\"function\":\"transfer\",\"target\":\"M-mpNeJbg9h7mZ-uHaNsa5jwFFRAq0PsTkNWXJ-ojwI\",\"qty\":100}"
}],
"block": {
"id": "FtFO_auDIaR-caLom7Zl8unOPRJLU8zel1XvuYxDJO_fsVjz45YLjKiTK7tDvZ5k",
"height": 1105599,
"timestamp": 1674667290
"id": "YOIBrNDTwRoZRmlfTZhyjg7ygdjzqV9bZb6pZmXQzeE",
"fee": {
"winston": "62411260"
},
"tags": [
{
"name": "App-Name",
"value": "SmartWeaveAction"
},
{
"name": "App-Version",
"value": "0.3.0"
},
{
"name": "SDK",
"value": "RedStone"
},
{
"name": "Contract",
"value": "OrO8n453N6bx921wtsEs-0OCImBLCItNU5oSbFKlFuU"
},
{
"name": "Input",
"value": "{\"function\":\"registerProvider\",\"data\":{\"provider\":{\"adminsPool\":[\"saRRtnBNekVmBvx_3vNqQ2n2zhG7v3KCGsHbKioS5Sc\"],\"profile\":{\"name\":\"RedStone Avalanche prod 5\",\"description\":\"Most popular tokens from the Avalanche ecosystem\",\"url\":\"https://redstone.finance/\",\"imgUrl\":\"https://redstone.finance/assets/img/redstone-logo-full.svg\"},\"manifests\":[{\"changeMessage\":\"initial manifest\",\"lockedHours\":0,\"manifestTxId\":\"y7ppr6m9MuP65Fiivd9CX84qcPLoYBMifUrFK3jXw2k\"}]}}}"
}
],
"block": {
"id": "fZsSqrjTNX3IDVkDuCVX512ZnJ3HU9jjZ9Dg_7b471BWeT1sJ83c7RDMWCWd-1Mt",
"height": 910563,
"timestamp": 1649606400
},
"owner": {
"address": "saRRtnBNekVmBvx_3vNqQ2n2zhG7v3KCGsHbKioS5Sc"
},
"owner": {"address": "33F0QHcb22W7LwWR1iRC8Az1ntZG09XQ03YWuw2ABqA"},
"source": "redstone-sequencer",
"sortKey": "000001105599,1674667555795,7298532efd6c0aa28fad539bbe7a37007a49719d42e7a5dff5a3a00d28086297",
"testnet": null,
"quantity": {"winston": "0"},
"recipient": "",
"lastSortKey": "000001105599,1674667555600,3ffc7b84a6ea98d21fe13a773ad17d051d2aaa402b229d01acd189b4431085fa"
"sortKey": "000000910564,1649606636671,94a0b260d85920f86100fb200c60307ea0b30b70b4d2970049a567f53cd6f9c0",
"quantity": {
"winston": "0"
},
"recipient": ""
} as any]
)
console.log(result2.cachedValue.validity);
console.log(result2.sortKey);
} catch (e) {
console.error(e);
}