Skip to content

Commit

Permalink
docs: fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Oct 28, 2021
1 parent 37450a8 commit 30957be
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions examples/node/contract-interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const COMPILER_URL = 'https://compiler.aepps.com';
// The `Universal` [Stamp](https://stampit.js.org/essentials/what-is-a-stamp) itself is asynchronous as it determines the node's version and
// rest interface automatically. Only once the Promise is fulfilled, you know you have a working object instance
// which is assigned to the `client` constant in this case.
//
//
// Note:
//
// - `Universal` is not a constructor but a factory, which means it's *not* invoked with `new`.
Expand All @@ -94,7 +94,7 @@ const COMPILER_URL = 'https://compiler.aepps.com';
// being created, signed (using the _secretKey_ of the previously defined `MemoryAccount`) and broadcasted to the network.
// It will be picked up by the miners and written to the chain.

const contract = await bytecode.deploy(['5'])
const contract = await bytecode.deploy([5])
console.log(`Contract deployed at ${contract.address}`)

// Note:
Expand All @@ -107,7 +107,7 @@ const COMPILER_URL = 'https://compiler.aepps.com';
// any public function (aka `entrypoint` in Sophia) defined within it.
// In this case you can use `callStatic` which performs a `dry-run` of the transaction which allows you to get the result without having to mine a transaction.

const call = await contract.callStatic('multiplyBy', ['7'])
const call = await contract.callStatic('multiplyBy', [7])

// **Note**:
//
Expand All @@ -117,7 +117,7 @@ const COMPILER_URL = 'https://compiler.aepps.com';
// The execution result, if successful, will be an FATE-encoded result value.
// The `decode` function will use the Sophia HTTP compiler to decode the result value.

console.log(`Execution result: ${await call.decode()}`)
console.log(`Execution result: ${call.decodedResult}`)

// ## 9. Get contract instance of a deployed contract
// Knowing the contract address and the source code allows you to
Expand Down
6 changes: 3 additions & 3 deletions examples/node/paying-for-tx-contract-call-tx.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const CONTRACT_SOURCE =
@compiler >= 6
contract PayingForTxExample =
record state = { last_caller: option(address) }
entrypoint init() =
Expand Down Expand Up @@ -104,7 +104,7 @@ const NEW_USER_KEYPAIR = Crypto.generateKeyPair();
// The `Universal` [Stamp](https://stampit.js.org/essentials/what-is-a-stamp) itself is asynchronous as it determines the node's version and
// rest interface automatically. Only once the Promise is fulfilled, you know you have a working object instance
// which is assigned to the `client` constant in this case.
//
//
// Note:
//
// - `Universal` is not a constructor but a factory, which means it's *not* invoked with `new`.
Expand Down Expand Up @@ -137,7 +137,7 @@ const NEW_USER_KEYPAIR = Crypto.generateKeyPair();
const contractInstance = await client.getContractInstance(CONTRACT_SOURCE, { contractAddress: CONTRACT_ADDRESS })
const dryRunTx = await contractInstance.methods.get_last_caller()
console.log(`New user: ${await newUserAccount.address()}`)
console.log(`Last caller: ${dryRunTx.decodedResult}`)
console.log(`Last caller:`, dryRunTx.decodedResult)

// Note:
//
Expand Down
2 changes: 1 addition & 1 deletion examples/node/paying-for-tx-spend-tx.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const AMOUNT = 1;
// The `Universal` [Stamp](https://stampit.js.org/essentials/what-is-a-stamp) itself is asynchronous as it determines the node's version and
// rest interface automatically. Only once the Promise is fulfilled, you know you have a working object instance
// which is assigned to the `client` constant in this case.
//
//
// Note:
//
// - `Universal` is not a constructor but a factory, which means it's *not* invoked with `new`.
Expand Down
2 changes: 1 addition & 1 deletion examples/node/transfer-ae.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const [amount = 1, recipient = ACCOUNT_KEYPAIR.publicKey] = process.argv.slice(2
// The `Universal` [Stamp](https://stampit.js.org/essentials/what-is-a-stamp) itself is asynchronous as it determines the node's version and
// rest interface automatically. Only once the Promise is fulfilled, you know you have a working object instance
// which is assigned to the `client` constant in this case.
//
//
// Note:
//
// - `Universal` is not a constructor but a factory, which means it's *not* invoked with `new`.
Expand Down

0 comments on commit 30957be

Please sign in to comment.