chore: arlocal update

This commit is contained in:
ppedziwiatr
2021-12-01 21:34:17 +01:00
committed by Piotr Pędziwiatr
parent 0a20827b15
commit 730c3e10c6
6 changed files with 21 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "redstone-smartweave",
"version": "0.3.10-alpha.19",
"version": "0.4.0",
"description": "An implementation of the SmartWeave SDK.",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
@@ -67,7 +67,7 @@
"@types/node": "^16.7.1",
"@typescript-eslint/eslint-plugin": "^4.29.2",
"@typescript-eslint/parser": "^4.29.2",
"arlocal": "1.1.4",
"arlocal": "1.1.13",
"cheerio": "^1.0.0-rc.10",
"cors": "^2.8.5",
"eslint": "^7.32.0",

View File

@@ -52,12 +52,14 @@ describe('Testing the SmartWeave client', () => {
initialState = fs.readFileSync(path.join(__dirname, 'data/example-contract-state.json'), 'utf8');
// deploying contract using the new SDK.
await addFunds();
const contractTxId = await smartweave.createContract.deploy({
wallet,
initState: initialState,
src: contractSrc
});
contract = smartweave.contract(contractTxId);
contract.connect(wallet);
@@ -99,4 +101,9 @@ describe('Testing the SmartWeave client', () => {
async function mine() {
await arweave.api.get('mine');
}
async function addFunds() {
const walletAddress = await arweave.wallets.getAddress(wallet);
await arweave.api.get(`/mint/${walletAddress}/1000`);
}
});

View File

@@ -1,5 +1,6 @@
import Arweave from 'arweave';
import {
BlockHeightSwCache,
DebuggableExecutorFactory,
DefinitionLoader,
ExecutorFactory,

View File

@@ -9,7 +9,7 @@ export class DefaultCreateContract implements CreateContract {
this.deployFromSourceTx = this.deployFromSourceTx.bind(this);
}
async deploy(contractData: ContractData) {
async deploy(contractData: ContractData): Promise<string> {
this.logger.debug('Creating new contract');
const { wallet, src, initState, tags, transfer } = contractData;

View File

@@ -67,7 +67,11 @@ export class SmartWeaveWebFactory {
* Returns a preconfigured, memCached {@link SmartWeaveBuilder}, that allows for customization of the SmartWeave instance.
* Use {@link SmartWeaveBuilder.build()} to finish the configuration.
*/
static memCachedBased(arweave: Arweave, maxStoredBlockHeights: number = Number.MAX_SAFE_INTEGER): SmartWeaveBuilder {
static memCachedBased(
arweave: Arweave,
maxStoredBlockHeights: number = Number.MAX_SAFE_INTEGER,
stateCache?: MemBlockHeightSwCache<StateCache<unknown>>
): SmartWeaveBuilder {
const definitionLoader = new ContractDefinitionLoader(arweave, new MemCache());
const interactionsLoader = new CacheableContractInteractionsLoader(
@@ -79,7 +83,7 @@ export class SmartWeaveWebFactory {
const stateEvaluator = new CacheableStateEvaluator(
arweave,
new MemBlockHeightSwCache<StateCache<unknown>>(maxStoredBlockHeights),
stateCache ? stateCache : new MemBlockHeightSwCache<StateCache<unknown>>(maxStoredBlockHeights),
[new Evolve(definitionLoader, executorFactory)]
);

View File

@@ -1539,10 +1539,10 @@ argparse@^1.0.7:
dependencies:
sprintf-js "~1.0.2"
arlocal@1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/arlocal/-/arlocal-1.1.4.tgz#853d371573d1e055f13d0178b02a75de7927d129"
integrity sha512-SnQZ4MeRDnnLbkZRaDcq8gZeD1jBbTR6YEpOYD8gV/OhsNhURX/WuzKyzjiNdQCAs+mXpkpnRUNCnGDQE4gfMQ==
arlocal@1.1.13:
version "1.1.13"
resolved "https://registry.yarnpkg.com/arlocal/-/arlocal-1.1.13.tgz#a6875631c867bd377129b964a3aac4253964cf8a"
integrity sha512-zT8EZm71UTNtRw2FoxRRuojuUlfCTZOj9dz1uV9Z5tw5jTzB6ZUGCISo4W/G8iTvjAjZFmvFcq0OQW16x8gjEg==
dependencies:
"@koa/cors" "^3.1.0"
apollo-server-koa "^2.25.1"