Running Move Scripts
How can I run Move Scripts?
Running scripts with the TypeScript SDK
import { readFileSync } from "fs";
import { Endless, Account, AccountAddress } from "@endless-labs/ts-sdk";
// Setup client, and account to sign
const endless = new Endless();
const account = Account.generate();
// Load script bytecode
const buffer = readFileSync("./transfer_half.mv", "buffer");
const bytecode = new Uint8Array.from(buffer);
// Build a transaction with the bytecode of the script
const transaction = await endless.transaction.build.simple({
sender: account.accountAddress,
data: {
bytecode,
typeArguments: ["0x1::endless_coin::EndlessCoin"],
functionArguments: ["0x1"],
},
});
// Submit and wait for the transaction to complete
const pendingTxn = await endless.signAndSubmitTransaction({
signer: account,
transaction,
});
await endless.waitForTransaction({ transactionHash: pendingTxn.hash });Running scripts with the Endless Wallet Adapter
Running scripts with the CLI
Last updated