Options
All
  • Public
  • Public/Protected
  • All
Menu

Batch actions from within an AssemblyScript contract

(1) transfer money

// assume Context.sender = "bob.testnet" ContractPromiseBatch.create("alice.testnet").transfer(100); // send 100 N to "alice.testnet"

(2) deploy a contract

// assume contract is loaded, either included and encoded as base64 in the current // contract itself or via input to a function call (requires some other changes in near-sdk-as) const code = Uint8Array[1,2,3]; // regardless, you end up with the contract code somehow

// assume Context.sender = "bob.testnet"

ContractPromiseBatch .create("app-v1.bob.testnet") .create_account() .transfer(u128.from(100)) .add_full_access_key(new Uint8Array(0)) // TODO: need signer public key as byte array .deploy_contract(code)

(3) chain promises

// assume Context.sender = "bob.testnet"

let promise = ContractPromiseBatch.create("first-contract.bob.testnet")

promise.then("first-contract.bob.testnet") .transfer(u128.from(10))

Hierarchy

  • ContractPromiseBatch

Index

Properties

id

id: u64

Methods

add_access_key

add_full_access_key

create_account

delete_account

delete_key

deploy_contract

function_call

stake

then

transfer

Static create

Generated using TypeDoc