Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate calldata package, drop joi package #1313

Merged
merged 11 commits into from
Nov 12, 2021
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
127 changes: 40 additions & 87 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
"docs:api": "node apidoc.js",
"docs:changelog": "cp CHANGELOG.md docs/CHANGELOG.md",
"lint": "commitlint --from 635f1aa --verbose && ts-standard",
"test": "nyc --require @babel/register --require ts-node/register mocha --recursive --exit --timeout 10m",
"test": "nyc --require @babel/register --require ts-node/register mocha --recursive --exit --timeout 40s",
"report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
"test:integration:channel,accounts": "nyc --require @babel/register --require ts-node/register mocha './test/integration/@(channel|accounts).js' --exit --timeout 10m",
"test:integration:contract,chain": "nyc --require @babel/register --require ts-node/register mocha './test/integration/@(contract|contract-aci|chain).js' --timeout 10m",
"test:integration:else": "nyc --require @babel/register --require ts-node/register mocha './test/integration/!(channel|accounts|contract|chain).js' --timeout 10m",
"test:integration:channel,accounts": "nyc --require @babel/register --require ts-node/register mocha './test/integration/@(channel|accounts).js' --exit --timeout 40s",
"test:integration:contract,chain": "nyc --require @babel/register --require ts-node/register mocha './test/integration/@(contract|contract-aci|chain).js' --timeout 40s",
"test:integration:else": "nyc --require @babel/register --require ts-node/register mocha './test/integration/!(channel|accounts|contract|chain).js' --timeout 40s",
"test:unit": "nyc --require @babel/register --require ts-node/register mocha './test/unit/*'",
"test:watch": "mocha --recursive --require @babel/register --require ts-node/register --watch --timeout 10m",
"test:watch": "mocha --recursive --require @babel/register --require ts-node/register --watch --timeout 40s",
"prepare": "npm run build",
"prepublishOnly": "npm run docs:examples && npm run docs:changelog",
"release": "standard-version --skip.tag"
Expand All @@ -36,6 +36,7 @@
"SDK"
],
"dependencies": {
"@aeternity/aepp-calldata": "github:aeternity/aepp-calldata-js#for-sdk",
"@aeternity/bip39": "^0.1.0",
"@aeternity/json-bigint": "^0.3.1",
"@babel/runtime-corejs3": "^7.15.4",
Expand All @@ -51,7 +52,6 @@
"crypto-browserify": "^3.12.0",
"ed2curve": "^0.3.0",
"events": "^3.3.0",
"joi": "^17.4.2",
"libsodium-wrappers-sumo": "0.7.9",
"path-browserify": "^1.0.1",
"process": "^0.11.10",
Expand Down
Loading