tests: example rust contracts moved from warp-wasm-templates

This commit is contained in:
robal
2023-03-17 17:55:17 +01:00
parent c1d8fb7a52
commit dbe52e82cd
75 changed files with 17993 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
const { loadWallet } = require('./utils/load-wallet');
const { connectArweave } = require('./utils/connect-arweave');
const { connectPstContract } = require('./utils/connect-pst-contract');
const { contractTxId } = require('./utils/contract-tx-id');
module.exports.interactBalance = async function (
host,
port,
protocol,
target,
walletJwk
) {
const arweave = connectArweave(host, port, protocol);
const wallet = await loadWallet(arweave, walletJwk, target, true);
const walletAddress = await arweave.wallets.jwkToAddress(wallet);
const txId = contractTxId(target);
const pst = await connectPstContract(arweave, wallet, txId, target);
const balance = await pst.currentBalance(walletAddress);
console.log(balance);
};