From 56e3aa9d0d4a3e89aa70a1b94aaab463683d3f09 Mon Sep 17 00:00:00 2001 From: Denis Davidyuk Date: Mon, 6 Jul 2020 12:10:43 +1000 Subject: [PATCH 1/5] Fix api docs generation --- es/tx/builder/helpers.js | 5 +++-- es/tx/builder/index.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/es/tx/builder/helpers.js b/es/tx/builder/helpers.js index d64123f1e5..4a20d172ef 100644 --- a/es/tx/builder/helpers.js +++ b/es/tx/builder/helpers.js @@ -55,10 +55,11 @@ export function buildContractId (ownerId, nonce) { * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers * @param {String} prefix Transaction hash prefix * @param {Buffer} data Rlp encoded transaction buffer - * @param {{ raw: boolean = false }} options Options + * @param {Object} options + * @param {Boolean} options.raw * @return {String} Transaction hash */ -export function buildHash (prefix, data, options = { raw: false }) { +export function buildHash (prefix, data, options = {}) { return options.raw ? hash(data) : encode(hash(data), prefix) } diff --git a/es/tx/builder/index.js b/es/tx/builder/index.js index 763cbe32b3..ee904d5eb0 100644 --- a/es/tx/builder/index.js +++ b/es/tx/builder/index.js @@ -409,10 +409,11 @@ export function unpackTx (encodedTx, fromRlpBinary = false, prefix = 'tx') { * @function * @alias module:@aeternity/aepp-sdk/es/tx/builder * @param {String | Buffer} rawTx base64 or rlp encoded transaction - * @param {{ raw: boolean = false }} options Options + * @param {Object} options + * @param {Boolean} options.raw * @return {String} Transaction hash */ -export function buildTxHash (rawTx, options = { raw: false }) { +export function buildTxHash (rawTx, options) { if (typeof rawTx === 'string' && rawTx.indexOf('tx_') !== -1) return buildHash('th', unpackTx(rawTx).rlpEncoded, options) return buildHash('th', rawTx, options) } From fd802b009898cd570fe069f709e40a0c33fd8aee Mon Sep 17 00:00:00 2001 From: Denis Davidyuk Date: Mon, 6 Jul 2020 12:25:10 +1000 Subject: [PATCH 2/5] Remove generated docs --- .gitignore | 2 + docs/api.md | 45 -- docs/api/account.md | 117 ---- docs/api/account/memory.md | 24 - docs/api/account/selector.md | 50 -- docs/api/accounts.md | 106 --- docs/api/ae.md | 112 --- docs/api/ae/aens.md | 245 ------- docs/api/ae/aepp.md | 26 - docs/api/ae/contract.md | 354 ---------- docs/api/ae/oracle.md | 179 ----- docs/api/ae/universal.md | 25 - docs/api/ae/wallet.md | 41 -- docs/api/chain.md | 283 -------- docs/api/chain/node.md | 31 - docs/api/channel/index.md | 638 ------------------ docs/api/contract.md | 184 ----- docs/api/contract/aci.md | 97 --- docs/api/contract/compiler.md | 31 - docs/api/contract/ga.md | 73 -- docs/api/node-pool.md | 112 --- docs/api/node.md | 93 --- docs/api/oracle.md | 76 --- docs/api/oracle/node.md | 11 - docs/api/rpc/client.md | 28 - docs/api/tx.md | 232 ------- docs/api/tx/builder.md | 149 ---- docs/api/tx/builder/helpers.md | 269 -------- docs/api/tx/builder/schema.md | 33 - docs/api/tx/tx-object.md | 161 ----- docs/api/tx/tx.md | 38 -- docs/api/tx/validator.md | 66 -- .../aepp-wallet-communication/connection.md | 73 -- .../connection/browser-runtime.md | 67 -- .../connection/browser-window-message.md | 68 -- .../content-script-bridge.md | 43 -- .../aepp-wallet-communication/rpc/aepp-rpc.md | 127 ---- .../rpc/rpc-client.md | 229 ------- .../rpc/wallet-rpc.md | 100 --- .../wallet-detector.md | 55 -- docs/api/utils/amount-formatter.md | 69 -- docs/api/utils/bignumber.md | 60 -- docs/api/utils/bytes.md | 69 -- docs/api/utils/crypto.md | 543 --------------- docs/api/utils/keystore.md | 137 ---- docs/api/utils/swagger.md | 293 -------- docs/examples/node/aecontract.md | 209 ------ docs/examples/node/aecrypto.md | 329 --------- docs/examples/node/aewallet.md | 125 ---- 49 files changed, 2 insertions(+), 6525 deletions(-) delete mode 100644 docs/api.md delete mode 100644 docs/api/account.md delete mode 100644 docs/api/account/memory.md delete mode 100644 docs/api/account/selector.md delete mode 100644 docs/api/accounts.md delete mode 100644 docs/api/ae.md delete mode 100644 docs/api/ae/aens.md delete mode 100644 docs/api/ae/aepp.md delete mode 100644 docs/api/ae/contract.md delete mode 100644 docs/api/ae/oracle.md delete mode 100644 docs/api/ae/universal.md delete mode 100644 docs/api/ae/wallet.md delete mode 100644 docs/api/chain.md delete mode 100644 docs/api/chain/node.md delete mode 100644 docs/api/channel/index.md delete mode 100644 docs/api/contract.md delete mode 100644 docs/api/contract/aci.md delete mode 100644 docs/api/contract/compiler.md delete mode 100644 docs/api/contract/ga.md delete mode 100644 docs/api/node-pool.md delete mode 100644 docs/api/node.md delete mode 100644 docs/api/oracle.md delete mode 100644 docs/api/oracle/node.md delete mode 100644 docs/api/rpc/client.md delete mode 100644 docs/api/tx.md delete mode 100644 docs/api/tx/builder.md delete mode 100644 docs/api/tx/builder/helpers.md delete mode 100644 docs/api/tx/builder/schema.md delete mode 100644 docs/api/tx/tx-object.md delete mode 100644 docs/api/tx/tx.md delete mode 100644 docs/api/tx/validator.md delete mode 100644 docs/api/utils/aepp-wallet-communication/connection.md delete mode 100644 docs/api/utils/aepp-wallet-communication/connection/browser-runtime.md delete mode 100644 docs/api/utils/aepp-wallet-communication/connection/browser-window-message.md delete mode 100644 docs/api/utils/aepp-wallet-communication/content-script-bridge.md delete mode 100644 docs/api/utils/aepp-wallet-communication/rpc/aepp-rpc.md delete mode 100644 docs/api/utils/aepp-wallet-communication/rpc/rpc-client.md delete mode 100644 docs/api/utils/aepp-wallet-communication/rpc/wallet-rpc.md delete mode 100644 docs/api/utils/aepp-wallet-communication/wallet-detector.md delete mode 100644 docs/api/utils/amount-formatter.md delete mode 100644 docs/api/utils/bignumber.md delete mode 100644 docs/api/utils/bytes.md delete mode 100644 docs/api/utils/crypto.md delete mode 100644 docs/api/utils/keystore.md delete mode 100644 docs/api/utils/swagger.md delete mode 100644 docs/examples/node/aecontract.md delete mode 100644 docs/examples/node/aecrypto.md delete mode 100644 docs/examples/node/aewallet.md diff --git a/.gitignore b/.gitignore index 6a99e7903a..6f2a8fe6c2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ node_modules .tern-project .dir-locals.el /dist +/docs/api* +/docs/examples /.envrc /yarn-error.log .idea diff --git a/docs/api.md b/docs/api.md deleted file mode 100644 index 88895eb55f..0000000000 --- a/docs/api.md +++ /dev/null @@ -1,45 +0,0 @@ -# API Table of Contents - * [@aeternity/aepp-sdk/es/account](api/account.md) - * [@aeternity/aepp-sdk/es/account/memory](api/account/memory.md) - * [@aeternity/aepp-sdk/es/account/selector](api/account/selector.md) - * [@aeternity/aepp-sdk/es/accounts](api/accounts.md) - * [@aeternity/aepp-sdk/es/ae/aens](api/ae/aens.md) - * [@aeternity/aepp-sdk/es/ae/aepp](api/ae/aepp.md) - * [@aeternity/aepp-sdk/es/ae/contract](api/ae/contract.md) - * [@aeternity/aepp-sdk/es/ae](api/ae.md) - * [@aeternity/aepp-sdk/es/ae/oracle](api/ae/oracle.md) - * [@aeternity/aepp-sdk/es/ae/universal](api/ae/universal.md) - * [@aeternity/aepp-sdk/es/ae/wallet](api/ae/wallet.md) - * [@aeternity/aepp-sdk/es/chain](api/chain.md) - * [@aeternity/aepp-sdk/es/chain/node](api/chain/node.md) - * [@aeternity/aepp-sdk/es/channel/index](api/channel/index.md) - * [@aeternity/aepp-sdk/es/contract/aci](api/contract/aci.md) - * [@aeternity/aepp-sdk/es/contract/compiler](api/contract/compiler.md) - * [@aeternity/aepp-sdk/es/contract/ga](api/contract/ga.md) - * [@aeternity/aepp-sdk/es/contract](api/contract.md) - * [@aeternity/aepp-sdk/es/node-pool](api/node-pool.md) - * [@aeternity/aepp-sdk/es/node](api/node.md) - * [@aeternity/aepp-sdk/es/oracle](api/oracle.md) - * [@aeternity/aepp-sdk/es/oracle/node](api/oracle/node.md) - * [@aeternity/aepp-sdk/es/rpc/client](api/rpc/client.md) - * [@aeternity/aepp-sdk/es/tx/builder/helpers](api/tx/builder/helpers.md) - * [@aeternity/aepp-sdk/es/tx/builder](api/tx/builder.md) - * [@aeternity/aepp-sdk/es/tx/builder/schema](api/tx/builder/schema.md) - * [@aeternity/aepp-sdk/es/tx](api/tx.md) - * [@aeternity/aepp-sdk/es/tx/tx-object](api/tx/tx-object.md) - * [@aeternity/aepp-sdk/es/tx/tx](api/tx/tx.md) - * [@aeternity/aepp-sdk/es/tx/validator](api/tx/validator.md) - * [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-runtime](api/utils/aepp-wallet-communication/connection/browser-runtime.md) - * [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-window-message](api/utils/aepp-wallet-communication/connection/browser-window-message.md) - * [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection](api/utils/aepp-wallet-communication/connection.md) - * [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/content-script-bridge](api/utils/aepp-wallet-communication/content-script-bridge.md) - * [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc](api/utils/aepp-wallet-communication/rpc/aepp-rpc.md) - * [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client](api/utils/aepp-wallet-communication/rpc/rpc-client.md) - * [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/wallet-rpc](api/utils/aepp-wallet-communication/rpc/wallet-rpc.md) - * [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/wallet-detector](api/utils/aepp-wallet-communication/wallet-detector.md) - * [@aeternity/aepp-sdk/es/utils/amount-formatter](api/utils/amount-formatter.md) - * [@aeternity/aepp-sdk/es/utils/bignumber](api/utils/bignumber.md) - * [@aeternity/aepp-sdk/es/utils/bytes](api/utils/bytes.md) - * [@aeternity/aepp-sdk/es/utils/crypto](api/utils/crypto.md) - * [@aeternity/aepp-sdk/es/utils/keystore](api/utils/keystore.md) - * [@aeternity/aepp-sdk/es/utils/swagger](api/utils/swagger.md) diff --git a/docs/api/account.md b/docs/api/account.md deleted file mode 100644 index 67f8fd8ddc..0000000000 --- a/docs/api/account.md +++ /dev/null @@ -1,117 +0,0 @@ - - -## @aeternity/aepp-sdk/es/account -Account module - -**Example** -```js -import Account from '@aeternity/aepp-sdk/es/account' -``` - -* [@aeternity/aepp-sdk/es/account](#module_@aeternity/aepp-sdk/es/account) - * [Account([options])](#exp_module_@aeternity/aepp-sdk/es/account--Account) ⇒ `Object` ⏏ - * [.signTransaction(tx, opt)](#module_@aeternity/aepp-sdk/es/account--Account+signTransaction) ⇒ `String` - * [.getNetworkId()](#module_@aeternity/aepp-sdk/es/account--Account+getNetworkId) ⇒ `String` - * [.signMessage(message, opt)](#module_@aeternity/aepp-sdk/es/account--Account+signMessage) ⇒ `String` - * [.verifyMessage(message, signature, opt)](#module_@aeternity/aepp-sdk/es/account--Account+verifyMessage) ⇒ `Boolean` - * *[.sign(data)](#module_@aeternity/aepp-sdk/es/account--Account+sign) ⇒ `String`* - * *[.address()](#module_@aeternity/aepp-sdk/es/account--Account+address) ⇒ `String`* - - - -### Account([options]) ⇒ `Object` ⏏ -Basic Account Stamp - -Attempting to create instances from the Stamp without overwriting all -abstract methods using composition will result in an exception. - -Account is one of the three basic building blocks of an -[Ae](#exp_module_@aeternity/aepp-sdk/es/ae--Ae) client and provides access to a -signing key pair. - -**Kind**: Exported function -**Returns**: `Object` - Account instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | -| options.networkId | `String` | | NETWORK_ID using for signing transaction's | - - - -#### account.signTransaction(tx, opt) ⇒ `String` -Sign encoded transaction - -**Kind**: instance method of [`Account`](#exp_module_@aeternity/aepp-sdk/es/account--Account) -**Returns**: `String` - Signed transaction -**Category**: async -**rtype**: `(tx: String) => tx: Promise[String], throws: Error` - -| Param | Type | Description | -| --- | --- | --- | -| tx | `String` | Transaction to sign | -| opt | `Object` | Options | - - - -#### account.getNetworkId() ⇒ `String` -Get network Id - -**Kind**: instance method of [`Account`](#exp_module_@aeternity/aepp-sdk/es/account--Account) -**Returns**: `String` - Network Id -**Category**: async -**rtype**: `() => networkId: String` - - -#### account.signMessage(message, opt) ⇒ `String` -Sign message - -**Kind**: instance method of [`Account`](#exp_module_@aeternity/aepp-sdk/es/account--Account) -**Returns**: `String` - Signature -**Category**: async -**rtype**: `(msg: String) => signature: Promise[String], throws: Error` - -| Param | Type | Description | -| --- | --- | --- | -| message | `String` | Message to sign | -| opt | `Object` | Options | - - - -#### account.verifyMessage(message, signature, opt) ⇒ `Boolean` -Verify message - -**Kind**: instance method of [`Account`](#exp_module_@aeternity/aepp-sdk/es/account--Account) -**Category**: async -**rtype**: `(msg: String, signature: String, publicKey: String) => signature: Promise[String], throws: Error` - -| Param | Type | Description | -| --- | --- | --- | -| message | `String` | Message to verify | -| signature | `String` | Signature | -| opt | `Object` | Options | - - - -#### *account.sign(data) ⇒ `String`* -Sign data blob - -**Kind**: instance abstract method of [`Account`](#exp_module_@aeternity/aepp-sdk/es/account--Account) -**Returns**: `String` - Signed data blob -**Category**: async -**rtype**: `(data: String) => data: Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| data | `String` | Data blob to sign | - - - -#### *account.address() ⇒ `String`* -Obtain account address - -**Kind**: instance abstract method of [`Account`](#exp_module_@aeternity/aepp-sdk/es/account--Account) -**Returns**: `String` - Public account address -**Category**: async -**rtype**: `() => address: Promise[String]` diff --git a/docs/api/account/memory.md b/docs/api/account/memory.md deleted file mode 100644 index 2e3fa0cd1f..0000000000 --- a/docs/api/account/memory.md +++ /dev/null @@ -1,24 +0,0 @@ - - -## @aeternity/aepp-sdk/es/account/memory -Memory Account module - -**Example** -```js -import MemoryAccount from '@aeternity/aepp-sdk/es/account/memory' -``` - - -### MemoryAccount([options]) ⇒ `Account` ⏏ -In-memory `Account` factory - -**Kind**: Exported function -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | -| options.keypair | `Object` | | Key pair to use | -| options.keypair.publicKey | `String` | | Public key | -| options.keypair.secretKey | `String` | | Private key | - diff --git a/docs/api/account/selector.md b/docs/api/account/selector.md deleted file mode 100644 index 316ccc2ac6..0000000000 --- a/docs/api/account/selector.md +++ /dev/null @@ -1,50 +0,0 @@ - - -## @aeternity/aepp-sdk/es/account/selector -Accounts Selector module - -This is the complement to [@aeternity/aepp-sdk/es/accounts](#module_@aeternity/aepp-sdk/es/accounts). - -**Example** -```js -import Selector from '@aeternity/aepp-sdk/es/account/selector' -``` - -* [@aeternity/aepp-sdk/es/account/selector](#module_@aeternity/aepp-sdk/es/account/selector) - * [Selector([options])](#exp_module_@aeternity/aepp-sdk/es/account/selector--Selector) ⇒ `Account` ⏏ - * _instance_ - * [.selectAccount(address)](#exp_module_@aeternity/aepp-sdk/es/account/selector--selectAccount) ⏏ - - - -### Selector([options]) ⇒ `Account` ⏏ -Selector Stamp - -**Kind**: Exported function -**Returns**: `Account` - Account instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | - -**Example** -```js -Selector() -``` - - -### .selectAccount(address) ⏏ -Select specific account - -**Kind**: instance method of [`@aeternity/aepp-sdk/es/account/selector`](#module_@aeternity/aepp-sdk/es/account/selector) -**rtype**: `(address: String) => Void` - -| Param | Type | Description | -| --- | --- | --- | -| address | `String` | Address of account to select | - -**Example** -```js -selectAccount('ak_xxxxxxxx') -``` diff --git a/docs/api/accounts.md b/docs/api/accounts.md deleted file mode 100644 index abad8a5101..0000000000 --- a/docs/api/accounts.md +++ /dev/null @@ -1,106 +0,0 @@ - - -## @aeternity/aepp-sdk/es/accounts -Accounts module - -**Example** -```js -import Accounts from '@aeternity/aepp-sdk/es/accounts' -``` - -* [@aeternity/aepp-sdk/es/accounts](#module_@aeternity/aepp-sdk/es/accounts) - * [removeAccount(address)](#exp_module_@aeternity/aepp-sdk/es/accounts--removeAccount) ⇒ `Void` ⏏ - * [addresses()](#exp_module_@aeternity/aepp-sdk/es/accounts--addresses) ⇒ `Array.<String>` ⏏ - * [Accounts([options])](#exp_module_@aeternity/aepp-sdk/es/accounts--Accounts) ⇒ `Object` ⏏ - * _async_ - * [signWith(address, data)](#exp_module_@aeternity/aepp-sdk/es/accounts--signWith) ⇒ `String` ⏏ - * [addAccount(account, [options])](#exp_module_@aeternity/aepp-sdk/es/accounts--addAccount) ⇒ `Void` ⏏ - - - -### removeAccount(address) ⇒ `Void` ⏏ -Remove specific account - -**Kind**: Exported function -**rtype**: `(address: String) => Void` - -| Param | Type | Description | -| --- | --- | --- | -| address | `String` | Address of account to remove | - -**Example** -```js -removeAccount(address) -``` - - -### addresses() ⇒ `Array.<String>` ⏏ -Get accounts addresses - -**Kind**: Exported function -**rtype**: `() => String[]` -**Example** -```js -addresses() -``` - - -### Accounts([options]) ⇒ `Object` ⏏ -Accounts Stamp - -The purpose of the Accounts Stamp is to wrap up -[Account](#exp_module_@aeternity/aepp-sdk/es/account--Account) objects and provide a -common interface to all of them. Accounts are a substantial part of -[module:@aeternity/aepp-sdk/es/ae/wallet--Wallet](module:@aeternity/aepp-sdk/es/ae/wallet--Wallet)s. - -**Kind**: Exported function -**Returns**: `Object` - Accounts instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | -| [options.accounts] | `Array` | | Accounts array | - -**Example** -```js -const accounts = await Accounts({ accounts: [ MemmoryAccount({ keypair: 'keypair_object' }) ] }) -await accounts.addAccount(account, { select: true }) // Add account and make it selected -accounts.removeAccount(address) // Remove account -accounts.selectAccount(address) // Select account -accounts.addresses() // Get available accounts -``` - - -### signWith(address, data) ⇒ `String` ⏏ -Sign data blob with specific key - -**Kind**: Exported function -**Returns**: `String` - Signed data blob -**Category**: async -**rtype**: `(address: String, data: String) => data: Promise[String], throws: Error` - -| Param | Type | Description | -| --- | --- | --- | -| address | `String` | Public key of account to sign with | -| data | `String` | Data blob to sign | - - - -### addAccount(account, [options]) ⇒ `Void` ⏏ -Add specific account - -**Kind**: Exported function -**Category**: async -**rtype**: `(account: Account, { select: Boolean }) => Void` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| account | `Object` | | Account instance | -| [options] | `Object` | {} | Options | -| [options.select] | `Boolean` | | Select account | - -**Example** -```js -addAccount(account) -``` diff --git a/docs/api/ae.md b/docs/api/ae.md deleted file mode 100644 index 2f9abb39b3..0000000000 --- a/docs/api/ae.md +++ /dev/null @@ -1,112 +0,0 @@ - - -## @aeternity/aepp-sdk/es/ae -Ae module - -**Example** -```js -import Ae from '@aeternity/aepp-sdk/es/ae' -``` - -* [@aeternity/aepp-sdk/es/ae](#module_@aeternity/aepp-sdk/es/ae) - * [Ae([options])](#exp_module_@aeternity/aepp-sdk/es/ae--Ae) ⇒ `Object` ⏏ - * _instance_ - * [.destroyInstance()](#module_@aeternity/aepp-sdk/es/ae--Ae+destroyInstance) ⇒ `void` - * _async_ - * [.send(tx, [options])](#module_@aeternity/aepp-sdk/es/ae--Ae+send) ⇒ `String` \| `String` - * [.spend(amount, recipientId, options)](#module_@aeternity/aepp-sdk/es/ae--Ae+spend) ⇒ `String` \| `String` - * [.transferFunds(percentage, recipientId, options)](#module_@aeternity/aepp-sdk/es/ae--Ae+transferFunds) ⇒ `String` \| `String` - * _inner_ - * [~resolveRecipientName(nameOrAddress, verify)](#module_@aeternity/aepp-sdk/es/ae--Ae..resolveRecipientName) ⇒ `String` - - - -### Ae([options]) ⇒ `Object` ⏏ -Basic Ae Stamp - -Attempting to create instances from the Stamp without overwriting all -abstract methods using composition will result in an exception. - -Ae objects are the composition of three basic building blocks: -* [Tx](#exp_module_@aeternity/aepp-sdk/es/tx--Tx) -* [Account](#exp_module_@aeternity/aepp-sdk/es/account--Account) -* [Chain](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -Only by providing the joint functionality of those three, most more advanced -operations, i.e. the ones with actual use value on the chain, become -available. - -**Kind**: Exported function -**Returns**: `Object` - Ae instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | - - - -#### ae.destroyInstance() ⇒ `void` -Remove all listeners for RPC - -**Kind**: instance method of [`Ae`](#exp_module_@aeternity/aepp-sdk/es/ae--Ae) - - -#### ae.send(tx, [options]) ⇒ `String` \| `String` -Sign and post a transaction to the chain - -**Kind**: instance method of [`Ae`](#exp_module_@aeternity/aepp-sdk/es/ae--Ae) -**Returns**: `String` \| `String` - Transaction or transaction hash -**Category**: async -**rtype**: `(tx: String, options: Object) => Promise[String]` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| tx | `String` | | Transaction | -| [options] | `Object` | {} | options - Options | -| [options.verify] | `Object` | | verify - Verify transaction before broadcast, throw error if not valid | - - - -#### ae.spend(amount, recipientId, options) ⇒ `String` \| `String` -Send tokens to another account - -**Kind**: instance method of [`Ae`](#exp_module_@aeternity/aepp-sdk/es/ae--Ae) -**Returns**: `String` \| `String` - Transaction or transaction hash -**Category**: async -**rtype**: `(amount: Number|String, recipientId: String, options?: Object) => Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| amount | `Number` \| `String` | Amount to spend | -| recipientId | `String` | Address or Name of recipient account | -| options | `Object` | Options | - - - -#### ae.transferFunds(percentage, recipientId, options) ⇒ `String` \| `String` -Send a percentage of funds to another account - -**Kind**: instance method of [`Ae`](#exp_module_@aeternity/aepp-sdk/es/ae--Ae) -**Returns**: `String` \| `String` - Transaction or transaction hash -**Category**: async -**rtype**: `(percentage: Number|String, recipientId: String, options?: Object) => Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| percentage | `Number` \| `String` | Percentage of amount to spend | -| recipientId | `String` | Address of recipient account | -| options | `Object` | Options | - - - -#### Ae~resolveRecipientName(nameOrAddress, verify) ⇒ `String` -Resolve AENS name and return name hash - -**Kind**: inner method of [`Ae`](#exp_module_@aeternity/aepp-sdk/es/ae--Ae) -**Returns**: `String` - Address or AENS name hash - -| Param | Type | -| --- | --- | -| nameOrAddress | `String` | -| verify | `Boolean` | - diff --git a/docs/api/ae/aens.md b/docs/api/ae/aens.md deleted file mode 100644 index 47e762e7c5..0000000000 --- a/docs/api/ae/aens.md +++ /dev/null @@ -1,245 +0,0 @@ - - -## @aeternity/aepp-sdk/es/ae/aens -Aens module - routines to interact with the æternity naming system - -The high-level description of the naming system is -https://github.com/aeternity/protocol/blob/master/AENS.md in the protocol -repository. - -**Example** -```js -import Aens from '@aeternity/aepp-sdk/es/ae/aens' -``` - -* [@aeternity/aepp-sdk/es/ae/aens](#module_@aeternity/aepp-sdk/es/ae/aens) - * [Aens([options])](#exp_module_@aeternity/aepp-sdk/es/ae/aens--Aens) ⇒ `Object` ⏏ - * _instance_ - * _async_ - * [.revoke(name, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/aens--revoke) ⇒ `Promise.<Object>` ⏏ - * [.update(name, pointers, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/aens--update) ⇒ `Promise.<Object>` ⏏ - * [.transfer(name, account, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/aens--transfer) ⇒ `Promise.<Object>` ⏏ - * [.query(name, opt)](#exp_module_@aeternity/aepp-sdk/es/ae/aens--query) ⇒ `Promise.<Object>` ⏏ - * [.claim(name, salt, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/aens--claim) ⇒ `Promise.<Object>` ⏏ - * [.preclaim(name, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/aens--preclaim) ⇒ `Promise.<Object>` ⏏ - * [.bid(name, nameFee, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/aens--bid) ⇒ `Promise.<Object>` ⏏ - - - -### Aens([options]) ⇒ `Object` ⏏ -Aens Stamp - -Aens provides name-system related methods atop -[Ae](#exp_module_@aeternity/aepp-sdk/es/ae--Ae) clients. - -**Kind**: Exported function -**Returns**: `Object` - Aens instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | - - - -### .revoke(name, [options]) ⇒ `Promise.<Object>` ⏏ -Revoke a name - -**Kind**: instance method of [`@aeternity/aepp-sdk/es/ae/aens`](#module_@aeternity/aepp-sdk/es/ae/aens) -**Returns**: `Promise.<Object>` - Transaction result -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| name | `String` | | Name hash | -| [options] | `Object` | {} | options | -| [options.onAccount] | `String` \| `Object` | | onAccount Make operation on specific account from sdk(you pass publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount) | -| [options.fee] | `Number` \| `String` \| `BigNumber` | | fee | -| [options.ttl] | `Number` \| `String` \| `BigNumber` | | ttl | -| [options.nonce] | `Number` \| `String` \| `BigNumber` | | nonce | - -**Example** -```js -const name = 'test.chain' -const nameObject = await sdkInstance.aensQuery(name) - -await sdkInstance.aensRevoke(name, { fee, ttl , nonce }) -// or -await nameObject.revoke({ fee, ttl, nonce }) -``` - - -### .update(name, pointers, [options]) ⇒ `Promise.<Object>` ⏏ -Update a name - -**Kind**: instance method of [`@aeternity/aepp-sdk/es/ae/aens`](#module_@aeternity/aepp-sdk/es/ae/aens) -**Category**: async -**Throws**: - -- Invalid pointer array error - - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| name | `String` | | AENS name | -| pointers | `Array.<String>` | | Array of name pointers. Can be oracle|account|contract|channel public key | -| [options] | `Object` | {} | | -| [options.extendPointers] | `Boolean` | false | extendPointers Get the pointers from the node and merge with provided one. Pointers with the same type will be overwrited | -| [options.onAccount] | `String` \| `Object` | | onAccount Make operation on specific account from sdk(you pass publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount) | -| [options.fee] | `Number` \| `String` \| `BigNumber` | | fee | -| [options.ttl] | `Number` \| `String` \| `BigNumber` | | ttl | -| [options.nonce] | `Number` \| `String` \| `BigNumber` | | nonce | -| [options.nameTtl] | `Number` \| `String` \| `BigNumber` | 50000 | nameTtl Name ttl represented in number of blocks (Max value is 50000 blocks) | -| [options.clientTtl] | `Number` \| `String` \| `BigNumber` | 84600 | clientTtl a suggestion as to how long any clients should cache this information | - -**Example** -```js -const name = 'test.chain' -const pointersArray = ['ak_asd23dasdas...,' 'ct_asdf34fasdasd...'] -const nameObject = await sdkInstance.aensQuery(name) - -await sdkInstance.aensUpdate(name, pointersArray, { nameTtl, ttl, fee, nonce, clientTtl }) -// or -await nameObject.update(pointersArray, { nameTtl, ttl, fee, nonce, clientTtl }) -``` - - -### .transfer(name, account, [options]) ⇒ `Promise.<Object>` ⏏ -Transfer a domain to another account - -**Kind**: instance method of [`@aeternity/aepp-sdk/es/ae/aens`](#module_@aeternity/aepp-sdk/es/ae/aens) -**Returns**: `Promise.<Object>` - Transaction result -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| name | `String` | | AENS name | -| account | `String` | | Recipient account publick key | -| [options] | `Object` | {} | | -| [options.onAccount] | `String` \| `Object` | | onAccount Make operation on specific account from sdk(you pass publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount) | -| [options.fee] | `Number` \| `String` \| `BigNumber` | | fee | -| [options.ttl] | `Number` \| `String` \| `BigNumber` | | ttl | -| [options.nonce] | `Number` \| `String` \| `BigNumber` | | nonce | - -**Example** -```js -const name = 'test.chain' -const recipientPub = 'ak_asd23dasdas...' -const nameObject = await sdkInstance.aensQuery(name) - -await sdkInstance.aensTransfer(name, recipientPub, { ttl, fee, nonce }) -// or -await nameObject.transfer(recipientPub, { ttl, fee, nonce }) -``` - - -### .query(name, opt) ⇒ `Promise.<Object>` ⏏ -Query the AENS name info from the node -and return the object with info and predefined functions for manipulating name - -**Kind**: instance method of [`@aeternity/aepp-sdk/es/ae/aens`](#module_@aeternity/aepp-sdk/es/ae/aens) -**Category**: async - -| Param | Type | Description | -| --- | --- | --- | -| name | `String` | | -| opt | `Object` | Options | - -**Example** -```js -const nameObject = sdkInstance.aensQuery('test.chain') -console.log(nameObject) -{ - id, // name hash - pointers, // array of pointers - update, // Update name function - extendTtl, // Extend Ttl name function - transfer, // Transfer name function - revoke // Revoke name function -} -``` - - -### .claim(name, salt, [options]) ⇒ `Promise.<Object>` ⏏ -Claim a previously preclaimed registration. This can only be done after the -preclaim step - -**Kind**: instance method of [`@aeternity/aepp-sdk/es/ae/aens`](#module_@aeternity/aepp-sdk/es/ae/aens) -**Returns**: `Promise.<Object>` - the result of the claim -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| name | `String` | | | -| salt | `Number` | | Salt from pre-claim, or 0 if it's a bid | -| [options] | `Object` | {} | options | -| [options.onAccount] | `String` \| `Object` | | onAccount Make operation on specific account from sdk(you pass publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount) | -| [options.fee] | `Number` \| `String` \| `BigNumber` | | fee | -| [options.ttl] | `Number` \| `String` \| `BigNumber` | | ttl | -| [options.nonce] | `Number` \| `String` \| `BigNumber` | | nonce | -| [options.nameFee] | `Number` \| `String` | | Name Fee (By default calculated by sdk) | -| [options.vsn] | `Number` \| `String` | 2 | Transaction vsn from Lima is 2 | - -**Example** -```js -const name = 'test.chain' -const salt = preclaimResult.salt // salt from pre-claim transaction - -await sdkInstance.aensClaim(name, salt, { ttl, fee, nonce, nameFee }) -``` - - -### .preclaim(name, [options]) ⇒ `Promise.<Object>` ⏏ -Preclaim a name. Sends a hash of the name and a random salt to the node - -**Kind**: instance method of [`@aeternity/aepp-sdk/es/ae/aens`](#module_@aeternity/aepp-sdk/es/ae/aens) -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| name | `String` | | | -| [options] | `Object` | {} | | -| [options.onAccount] | `String` \| `Object` | | onAccount Make operation on specific account from sdk(you pass publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount) | -| [options.fee] | `Number` \| `String` \| `BigNumber` | | fee | -| [options.ttl] | `Number` \| `String` \| `BigNumber` | | ttl | -| [options.nonce] | `Number` \| `String` \| `BigNumber` | | nonce | - -**Example** -```js -const name = 'test.chain' -const salt = preclaimResult.salt // salt from pre-claim transaction - -await sdkInstance.aensPreclaim(name, { ttl, fee, nonce }) -{ - ...transactionResult, - claim, // Claim function (options={}) => claimTransactionResult - salt, - commitmentId -} -``` - - -### .bid(name, nameFee, [options]) ⇒ `Promise.<Object>` ⏏ -Bid to name auction - -**Kind**: instance method of [`@aeternity/aepp-sdk/es/ae/aens`](#module_@aeternity/aepp-sdk/es/ae/aens) -**Returns**: `Promise.<Object>` - Transaction result -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| name | `String` | | Domain name | -| nameFee | `String` \| `Number` | | Name fee (bid fee) | -| [options] | `Object` | {} | | -| [options.onAccount] | `String` \| `Object` | | onAccount Make operation on specific account from sdk(you pass publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount) | -| [options.fee] | `Number` \| `String` \| `BigNumber` | | fee | -| [options.ttl] | `Number` \| `String` \| `BigNumber` | | ttl | -| [options.nonce] | `Number` \| `String` \| `BigNumber` | | nonce | - -**Example** -```js -const name = 'test.chain' -const bidFee = computeBidFee(name, startFee, incrementPercentage) - -await sdkInstance.aensBid(name, 213109412839123, { ttl, fee, nonce }) -``` diff --git a/docs/api/ae/aepp.md b/docs/api/ae/aepp.md deleted file mode 100644 index dc20bdb18b..0000000000 --- a/docs/api/ae/aepp.md +++ /dev/null @@ -1,26 +0,0 @@ - - -## @aeternity/aepp-sdk/es/ae/aepp -Aepp module - -**Example** -```js -import Ae from '@aeternity/aepp-sdk/es/ae/aepp' -``` - - -### exports.Aepp([options]) ⇒ `Object` ⏏ -Aepp Stamp - -Aepp provides Ae base functionality with Contract and Aens. -This stamp can be used only with Wallet, all Aepp method's going through RPC to Wallet. -[Ae](#exp_module_@aeternity/aepp-sdk/es/ae--Ae) clients. - -**Kind**: Exported function -**Returns**: `Object` - Aepp instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | - diff --git a/docs/api/ae/contract.md b/docs/api/ae/contract.md deleted file mode 100644 index 453d0fd7fd..0000000000 --- a/docs/api/ae/contract.md +++ /dev/null @@ -1,354 +0,0 @@ - - -## @aeternity/aepp-sdk/es/ae/contract -Contract module - routines to interact with the æternity contract - -High level documentation of the contracts are available at -https://github.com/aeternity/protocol/tree/master/contracts and - -**Example** -```js -import Contract from '@aeternity/aepp-sdk/es/ae/contract' (Using tree-shaking) -``` -**Example** -```js -import { Contract } from '@aeternity/aepp-sdk' (Using bundle) -``` - -* [@aeternity/aepp-sdk/es/ae/contract](#module_@aeternity/aepp-sdk/es/ae/contract) - * [exports.ContractAPI([options])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--exports.ContractAPI) ⇒ `Object` ⏏ - * _async_ - * [handleCallError(result, tx)](#exp_module_@aeternity/aepp-sdk/es/ae/contract--handleCallError) ⇒ `Promise.<void>` ⏏ - * [contractEncodeCall(source, name, args, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--contractEncodeCall) ⇒ `Promise.<String>` ⏏ - * [contractDecodeData(source, fn, callValue, callResult, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--contractDecodeData) ⇒ `Promise.<String>` ⏏ - * [contractCallStatic(source, address, name, args, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--contractCallStatic) ⇒ `Promise.<Object>` ⏏ - * [contractCall(source, address, name, argsOrCallData, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--contractCall) ⏏ - * [contractDeploy(code, source, initState, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--contractDeploy) ⇒ `Promise.<Object>` ⏏ - * [contractCompile(source, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--contractCompile) ⇒ `Promise.<Object>` ⏏ - * [delegateSignatureCommon(ids, [opt], [opt])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--delegateSignatureCommon) ⇒ `Promise.<String>` ⏏ - * [delegateNamePreclaimSignature(contractId, [opt])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--delegateNamePreclaimSignature) ⇒ `Promise.<String>` ⏏ - * [delegateNameClaimSignature(name, contractId, [opt])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--delegateNameClaimSignature) ⇒ `Promise.<String>` ⏏ - * [delegateNameTransferSignature(contractId, name, [opt])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--delegateNameTransferSignature) ⇒ `Promise.<String>` ⏏ - * [delegateNameRevokeSignature(contractId, name, [opt])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--delegateNameRevokeSignature) ⇒ `Promise.<String>` ⏏ - * [delegateOracleRegisterSignature(contractId, [opt])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--delegateOracleRegisterSignature) ⇒ `Promise.<String>` ⏏ - * [delegateOracleExtendSignature(contractId, [opt])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--delegateOracleExtendSignature) ⇒ `Promise.<String>` ⏏ - * [delegateOracleRespondSignature(queryId, contractId, [opt])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--delegateOracleRespondSignature) ⇒ `Promise.<String>` ⏏ - - - -### exports.ContractAPI([options]) ⇒ `Object` ⏏ -Contract Stamp - -Provide contract implementation -[Ae](#exp_module_@aeternity/aepp-sdk/es/ae--Ae) clients. - -**Kind**: Exported function -**Returns**: `Object` - Contract instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | - -**Example** -```js -import Transaction from '@aeternity/aepp-sdk/es/tx/tx -import MemoryAccount from '@aeternity/aepp-sdk/es/account/memory -import ChainNode from '@aeternity/aepp-sdk/es/chain/node -import ContractCompilerAPI from '@aeternity/aepp-sdk/es/contract/compiler -// or using bundle -import { - Transaction, - MemoryAccount, - ChainNode, - ContractCompilerAPI -} from '@aeternity/aepp-sdk - -const ContractWithAE = await Contract - .compose(Transaction, MemoryAccount, ChainNode) // AE implementation - .compose(ContractCompilerAPI) // ContractBase implementation -const client = await ContractWithAe({ url, internalUrl, compilerUrl, keypair, ... }) -``` - - -### handleCallError(result, tx) ⇒ `Promise.<void>` ⏏ -Handle contract call error - -**Kind**: Exported function -**Category**: async -**Throws**: - -- Error Decoded error - - -| Param | Type | Description | -| --- | --- | --- | -| result | `Object` | call result object | -| tx | `Object` | Unpacked transaction | - - - -### contractEncodeCall(source, name, args, [options]) ⇒ `Promise.<String>` ⏏ -Encode call data for contract call - -**Kind**: Exported function -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| source | `String` | | Contract source code | -| name | `String` | | Name of function to call | -| args | `Array` | | Argument's for call | -| [options] | `Object` | {} | Options | -| [options.filesystem] | `Object` | {} | Contract external namespaces map | -| [options.backend] | `Object` | 'fate' | Compiler backend | - - - -### contractDecodeData(source, fn, callValue, callResult, [options]) ⇒ `Promise.<String>` ⏏ -Decode contract call result data - -**Kind**: Exported function -**Returns**: `Promise.<String>` - Result object -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| source | `String` | | source code | -| fn | `String` | | function name | -| callValue | `String` | | result call data | -| callResult | `String` | | result status | -| [options] | `Object` | {} | Options | -| [options.filesystem] | `Object` | {} | Contract external namespaces map | - -**Example** -```js -const decodedData = await client.contractDecodeData(SourceCode ,'functionName', 'cb_asdasdasd...', 'ok|revert')lt -``` - - -### contractCallStatic(source, address, name, args, [options]) ⇒ `Promise.<Object>` ⏏ -Static contract call(using dry-run) - -**Kind**: Exported function -**Returns**: `Promise.<Object>` - Result object -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| source | `String` | | Contract source code | -| address | `String` | | Contract address | -| name | `String` | | Name of function to call | -| args | `Array` \| `String` | | Argument's or callData for call/deploy transaction | -| [options] | `Object` | {} | Options | -| [options.top] | `String` | | Block hash on which you want to call contract | -| [options.bytecode] | `String` | | Block hash on which you want to call contract | -| [options.options] | `Object` | | Transaction options (fee, ttl, gas, amount, deposit) | -| [options.options.filesystem] | `Object` | | Contract external namespaces map | - -**Example** -```js -const callResult = await client.contractCallStatic(source, address, fnName, args = [], { top, options = {} }) -{ - result: TX_DATA, - decode: (type) => Decode call result -} -``` - - -### contractCall(source, address, name, argsOrCallData, [options]) ⏏ -Call contract function - -**Kind**: Exported function -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| source | `String` | | Contract source code | -| address | `String` | | Contract address | -| name | `String` | | Name of function to call | -| argsOrCallData | `Array` \| `String` | | Argument's array or callData for call function | -| [options] | `Object` | {} | Transaction options (fee, ttl, gas, amount, deposit) | -| [options.filesystem] | `Object` | {} | Contract external namespaces map* @return {Promise} Result object | - -**Example** -```js -const callResult = await client.contractCall(source, address, fnName, args = [], options) -{ - hash: TX_HASH, - result: TX_DATA, - decode: (type) => Decode call result -} -``` - - -### contractDeploy(code, source, initState, [options]) ⇒ `Promise.<Object>` ⏏ -Deploy contract to the node - -**Kind**: Exported function -**Returns**: `Promise.<Object>` - Result object -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| code | `String` | | Compiled contract | -| source | `String` | | Contract source code | -| initState | `Array` \| `String` | | Arguments of contract constructor(init) function. Can be array of arguments or callData string | -| [options] | `Object` | {} | Transaction options (fee, ttl, gas, amount, deposit) | -| [options.filesystem] | `Object` | {} | Contract external namespaces map* @return {Promise} Result object | - -**Example** -```js -const deployed = await client.contractDeploy(bytecode, source, init = [], options) -{ - owner: OWNER_PUB_KEY, - transaction: TX_HASH, - address: CONTRACT_ADDRESS, - createdAt: Date, - result: DEPLOY_TX_DATA, - call: (fnName, args = [], options) => Call contract function, - callStatic: (fnName, args = [], options) => Static all contract function -} -``` - - -### contractCompile(source, [options]) ⇒ `Promise.<Object>` ⏏ -Compile contract source code - -**Kind**: Exported function -**Returns**: `Promise.<Object>` - Result object -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| source | `String` | | Contract sourece code | -| [options] | `Object` | {} | Transaction options (fee, ttl, gas, amount, deposit) | -| [options.filesystem] | `Object` | {} | Contract external namespaces map* @return {Promise} Result object | -| [options.backend] | `Object` | 'aevm' | Contract backend version (aevm|fate) | - -**Example** -```js -const compiled = await client.contractCompile(SOURCE_CODE) -{ - bytecode: CONTRACT_BYTE_CODE, - deploy: (init = [], options = {}) => Deploy Contract, - encodeCall: (fnName, args = []) => Prepare callData -} -``` - - -### delegateSignatureCommon(ids, [opt], [opt]) ⇒ `Promise.<String>` ⏏ -Utility method to create a delegate signature for a contract - -**Kind**: Exported function -**Returns**: `Promise.<String>` - Signature in hex representation -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| ids | `Array.<String>` | | The list of id's to prepend | -| [opt] | `Object` | {} | options | -| [opt] | `Object` | {} | opt Options | - - - -### delegateNamePreclaimSignature(contractId, [opt]) ⇒ `Promise.<String>` ⏏ -Helper to generate a signature to delegate a name pre-claim to a contract. - -**Kind**: Exported function -**Returns**: `Promise.<String>` - Signature for delegation -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| contractId | `String` | | Contract Id | -| [opt] | `Object` | {} | opt Options | - - - -### delegateNameClaimSignature(name, contractId, [opt]) ⇒ `Promise.<String>` ⏏ -Helper to generate a signature to delegate a name claim to a contract. - -**Kind**: Exported function -**Returns**: `Promise.<String>` - Signature for delegation -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| name | `String` | | The name being claimed | -| contractId | `String` | | Contract Id | -| [opt] | `Object` | {} | opt Options | - - - -### delegateNameTransferSignature(contractId, name, [opt]) ⇒ `Promise.<String>` ⏏ -Helper to generate a signature to delegate a name transfer to a contract. - -**Kind**: Exported function -**Returns**: `Promise.<String>` - Signature for delegation -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| contractId | `String` | | Contract Id | -| name | `String` | | The name being transferred | -| [opt] | `Object` | {} | opt Options | - - - -### delegateNameRevokeSignature(contractId, name, [opt]) ⇒ `Promise.<String>` ⏏ -Helper to generate a signature to delegate a name revoke to a contract. - -**Kind**: Exported function -**Returns**: `Promise.<String>` - Signature for delegation -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| contractId | `String` | | Contract Id | -| name | `String` | | The name being revoked | -| [opt] | `Object` | {} | opt Options | - - - -### delegateOracleRegisterSignature(contractId, [opt]) ⇒ `Promise.<String>` ⏏ -Helper to generate a signature to delegate a Oracle register to a contract. - -**Kind**: Exported function -**Returns**: `Promise.<String>` - Signature for delegation -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| contractId | `String` | | Contract Id | -| [opt] | `Object` | {} | opt Options | - - - -### delegateOracleExtendSignature(contractId, [opt]) ⇒ `Promise.<String>` ⏏ -Helper to generate a signature to delegate a Oracle extend to a contract. - -**Kind**: Exported function -**Returns**: `Promise.<String>` - Signature for delegation -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| contractId | `String` | | Contract Id | -| [opt] | `Object` | {} | opt Options | - - - -### delegateOracleRespondSignature(queryId, contractId, [opt]) ⇒ `Promise.<String>` ⏏ -Helper to generate a signature to delegate a Oracle respond to a contract. - -**Kind**: Exported function -**Returns**: `Promise.<String>` - Signature for delegation -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| queryId | `String` | | Oracle Query Id | -| contractId | `String` | | Contract Id | -| [opt] | `Object` | {} | opt Options | - diff --git a/docs/api/ae/oracle.md b/docs/api/ae/oracle.md deleted file mode 100644 index 2d7e217d89..0000000000 --- a/docs/api/ae/oracle.md +++ /dev/null @@ -1,179 +0,0 @@ - - -## @aeternity/aepp-sdk/es/ae/oracle -Oracle module - routines to interact with the æternity oracle system - -The high-level description of the oracle system is -https://github.com/aeternity/protocol/blob/master/ORACLE.md in the protocol -repository. - -**Example** -```js -import Oracle from '@aeternity/aepp-sdk/es/ae/oracle' -``` - -* [@aeternity/aepp-sdk/es/ae/oracle](#module_@aeternity/aepp-sdk/es/ae/oracle) - * [Oracle([options])](#exp_module_@aeternity/aepp-sdk/es/ae/oracle--Oracle) ⇒ `Object` ⏏ - * _instance_ - * _async_ - * [.getOracleObject(oracleId)](#exp_module_@aeternity/aepp-sdk/es/ae/oracle--getOracleObject) ⇒ `Promise.<Object>` ⏏ - * [.pollForQueries(oracleId, onQuery, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/oracle--pollForQueries) ⇒ `function` ⏏ - * [.getQueryObject(oracleId, queryId)](#exp_module_@aeternity/aepp-sdk/es/ae/oracle--getQueryObject) ⇒ `Promise.<Object>` ⏏ - * [.exports.pollForQueryResponse(oracleId, queryId, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/oracle--exports.pollForQueryResponse) ⇒ `Promise.<Object>` ⏏ - * [.registerOracle(queryFormat, responseFormat, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/oracle--registerOracle) ⇒ `Promise.<Object>` ⏏ - * [.postQueryToOracle(oracleId, query, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/oracle--postQueryToOracle) ⇒ `Promise.<Object>` ⏏ - * [.extendOracleTtl(oracleId, oracleTtl, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/oracle--extendOracleTtl) ⇒ `Promise.<Object>` ⏏ - * [.respondToQuery(oracleId, queryId, response, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/oracle--respondToQuery) ⇒ `Promise.<Object>` ⏏ - - - -### Oracle([options]) ⇒ `Object` ⏏ -Oracle Stamp - -Oracle provides oracle-system related methods atop -[Ae](#exp_module_@aeternity/aepp-sdk/es/ae--Ae) clients. - -**Kind**: Exported function -**Returns**: `Object` - Oracle instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | - - - -### .getOracleObject(oracleId) ⇒ `Promise.<Object>` ⏏ -Constructor for Oracle Object (helper object for using Oracle) - -**Kind**: instance method of [`@aeternity/aepp-sdk/es/ae/oracle`](#module_@aeternity/aepp-sdk/es/ae/oracle) -**Returns**: `Promise.<Object>` - Oracle object -**Category**: async - -| Param | Type | Description | -| --- | --- | --- | -| oracleId | `String` | Oracle public key | - - - -### .pollForQueries(oracleId, onQuery, [options]) ⇒ `function` ⏏ -Poll for oracle queries - -**Kind**: instance method of [`@aeternity/aepp-sdk/es/ae/oracle`](#module_@aeternity/aepp-sdk/es/ae/oracle) -**Returns**: `function` - stopPolling - Stop polling function -**Category**: async - -| Param | Type | Description | -| --- | --- | --- | -| oracleId | `String` | Oracle public key | -| onQuery | `function` | OnQuery callback | -| [options] | `Object` | Options object | -| [options.interval] | `Number` | Poll interval(default: 5000) | - - - -### .getQueryObject(oracleId, queryId) ⇒ `Promise.<Object>` ⏏ -Constructor for OracleQuery Object (helper object for using OracleQuery) - -**Kind**: instance method of [`@aeternity/aepp-sdk/es/ae/oracle`](#module_@aeternity/aepp-sdk/es/ae/oracle) -**Returns**: `Promise.<Object>` - OracleQuery object -**Category**: async - -| Param | Type | Description | -| --- | --- | --- | -| oracleId | `String` | Oracle public key | -| queryId | `String` | Oracle Query id | - - - -### .exports.pollForQueryResponse(oracleId, queryId, [options]) ⇒ `Promise.<Object>` ⏏ -Poll for oracle query response - -**Kind**: instance method of [`@aeternity/aepp-sdk/es/ae/oracle`](#module_@aeternity/aepp-sdk/es/ae/oracle) -**Returns**: `Promise.<Object>` - OracleQuery object -**Category**: async - -| Param | Type | Description | -| --- | --- | --- | -| oracleId | `String` | Oracle public key | -| queryId | `String` | Oracle Query id | -| [options] | `Object` | Options object | -| [options.attempts] | `Object` | Poll attempt's(default: 20) | -| [options.interval] | `Object` | Poll interval(default: 5000) | - - - -### .registerOracle(queryFormat, responseFormat, [options]) ⇒ `Promise.<Object>` ⏏ -Register oracle - -**Kind**: instance method of [`@aeternity/aepp-sdk/es/ae/oracle`](#module_@aeternity/aepp-sdk/es/ae/oracle) -**Returns**: `Promise.<Object>` - Oracle object -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| queryFormat | `String` | | Format of query | -| responseFormat | `String` | | Format of query response | -| [options] | `Object` | {} | Options | -| [options.queryFee] | `String` \| `Number` | | queryFee Oracle query Fee | -| [options.oracleTtl] | `Object` | | oracleTtl OracleTtl object {type: 'delta|block', value: 'number'} | -| [options.abiVersion] | `Number` | | abiVersion Always 0 (do not use virtual machine) | -| [options.fee] | `Number` \| `String` | | fee Transaction fee | -| [options.ttl] | `Number` \| `String` | | Transaction time to leave | - - - -### .postQueryToOracle(oracleId, query, [options]) ⇒ `Promise.<Object>` ⏏ -Post query to oracle - -**Kind**: instance method of [`@aeternity/aepp-sdk/es/ae/oracle`](#module_@aeternity/aepp-sdk/es/ae/oracle) -**Returns**: `Promise.<Object>` - Query object -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| oracleId | `String` | | Oracle public key | -| query | `String` | | Oracle query object | -| [options] | `Object` | {} | | -| [options.queryTtl] | `String` \| `Number` | | queryTtl Oracle query time to leave | -| [options.responseTtl] | `String` \| `Number` | | queryFee Oracle query response time to leave | -| [options.queryFee] | `String` \| `Number` | | queryFee Oracle query fee | -| [options.fee] | `Number` | | fee Transaction fee | -| [options.ttl] | `Number` | | Transaction time to leave | - - - -### .extendOracleTtl(oracleId, oracleTtl, [options]) ⇒ `Promise.<Object>` ⏏ -Extend oracle ttl - -**Kind**: instance method of [`@aeternity/aepp-sdk/es/ae/oracle`](#module_@aeternity/aepp-sdk/es/ae/oracle) -**Returns**: `Promise.<Object>` - Oracle object -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| oracleId | `String` | | Oracle public key | -| oracleTtl | `String` | | Oracle time to leave for extend | -| [options] | `Object` | {} | | -| [options.fee] | `Number` | | fee Transaction fee | -| [options.ttl] | `Number` | | Transaction time to leave | - - - -### .respondToQuery(oracleId, queryId, response, [options]) ⇒ `Promise.<Object>` ⏏ -Extend oracle ttl - -**Kind**: instance method of [`@aeternity/aepp-sdk/es/ae/oracle`](#module_@aeternity/aepp-sdk/es/ae/oracle) -**Returns**: `Promise.<Object>` - Oracle object -**Category**: async - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| oracleId | `String` | | Oracle public key | -| queryId | `String` | | Oracle query id | -| response | `String` | | Oracle query response | -| [options] | `Object` | {} | | -| [options.responseTtl] | `Number` | | responseTtl Query response time to leave | -| [options.fee] | `Number` | | Transaction fee | -| [options.ttl] | `Number` | | Transaction time to leave | - diff --git a/docs/api/ae/universal.md b/docs/api/ae/universal.md deleted file mode 100644 index 19c73c33e7..0000000000 --- a/docs/api/ae/universal.md +++ /dev/null @@ -1,25 +0,0 @@ - - -## @aeternity/aepp-sdk/es/ae/universal -Universal module - -**Example** -```js -import Ae from '@aeternity/aepp-sdk/es/ae/universal' -``` - - -### exports.Universal([options]) ⇒ `Object` ⏏ -Universal Stamp - -Universal provides Ae base functionality with Contract and Aens -[Ae](#exp_module_@aeternity/aepp-sdk/es/ae--Ae) clients. - -**Kind**: Exported function -**Returns**: `Object` - Universal instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | - diff --git a/docs/api/ae/wallet.md b/docs/api/ae/wallet.md deleted file mode 100644 index 78571bb486..0000000000 --- a/docs/api/ae/wallet.md +++ /dev/null @@ -1,41 +0,0 @@ - - -## @aeternity/aepp-sdk/es/ae/wallet -Wallet module - -**Example** -```js -import Wallet from '@aeternity/aepp-sdk/es/ae/wallet' -``` - - -### exports.Wallet([options]) ⇒ `Object` ⏏ -Wallet Stamp - -**Kind**: Exported function -**Returns**: `Object` - Wallet instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | -| options.url | `String` | | Node instance to connect to | -| [options.accounts] | `Array.<Account>` | | Accounts to initialize with | -| [options.account] | `String` | | Public key of account to preselect | -| [options.onTx] | `function` | | Tx method protector function | -| [options.onChain] | `function` | | Chain method protector function | -| [options.onAccount] | `function` | | Account method protector function | -| [options.onContract] | `function` | | Contract method protector function | - -**Example** -```js -Wallet({ - url: 'https://sdk-testnet.aepps.com/', - accounts: [MemoryAccount({keypair})], - address: keypair.publicKey, - onTx: confirm, - onChain: confirm, - onAccount: confirm - onContract: confirm -}) -``` diff --git a/docs/api/chain.md b/docs/api/chain.md deleted file mode 100644 index c239b4c5d0..0000000000 --- a/docs/api/chain.md +++ /dev/null @@ -1,283 +0,0 @@ - - -## @aeternity/aepp-sdk/es/chain -Chain module - -**Example** -```js -import Chain from '@aeternity/aepp-sdk/es/chain' -``` - -* [@aeternity/aepp-sdk/es/chain](#module_@aeternity/aepp-sdk/es/chain) - * [Chain([options])](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) ⇒ `Object` ⏏ - * _instance_ - * _async_ - * *[.sendTransaction(tx, [options])](#module_@aeternity/aepp-sdk/es/chain--Chain+sendTransaction) ⇒ `Object` \| `String`* - * *[.height()](#module_@aeternity/aepp-sdk/es/chain--Chain+height) ⇒ `Number`* - * *[.awaitHeight([options])](#module_@aeternity/aepp-sdk/es/chain--Chain+awaitHeight) ⇒ `Number`* - * *[.poll([options])](#module_@aeternity/aepp-sdk/es/chain--Chain+poll) ⇒ `Object`* - * *[.balance(address, [options])](#module_@aeternity/aepp-sdk/es/chain--Chain+balance) ⇒ `Object`* - * *[.tx(hash, info)](#module_@aeternity/aepp-sdk/es/chain--Chain+tx) ⇒ `Object`* - * *[.getTxInfo(hash)](#module_@aeternity/aepp-sdk/es/chain--Chain+getTxInfo) ⇒ `Object`* - * *[.mempool()](#module_@aeternity/aepp-sdk/es/chain--Chain+mempool) ⇒ `Array.<Object>`* - * *[.getCurrentGeneration()](#module_@aeternity/aepp-sdk/es/chain--Chain+getCurrentGeneration) ⇒ `Object`* - * *[.getGeneration(hashOrHeight)](#module_@aeternity/aepp-sdk/es/chain--Chain+getGeneration) ⇒ `Object`* - * *[.waitForTxConfirm(txHash, [options])](#module_@aeternity/aepp-sdk/es/chain--Chain+waitForTxConfirm) ⇒ `Promise.<Number>`* - * *[.getMicroBlockTransactions()](#module_@aeternity/aepp-sdk/es/chain--Chain+getMicroBlockTransactions) ⇒ `Array.<Object>`* - * *[.getKeyBlock()](#module_@aeternity/aepp-sdk/es/chain--Chain+getKeyBlock) ⇒ `Object`* - * *[.getMicroBlockHeader()](#module_@aeternity/aepp-sdk/es/chain--Chain+getMicroBlockHeader) ⇒ `Object`* - * *[.getAccount(address, [options])](#module_@aeternity/aepp-sdk/es/chain--Chain+getAccount) ⇒ `Object`* - * *[.txDryRun(txs, accounts, hashOrHeight)](#module_@aeternity/aepp-sdk/es/chain--Chain+txDryRun) ⇒ `Object`* - * *[.getInfo()](#module_@aeternity/aepp-sdk/es/chain--Chain+getInfo) ⇒ `Object`* - * _static_ - * [.waitMined(bool)](#module_@aeternity/aepp-sdk/es/chain--Chain.waitMined) ⇒ `Stamp` - - - -### Chain([options]) ⇒ `Object` ⏏ -Basic Chain Stamp - -Attempting to create instances from the Stamp without overwriting all -abstract methods using composition will result in an exception. - -**Kind**: Exported function -**Returns**: `Object` - Chain instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | - - - -#### *chain.sendTransaction(tx, [options]) ⇒ `Object` \| `String`* -Submit a signed transaction for mining - -**Kind**: instance abstract method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -**Returns**: `Object` \| `String` - Transaction or transaction hash -**Category**: async -**rtype**: `(tx: String, options?: Object) => tx: Promise[Object]|txHash: Promise[String]` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| tx | `String` | | Transaction to submit | -| [options] | `String` | {} | Options to pass to the implementation | -| [options.verify] | `String` | false | Verify transaction before broadcast. | - - - -#### *chain.height() ⇒ `Number`* -Obtain current height of the chain - -**Kind**: instance abstract method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -**Returns**: `Number` - Current chain height -**Category**: async -**rtype**: `() => height: Number` - - -#### *chain.awaitHeight([options]) ⇒ `Number`* -Wait for the chain to reach a specific height - -**Kind**: instance abstract method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -**Returns**: `Number` - Current chain height -**Category**: async -**rtype**: `(height: Number, options?: Object) => height: Number` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Options | -| options.interval | `Number` | | Interval (in ms) at which to poll the chain | -| options.attempts | `Number` | | Number of polling attempts after which to fail | - - - -#### *chain.poll([options]) ⇒ `Object`* -Wait for a transaction to be mined - -**Kind**: instance abstract method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -**Returns**: `Object` - The transaction as it was mined -**Category**: async -**rtype**: `(th: String, options?: Object) => tx: Object` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Options | -| options.interval | `Number` | | Interval (in ms) at which to poll the chain | -| options.blocks | `Number` | | Number of blocks mined after which to fail | - - - -#### *chain.balance(address, [options]) ⇒ `Object`* -Request the balance of specified account - -**Kind**: instance abstract method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -**Returns**: `Object` - The transaction as it was mined -**Category**: async -**rtype**: `(address: String, options?: Object) => balance: Number` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| address | `String` | | The public account address to obtain the balance for | -| [options] | `Object` | {} | Options | -| options.height | `Number` | | The chain height at which to obtain the balance for (default: top of chain) | -| options.hash | `String` | | The block hash on which to obtain the balance for (default: top of chain) | - - - -#### *chain.tx(hash, info) ⇒ `Object`* -Obtain a transaction based on its hash - -**Kind**: instance abstract method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -**Returns**: `Object` - Transaction -**Category**: async -**rtype**: `(hash: String, info = false) => tx: Object` - -| Param | Type | Description | -| --- | --- | --- | -| hash | `String` | Transaction hash | -| info | `Boolean` | Retrieve additional transaction date. Works only for (ContractCreate and ContractCall transaction's) | - - - -#### *chain.getTxInfo(hash) ⇒ `Object`* -Obtain a transaction info based on its hash - -**Kind**: instance abstract method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -**Returns**: `Object` - Transaction -**Category**: async -**rtype**: `(hash: String) => tx: Object` - -| Param | Type | Description | -| --- | --- | --- | -| hash | `String` | Transaction hash | - - - -#### *chain.mempool() ⇒ `Array.<Object>`* -Obtain transaction's from mempool - -**Kind**: instance abstract method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -**Returns**: `Array.<Object>` - Transactions -**Category**: async -**rtype**: `() => txs: [...Object]` - - -#### *chain.getCurrentGeneration() ⇒ `Object`* -Obtain current generation - -**Kind**: instance abstract method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -**Returns**: `Object` - Current Generation -**Category**: async -**rtype**: `() => generation: Object` - - -#### *chain.getGeneration(hashOrHeight) ⇒ `Object`* -Get generation by hash or height - -**Kind**: instance abstract method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -**Returns**: `Object` - Generation -**Category**: async -**rtype**: `(hashOrHeight) => generation: Object` - -| Param | Type | Description | -| --- | --- | --- | -| hashOrHeight | `String` \| `Number` | Generation hash or height | - - - -#### *chain.waitForTxConfirm(txHash, [options]) ⇒ `Promise.<Number>`* -Wait for transaction confirmation - -**Kind**: instance abstract method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -**Returns**: `Promise.<Number>` - Current Height -**Category**: async -**rtype**: `(txHash: String, { confirm: Number | Boolean } = { confirm: 3 }) => Promise` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| txHash | `String` | | Generation hash or height | -| [options] | `String` | {} | options | -| [options.confirm] | `String` | 3 | Block confirmation count | - - - -#### *chain.getMicroBlockTransactions() ⇒ `Array.<Object>`* -Get micro block transactions - -**Kind**: instance abstract method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -**Returns**: `Array.<Object>` - Transactions -**Category**: async -**rtype**: `(hash) => txs: [...Object]` - - -#### *chain.getKeyBlock() ⇒ `Object`* -Get key block - -**Kind**: instance abstract method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -**Returns**: `Object` - Key Block -**Category**: async -**rtype**: `(hashOrHeight) => keyBlock: Object` - - -#### *chain.getMicroBlockHeader() ⇒ `Object`* -Get micro block header - -**Kind**: instance abstract method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -**Returns**: `Object` - Micro block header -**Category**: async -**rtype**: `(hash) => header: Object` - - -#### *chain.getAccount(address, [options]) ⇒ `Object`* -Get account by account public key - -**Kind**: instance abstract method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -**Returns**: `Object` - Account -**Category**: async -**rtype**: `(address, { hash, height }) => account: Object` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| address | `String` | | Account public key | -| [options] | `Object` | {} | Options | -| [options.height] | `Number` | | Get account on specific block by block height | -| [options.hash] | `String` | | Get account on specific block by block hash | - - - -#### *chain.txDryRun(txs, accounts, hashOrHeight) ⇒ `Object`* -Transaction dry-run - -**Kind**: instance abstract method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -**Returns**: `Object` - Result -**Category**: async -**rtype**: `(txs, accounts, hashOrHeight) => result: Object` - -| Param | Type | Description | -| --- | --- | --- | -| txs | `Array` | Array of transaction's | -| accounts | `Array` | Array of account's | -| hashOrHeight | `String` \| `Number` | hash or height of block on which to make dry-run | - - - -#### *chain.getInfo() ⇒ `Object`* -Get Node Info - -**Kind**: instance abstract method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -**Returns**: `Object` - Result -**Category**: async -**rtype**: `() => result: Object` - - -#### Chain.waitMined(bool) ⇒ `Stamp` -Reconfigure Stamp to (not) wait until transactions are mined - -**Kind**: static method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -**Returns**: `Stamp` - Reconfigured Chain Stamp -**rtype**: `(bool: Boolean) => Stamp` - -| Param | Type | Description | -| --- | --- | --- | -| bool | `boolean` | Whether to wait for transactions | - diff --git a/docs/api/chain/node.md b/docs/api/chain/node.md deleted file mode 100644 index 85f2ff8bd6..0000000000 --- a/docs/api/chain/node.md +++ /dev/null @@ -1,31 +0,0 @@ - - -## @aeternity/aepp-sdk/es/chain/node -ChainNode module - -This is the complement to [@aeternity/aepp-sdk/es/chain](#module_@aeternity/aepp-sdk/es/chain). - -**Example** -```js -import ChainNode from '@aeternity/aepp-sdk/es/chain/node' -``` - - -### ChainNode([options]) ⇒ `Object` ⏏ -ChainNode Stamp - -This is implementation of [Chain](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) -composed with [module:@aeternity/aepp-sdk/es/contract/node--ContractNodeAPI](module:@aeternity/aepp-sdk/es/contract/node--ContractNodeAPI) and [module:@aeternity/aepp-sdk/es/oracle/node--OracleNodeAPI](module:@aeternity/aepp-sdk/es/oracle/node--OracleNodeAPI) - -**Kind**: Exported function -**Returns**: `Object` - ChainNode instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | - -**Example** -```js -ChainNode({url: 'https://sdk-testnet.aepps.com/'}) -``` diff --git a/docs/api/channel/index.md b/docs/api/channel/index.md deleted file mode 100644 index 2b790d5b2c..0000000000 --- a/docs/api/channel/index.md +++ /dev/null @@ -1,638 +0,0 @@ - - -## @aeternity/aepp-sdk/es/channel/index -Channel module - -**Example** -```js -import Channel from '@aeternity/aepp-sdk/es/channel/index' -``` - -* [@aeternity/aepp-sdk/es/channel/index](#module_@aeternity/aepp-sdk/es/channel/index) - * [Channel(options)](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) ⇒ `Promise.<Object>` ⏏ - * [~on(event, callback)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..on) - * [~off(event, callback)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..off) - * [~disconnect()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..disconnect) - * [~status()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..status) ⇒ `String` - * [~state()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..state) ⇒ `Promise.<Object>` - * [~round()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..round) ⇒ `Number` - * [~id()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..id) ⇒ `String` - * [~fsmId()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..fsmId) ⇒ `String` - * [~update(from, to, amount, sign, metadata)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..update) ⇒ `Promise.<Object>` - * [~poi(addresses)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..poi) ⇒ `Promise.<String>` - * [~balances(accounts)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..balances) ⇒ `Promise.<Object>` - * [~leave()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..leave) ⇒ `Promise.<Object>` - * [~shutdown(sign)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..shutdown) ⇒ `Promise.<String>` - * [~withdraw(amount, sign, [callbacks])](#module_@aeternity/aepp-sdk/es/channel/index--Channel..withdraw) ⇒ `Promise.<Object>` - * [~deposit(amount, sign, [callbacks])](#module_@aeternity/aepp-sdk/es/channel/index--Channel..deposit) ⇒ `Promise.<Object>` - * [~createContract(options, sign)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..createContract) ⇒ `Promise.<Object>` - * [~callContract(options, sign)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..callContract) ⇒ `Promise.<Object>` - * [~forceProgress(options, sign, callbacks)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..forceProgress) ⇒ `Promise.<Object>` - * [~callContractStatic(options)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..callContractStatic) ⇒ `Promise.<Object>` - * [~getContractCall(options)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..getContractCall) ⇒ `Promise.<Object>` - * [~getContractState(contract)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..getContractState) ⇒ `Promise.<Object>` - * [~cleanContractCalls()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..cleanContractCalls) ⇒ `Promise` - * [~sendMessage(message, recipient)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..sendMessage) - - - -### Channel(options) ⇒ `Promise.<Object>` ⏏ -Channel - -**Kind**: Exported function -**Returns**: `Promise.<Object>` - Channel instance -**rtype**: `Channel` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| options | `Object` | | Channel params | -| options.url | `String` | | Channel url (for example: "ws://localhost:3001") | -| options.role | `String` | | Participant role ("initiator" or "responder") | -| options.initiatorId | `String` | | Initiator's public key | -| options.responderId | `String` | | Responder's public key | -| options.pushAmount | `Number` | | Initial deposit in favour of the responder by the initiator | -| options.initiatorAmount | `Number` | | Amount of tokens the initiator has committed to the channel | -| options.responderAmount | `Number` | | Amount of tokens the responder has committed to the channel | -| options.channelReserve | `Number` | | The minimum amount both peers need to maintain | -| [options.ttl] | `Number` | | Minimum block height to include the channel_create_tx | -| options.host | `String` | | Host of the responder's node | -| options.port | `Number` | | The port of the responders node | -| options.lockPeriod | `Number` | | Amount of blocks for disputing a solo close | -| [options.existingChannelId] | `Number` | | Existing channel id (required if reestablishing a channel) | -| [options.offchainTx] | `Number` | | Offchain transaction (required if reestablishing a channel) | -| [options.timeoutIdle] | `Number` | | The time waiting for a new event to be initiated (default: 600000) | -| [options.timeoutFundingCreate] | `Number` | | The time waiting for the initiator to produce the create channel transaction after the noise session had been established (default: 120000) | -| [options.timeoutFundingSign] | `Number` | | The time frame the other client has to sign an off-chain update after our client had initiated and signed it. This applies only for double signed on-chain intended updates: channel create transaction, deposit, withdrawal and etc. (default: 120000) | -| [options.timeoutFundingLock] | `Number` | | The time frame the other client has to confirm an on-chain transaction reaching maturity (passing minimum depth) after the local node has detected this. This applies only for double signed on-chain intended updates: channel create transaction, deposit, withdrawal and etc. (default: 360000) | -| [options.timeoutSign] | `Number` | | The time frame the client has to return a signed off-chain update or to decline it. This applies for all off-chain updates (default: 500000) | -| [options.timeoutAccept] | `Number` | | The time frame the other client has to react to an event. This applies for all off-chain updates that are not meant to land on-chain, as well as some special cases: opening a noise connection, mutual closing acknowledgement and reestablishing an existing channel (default: 120000) | -| [options.timeoutInitialized] | `Number` | | the time frame the responder has to accept an incoming noise session. Applicable only for initiator (default: timeout_accept's value) | -| [options.timeoutAwaitingOpen] | `Number` | | The time frame the initiator has to start an outgoing noise session to the responder's node. Applicable only for responder (default: timeout_idle's value) | -| [options.debug] | `Number` | false | Log websocket communication | -| options.sign | `function` | | Function which verifies and signs transactions | - -**Example** -```js -Channel({ - url: 'ws://localhost:3001', - role: 'initiator' - initiatorId: 'ak_Y1NRjHuoc3CGMYMvCmdHSBpJsMDR6Ra2t5zjhRcbtMeXXLpLH', - responderId: 'ak_V6an1xhec1xVaAhLuak7QoEbi6t7w5hEtYWp9bMKaJ19i6A9E', - initiatorAmount: 1e18, - responderAmount: 1e18, - pushAmount: 0, - channelReserve: 0, - ttl: 1000, - host: 'localhost', - port: 3002, - lockPeriod: 10, - async sign (tag, tx) => await account.signTransaction(tx) -}) -``` - - -#### Channel~on(event, callback) -Register event listener function - -Possible events: - - - "error" - - "onChainTx" - - "ownWithdrawLocked" - - "withdrawLocked" - - "ownDepositLocked" - - "depositLocked" - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - -| Param | Type | Description | -| --- | --- | --- | -| event | `String` | Event name | -| callback | `function` | Callback function | - - - -#### Channel~off(event, callback) -Remove event listener function - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - -| Param | Type | Description | -| --- | --- | --- | -| event | `String` | Event name | -| callback | `function` | Callback function | - - - -#### Channel~disconnect() -Close the connection - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - - -#### Channel~status() ⇒ `String` -Get current status - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - - -#### Channel~state() ⇒ `Promise.<Object>` -Get current state - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - - -#### Channel~round() ⇒ `Number` -Get current round - -If round cannot be determined (for example when channel has not been opened) -it will return `null`. - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - - -#### Channel~id() ⇒ `String` -Get channel id - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - - -#### Channel~fsmId() ⇒ `String` -Get channel's fsm id - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - - -#### Channel~update(from, to, amount, sign, metadata) ⇒ `Promise.<Object>` -Trigger a transfer update - -The transfer update is moving tokens from one channel account to another. -The update is a change to be applied on top of the latest state. - -Sender and receiver are the channel parties. Both the initiator and responder -can take those roles. Any public key outside of the channel is considered invalid. - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - -| Param | Type | Description | -| --- | --- | --- | -| from | `String` | Sender's public address | -| to | `String` | Receiver's public address | -| amount | `Number` | Transaction amount | -| sign | `function` | Function which verifies and signs offchain transaction | -| metadata | `Array.<String>` | | - -**Example** -```js -channel.update( - 'ak_Y1NRjHuoc3CGMYMvCmdHSBpJsMDR6Ra2t5zjhRcbtMeXXLpLH', - 'ak_V6an1xhec1xVaAhLuak7QoEbi6t7w5hEtYWp9bMKaJ19i6A9E', - 10, - async (tx) => await account.signTransaction(tx) -).then(({ accepted, signedTx }) => - if (accepted) { - console.log('Update has been accepted') - } -) -``` - - -#### Channel~poi(addresses) ⇒ `Promise.<String>` -Get proof of inclusion - -If a certain address of an account or a contract is not found -in the state tree - the response is an error. - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - -| Param | Type | Description | -| --- | --- | --- | -| addresses | `Object` | | -| [addresses.accounts] | `Array.<String>` | List of account addresses to include in poi | -| [addresses.contracts] | `Array.<String>` | List of contract addresses to include in poi | - -**Example** -```js -channel.poi({ - accounts: [ - 'ak_Y1NRjHuoc3CGMYMvCmdHSBpJsMDR6Ra2t5zjhRcbtMeXXLpLH', - 'ak_V6an1xhec1xVaAhLuak7QoEbi6t7w5hEtYWp9bMKaJ19i6A9E' - ], - contracts: ['ct_2dCUAWYZdrWfACz3a2faJeKVTVrfDYxCQHCqAt5zM15f3u2UfA'] -}).then(poi => console.log(poi)) -``` - - -#### Channel~balances(accounts) ⇒ `Promise.<Object>` -Get balances - -The accounts paramcontains a list of addresses to fetch balances of. -Those can be either account balances or a contract ones, encoded as an account addresses. - -If a certain account address had not being found in the state tree - it is simply -skipped in the response. - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - -| Param | Type | Description | -| --- | --- | --- | -| accounts | `Array.<String>` | List of addresses to fetch balances from | - -**Example** -```js -channel.balances([ - 'ak_Y1NRjHuoc3CGMYMvCmdHSBpJsMDR6Ra2t5zjhRcbtMeXXLpLH', - 'ak_V6an1xhec1xVaAhLuak7QoEbi6t7w5hEtYWp9bMKaJ19i6A9E' - 'ct_2dCUAWYZdrWfACz3a2faJeKVTVrfDYxCQHCqAt5zM15f3u2UfA' -]).then(balances => - console.log(balances['ak_Y1NRjHuoc3CGMYMvCmdHSBpJsMDR6Ra2t5zjhRcbtMeXXLpLH']) -) -``` - - -#### Channel~leave() ⇒ `Promise.<Object>` -Leave channel - -It is possible to leave a channel and then later reestablish the channel -off-chain state and continue operation. When a leave method is called, -the channel fsm passes it on to the peer fsm, reports the current mutually -signed state and then terminates. - -The channel can be reestablished by instantiating another Channel instance -with two extra params: existingChannelId and offchainTx (returned from leave -method as channelId and signedTx respectively). - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) -**Example** -```js -channel.leave().then(({ channelId, signedTx }) => { - console.log(channelId) - console.log(signedTx) -}) -``` - - -#### Channel~shutdown(sign) ⇒ `Promise.<String>` -Trigger mutual close - -At any moment after the channel is opened, a closing procedure can be triggered. -This can be done by either of the parties. The process is similar to the off-chain updates. - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - -| Param | Type | Description | -| --- | --- | --- | -| sign | `function` | Function which verifies and signs mutual close transaction | - -**Example** -```js -channel.shutdown( - async (tx) => await account.signTransaction(tx) -).then(tx => console.log('on_chain_tx', tx)) -``` - - -#### Channel~withdraw(amount, sign, [callbacks]) ⇒ `Promise.<Object>` -Withdraw tokens from the channel - -After the channel had been opened any of the participants can initiate a withdrawal. -The process closely resembles the update. The most notable difference is that the -transaction has been co-signed: it is channel_withdraw_tx and after the procedure -is finished - it is being posted on-chain. - -Any of the participants can initiate a withdrawal. The only requirements are: - - - Channel is already opened - - No off-chain update/deposit/withdrawal is currently being performed - - Channel is not being closed or in a solo closing state - - The withdrawal amount must be equal to or greater than zero, and cannot exceed - the available balance on the channel (minus the channel_reserve) - -After the other party had signed the withdraw transaction, the transaction is posted -on-chain and onOnChainTx callback is called with on-chain transaction as first argument. -After computing transaction hash it can be tracked on the chain: entering the mempool, -block inclusion and a number of confirmations. - -After the minimum_depth block confirmations onOwnWithdrawLocked callback is called -(without any arguments). - -When the other party had confirmed that the block height needed is reached -onWithdrawLocked callback is called (without any arguments). - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - -| Param | Type | Description | -| --- | --- | --- | -| amount | `Number` | Amount of tokens to withdraw | -| sign | `function` | Function which verifies and signs withdraw transaction | -| [callbacks] | `Object` | | -| [callbacks.onOnChainTx] | `function` | Called when withdraw transaction has been posted on chain | -| [callbacks.onOwnWithdrawLocked] | `function` | | -| [callbacks.onWithdrawLocked] | `function` | | - -**Example** -```js -channel.withdraw( - 100, - async (tx) => await account.signTransaction(tx), - { onOnChainTx: (tx) => console.log('on_chain_tx', tx) } -).then(({ accepted, signedTx }) => { - if (accepted) { - console.log('Withdrawal has been accepted') - } else { - console.log('Withdrawal has been rejected') - } -}) -``` - - -#### Channel~deposit(amount, sign, [callbacks]) ⇒ `Promise.<Object>` -Deposit tokens into the channel - -After the channel had been opened any of the participants can initiate a deposit. -The process closely resembles the update. The most notable difference is that the -transaction has been co-signed: it is channel_deposit_tx and after the procedure -is finished - it is being posted on-chain. - -Any of the participants can initiate a deposit. The only requirements are: - - - Channel is already opened - - No off-chain update/deposit/withdrawal is currently being performed - - Channel is not being closed or in a solo closing state - - The deposit amount must be equal to or greater than zero, and cannot exceed - the available balance on the channel (minus the channel_reserve) - -After the other party had signed the deposit transaction, the transaction is posted -on-chain and onOnChainTx callback is called with on-chain transaction as first argument. -After computing transaction hash it can be tracked on the chain: entering the mempool, -block inclusion and a number of confirmations. - -After the minimum_depth block confirmations onOwnDepositLocked callback is called -(without any arguments). - -When the other party had confirmed that the block height needed is reached -onDepositLocked callback is called (without any arguments). - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - -| Param | Type | Description | -| --- | --- | --- | -| amount | `Number` | Amount of tokens to deposit | -| sign | `function` | Function which verifies and signs deposit transaction | -| [callbacks] | `Object` | | -| [callbacks.onOnChainTx] | `function` | Called when deposit transaction has been posted on chain | -| [callbacks.onOwnDepositLocked] | `function` | | -| [callbacks.onDepositLocked] | `function` | | - -**Example** -```js -channel.deposit( - 100, - async (tx) => await account.signTransaction(tx), - { onOnChainTx: (tx) => console.log('on_chain_tx', tx) } -).then(({ accepted, state }) => { - if (accepted) { - console.log('Deposit has been accepted') - console.log('The new state is:', state) - } else { - console.log('Deposit has been rejected') - } -}) -``` - - -#### Channel~createContract(options, sign) ⇒ `Promise.<Object>` -Trigger create contract update - -The create contract update is creating a contract inside the channel's internal state tree. -The update is a change to be applied on top of the latest state. - -That would create a contract with the poster being the owner of it. Poster commits initially -a deposit amount of tokens to the new contract. - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | | -| options.code | `String` | Api encoded compiled AEVM byte code | -| options.callData | `String` | Api encoded compiled AEVM call data for the code | -| options.deposit | `Number` | Initial amount the owner of the contract commits to it | -| options.vmVersion | `Number` | Version of the AEVM | -| options.abiVersion | `Number` | Version of the ABI | -| sign | `function` | Function which verifies and signs create contract transaction | - -**Example** -```js -channel.createContract({ - code: 'cb_HKtpipK4aCgYb17wZ...', - callData: 'cb_1111111111111111...', - deposit: 10, - vmVersion: 3, - abiVersion: 1 -}).then(({ accepted, signedTx, address }) => { - if (accepted) { - console.log('New contract has been created') - console.log('Contract address:', address) - } else { - console.log('New contract has been rejected') - } -}) -``` - - -#### Channel~callContract(options, sign) ⇒ `Promise.<Object>` -Trigger call a contract update - -The call contract update is calling a preexisting contract inside the channel's -internal state tree. The update is a change to be applied on top of the latest state. - -That would call a contract with the poster being the caller of it. Poster commits -an amount of tokens to the contract. - -The call would also create a call object inside the channel state tree. It contains -the result of the contract call. - -It is worth mentioning that the gas is not consumed, because this is an off-chain -contract call. It would be consumed if it were a on-chain one. This could happen -if a call with a similar computation amount is to be forced on-chain. - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | | -| [options.amount] | `String` | Amount the caller of the contract commits to it | -| [options.callData] | `String` | ABI encoded compiled AEVM call data for the code | -| [options.contract] | `Number` | Address of the contract to call | -| [options.abiVersion] | `Number` | Version of the ABI | -| sign | `function` | Function which verifies and signs contract call transaction | - -**Example** -```js -channel.callContract({ - contract: 'ct_9sRA9AVE4BYTAkh5RNfJYmwQe1NZ4MErasQLXZkFWG43TPBqa', - callData: 'cb_1111111111111111...', - amount: 0, - abiVersion: 1 -}).then(({ accepted, signedTx }) => { - if (accepted) { - console.log('Contract called succesfully') - } else { - console.log('Contract call has been rejected') - } -}) -``` - - -#### Channel~forceProgress(options, sign, callbacks) ⇒ `Promise.<Object>` -Trigger a force progress contract call -This call is going on-chain - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| options | `Object` | | | -| [options.amount] | `String` | | Amount the caller of the contract commits to it | -| [options.callData] | `String` | | ABI encoded compiled AEVM call data for the code | -| [options.contract] | `Number` | | Address of the contract to call | -| [options.abiVersion] | `Number` | | Version of the ABI | -| [options.gasPrice] | `Number` | 1000000000 | Gas price | -| [options.gas] | `Number` | 1000000 | Gas limit | -| sign | `function` | | Function which verifies and signs contract force progress transaction | -| callbacks | `Object` | | | - -**Example** -```js -channel.forceProgress({ - contract: 'ct_9sRA9AVE4BYTAkh5RNfJYmwQe1NZ4MErasQLXZkFWG43TPBqa', - callData: 'cb_1111111111111111...', - amount: 0, - abiVersion: 1, - gasPrice: 1000005554 -}).then(({ accepted, signedTx }) => { - if (accepted) { - console.log('Contract force progress call successful') - } else { - console.log('Contract force progress call has been rejected') - } -}) -``` - - -#### Channel~callContractStatic(options) ⇒ `Promise.<Object>` -Call contract using dry-run - -In order to get the result of a potential contract call, one might need to -dry-run a contract call. It takes the exact same arguments as a call would -and returns the call object. - -The call is executed in the channel's state but it does not impact the state -whatsoever. It uses as an environment the latest channel's state and the current -top of the blockchain as seen by the node. - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | | -| [options.amount] | `String` | Amount the caller of the contract commits to it | -| [options.callData] | `String` | ABI encoded compiled AEVM call data for the code | -| [options.contract] | `Number` | Address of the contract to call | -| [options.abiVersion] | `Number` | Version of the ABI | - -**Example** -```js -channel.callContractStatic({ - contract: 'ct_9sRA9AVE4BYTAkh5RNfJYmwQe1NZ4MErasQLXZkFWG43TPBqa', - callData: 'cb_1111111111111111...', - amount: 0, - abiVersion: 1 -}).then(({ returnValue, gasUsed }) => { - console.log('Returned value:', returnValue) - console.log('Gas used:', gasUsed) -}) -``` - - -#### Channel~getContractCall(options) ⇒ `Promise.<Object>` -Get contract call result - -The combination of a caller, contract and a round of execution determines the -contract call. Providing an incorrect set of those results in an error response. - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | | -| [options.caller] | `String` | Address of contract caller | -| [options.contract] | `String` | Address of the contract | -| [options.round] | `Number` | Round when contract was called | - -**Example** -```js -channel.getContractCall({ - caller: 'ak_Y1NRjHuoc3CGMYMvCmdHSBpJsMDR6Ra2t5zjhRcbtMeXXLpLH', - contract: 'ct_9sRA9AVE4BYTAkh5RNfJYmwQe1NZ4MErasQLXZkFWG43TPBqa', - round: 3 -}).then(({ returnType, returnValue }) => { - if (returnType === 'ok') console.log(returnValue) -}) -``` - - -#### Channel~getContractState(contract) ⇒ `Promise.<Object>` -Get contract latest state - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - -| Param | Type | Description | -| --- | --- | --- | -| contract | `String` | Address of the contract | - -**Example** -```js -channel.getContractState( - 'ct_9sRA9AVE4BYTAkh5RNfJYmwQe1NZ4MErasQLXZkFWG43TPBqa' -).then(({ contract }) => { - console.log('deposit:', contract.deposit) -}) -``` - - -#### Channel~cleanContractCalls() ⇒ `Promise` -Clean up all locally stored contract calls - -Contract calls are kept locally in order for the participant to be able to look them up. -They consume memory and in order for the participant to free it - one can prune all messages. -This cleans up all locally stored contract calls and those will no longer be available for -fetching and inspection. - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - - -#### Channel~sendMessage(message, recipient) -Send generic message - -If message is an object it will be serialized into JSON string -before sending. - -If there is ongoing update that has not yet been finished the message -will be sent after that update is finalized. - -**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) - -| Param | Type | Description | -| --- | --- | --- | -| message | `String` \| `Object` | | -| recipient | `String` | Address of the recipient | - -**Example** -```js -channel.sendMessage( - 'hello world', - 'ak_Y1NRjHuoc3CGMYMvCmdHSBpJsMDR6Ra2t5zjhRcbtMeXXLpLH' -) -``` diff --git a/docs/api/contract.md b/docs/api/contract.md deleted file mode 100644 index 832abf67d3..0000000000 --- a/docs/api/contract.md +++ /dev/null @@ -1,184 +0,0 @@ - - -## @aeternity/aepp-sdk/es/contract -Contract Base module - -**Example** -```js -import ContractBase from '@aeternity/aepp-sdk/es/contract' -``` - -* [@aeternity/aepp-sdk/es/contract](#module_@aeternity/aepp-sdk/es/contract) - * [ContractBase([options])](#exp_module_@aeternity/aepp-sdk/es/contract--ContractBase) ⇒ `Object` ⏏ - * *[.contractGetACI(source, [options])](#module_@aeternity/aepp-sdk/es/contract--ContractBase+contractGetACI) ⇒ `Object`* - * *[.contractEncodeCallDataAPI(source, name, args, [options])](#module_@aeternity/aepp-sdk/es/contract--ContractBase+contractEncodeCallDataAPI) ⇒ `String`* - * *[.contractDecodeDataAPI(type, data)](#module_@aeternity/aepp-sdk/es/contract--ContractBase+contractDecodeDataAPI) ⇒ `String`* - * *[.contractDecodeCallResultAPI(source, fn, callValue, callResult, [options])](#module_@aeternity/aepp-sdk/es/contract--ContractBase+contractDecodeCallResultAPI) ⇒ `String`* - * *[.contractDecodeCallDataBySourceAPI(source, function, callData, [options])](#module_@aeternity/aepp-sdk/es/contract--ContractBase+contractDecodeCallDataBySourceAPI) ⇒ `String`* - * *[.contractDecodeCallDataByCodeAPI(code, callData, backend)](#module_@aeternity/aepp-sdk/es/contract--ContractBase+contractDecodeCallDataByCodeAPI) ⇒ `String`* - * *[.compileContractAPI(code, [options])](#module_@aeternity/aepp-sdk/es/contract--ContractBase+compileContractAPI) ⇒ `Object`* - * *[.setCompilerUrl(url)](#module_@aeternity/aepp-sdk/es/contract--ContractBase+setCompilerUrl) ⇒ `void`* - * *[.getCompilerVersion()](#module_@aeternity/aepp-sdk/es/contract--ContractBase+getCompilerVersion) ⇒ `String`* - - - -### ContractBase([options]) ⇒ `Object` ⏏ -Basic Contract Stamp - -This stamp include api call's related to contract functionality. -Attempting to create instances from the Stamp without overwriting all -abstract methods using composition will result in an exception. - -**Kind**: Exported function -**Returns**: `Object` - Contract instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | - - - -#### *contractBase.contractGetACI(source, [options]) ⇒ `Object`* -Get contract ACI - -**Kind**: instance abstract method of [`ContractBase`](#exp_module_@aeternity/aepp-sdk/es/contract--ContractBase) -**Returns**: `Object` - - Contract aci object -**Category**: async -**rtype**: `(source: String, options: Array) => aciObject: Promise[Object]` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| source | `String` | | Contract source code | -| [options] | `Object` | {} | Options | -| [options.filesystem] | `Object` | | Contract external namespaces map | -| [options.backend] | `Object` | | Contract vm(default: aevm) | - - - -#### *contractBase.contractEncodeCallDataAPI(source, name, args, [options]) ⇒ `String`* -Encode contract data - -**Kind**: instance abstract method of [`ContractBase`](#exp_module_@aeternity/aepp-sdk/es/contract--ContractBase) -**Returns**: `String` - - Contract encoded data -**Category**: async -**rtype**: `(source: String, name: String, args: Array, options: Array) => callData: Promise[String]` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| source | `String` | | Contract source code | -| name | `String` | | Function name | -| args | `Array` | | Function argument's | -| [options] | `Object` | {} | Options | -| [options.filesystem] | `Object` | | Contract external namespaces map | -| [options.backend] | `Object` | | Contract vm(default: aevm) | - - - -#### *contractBase.contractDecodeDataAPI(type, data) ⇒ `String`* -Decode data - -**Kind**: instance abstract method of [`ContractBase`](#exp_module_@aeternity/aepp-sdk/es/contract--ContractBase) -**Returns**: `String` - - Decoded contract call result -**Category**: async -**rtype**: `(type: String, data: String) => decodedResult: Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| type | `String` | Contract call result type | -| data | `String` | Encoded contract call result | - - - -#### *contractBase.contractDecodeCallResultAPI(source, fn, callValue, callResult, [options]) ⇒ `String`* -Decode contract call result data - -**Kind**: instance abstract method of [`ContractBase`](#exp_module_@aeternity/aepp-sdk/es/contract--ContractBase) -**Returns**: `String` - - Decoded contract call result -**Category**: async -**rtype**: `(source: String, fn: String, callValue: String, callResult: String, options: Array) => decodedResult: Promise[String]` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| source | `String` | | Contract source | -| fn | `String` | | Fn name | -| callValue | `String` | | result data (cb_das...) | -| callResult | `String` | | contract call result status('ok', 'revert', ...) | -| [options] | `Object` | {} | Options | -| [options.filesystem] | `Object` | | Contract external namespaces map | -| [options.backend] | `Object` | | Contract vm(default: aevm) | - - - -#### *contractBase.contractDecodeCallDataBySourceAPI(source, function, callData, [options]) ⇒ `String`* -Decode call data by source - -**Kind**: instance abstract method of [`ContractBase`](#exp_module_@aeternity/aepp-sdk/es/contract--ContractBase) -**Returns**: `String` - - Decoded contract call data -**Category**: async -**rtype**: `(source: String, function: String, callData: String, options: Array) => decodedResult: Promise[String]` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| source | `String` | | contract source | -| function | `String` | | function name | -| callData | `String` | | Encoded contract call data | -| [options] | `Object` | {} | Options | -| [options.filesystem] | `Object` | | Contract external namespaces map | -| [options.backend] | `Object` | | Contract vm(default: aevm) | - - - -#### *contractBase.contractDecodeCallDataByCodeAPI(code, callData, backend) ⇒ `String`* -Decode call data by bytecode - -**Kind**: instance abstract method of [`ContractBase`](#exp_module_@aeternity/aepp-sdk/es/contract--ContractBase) -**Returns**: `String` - - Decoded contract call data -**Category**: async -**rtype**: `(code: String, callData: String) => decodedResult: Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| code | `String` | contract byte code | -| callData | `String` | Encoded contract call data | -| backend | `String` | Contract vm(default: aevm) | - - - -#### *contractBase.compileContractAPI(code, [options]) ⇒ `Object`* -Compile contract - -**Kind**: instance abstract method of [`ContractBase`](#exp_module_@aeternity/aepp-sdk/es/contract--ContractBase) -**Returns**: `Object` - Object which contain bytecode of contract -**Category**: async -**rtype**: `(code: String, options?: Object) => compiledContract: Object` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| code | `String` | | Contract source code | -| [options] | `Object` | {} | Options | -| [options.filesystem] | `Object` | | Contract external namespaces map | -| [options.backend] | `Object` | | Contract vm(default: aevm) | - - - -#### *contractBase.setCompilerUrl(url) ⇒ `void`* -Set compiler url - -**Kind**: instance abstract method of [`ContractBase`](#exp_module_@aeternity/aepp-sdk/es/contract--ContractBase) -**Category**: async -**rtype**: `(url: String) => void` - -| Param | Type | Description | -| --- | --- | --- | -| url | `String` | Compiler url | - - - -#### *contractBase.getCompilerVersion() ⇒ `String`* -Get Compiler Version - -**Kind**: instance abstract method of [`ContractBase`](#exp_module_@aeternity/aepp-sdk/es/contract--ContractBase) -**Returns**: `String` - Compiler version -**Category**: async -**rtype**: `() => String` diff --git a/docs/api/contract/aci.md b/docs/api/contract/aci.md deleted file mode 100644 index d25590c4fa..0000000000 --- a/docs/api/contract/aci.md +++ /dev/null @@ -1,97 +0,0 @@ - - -## @aeternity/aepp-sdk/es/contract/aci -ContractACI module - -**Example** -```js -import ContractACI from '@aeternity/aepp-sdk/es/contract/aci' -``` - -* [@aeternity/aepp-sdk/es/contract/aci](#module_@aeternity/aepp-sdk/es/contract/aci) - * [instance.compile](#exp_module_@aeternity/aepp-sdk/es/contract/aci--instance.compile) ⇒ `ContractInstance` ⏏ - * [instance.deploy](#exp_module_@aeternity/aepp-sdk/es/contract/aci--instance.deploy) ⇒ `ContractInstance` ⏏ - * [instance.call](#exp_module_@aeternity/aepp-sdk/es/contract/aci--instance.call) ⇒ `Object` ⏏ - * [getContractInstance(source, [options])](#exp_module_@aeternity/aepp-sdk/es/contract/aci--getContractInstance) ⇒ `ContractInstance` ⏏ - * [module.exports()](#exp_module_@aeternity/aepp-sdk/es/contract/aci--module.exports) ⇒ `Object` ⏏ - - - -### instance.compile ⇒ `ContractInstance` ⏏ -Compile contract - -**Kind**: Exported member -**Returns**: `ContractInstance` - Contract ACI object with predefined js methods for contract usage -**rtype**: `() => ContractInstance: Object` - - -### instance.deploy ⇒ `ContractInstance` ⏏ -Deploy contract - -**Kind**: Exported member -**Returns**: `ContractInstance` - Contract ACI object with predefined js methods for contract usage -**rtype**: `(init: Array, options: Object = { skipArgsConvert: false }) => ContractInstance: Object` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| init | `Array` | | Contract init function arguments array | -| [options] | `Object` | {} | options Options object | -| [options.skipArgsConvert] | `Boolean` | false | Skip Validation and Transforming arguments before prepare call-data | - - - -### instance.call ⇒ `Object` ⏏ -Call contract function - -**Kind**: Exported member -**Returns**: `Object` - CallResult -**rtype**: `(init: Array, options: Object = { skipArgsConvert: false, skipTransformDecoded: false, callStatic: false }) => CallResult: Object` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| fn | `String` | | Function name | -| params | `Array` | | Array of function arguments | -| [options] | `Object` | {} | Array of function arguments | -| [options.skipArgsConvert] | `Boolean` | false | Skip Validation and Transforming arguments before prepare call-data | -| [options.skipTransformDecoded] | `Boolean` | false | Skip Transform decoded data to JS type | -| [options.callStatic] | `Boolean` | false | Static function call | - - - -### getContractInstance(source, [options]) ⇒ `ContractInstance` ⏏ -Generate contract ACI object with predefined js methods for contract usage - can be used for creating a reference to already deployed contracts - -**Kind**: Exported function -**Returns**: `ContractInstance` - JS Contract API - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| source | `String` | | Contract source code | -| [options] | `Object` | {} | Options object | -| [options.aci] | `String` | | Contract ACI | -| [options.contractAddress] | `String` | | Contract address | -| [options.filesystem] | `Object` | | Contact source external namespaces map | -| [options.forceCodeCheck] | `Object` | true | Don't check contract code | -| [options.opt] | `Object` | | Contract options | - -**Example** -```js -const contractIns = await client.getContractInstance(sourceCode) -await contractIns.deploy([321]) or await contractIns.methods.init(321) -const callResult = await contractIns.call('setState', [123]) or await contractIns.methods.setState.send(123, options) -const staticCallResult = await contractIns.call('setState', [123], { callStatic: true }) or await contractIns.methods.setState.get(123, options) -Also you can call contract like: await contractIns.methods.setState(123, options) -Then sdk decide to make on-chain or static call(dry-run API) transaction based on function is stateful or not -``` - - -### module.exports() ⇒ `Object` ⏏ -Contract ACI Stamp - -**Kind**: Exported function -**Returns**: `Object` - Contract compiler instance -**rtype**: `Stamp` -**Example** -```js -ContractACI() -``` diff --git a/docs/api/contract/compiler.md b/docs/api/contract/compiler.md deleted file mode 100644 index 70105feb9c..0000000000 --- a/docs/api/contract/compiler.md +++ /dev/null @@ -1,31 +0,0 @@ - - -## @aeternity/aepp-sdk/es/contract/compiler -ContractCompilerAPI module - -This is the complement to [@aeternity/aepp-sdk/es/contract](#module_@aeternity/aepp-sdk/es/contract). - -**Example** -```js -import ContractCompilerAPI from '@aeternity/aepp-sdk/es/contract/compiler' -``` - - -### ContractCompilerAPI([options]) ⇒ `Object` ⏏ -Contract Compiler Stamp - -This stamp include api call's related to contract compiler functionality. - -**Kind**: Exported function -**Returns**: `Object` - Contract compiler instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | -| [options.compilerUrl] | `String` | | compilerUrl - Url for compiler API | - -**Example** -```js -ContractCompilerAPI({ compilerUrl: 'COMPILER_URL' }) -``` diff --git a/docs/api/contract/ga.md b/docs/api/contract/ga.md deleted file mode 100644 index 74fae2afb3..0000000000 --- a/docs/api/contract/ga.md +++ /dev/null @@ -1,73 +0,0 @@ - - -## @aeternity/aepp-sdk/es/contract/ga -Generalize Account module - routines to use generalize account - -**Example** -```js -import GeneralizeAccount from '@aeternity/aepp-sdk/es/contract/ga' (Using tree-shaking) -``` -**Example** -```js -import { GeneralizeAccount } from '@aeternity/aepp-sdk' (Using bundle) -``` - -* [@aeternity/aepp-sdk/es/contract/ga](#module_@aeternity/aepp-sdk/es/contract/ga) - * [exports.GeneralizeAccount([options])](#exp_module_@aeternity/aepp-sdk/es/contract/ga--exports.GeneralizeAccount) ⇒ `Object` ⏏ - * [createGeneralizeAccount(authFnName, source, args, options)](#exp_module_@aeternity/aepp-sdk/es/contract/ga--createGeneralizeAccount) ⇒ `Promise.<Readonly.<{result: \*, owner: \*, createdAt: Date, address, rawTx: \*, transaction: \*}>>` ⏏ - * [createMetaTx(rawTransaction, authData, authFnName, options)](#exp_module_@aeternity/aepp-sdk/es/contract/ga--createMetaTx) ⇒ `String` ⏏ - - - -### exports.GeneralizeAccount([options]) ⇒ `Object` ⏏ -GeneralizeAccount Stamp - -Provide Generalize Account implementation -[@aeternity/aepp-sdk/es/contract/ga](#module_@aeternity/aepp-sdk/es/contract/ga) clients. - -**Kind**: Exported function -**Returns**: `Object` - GeneralizeAccount instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | - -**Example** -```js -const authContract = `` -await client.createGeneralizeAccount(authFnName, authContract, [...authFnArguments] -// Make spend using GA -const callData = 'cb_...' // encoded call data for auth contract -await client.spend(10000, receiverPub, { authData: { callData } }) -// or -await client.spend(10000, receiverPub, { authData: { source: authContract, args: [...authContractArgs] } }) // sdk will prepare callData itself -``` - - -### createGeneralizeAccount(authFnName, source, args, options) ⇒ `Promise.<Readonly.<{result: \*, owner: \*, createdAt: Date, address, rawTx: \*, transaction: \*}>>` ⏏ -Convert current account to GA account - -**Kind**: Exported function - -| Param | Type | Description | -| --- | --- | --- | -| authFnName | `String` | Authorization function name | -| source | `String` | Auth contract source code | -| args | `Array` | init arguments | -| options | `Object` | Options | - - - -### createMetaTx(rawTransaction, authData, authFnName, options) ⇒ `String` ⏏ -Create a metaTx transaction - -**Kind**: Exported function - -| Param | Type | Description | -| --- | --- | --- | -| rawTransaction | `String` | Inner transaction | -| authData | `Object` | Object with gaMeta params | -| authFnName | `String` | Authorization function name | -| options | `Object` | Options | - diff --git a/docs/api/node-pool.md b/docs/api/node-pool.md deleted file mode 100644 index ed366b57d8..0000000000 --- a/docs/api/node-pool.md +++ /dev/null @@ -1,112 +0,0 @@ - - -## @aeternity/aepp-sdk/es/node-pool -NodePool module - -**Example** -```js -import NodePool from '@aeternity/aepp-sdk/es/node-pool' -``` - -* [@aeternity/aepp-sdk/es/node-pool](#module_@aeternity/aepp-sdk/es/node-pool) - * [exports.NodePool([options])](#exp_module_@aeternity/aepp-sdk/es/node-pool--exports.NodePool) ⇒ `Object` ⏏ - * [addNode(name, nodeInstance, select)](#exp_module_@aeternity/aepp-sdk/es/node-pool--addNode) ⇒ `Void` ⏏ - * [selectNode(name)](#exp_module_@aeternity/aepp-sdk/es/node-pool--selectNode) ⇒ `Void` ⏏ - * [getNetworkId()](#exp_module_@aeternity/aepp-sdk/es/node-pool--getNetworkId) ⇒ `String` ⏏ - * [isNodeConnected()](#exp_module_@aeternity/aepp-sdk/es/node-pool--isNodeConnected) ⇒ `Boolean` ⏏ - * [getNodeInfo()](#exp_module_@aeternity/aepp-sdk/es/node-pool--getNodeInfo) ⇒ `Object` ⏏ - * [getNodesInPool()](#exp_module_@aeternity/aepp-sdk/es/node-pool--getNodesInPool) ⇒ `Array.<Object>` ⏏ - - - -### exports.NodePool([options]) ⇒ `Object` ⏏ -Node Pool Stamp -This stamp allow you to make basic manipulation(add, remove, select) on list of nodes - -**Kind**: Exported function -**Returns**: `Object` - NodePool instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | -| [options.nodes] | `Array` | | Array with Node instances | - - - -### addNode(name, nodeInstance, select) ⇒ `Void` ⏏ -Add Node - -**Kind**: Exported function -**rtype**: `(name: String, nodeInstance: Object, select: Boolean) => Void` - -| Param | Type | Description | -| --- | --- | --- | -| name | `String` | Node name | -| nodeInstance | `Object` | Node instance | -| select | `Boolean` | Select this node as current | - -**Example** -```js -nodePool.addNode('testNode', awaitNode({ url, internalUrl }), true) // add and select new node with name 'testNode' -``` - - -### selectNode(name) ⇒ `Void` ⏏ -Select Node - -**Kind**: Exported function -**rtype**: `(name: String) => Void` - -| Param | Type | Description | -| --- | --- | --- | -| name | `String` | Node name | - -**Example** -```js -nodePool.selectNode('testNode') -``` - - -### getNetworkId() ⇒ `String` ⏏ -Get NetworkId of current Node - -**Kind**: Exported function -**rtype**: `() => String` -**Example** -```js -nodePool.getNetworkId() -``` - - -### isNodeConnected() ⇒ `Boolean` ⏏ -Check if you have selected node - -**Kind**: Exported function -**rtype**: `() => Boolean` -**Example** -```js -nodePool.isNodeConnected() -``` - - -### getNodeInfo() ⇒ `Object` ⏏ -Get information about node - -**Kind**: Exported function -**rtype**: `() => Object` -**Example** -```js -nodePool.getNodeInfo() // { name, version, networkId, protocol, ... } -``` - - -### getNodesInPool() ⇒ `Array.<Object>` ⏏ -Get array of available nodes - -**Kind**: Exported function -**rtype**: `() => Object[]` -**Example** -```js -nodePool.getNodesInPool() -``` diff --git a/docs/api/node.md b/docs/api/node.md deleted file mode 100644 index 21e991c9c0..0000000000 --- a/docs/api/node.md +++ /dev/null @@ -1,93 +0,0 @@ - - -## @aeternity/aepp-sdk/es/node -Node module - -**Example** -```js -import Node from '@aeternity/aepp-sdk/es/node' -``` - -* [@aeternity/aepp-sdk/es/node](#module_@aeternity/aepp-sdk/es/node) - * [Node([options])](#exp_module_@aeternity/aepp-sdk/es/node--Node) ⇒ `Object` ⏏ - * _static_ - * _async_ - * [.getNetworkId()](#module_@aeternity/aepp-sdk/es/node--Node.getNetworkId) ⇒ `String` - * _inner_ - * [~loader(options)](#module_@aeternity/aepp-sdk/es/node--Node..loader) ⇒ `function` - * [~getConsensusProtocolVersion(protocols, height)](#module_@aeternity/aepp-sdk/es/node--Node..getConsensusProtocolVersion) ⇒ `Number` - * _async_ - * [~remoteSwag(url, axiosConfig)](#module_@aeternity/aepp-sdk/es/node--Node..remoteSwag) ⇒ `Object` - - - -### Node([options]) ⇒ `Object` ⏏ -[Swagger](Swagger) based Node remote API Stamp - -**Kind**: Exported function -**Returns**: `Object` - Node client -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Options | -| options.url | `String` | | Base URL for Node | -| options.internalUrl | `String` | | Base URL for internal requests | -| options.axiosConfig | `String` | | Object with axios configuration. Example { config: {}, errorHandler: (err) => throw err } | - -**Example** -```js -Node({url: 'https://sdk-testnet.aepps.com'}) -``` - - -#### Node.getNetworkId() ⇒ `String` -Obtain networkId from account or node - -**Kind**: static method of [`Node`](#exp_module_@aeternity/aepp-sdk/es/node--Node) -**Returns**: `String` - NetworkId -**Category**: async -**rtype**: `() => networkId: String` - - -#### Node~loader(options) ⇒ `function` -Node specific loader for `urlFor` - -**Kind**: inner method of [`Node`](#exp_module_@aeternity/aepp-sdk/es/node--Node) -**Returns**: `function` - Implementation for [urlFor](urlFor) -**rtype**: `({url: String, internalUrl?: String}) => (path: String, definition: Object) => tx: String` - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | | -| options.url | `String` | Base URL for Node | -| options.internalUrl | `String` | Base URL for internal requests | - - - -#### Node~getConsensusProtocolVersion(protocols, height) ⇒ `Number` -get consensus protocol version - -**Kind**: inner method of [`Node`](#exp_module_@aeternity/aepp-sdk/es/node--Node) -**Returns**: `Number` - version Protocol version - -| Param | Type | Description | -| --- | --- | --- | -| protocols | `Array` | Array of protocols | -| height | `Number` | Height | - - - -#### Node~remoteSwag(url, axiosConfig) ⇒ `Object` -Obtain Swagger configuration from Node node - -**Kind**: inner method of [`Node`](#exp_module_@aeternity/aepp-sdk/es/node--Node) -**Returns**: `Object` - Swagger configuration -**Category**: async -**rtype**: `(url: String) => swagger: Object` - -| Param | Type | Description | -| --- | --- | --- | -| url | `String` | Node base URL | -| axiosConfig | `Object` | Axios configuration object | - diff --git a/docs/api/oracle.md b/docs/api/oracle.md deleted file mode 100644 index 4468e5f5fd..0000000000 --- a/docs/api/oracle.md +++ /dev/null @@ -1,76 +0,0 @@ - - -## @aeternity/aepp-sdk/es/oracle -Oracle Base module - -**Example** -```js -import ContractBase from '@aeternity/aepp-sdk/es/oracle' -``` - -* [@aeternity/aepp-sdk/es/oracle](#module_@aeternity/aepp-sdk/es/oracle) - * [OracleBase([options])](#exp_module_@aeternity/aepp-sdk/es/oracle--OracleBase) ⇒ `Object` ⏏ - * *[.getOracle(oracleId)](#module_@aeternity/aepp-sdk/es/oracle--OracleBase+getOracle) ⇒ `Object`* - * *[.getOracleQueries(oracleId-)](#module_@aeternity/aepp-sdk/es/oracle--OracleBase+getOracleQueries) ⇒ `Object`* - * *[.getOracleQuery(oracleId, queryId)](#module_@aeternity/aepp-sdk/es/oracle--OracleBase+getOracleQuery) ⇒ `Object`* - - - -### OracleBase([options]) ⇒ `Object` ⏏ -Basic Oracle Stamp - -This stamp include api call's related to oracle functionality. -Attempting to create instances from the Stamp without overwriting all -abstract methods using composition will result in an exception. - -**Kind**: Exported function -**Returns**: `Object` - Oracle instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | - - - -#### *oracleBase.getOracle(oracleId) ⇒ `Object`* -Get oracle by oracle public key - -**Kind**: instance abstract method of [`OracleBase`](#exp_module_@aeternity/aepp-sdk/es/oracle--OracleBase) -**Returns**: `Object` - - Oracle object -**Category**: async -**rtype**: `(oracleId: String) => oracle: Promise[Object]` - -| Param | Type | Description | -| --- | --- | --- | -| oracleId | `String` | Oracle public key | - - - -#### *oracleBase.getOracleQueries(oracleId-) ⇒ `Object`* -Get oracle queries - -**Kind**: instance abstract method of [`OracleBase`](#exp_module_@aeternity/aepp-sdk/es/oracle--OracleBase) -**Returns**: `Object` - - Oracle queries -**Category**: async -**rtype**: `(oracleId: String) => oracleQueries: Promise[Object]` - -| Param | Type | Description | -| --- | --- | --- | -| oracleId- | `String` | Oracle public key | - - - -#### *oracleBase.getOracleQuery(oracleId, queryId) ⇒ `Object`* -Get oracle query - -**Kind**: instance abstract method of [`OracleBase`](#exp_module_@aeternity/aepp-sdk/es/oracle--OracleBase) -**Returns**: `Object` - - Oracle query object -**Category**: async -**rtype**: `(oracleId: String, queryId: String) => oracleQuery: Promise[Object]` - -| Param | Type | Description | -| --- | --- | --- | -| oracleId | `String` | Oracle public key | -| queryId | `String` | Query id | - diff --git a/docs/api/oracle/node.md b/docs/api/oracle/node.md deleted file mode 100644 index fc6d4e6c67..0000000000 --- a/docs/api/oracle/node.md +++ /dev/null @@ -1,11 +0,0 @@ - - -## @aeternity/aepp-sdk/es/oracle/node -OracleNodeAPI module - -This is the complement to [@aeternity/aepp-sdk/es/oracle](#module_@aeternity/aepp-sdk/es/oracle). - -**Example** -```js -import OracleNodeAPI from '@aeternity/aepp-sdk/es/oracle/node' -``` diff --git a/docs/api/rpc/client.md b/docs/api/rpc/client.md deleted file mode 100644 index 333b2bb052..0000000000 --- a/docs/api/rpc/client.md +++ /dev/null @@ -1,28 +0,0 @@ - - -## @aeternity/aepp-sdk/es/rpc/client -RPC client module - -**Example** -```js -import RpcClient from '@aeternity/aepp-sdk/es/rpc/client' -``` - - -### RpcClient([options]) ⇒ `Object` ⏏ -RPC client Stamp - -**Kind**: Exported function -**Returns**: `Object` - RPC client -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | -| [options.parent] | `Object` | window.parent | IFrame parent window | -| [options.self] | `Object` | window | IFrame window | - -**Example** -```js -RpcClient() -``` diff --git a/docs/api/tx.md b/docs/api/tx.md deleted file mode 100644 index 100bcab7bb..0000000000 --- a/docs/api/tx.md +++ /dev/null @@ -1,232 +0,0 @@ - - -## @aeternity/aepp-sdk/es/tx -Tx module - -**Example** -```js -import Tx from '@aeternity/aepp-sdk/es/tx' -``` - -* [@aeternity/aepp-sdk/es/tx](#module_@aeternity/aepp-sdk/es/tx) - * [Tx([options])](#exp_module_@aeternity/aepp-sdk/es/tx--Tx) ⇒ `Object` ⏏ - * *[.spendTx(options)](#module_@aeternity/aepp-sdk/es/tx--Tx+spendTx) ⇒ `String`* - * *[.namePreclaimTx(options)](#module_@aeternity/aepp-sdk/es/tx--Tx+namePreclaimTx) ⇒ `String`* - * *[.nameClaimTx(options)](#module_@aeternity/aepp-sdk/es/tx--Tx+nameClaimTx) ⇒ `String`* - * *[.nameTransferTx(options)](#module_@aeternity/aepp-sdk/es/tx--Tx+nameTransferTx) ⇒ `String`* - * *[.nameUpdateTx(options)](#module_@aeternity/aepp-sdk/es/tx--Tx+nameUpdateTx) ⇒ `String`* - * *[.nameRevokeTx(options)](#module_@aeternity/aepp-sdk/es/tx--Tx+nameRevokeTx) ⇒ `String`* - * *[.contractCreateTx(options)](#module_@aeternity/aepp-sdk/es/tx--Tx+contractCreateTx) ⇒ `String`* - * *[.contractCallTx(options)](#module_@aeternity/aepp-sdk/es/tx--Tx+contractCallTx) ⇒ `String`* - * *[.oracleRegisterTx(options)](#module_@aeternity/aepp-sdk/es/tx--Tx+oracleRegisterTx) ⇒ `String`* - * *[.oracleExtendTx(options)](#module_@aeternity/aepp-sdk/es/tx--Tx+oracleExtendTx) ⇒ `String`* - * *[.oraclePostQuery(options)](#module_@aeternity/aepp-sdk/es/tx--Tx+oraclePostQuery) ⇒ `String`* - * *[.oracleRespondTx(options)](#module_@aeternity/aepp-sdk/es/tx--Tx+oracleRespondTx) ⇒ `String`* - * *[.getAccountNonce(address)](#module_@aeternity/aepp-sdk/es/tx--Tx+getAccountNonce) ⇒ `Number`* - - - -### Tx([options]) ⇒ `Object` ⏏ -Basic Tx Stamp - -Attempting to create instances from the Stamp without overwriting all -abstract methods using composition will result in an exception. - -Tx is one of the three basic building blocks of an -[Ae](#exp_module_@aeternity/aepp-sdk/es/ae--Ae) client and provides methods to -create aeternity transactions. - -**Kind**: Exported function -**Returns**: `Object` - Tx instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | - -**Example** -```js -Tx() -``` - - -#### *tx.spendTx(options) ⇒ `String`* -Create a `spend_tx` transaction - -**Kind**: instance abstract method of [`Tx`](#exp_module_@aeternity/aepp-sdk/es/tx--Tx) -**Returns**: `String` - `spend_tx` transaction -**Category**: async -**rtype**: `({sender?: String, recipientId: String, amount: Number, fee?: Number, ttl?: Number, nonce?: Number, payload?: String}) => tx: Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | The object to extract properties from | - - - -#### *tx.namePreclaimTx(options) ⇒ `String`* -Create a `name_preclaim_tx` transaction - -**Kind**: instance abstract method of [`Tx`](#exp_module_@aeternity/aepp-sdk/es/tx--Tx) -**Returns**: `String` - `name_preclaim_tx` transaction -**Category**: async -**rtype**: `({account?: String, commitment: String, fee?: Number, ttl?: Number, nonce?: Number}) => tx: Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | The object to extract properties from | - - - -#### *tx.nameClaimTx(options) ⇒ `String`* -Create a `name_claim_tx` transaction - -**Kind**: instance abstract method of [`Tx`](#exp_module_@aeternity/aepp-sdk/es/tx--Tx) -**Returns**: `String` - `name_claim_tx` transaction -**Category**: async -**rtype**: `({account?: String, name: String, nameSalt: String, fee?: Number, ttl?: Number, nonce?: Number}) => tx: Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | The object to extract properties from | - - - -#### *tx.nameTransferTx(options) ⇒ `String`* -Create a `name_transfer_tx` transaction - -**Kind**: instance abstract method of [`Tx`](#exp_module_@aeternity/aepp-sdk/es/tx--Tx) -**Returns**: `String` - `name_transfer_tx` transaction -**Category**: async -**rtype**: `({account?: String, nameId: String, recipientId: String, fee?: Number, ttl?: Number, nonce?: Number}) => tx: Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | The object to extract properties from | - - - -#### *tx.nameUpdateTx(options) ⇒ `String`* -Create a `name_update_tx` transaction - -**Kind**: instance abstract method of [`Tx`](#exp_module_@aeternity/aepp-sdk/es/tx--Tx) -**Returns**: `String` - `name_update_tx` transaction -**Category**: async -**rtype**: `({account?: String, nameId: String, pointers: Object, nameTtl: Number, clientTtl: Number, fee?: Number, ttl?: Number, nonce?: Number}) => tx: Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | The object to extract properties from | - - - -#### *tx.nameRevokeTx(options) ⇒ `String`* -Create a `name_revoke_tx` transaction - -**Kind**: instance abstract method of [`Tx`](#exp_module_@aeternity/aepp-sdk/es/tx--Tx) -**Returns**: `String` - `name_revoke_tx` transaction -**Category**: async -**rtype**: `({account?: String, nameId: String, fee?: Number, ttl?: Number, nonce?: Number}) => tx: Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | The object to extract properties from | - - - -#### *tx.contractCreateTx(options) ⇒ `String`* -Create a `contract_create_tx` transaction - -**Kind**: instance abstract method of [`Tx`](#exp_module_@aeternity/aepp-sdk/es/tx--Tx) -**Returns**: `String` - `contract_create_tx` transaction -**Category**: async -**rtype**: `({owner: String, code: String, callData: String, vmVersion: Number, deposit: Number, amount: Number, gas: Number, gasPrice: Number, fee?: Number, ttl?: Number, nonce?: Number}) => tx: Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | The object to extract properties from | - - - -#### *tx.contractCallTx(options) ⇒ `String`* -Create a `contract_call_tx` transaction - -**Kind**: instance abstract method of [`Tx`](#exp_module_@aeternity/aepp-sdk/es/tx--Tx) -**Returns**: `String` - `contract_call_tx` transaction -**Category**: async -**rtype**: `({callerId: String, contract: String, callData: String, vmVersion: Number, amount: Number, gas: Number, gasPrice: Number, fee?: Number, ttl?: Number, nonce?: Number}) => tx: Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | The object to extract properties from | - - - -#### *tx.oracleRegisterTx(options) ⇒ `String`* -Create a `oracle_register_tx` transaction - -**Kind**: instance abstract method of [`Tx`](#exp_module_@aeternity/aepp-sdk/es/tx--Tx) -**Returns**: `String` - `oracle_register_tx` transaction -**Category**: async -**rtype**: `({ accountId: String, queryFormat: String, responseFormat: String, queryFee: String|Number, oracleTtl: Object, vmVersion: Number = ORACLE_VM_VERSION, fee?: Number, ttl?: Number, nonce?: Number }) => tx: Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | The object to extract properties from | - - - -#### *tx.oracleExtendTx(options) ⇒ `String`* -Create a `oracle_extend_tx` transaction - -**Kind**: instance abstract method of [`Tx`](#exp_module_@aeternity/aepp-sdk/es/tx--Tx) -**Returns**: `String` - `oracle_extend_tx` transaction -**Category**: async -**rtype**: `({ oracleId: String, callerId: String, oracleTtl: Object, fee?: Number, ttl: Number, nonce?: Number}) => tx: Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | The object to extract properties from | - - - -#### *tx.oraclePostQuery(options) ⇒ `String`* -Create a `oracle_post_query_tx` transaction - -**Kind**: instance abstract method of [`Tx`](#exp_module_@aeternity/aepp-sdk/es/tx--Tx) -**Returns**: `String` - `oracle_post_query_tx` transaction -**Category**: async -**rtype**: `({ oracleId: String, responseTtl: Object, query: String, queryTtl: Object, queryFee: String|Number, senderId: String, fee?: Number, ttl: Number, nonce?: Number}) => tx: Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | The object to extract properties from | - - - -#### *tx.oracleRespondTx(options) ⇒ `String`* -Create a `oracle_respond_tx` transaction - -**Kind**: instance abstract method of [`Tx`](#exp_module_@aeternity/aepp-sdk/es/tx--Tx) -**Returns**: `String` - `oracle_respond_tx` transaction -**Category**: async -**rtype**: `({ oracleId: String, callerId: String, responseTtl: Object, queryId: String, response: String, fee?: Number, ttl?: Number, nonce?: Number}) => tx: Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | The object to extract properties from | - - - -#### *tx.getAccountNonce(address) ⇒ `Number`* -Get Account Nonce - -**Kind**: instance abstract method of [`Tx`](#exp_module_@aeternity/aepp-sdk/es/tx--Tx) -**Returns**: `Number` - Result -**Category**: async -**rtype**: `(address) => result: Number` - -| Param | Type | Description | -| --- | --- | --- | -| address | `String` | Account public key | - diff --git a/docs/api/tx/builder.md b/docs/api/tx/builder.md deleted file mode 100644 index f919b09b67..0000000000 --- a/docs/api/tx/builder.md +++ /dev/null @@ -1,149 +0,0 @@ - - -## @aeternity/aepp-sdk/es/tx/builder -JavaScript-based Transaction builder - -**Example** -```js -import Transaction from '@aeternity/aepp-sdk/es/tx/builder' -``` - -* [@aeternity/aepp-sdk/es/tx/builder](#module_@aeternity/aepp-sdk/es/tx/builder) - * [exports.calculateFee(fee, txType, options)](#exp_module_@aeternity/aepp-sdk/es/tx/builder--exports.calculateFee) ⇒ `String` \| `Number` ⏏ - * [exports.validateParams(params, schema, excludeKeys)](#exp_module_@aeternity/aepp-sdk/es/tx/builder--exports.validateParams) ⇒ `Object` ⏏ - * [exports.buildRawTx(params, schema, [options])](#exp_module_@aeternity/aepp-sdk/es/tx/builder--exports.buildRawTx) ⇒ `Array` ⏏ - * [exports.unpackRawTx(binary, schema)](#exp_module_@aeternity/aepp-sdk/es/tx/builder--exports.unpackRawTx) ⇒ `Object` ⏏ - * [getSchema()](#exp_module_@aeternity/aepp-sdk/es/tx/builder--getSchema) ⇒ `Object` ⏏ - * [exports.buildTx(params, type, [options])](#exp_module_@aeternity/aepp-sdk/es/tx/builder--exports.buildTx) ⇒ `Object` ⏏ - * [exports.unpackTx(encodedTx, fromRlpBinary, prefix)](#exp_module_@aeternity/aepp-sdk/es/tx/builder--exports.unpackTx) ⇒ `Object` ⏏ - * [exports.buildTxHash(rawTx)](#exp_module_@aeternity/aepp-sdk/es/tx/builder--exports.buildTxHash) ⇒ `String` ⏏ - - - -### exports.calculateFee(fee, txType, options) ⇒ `String` \| `Number` ⏏ -Calculate fee - -**Kind**: Exported function -**rtype**: `(fee, txType, gas = 0) => String` - -| Param | Type | Description | -| --- | --- | --- | -| fee | `String` \| `Number` | fee | -| txType | `String` | Transaction type | -| options | `Options` | Options object | -| options.gas | `String` \| `Number` | Gas amount | -| options.params | `Object` | Tx params | - -**Example** -```js -calculateFee(null, 'spendTx', { gas, params }) -``` - - -### exports.validateParams(params, schema, excludeKeys) ⇒ `Object` ⏏ -Validate transaction params - -**Kind**: Exported function -**Returns**: `Object` - Object with validation errors - -| Param | Type | Description | -| --- | --- | --- | -| params | `Object` | Object with tx params | -| schema | `Array` | Transaction schema | -| excludeKeys | `Array` | Array of keys to exclude for validation | - - - -### exports.buildRawTx(params, schema, [options]) ⇒ `Array` ⏏ -Build binary transaction - -**Kind**: Exported function -**Returns**: `Array` - Array with binary fields of transaction -**Throws**: - -- `Error` Validation error - - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| params | `Object` | | Object with tx params | -| schema | `Array` | | Transaction schema | -| [options] | `Object` | {} | options | -| [options.excludeKeys] | `Array` | [] | excludeKeys Array of keys to exclude for validation and build | -| [options.denomination] | `String` | 'aettos' | denomination Denomination of amounts (default: aettos) | - - - -### exports.unpackRawTx(binary, schema) ⇒ `Object` ⏏ -Unpack binary transaction - -**Kind**: Exported function -**Returns**: `Object` - Object with transaction field's - -| Param | Type | Description | -| --- | --- | --- | -| binary | `Array` | Array with binary transaction field's | -| schema | `Array` | Transaction schema | - - - -### getSchema() ⇒ `Object` ⏏ -Get transaction serialization/deserialization schema - -**Kind**: Exported function -**Returns**: `Object` - Schema -**Throws**: - -- `Error` Schema not found error - - -| Type | -| --- | -| `Object` | - - - -### exports.buildTx(params, type, [options]) ⇒ `Object` ⏏ -Build transaction hash - -**Kind**: Exported function -**Returns**: `Object` - { tx, rlpEncoded, binary } Object with tx -> Base64Check transaction hash with 'tx_' prefix, rlp encoded transaction and binary transaction -**Throws**: - -- `Error` Validation error - - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| params | `Object` | | Object with tx params | -| type | `String` | | Transaction type | -| [options] | `Object` | {} | options | -| [options.excludeKeys] | `Object` | | excludeKeys Array of keys to exclude for validation and build | -| [options.prefix] | `String` | | Prefix of transaction | - - - -### exports.unpackTx(encodedTx, fromRlpBinary, prefix) ⇒ `Object` ⏏ -Unpack transaction hash - -**Kind**: Exported function -**Returns**: `Object` - { tx, rlpEncoded, binary } Object with tx -> Object with transaction param's, rlp encoded transaction and binary transaction - -| Param | Type | Description | -| --- | --- | --- | -| encodedTx | `String` \| `Buffer` | String or RLP encoded transaction array (if fromRlpBinary flag is true) | -| fromRlpBinary | `Boolean` | Unpack from RLP encoded transaction (default: false) | -| prefix | `String` | Prefix of data | - - - -### exports.buildTxHash(rawTx) ⇒ `String` ⏏ -Build a transaction hash - -**Kind**: Exported function -**Returns**: `String` - Transaction hash - -| Param | Type | Description | -| --- | --- | --- | -| rawTx | `String` \| `Buffer` | base64 or rlp encoded transaction | - diff --git a/docs/api/tx/builder/helpers.md b/docs/api/tx/builder/helpers.md deleted file mode 100644 index 13d87d5b7b..0000000000 --- a/docs/api/tx/builder/helpers.md +++ /dev/null @@ -1,269 +0,0 @@ - - -## @aeternity/aepp-sdk/es/tx/builder/helpers -JavaScript-based Transaction builder helper function's - -**Example** -```js -import TxBuilderHelper from '@aeternity/aepp-sdk/es/tx/builder/helpers' -``` - -* [@aeternity/aepp-sdk/es/tx/builder/helpers](#module_@aeternity/aepp-sdk/es/tx/builder/helpers) - * [exports.buildContractId(ownerId, nonce)](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.buildContractId) ⇒ `string` ⏏ - * [exports.buildHash(prefix, data)](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.buildHash) ⇒ `String` ⏏ - * [exports.formatSalt(salt)](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.formatSalt) ⇒ `string` ⏏ - * [exports.produceNameId(name)](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.produceNameId) ⇒ `String` ⏏ - * [exports.decode(data, type)](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.decode) ⇒ `Buffer` ⏏ - * [exports.encode(data, type)](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.encode) ⇒ `String` ⏏ - * [exports.writeId(hashId)](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.writeId) ⇒ `Buffer` ⏏ - * [exports.readId(buf)](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.readId) ⇒ `String` ⏏ - * [exports.writeInt(val)](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.writeInt) ⇒ `Buffer` ⏏ - * [exports.readInt(buf)](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.readInt) ⇒ `String` ⏏ - * [exports.buildPointers(pointers)](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.buildPointers) ⇒ `Array` ⏏ - * [exports.readPointers(pointers)](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.readPointers) ⇒ `Array` ⏏ - * [exports.isNameValid(name, [throwError])](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.isNameValid) ⇒ ⏏ - * [exports.validatePointers(pointers)](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.validatePointers) ⇒ `Boolean` ⏏ - * [exports.getMinimumNameFee(domain)](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.getMinimumNameFee) ⇒ `String` ⏏ - * [exports.computeBidFee(domain, startFee, [increment])](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.computeBidFee) ⇒ `String` ⏏ - * [exports.computeAuctionEndBlock(domain, claimHeight)](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.computeAuctionEndBlock) ⇒ `String` ⏏ - * [exports.getContractBackendFromTx({)](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.getContractBackendFromTx) ⇒ `String` ⏏ - * [exports.isAuctionName(name)](#exp_module_@aeternity/aepp-sdk/es/tx/builder/helpers--exports.isAuctionName) ⇒ `Boolean` ⏏ - - - -### exports.buildContractId(ownerId, nonce) ⇒ `string` ⏏ -Build a contract public key - -**Kind**: Exported function -**Returns**: `string` - Contract public key - -| Param | Type | Description | -| --- | --- | --- | -| ownerId | `string` | The public key of the owner account | -| nonce | `number` | the nonce of the transaction | - - - -### exports.buildHash(prefix, data) ⇒ `String` ⏏ -Build hash - -**Kind**: Exported function -**Returns**: `String` - Transaction hash - -| Param | Type | Description | -| --- | --- | --- | -| prefix | `String` | Transaction hash prefix | -| data | `Buffer` | Rlp encoded transaction buffer | - - - -### exports.formatSalt(salt) ⇒ `string` ⏏ -Format the salt into a 64-byte hex string - -**Kind**: Exported function -**Returns**: `string` - Zero-padded hex string of salt - -| Param | Type | -| --- | --- | -| salt | `number` | - - - -### exports.produceNameId(name) ⇒ `String` ⏏ -Encode a domain name - -**Kind**: Exported function -**Returns**: `String` - `nm_` prefixed encoded domain name - -| Param | Type | Description | -| --- | --- | --- | -| name | `String` | Name to encode | - - - -### exports.decode(data, type) ⇒ `Buffer` ⏏ -Decode data using the default encoding/decoding algorithm - -**Kind**: Exported function -**Returns**: `Buffer` - Buffer of decoded Base58check or Base64check data - -| Param | Type | Description | -| --- | --- | --- | -| data | `string` | An encoded and prefixed string (ex tx_..., sg_..., ak_....) | -| type | `string` | Prefix of Transaction | - - - -### exports.encode(data, type) ⇒ `String` ⏏ -Encode data using the default encoding/decoding algorithm - -**Kind**: Exported function -**Returns**: `String` - Encoded string Base58check or Base64check data - -| Param | Type | Description | -| --- | --- | --- | -| data | `Buffer` \| `String` | An decoded data | -| type | `string` | Prefix of Transaction | - - - -### exports.writeId(hashId) ⇒ `Buffer` ⏏ -Utility function to create and _id type - -**Kind**: Exported function -**Returns**: `Buffer` - Buffer Buffer with ID tag and decoded HASh - -| Param | Type | Description | -| --- | --- | --- | -| hashId | `string` | Encoded hash | - - - -### exports.readId(buf) ⇒ `String` ⏏ -Utility function to read and _id type - -**Kind**: Exported function -**Returns**: `String` - Encoided hash string with prefix - -| Param | Type | Description | -| --- | --- | --- | -| buf | `Buffer` | Data | - - - -### exports.writeInt(val) ⇒ `Buffer` ⏏ -Utility function to convert int to bytes - -**Kind**: Exported function -**Returns**: `Buffer` - Buffer Buffer from number(BigEndian) - -| Param | Type | Description | -| --- | --- | --- | -| val | `Number` \| `String` \| `BigNumber` | Value | - - - -### exports.readInt(buf) ⇒ `String` ⏏ -Utility function to convert bytes to int - -**Kind**: Exported function -**Returns**: `String` - Buffer Buffer from number(BigEndian) - -| Param | Type | Description | -| --- | --- | --- | -| buf | `Buffer` | Value | - - - -### exports.buildPointers(pointers) ⇒ `Array` ⏏ -Helper function to build pointers for name update TX - -**Kind**: Exported function -**Returns**: `Array` - Serialized pointers array - -| Param | Type | Description | -| --- | --- | --- | -| pointers | `Array` | Array of pointers ([ { key: 'account_pubkey', id: 'ak_32klj5j23k23j5423l434l2j3423'} ]) | - - - -### exports.readPointers(pointers) ⇒ `Array` ⏏ -Helper function to read pointers from name update TX - -**Kind**: Exported function -**Returns**: `Array` - Deserialize pointer array - -| Param | Type | Description | -| --- | --- | --- | -| pointers | `Array` | Array of pointers ([ { key: 'account_pubkey', id: 'ak_32klj5j23k23j5423l434l2j3423'} ]) | - - - -### exports.isNameValid(name, [throwError]) ⇒ ⏏ -Is name valid - -**Kind**: Exported function -**Returns**: Boolean -**Throws**: - -- Error - - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| name | `string` | | | -| [throwError] | `boolean` | true | Throw error on invalid | - - - -### exports.validatePointers(pointers) ⇒ `Boolean` ⏏ -Validate name pointers array - -**Kind**: Exported function - -| Param | Type | Description | -| --- | --- | --- | -| pointers | `Array.<String>` | Pointers array. Allowed values is: account(ak_), oracle(ok_), contract(ct_), channel(ch_) | - - - -### exports.getMinimumNameFee(domain) ⇒ `String` ⏏ -Get the minimum name fee for a domain - -**Kind**: Exported function -**Returns**: `String` - the minimum fee for the domain auction - -| Param | Type | Description | -| --- | --- | --- | -| domain | `String` | the domain name to get the fee for | - - - -### exports.computeBidFee(domain, startFee, [increment]) ⇒ `String` ⏏ -Compute bid fee for AENS auction - -**Kind**: Exported function -**Returns**: `String` - Bid fee - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| domain | `String` | | the domain name to get the fee for | -| startFee | `Number` \| `String` | | Auction start fee | -| [increment] | `Number` | 0.5 | Bid multiplier(In percentage, must be between 0 and 1) | - - - -### exports.computeAuctionEndBlock(domain, claimHeight) ⇒ `String` ⏏ -Compute auction end height - -**Kind**: Exported function -**Returns**: `String` - Auction end height - -| Param | Type | Description | -| --- | --- | --- | -| domain | `String` | the domain name to get the fee for | -| claimHeight | `Number` \| `String` | Auction starting height | - - - -### exports.getContractBackendFromTx({) ⇒ `String` ⏏ -Get contract backend by abiVersion - -**Kind**: Exported function -**Returns**: `String` - Backend - -| Param | Type | Description | -| --- | --- | --- | -| { | `Object` | abiVersion } abiVersion Transaction abiVersion | - - - -### exports.isAuctionName(name) ⇒ `Boolean` ⏏ -Is name accept going to auction - -**Kind**: Exported function - -| Param | Type | Description | -| --- | --- | --- | -| name | `String` | Transaction abiVersion | - diff --git a/docs/api/tx/builder/schema.md b/docs/api/tx/builder/schema.md deleted file mode 100644 index e7cfcf6873..0000000000 --- a/docs/api/tx/builder/schema.md +++ /dev/null @@ -1,33 +0,0 @@ - - -## @aeternity/aepp-sdk/es/tx/builder/schema -Transaction Schema for TxBuilder - -**Example** -```js -import TxSchema from '@aeternity/aepp-sdk/es/tx/builder/schema' -``` - - -### exports.TX\_TYPE ⏏ -Object with transaction types - -**Kind**: Exported constant -**Properties** - -| Name | Type | -| --- | --- | -| signed | `String` | -| spend | `String` | -| nameClaim | `String` | -| namePreClaim | `String` | -| nameUpdate | `String` | -| nameRevoke | `String` | -| nameTransfer | `String` | -| contractCreate | `String` | -| contractCall | `String` | -| oracleRegister | `String` | -| oracleExtend | `String` | -| oracleQuery | `String` | -| oracleResponse | `String` | - diff --git a/docs/api/tx/tx-object.md b/docs/api/tx/tx-object.md deleted file mode 100644 index 9d272367fc..0000000000 --- a/docs/api/tx/tx-object.md +++ /dev/null @@ -1,161 +0,0 @@ - - -## @aeternity/aepp-sdk/es/tx/tx-object -TxObject module - -**Example** -```js -import TxObject from '@aeternity/aepp-sdk/es/tx/tx-object' -``` - -* [@aeternity/aepp-sdk/es/tx/tx-object](#module_@aeternity/aepp-sdk/es/tx/tx-object) - * [buildTransaction(type, params, [options])](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--buildTransaction) ⇒ `Object` ⏏ - * [unpackTransaction(tx)](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--unpackTransaction) ⇒ `Object` ⏏ - * [initTransaction([tx], params, type, [options])](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--initTransaction) ⇒ `Object` ⏏ - * [exports.TxObject([options])](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--exports.TxObject) ⇒ `Object` ⏏ - * [setProp(props, options)](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--setProp) ⇒ `TxObject` ⏏ - * [getSignatures()](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--getSignatures) ⇒ `Array` ⏏ - * [addSignature(signature)](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--addSignature) ⇒ `void` ⏏ - * [calculateMinFee(props)](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--calculateMinFee) ⇒ `String` ⏏ - * _static_ - * [.fromString(tx)](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--fromString) ⇒ `TxObject` ⏏ - * [.fromRlp(tx)](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--fromRlp) ⇒ `TxObject` ⏏ - - - -### buildTransaction(type, params, [options]) ⇒ `Object` ⏏ -Build transaction from object - -**Kind**: Exported function -**Throws**: - -- `Error` Arguments validation error's - - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| type | `String` | | Transaction type | -| params | `Object` | | Transaction params | -| [options] | `Object` | {} | Options | - - - -### unpackTransaction(tx) ⇒ `Object` ⏏ -Unpack transaction from RLP encoded binary or base64c string - -**Kind**: Exported function -**Throws**: - -- `Error` Arguments validation error's - - -| Param | Type | Description | -| --- | --- | --- | -| tx | `Buffer` \| `String` | RLP encoded binary or base64c(rlpBinary) string | - - - -### initTransaction([tx], params, type, [options]) ⇒ `Object` ⏏ -Helper which build or unpack transaction base on constructor arguments -Need to provide one of arguments: [tx] -> unpack flow or [params, type] -> build flow - -**Kind**: Exported function -**Throws**: - -- `Error` Arguments validation error's - - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [tx] | `Buffer` \| `String` | | Transaction rlp binary or vase64c string | -| params | `Object` | | Transaction params | -| type | `String` | | Transaction type | -| [options] | `Object` | {} | Options | - - - -### exports.TxObject([options]) ⇒ `Object` ⏏ -Transaction Validator Stamp -This stamp give us possibility to unpack and validate some of transaction properties, -to make sure we can post it to the chain - -**Kind**: Exported function -**Returns**: `Object` - TxObject instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | -| [options.tx] | `Buffer` \| `String` | | Rlp binary or base64c transaction | -| [options.params] | `Object` | | Transaction params | -| [options.type] | `String` | | Transaction type | -| [options.options] | `Object` | | Build options | - -**Example** -```js -TxObject({ params: {...}, type: 'spendTx' }) -``` - - -### setProp(props, options) ⇒ `TxObject` ⏏ -Rebuild transaction with new params and recalculate fee - -**Kind**: Exported function - -| Param | Type | Description | -| --- | --- | --- | -| props | `Object` | Transaction properties for update | -| options | | | - - - -### getSignatures() ⇒ `Array` ⏏ -Get signatures - -**Kind**: Exported function -**Returns**: `Array` - Array of signatures - - -### addSignature(signature) ⇒ `void` ⏏ -Add signature - -**Kind**: Exported function - -| Param | Type | Description | -| --- | --- | --- | -| signature | `Buffer` \| `String` | Signature to add ( Can be: Buffer | Uint8Array | HexString ) | - - - -### calculateMinFee(props) ⇒ `String` ⏏ -Calculate fee - -**Kind**: Exported function -**Returns**: `String` - fee - -| Param | Type | -| --- | --- | -| props | `Object` | - - - -### .fromString(tx) ⇒ `TxObject` ⏏ -Create txObject from base64c RLP encoded transaction string with 'tx_' prefix - -**Kind**: static method of [`@aeternity/aepp-sdk/es/tx/tx-object`](#module_@aeternity/aepp-sdk/es/tx/tx-object) - -| Param | Type | Description | -| --- | --- | --- | -| tx | `String` | Transaction string (tx_23fsdgsdfg...) | - - - -### .fromRlp(tx) ⇒ `TxObject` ⏏ -Create txObject from transaction RLP binary - -**Kind**: static method of [`@aeternity/aepp-sdk/es/tx/tx-object`](#module_@aeternity/aepp-sdk/es/tx/tx-object) - -| Param | Type | Description | -| --- | --- | --- | -| tx | `Buffer` | Transaction RLP binary | - diff --git a/docs/api/tx/tx.md b/docs/api/tx/tx.md deleted file mode 100644 index 4b1f8389c0..0000000000 --- a/docs/api/tx/tx.md +++ /dev/null @@ -1,38 +0,0 @@ - - -## @aeternity/aepp-sdk/es/tx/tx -Transaction module - -**Example** -```js -import Transaction from '@aeternity/aepp-sdk/es/tx/tx' -``` - - -### Transaction([options]) ⇒ `Object` ⏏ -Transaction Stamp - -This is implementation of [Tx](api/tx.md) relays -the creation of transactions to [module:@aeternity/aepp-sdk/es/Node](module:@aeternity/aepp-sdk/es/Node). -This stamp provide ability to create native transaction's, -or transaction's using Node API. -As there is no built-in security between Node and client communication, -creating transaction using [module:@aeternity/aepp-sdk/es/Node](module:@aeternity/aepp-sdk/es/Node) API -must never be used for production but can be very useful to verify other -implementations. - -**Kind**: Exported function -**Returns**: `Object` - Transaction instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | -| [options.nativeMode] | `Boolean` | true | options.nativeMode - Use Native build of transaction's | -| options.url | `String` | | Node url | -| options.internalUrl | `String` | | Node internal url | - -**Example** -```js -Transaction({url: 'https://sdk-testnet.aepps.com/'}) -``` diff --git a/docs/api/tx/validator.md b/docs/api/tx/validator.md deleted file mode 100644 index b131cdf75e..0000000000 --- a/docs/api/tx/validator.md +++ /dev/null @@ -1,66 +0,0 @@ - - -## @aeternity/aepp-sdk/es/tx/validator -Transaction validator - -**Example** -```js -import TransactionValidator from '@aeternity/aepp-sdk/es/tx/validator' -``` - -* [@aeternity/aepp-sdk/es/tx/validator](#module_@aeternity/aepp-sdk/es/tx/validator) - * [unpackAndVerify(txHash, [options])](#exp_module_@aeternity/aepp-sdk/es/tx/validator--unpackAndVerify) ⇒ `Promise.<Object>` ⏏ - * [verifyTx([data], networkId)](#exp_module_@aeternity/aepp-sdk/es/tx/validator--verifyTx) ⇒ `Promise.<Array>` ⏏ - * [TransactionValidator([options])](#exp_module_@aeternity/aepp-sdk/es/tx/validator--TransactionValidator) ⇒ `Object` ⏏ - - - -### unpackAndVerify(txHash, [options]) ⇒ `Promise.<Object>` ⏏ -Unpack and verify transaction (verify nonce, ttl, fee, signature, account balance) - -**Kind**: Exported function -**Returns**: `Promise.<Object>` - Object with verification errors and warnings - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| txHash | `String` | | Base64Check transaction hash | -| [options] | `Object` | {} | Options | -| [options.networkId] | `String` | | networkId Use in signature verification | - - - -### verifyTx([data], networkId) ⇒ `Promise.<Array>` ⏏ -Verify transaction (verify nonce, ttl, fee, signature, account balance) - -**Kind**: Exported function -**Returns**: `Promise.<Array>` - Object with verification errors and warnings - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [data] | `Object` | {} | data TX data object | -| [data.tx] | `String` | | tx Transaction hash | -| [data.signatures] | `Array` | | signatures Transaction signature's | -| [data.rlpEncoded] | `Array` | | rlpEncoded RLP encoded transaction | -| networkId | `String` | | networkId Use in signature verification | - - - -### TransactionValidator([options]) ⇒ `Object` ⏏ -Transaction Validator Stamp -This stamp give us possibility to unpack and validate some of transaction properties, -to make sure we can post it to the chain - -**Kind**: Exported function -**Returns**: `Object` - Transaction Validator instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | -| [options.url] | `Object` | | Node url | -| [options.internalUrl] | `Object` | | Node internal url | - -**Example** -```js -TransactionValidator({url: 'https://sdk-testnet.aepps.com'}) -``` diff --git a/docs/api/utils/aepp-wallet-communication/connection.md b/docs/api/utils/aepp-wallet-communication/connection.md deleted file mode 100644 index 8c5778f2cb..0000000000 --- a/docs/api/utils/aepp-wallet-communication/connection.md +++ /dev/null @@ -1,73 +0,0 @@ - - -## @aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection -Wallet Connection base module - -**Example** -```js -import WalletConnection from '@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection' -``` - -* [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection) - * [exports.WalletConnection([options])](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection--exports.WalletConnection) ⇒ `Object` ⏏ - * *[.connect(onMessage)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection--exports.WalletConnection+connect) ⇒ `void`* - * *[.disconnect()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection--exports.WalletConnection+disconnect) ⇒ `void`* - * *[.sendMessage(msg)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection--exports.WalletConnection+sendMessage) ⇒ `void`* - * *[.isConnected()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection--exports.WalletConnection+isConnected) ⇒ `Boolean`* - - - -### exports.WalletConnection([options]) ⇒ `Object` ⏏ -Basic Wallet Connection - -This stamp include interface for wallet connection functionality. -Attempting to create instances from the Stamp without overwriting all -abstract methods using composition will result in an exception. - -**Kind**: Exported function -**Returns**: `Object` - WalletConnection instance -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | - - - -#### *exports.WalletConnection.connect(onMessage) ⇒ `void`* -Connect - -**Kind**: instance abstract method of [`exports.WalletConnection`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection--exports.WalletConnection) -**rtype**: `(onMessage: Function) => void` - -| Param | Type | Description | -| --- | --- | --- | -| onMessage | `function` | Message handler | - - - -#### *exports.WalletConnection.disconnect() ⇒ `void`* -Disconnect - -**Kind**: instance abstract method of [`exports.WalletConnection`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection--exports.WalletConnection) -**rtype**: `() => void` - - -#### *exports.WalletConnection.sendMessage(msg) ⇒ `void`* -Send message - -**Kind**: instance abstract method of [`exports.WalletConnection`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection--exports.WalletConnection) -**rtype**: `(msg: Object) => void` - -| Param | Type | Description | -| --- | --- | --- | -| msg | `Object` | Message | - - - -#### *exports.WalletConnection.isConnected() ⇒ `Boolean`* -Check if connected - -**Kind**: instance abstract method of [`exports.WalletConnection`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection--exports.WalletConnection) -**Returns**: `Boolean` - Is connected -**rtype**: `() => Boolean` diff --git a/docs/api/utils/aepp-wallet-communication/connection/browser-runtime.md b/docs/api/utils/aepp-wallet-communication/connection/browser-runtime.md deleted file mode 100644 index 29b997ce98..0000000000 --- a/docs/api/utils/aepp-wallet-communication/connection/browser-runtime.md +++ /dev/null @@ -1,67 +0,0 @@ - - -## @aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-runtime -Browser runtime connector module - -This is the complement to [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection). - -**Example** -```js -import BrowserRuntimeConnection from '@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-runtime' -``` - -* [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-runtime](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-runtime) - * [exports.BrowserRuntimeConnection(params)](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-runtime--exports.BrowserRuntimeConnection) ⇒ `Object` ⏏ - * [.connect(onMessage, onDisconnect)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-runtime--exports.BrowserRuntimeConnection+connect) ⇒ `void` - * [.sendMessage(msg)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-runtime--exports.BrowserRuntimeConnection+sendMessage) ⇒ `void` - * [.isConnected()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-runtime--exports.BrowserRuntimeConnection+isConnected) ⇒ `Boolean` - - - -### exports.BrowserRuntimeConnection(params) ⇒ `Object` ⏏ -BrowserRuntimeConnection stamp -Handle browser runtime communication - -**Kind**: Exported function -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| params | `Object` | {} | Initializer object | -| params.port | `Object` | | Runtime `port` object | -| [params.connectionInfo] | `Object` | {} | Connection info object | -| [params.debug] | `Boolean` | false | Debug flag | - - - -#### exports.BrowserRuntimeConnection.connect(onMessage, onDisconnect) ⇒ `void` -Connect - -**Kind**: instance method of [`exports.BrowserRuntimeConnection`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-runtime--exports.BrowserRuntimeConnection) -**rtype**: `(onMessage: Function, onDisconnect: Function) => void` - -| Param | Type | Description | -| --- | --- | --- | -| onMessage | `function` | Message handler | -| onDisconnect | `function` | trigger when runtime connection in closed | - - - -#### exports.BrowserRuntimeConnection.sendMessage(msg) ⇒ `void` -Send message - -**Kind**: instance method of [`exports.BrowserRuntimeConnection`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-runtime--exports.BrowserRuntimeConnection) -**rtype**: `(msg: Object) => void` - -| Param | Type | Description | -| --- | --- | --- | -| msg | `Object` | Message | - - - -#### exports.BrowserRuntimeConnection.isConnected() ⇒ `Boolean` -Check if connected - -**Kind**: instance method of [`exports.BrowserRuntimeConnection`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-runtime--exports.BrowserRuntimeConnection) -**Returns**: `Boolean` - Is connected -**rtype**: `() => Boolean` diff --git a/docs/api/utils/aepp-wallet-communication/connection/browser-window-message.md b/docs/api/utils/aepp-wallet-communication/connection/browser-window-message.md deleted file mode 100644 index 5c9e66800b..0000000000 --- a/docs/api/utils/aepp-wallet-communication/connection/browser-window-message.md +++ /dev/null @@ -1,68 +0,0 @@ - - -## @aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-window-message -Browser window Post Message connector module - -This is the complement to [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection). - -**Example** -```js -import BrowserWindowMessageConnection from '@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-window-message' -``` - -* [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-window-message](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-window-message) - * [exports.BrowserWindowMessageConnection([params])](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-window-message--exports.BrowserWindowMessageConnection) ⇒ `Object` ⏏ - * [.connect(onMessage)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-window-message--exports.BrowserWindowMessageConnection+connect) ⇒ `void` - * [.disconnect()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-window-message--exports.BrowserWindowMessageConnection+disconnect) ⇒ `void` - * [.sendMessage(msg)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-window-message--exports.BrowserWindowMessageConnection+sendMessage) ⇒ `void` - - - -### exports.BrowserWindowMessageConnection([params]) ⇒ `Object` ⏏ -BrowserWindowMessageConnection - -**Kind**: Exported function -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [params] | `Object` | {} | Initializer object | -| [params.target] | `Object` | window.parent | Target window for message | -| [params.self] | `Object` | window | Host window for message | -| [params.origin] | `Object` | | Origin of receiver | -| [params.sendDirection] | `Object` | | Optional field for wrapping messages in additional structure({ type: 'to_aepp' || 'to_waellet', data }).Used for handling messages netween content script and page | -| [params.receiveDirection] | `Object` | 'to_aepp' | Optional(default: 'to_aepp') field for unwrapping messages from additional structure({ type: 'to_aepp' || 'to_waellet', data }).Used for handling messages netween content script and page | -| [params.connectionInfo] | `Object` | {} | Connection info object | -| [params.debug] | `Boolean` | false | Debug flag | - - - -#### exports.BrowserWindowMessageConnection.connect(onMessage) ⇒ `void` -Connect - -**Kind**: instance method of [`exports.BrowserWindowMessageConnection`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-window-message--exports.BrowserWindowMessageConnection) -**rtype**: `(onMessage: Function) => void` - -| Param | Type | Description | -| --- | --- | --- | -| onMessage | `function` | Message handler | - - - -#### exports.BrowserWindowMessageConnection.disconnect() ⇒ `void` -Disconnect - -**Kind**: instance method of [`exports.BrowserWindowMessageConnection`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-window-message--exports.BrowserWindowMessageConnection) -**rtype**: `() => void` - - -#### exports.BrowserWindowMessageConnection.sendMessage(msg) ⇒ `void` -Send message - -**Kind**: instance method of [`exports.BrowserWindowMessageConnection`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-window-message--exports.BrowserWindowMessageConnection) -**rtype**: `(msg: Object) => void` - -| Param | Type | Description | -| --- | --- | --- | -| msg | `Object` | Message | - diff --git a/docs/api/utils/aepp-wallet-communication/content-script-bridge.md b/docs/api/utils/aepp-wallet-communication/content-script-bridge.md deleted file mode 100644 index 2d4cc13633..0000000000 --- a/docs/api/utils/aepp-wallet-communication/content-script-bridge.md +++ /dev/null @@ -1,43 +0,0 @@ - - -## @aeternity/aepp-sdk/es/utils/aepp-wallet-communication/content-script-bridge -Content Script Bridge module - -**Example** -```js -import ContentScriptBridge from '@aeternity/aepp-sdk/es/utils/wallet-communication/content-script-bridge -``` - -* [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/content-script-bridge](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/content-script-bridge) - * [exports.ContentScriptBridge(params)](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/content-script-bridge--exports.ContentScriptBridge) ⇒ `ContentScriptBridge` ⏏ - * [.run()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/content-script-bridge--exports.ContentScriptBridge+run) ⇒ `void` - * [.stop()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/content-script-bridge--exports.ContentScriptBridge+stop) ⇒ `void` - - - -### exports.ContentScriptBridge(params) ⇒ `ContentScriptBridge` ⏏ -ContentScriptBridge stamp -Provide functionality to easly redirect messages from page to extension and from extension to page through content script -Using Runtime(Extension) and WindowPostMessage(Web-Page) connections - -**Kind**: Exported function -**rtype**: `Stamp` - -| Param | Type | Description | -| --- | --- | --- | -| params | `Object` | Initializer object | -| params.pageConnection | `Object` | Page connection object(@link module:@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-window-message) | -| params.extConnection | `Object` | Extension connection object(module: @aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-runtime) | - - - -#### exports.ContentScriptBridge.run() ⇒ `void` -Start message proxy - -**Kind**: instance method of [`exports.ContentScriptBridge`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/content-script-bridge--exports.ContentScriptBridge) - - -#### exports.ContentScriptBridge.stop() ⇒ `void` -Stop message proxy - -**Kind**: instance method of [`exports.ContentScriptBridge`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/content-script-bridge--exports.ContentScriptBridge) diff --git a/docs/api/utils/aepp-wallet-communication/rpc/aepp-rpc.md b/docs/api/utils/aepp-wallet-communication/rpc/aepp-rpc.md deleted file mode 100644 index 14677979f4..0000000000 --- a/docs/api/utils/aepp-wallet-communication/rpc/aepp-rpc.md +++ /dev/null @@ -1,127 +0,0 @@ - - -## @aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc -RPC handler for AEPP side - -**Example** -```js -import ContentScriptBridge from '@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc' -``` - -* [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc) - * [exports.AeppRpc(param, onAddressChange, onDisconnect, onNetworkChange, connection)](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc) ⇒ `Object` ⏏ - * [.connectToWallet(connection)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc+connectToWallet) ⇒ `void` - * [.disconnectWallet(sendDisconnect)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc+disconnectWallet) ⇒ `void` - * [.askAddresses()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc+askAddresses) ⇒ `Promise` - * [.subscribeAddress(type, value)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc+subscribeAddress) ⇒ `Promise` - * [.signTransaction()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc+signTransaction) ⇒ `Promise.<String>` - * [.signMessage()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc+signMessage) ⇒ `Promise.<String>` - * [.sendConnectRequest()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc+sendConnectRequest) ⇒ `Promise` - * [.send(tx, [options])](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc+send) ⇒ `Promise.<Object>` - - - -### exports.AeppRpc(param, onAddressChange, onDisconnect, onNetworkChange, connection) ⇒ `Object` ⏏ -Contain functionality for wallet interaction and connect it to sdk - -**Kind**: Exported function -**rtype**: `Stamp` - -| Param | Type | Description | -| --- | --- | --- | -| param | `Object` | Init params object | -| [param.name] | `String` | Aepp name | -| onAddressChange | `function` | Call-back function for update address event | -| onDisconnect | `function` | Call-back function for disconnect event | -| onNetworkChange | `function` | Call-back function for update network event | -| connection | `Object` | Wallet connection object | - - - -#### exports.AeppRpc.connectToWallet(connection) ⇒ `void` -Connect to wallet - -**Kind**: instance method of [`exports.AeppRpc`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc) -**rtype**: `(connection: Object) => void` - -| Param | Type | Description | -| --- | --- | --- | -| connection | `Object` | Wallet connection object | - - - -#### exports.AeppRpc.disconnectWallet(sendDisconnect) ⇒ `void` -Disconnect from wallet - -**Kind**: instance method of [`exports.AeppRpc`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc) -**rtype**: `(force: Boolean = false) => void` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| sendDisconnect | `Boolean` | false | Force sending close connection message | - - - -#### exports.AeppRpc.askAddresses() ⇒ `Promise` -Ask address from wallet - -**Kind**: instance method of [`exports.AeppRpc`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc) -**Returns**: `Promise` - Address from wallet -**rtype**: `() => Promise` - - -#### exports.AeppRpc.subscribeAddress(type, value) ⇒ `Promise` -Subscribe for addresses from wallet - -**Kind**: instance method of [`exports.AeppRpc`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc) -**Returns**: `Promise` - Address from wallet -**rtype**: `(type: String, value: String) => Promise` - -| Param | Type | Description | -| --- | --- | --- | -| type | `String` | Type of subscription can be one of ['current'(just for selected account updates), 'connected(all accounts)'] | -| value | `String` | Subscription action('subscribe'|'unsubscribe') | - - - -#### exports.AeppRpc.signTransaction() ⇒ `Promise.<String>` -Overwriting of `signTransaction` AE method -All sdk API which use it will be send notification to wallet and wait for callBack - -**Kind**: instance method of [`exports.AeppRpc`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc) -**Returns**: `Promise.<String>` - Signed transaction -**rtype**: `(tx: String, options = {}) => Promise` - - -#### exports.AeppRpc.signMessage() ⇒ `Promise.<String>` -Overwriting of `signMessage` AE method -All sdk API which use it will be send notification to wallet and wait for callBack - -**Kind**: instance method of [`exports.AeppRpc`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc) -**Returns**: `Promise.<String>` - Signed transaction -**rtype**: `(msg: String, options = {}) => Promise` - - -#### exports.AeppRpc.sendConnectRequest() ⇒ `Promise` -Send connection request to wallet - -**Kind**: instance method of [`exports.AeppRpc`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc) -**Returns**: `Promise` - Connection response -**rtype**: `() => Promise` - - -#### exports.AeppRpc.send(tx, [options]) ⇒ `Promise.<Object>` -Overwriting of `send` AE method -All sdk API which use it will be send notification to wallet and wait for callBack -This method will sign, broadcast and wait until transaction will be accepted using rpc communication with wallet - -**Kind**: instance method of [`exports.AeppRpc`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc) -**Returns**: `Promise.<Object>` - Transaction broadcast result -**rtype**: `(tx: String, options = {}) => Promise` - -| Param | Type | Default | -| --- | --- | --- | -| tx | `String` | | -| [options] | `Object` | {} | -| [options.walletBroadcast] | `Object` | true | - diff --git a/docs/api/utils/aepp-wallet-communication/rpc/rpc-client.md b/docs/api/utils/aepp-wallet-communication/rpc/rpc-client.md deleted file mode 100644 index f3fece4a66..0000000000 --- a/docs/api/utils/aepp-wallet-communication/rpc/rpc-client.md +++ /dev/null @@ -1,229 +0,0 @@ - - -## @aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client -RPC client helpers - -**Example** -```js -import RpcClient from '@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client' -``` -**Example** -```js -import RpcClients from '@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client' -``` - -* [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client) - * [exports.RpcClient(param)](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient) ⇒ `Object` ⏏ - * _instance_ - * [.addClient(id, connectionData)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+addClient) ⇒ `void` - * [.getClient(id)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+getClient) ⇒ `Object` - * [.removeClient(id, forceConnectionClose)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+removeClient) ⇒ `Boolean` - * [.updateClientInfo(id, info)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+updateClientInfo) ⇒ `void` - * [.sendNotificationByCondition(msg, condition, transformMessage)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+sendNotificationByCondition) ⇒ `void` - * [.operationByCondition(condition, operation)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+operationByCondition) ⇒ `void` - * [.hasAccessToAccount(address)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+hasAccessToAccount) ⇒ `Boolean` - * [.isConnected()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+isConnected) ⇒ `Boolean` - * [.getCurrentAccount(options)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+getCurrentAccount) ⇒ `String` - * [.disconnect()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+disconnect) ⇒ `void` - * [.updateSubscription(type, value)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+updateSubscription) ⇒ `Array.<String>` - * [.addAction(action, resolvers)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+addAction) ⇒ `Object` - * [.request(name, params)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+request) ⇒ `Promise` - * [.processResponse(msg, [transformResult])](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+processResponse) ⇒ `void` - * _static_ - * [.RpcClients()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient.RpcClients) ⇒ `Object` - - - -### exports.RpcClient(param) ⇒ `Object` ⏏ -Contain functionality for using RPC conection - -**Kind**: Exported function -**rtype**: `Stamp` - -| Param | Type | Description | -| --- | --- | --- | -| param | `Object` | Init params object | -| param.id | `String` | Client id | -| param.name | `String` | Client name | -| param.connection | `Object` | Connection object | -| param.handlers | `Array.<function()>` | Arrays with two function for handling messages ([ onMessage: Function, onDisconnect: Function]) | - - - -#### exports.RpcClient.addClient(id, connectionData) ⇒ `void` -Add new client - -**Kind**: instance method of [`exports.RpcClient`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient) -**rtype**: `(id: (String|Number), connectionInfo: Object) => void` - -| Param | Type | Description | -| --- | --- | --- | -| id | `String` \| `Number` | Client ID | -| connectionData | `Object` | Object containing `connectionInfo` and `connection` objects | - - - -#### exports.RpcClient.getClient(id) ⇒ `Object` -Get clien by id - -**Kind**: instance method of [`exports.RpcClient`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient) -**Returns**: `Object` - RpcClient -**rtype**: `(id: (String|Number)) => Object` - -| Param | Type | Description | -| --- | --- | --- | -| id | `String` \| `Number` | Client ID | - - - -#### exports.RpcClient.removeClient(id, forceConnectionClose) ⇒ `Boolean` -Remove and disiconnect client by ID - -**Kind**: instance method of [`exports.RpcClient`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient) -**rtype**: `(id: (String|Number), { forceConnectionClose: boolean = false }) => boolean` - -| Param | Type | Description | -| --- | --- | --- | -| id | `String` \| `Number` | Client ID | -| forceConnectionClose | | | - - - -#### exports.RpcClient.updateClientInfo(id, info) ⇒ `void` -Update client info by id - -**Kind**: instance method of [`exports.RpcClient`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient) -**rtype**: `(id: (String|Number), info: Object) => void` - -| Param | Type | Description | -| --- | --- | --- | -| id | `String` \| `Number` | Client ID | -| info | `Object` | Info to update (will be merged with current info object) | - - - -#### exports.RpcClient.sendNotificationByCondition(msg, condition, transformMessage) ⇒ `void` -Send notification to all client passing condition - -**Kind**: instance method of [`exports.RpcClient`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient) -**rtype**: `(msg: Object, condition: Function) => void` - -| Param | Type | Description | -| --- | --- | --- | -| msg | `Object` | Msg object | -| condition | `function` | Condition function of (client: RpcClient) => Boolean | -| transformMessage | | | - - - -#### exports.RpcClient.operationByCondition(condition, operation) ⇒ `void` -Call provided function for each rpc client which by condition - -**Kind**: instance method of [`exports.RpcClient`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient) -**rtype**: `(condition: Function, operation: Function) => void` - -| Param | Type | Description | -| --- | --- | --- | -| condition | `function` | Condition function of (client: RpcClient) => Boolean | -| operation | `function` | Operation function of (client: RpcClient) => void | - - - -#### exports.RpcClient.hasAccessToAccount(address) ⇒ `Boolean` -Check if aepp has access to account - -**Kind**: instance method of [`exports.RpcClient`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient) -**Returns**: `Boolean` - is connected -**rtype**: `(address: String) => Boolean` - -| Param | Type | Description | -| --- | --- | --- | -| address | `String` | Account address | - - - -#### exports.RpcClient.isConnected() ⇒ `Boolean` -Check if is connected - -**Kind**: instance method of [`exports.RpcClient`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient) -**Returns**: `Boolean` - is connected -**rtype**: `() => Boolean` - - -#### exports.RpcClient.getCurrentAccount(options) ⇒ `String` -Get selected account - -**Kind**: instance method of [`exports.RpcClient`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient) -**rtype**: `({ onAccount } = {}) => String` - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | Options | - - - -#### exports.RpcClient.disconnect() ⇒ `void` -Disconnect - -**Kind**: instance method of [`exports.RpcClient`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient) -**rtype**: `() => void` - - -#### exports.RpcClient.updateSubscription(type, value) ⇒ `Array.<String>` -Update subscription - -**Kind**: instance method of [`exports.RpcClient`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient) -**rtype**: `(type: String, value: String) => void` - -| Param | Type | Description | -| --- | --- | --- | -| type | `String` | Subscription type | -| value | `String` | Subscription value | - - - -#### exports.RpcClient.addAction(action, resolvers) ⇒ `Object` -Add new action to actions - -**Kind**: instance method of [`exports.RpcClient`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient) -**rtype**: `(action: Object, [r: Function, j: Function]) => Object` - -| Param | Type | Description | -| --- | --- | --- | -| action | `Object` | Action object | -| resolvers | `Array.<function()>` | Array with two function [resolve, reject] action | - - - -#### exports.RpcClient.request(name, params) ⇒ `Promise` -Make a request - -**Kind**: instance method of [`exports.RpcClient`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient) -**Returns**: `Promise` - Promise which will be resolved after receiving response message -**rtype**: `(name: String, params: Object) => Promise` - -| Param | Type | Description | -| --- | --- | --- | -| name | `String` | Method name | -| params | `Object` | Method params | - - - -#### exports.RpcClient.processResponse(msg, [transformResult]) ⇒ `void` -Process response message - -**Kind**: instance method of [`exports.RpcClient`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient) -**rtype**: `(msg: Object, transformResult: Function) => void` - -| Param | Type | Description | -| --- | --- | --- | -| msg | `Object` | Message object | -| [transformResult] | `function` | Optional parser function for message | - - - -#### exports.RpcClient.RpcClients() ⇒ `Object` -Contain functionality for managing multiple RPC clients (RpcClient stamp) - -**Kind**: static method of [`exports.RpcClient`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient) -**rtype**: `Stamp` diff --git a/docs/api/utils/aepp-wallet-communication/rpc/wallet-rpc.md b/docs/api/utils/aepp-wallet-communication/rpc/wallet-rpc.md deleted file mode 100644 index f5a179fd2e..0000000000 --- a/docs/api/utils/aepp-wallet-communication/rpc/wallet-rpc.md +++ /dev/null @@ -1,100 +0,0 @@ - - -## @aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/wallet-rpc -RPC handler for WAELLET side - -**Example** -```js -import WalletRpc from '@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/wallet-rpc' -``` - -* [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/wallet-rpc](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/wallet-rpc) - * [exports.WalletRpc(param, onConnection, onSubscription, onSign, onAskAccounts, onMessageSign, onDisconnect)](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/wallet-rpc--exports.WalletRpc) ⇒ `Object` ⏏ - * [.getClients()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/wallet-rpc--exports.WalletRpc+getClients) ⇒ `Object` - * [.removeRpcClient(id, [opt])](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/wallet-rpc--exports.WalletRpc+removeRpcClient) ⇒ `Object` - * [.addRpcClient(clientConnection)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/wallet-rpc--exports.WalletRpc+addRpcClient) ⇒ `String` - * [.shareWalletInfo(postFn)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/wallet-rpc--exports.WalletRpc+shareWalletInfo) ⇒ `void` - * [.getWalletInfo()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/wallet-rpc--exports.WalletRpc+getWalletInfo) ⇒ `Object` - * [.getAccounts()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/wallet-rpc--exports.WalletRpc+getAccounts) ⇒ `Object` - - - -### exports.WalletRpc(param, onConnection, onSubscription, onSign, onAskAccounts, onMessageSign, onDisconnect) ⇒ `Object` ⏏ -Contain functionality for aepp interaction and managing multiple aepps - -**Kind**: Exported function -**rtype**: `Stamp` - -| Param | Type | Description | -| --- | --- | --- | -| param | `Object` | Init params object | -| [param.name] | `String` | Wallet name | -| onConnection | `function` | Call-back function for incoming AEPP connection (Second argument contain function for accept/deny request) | -| onSubscription | `function` | Call-back function for incoming AEPP account subscription (Second argument contain function for accept/deny request) | -| onSign | `function` | Call-back function for incoming AEPP sign request (Second argument contain function for accept/deny request) | -| onAskAccounts | `function` | Call-back function for incoming AEPP get address request (Second argument contain function for accept/deny request) | -| onMessageSign | `function` | Call-back function for incoming AEPP sign message request (Second argument contain function for accept/deny request) | -| onDisconnect | `function` | Call-back function for disconnect event | - - - -#### exports.WalletRpc.getClients() ⇒ `Object` -Get RpcClients object which contain all connected AEPPS - -**Kind**: instance method of [`exports.WalletRpc`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/wallet-rpc--exports.WalletRpc) -**rtype**: `() => Object` - - -#### exports.WalletRpc.removeRpcClient(id, [opt]) ⇒ `Object` -Remove specific RpcClient by ID - -**Kind**: instance method of [`exports.WalletRpc`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/wallet-rpc--exports.WalletRpc) -**rtype**: `(id: string) => Boolean` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| id | `String` | | Client ID | -| [opt] | `Object` | {} | | - - - -#### exports.WalletRpc.addRpcClient(clientConnection) ⇒ `String` -Add new AEPP connection - -**Kind**: instance method of [`exports.WalletRpc`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/wallet-rpc--exports.WalletRpc) -**Returns**: `String` - Client ID -**rtype**: `(clientConnection: Object) => Object` - -| Param | Type | Description | -| --- | --- | --- | -| clientConnection | `Object` | AEPP connection object | - - - -#### exports.WalletRpc.shareWalletInfo(postFn) ⇒ `void` -Share wallet info -Send shareWalletInfo message to notify AEPP about wallet - -**Kind**: instance method of [`exports.WalletRpc`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/wallet-rpc--exports.WalletRpc) -**rtype**: `(postFn: Function) => void` - -| Param | Type | Description | -| --- | --- | --- | -| postFn | `function` | Send message function like `(msg) => void` | - - - -#### exports.WalletRpc.getWalletInfo() ⇒ `Object` -Get Wallet info object - -**Kind**: instance method of [`exports.WalletRpc`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/wallet-rpc--exports.WalletRpc) -**Returns**: `Object` - Object with wallet information(id, name, network, ...) -**rtype**: `() => Object` - - -#### exports.WalletRpc.getAccounts() ⇒ `Object` -Get Wallet accounts - -**Kind**: instance method of [`exports.WalletRpc`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/wallet-rpc--exports.WalletRpc) -**Returns**: `Object` - Object with accounts information({ connected: Object, current: Object }) -**rtype**: `() => Object` diff --git a/docs/api/utils/aepp-wallet-communication/wallet-detector.md b/docs/api/utils/aepp-wallet-communication/wallet-detector.md deleted file mode 100644 index 661458276b..0000000000 --- a/docs/api/utils/aepp-wallet-communication/wallet-detector.md +++ /dev/null @@ -1,55 +0,0 @@ - - -## @aeternity/aepp-sdk/es/utils/aepp-wallet-communication/wallet-detector -Wallet Detector - -This is the complement to [module:@aeternity/aepp-sdk/es/utils](module:@aeternity/aepp-sdk/es/utils). - -**Example** -```js -import WalletDetector from '@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/wallet-detector' -``` - -* [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/wallet-detector](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/wallet-detector) - * [exports.WalletDetector(params)](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/wallet-detector--exports.WalletDetector) ⇒ `WalletDetector` ⏏ - * [.scan(onDetected)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/wallet-detector--exports.WalletDetector+scan) ⇒ `void` - * [.stopScan()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/wallet-detector--exports.WalletDetector+stopScan) ⇒ `void` - * [.getWallets()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/wallet-detector--exports.WalletDetector+getWallets) ⇒ `Array` - - - -### exports.WalletDetector(params) ⇒ `WalletDetector` ⏏ -WalletDetector stamp - -**Kind**: Exported function -**rtype**: `Stamp` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| params | `Object` | {} | Initializer object | -| params.connection | `WalletConnection` | | Connection for listening for wallets | - - - -#### exports.WalletDetector.scan(onDetected) ⇒ `void` -Start scanning - -**Kind**: instance method of [`exports.WalletDetector`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/wallet-detector--exports.WalletDetector) - -| Param | Type | Description | -| --- | --- | --- | -| onDetected | `function` | Call-back function which trigger on new wallet | - - - -#### exports.WalletDetector.stopScan() ⇒ `void` -Stop scanning - -**Kind**: instance method of [`exports.WalletDetector`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/wallet-detector--exports.WalletDetector) - - -#### exports.WalletDetector.getWallets() ⇒ `Array` -Get wallet list - -**Kind**: instance method of [`exports.WalletDetector`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/wallet-detector--exports.WalletDetector) -**Returns**: `Array` - Available wallets diff --git a/docs/api/utils/amount-formatter.md b/docs/api/utils/amount-formatter.md deleted file mode 100644 index 70686bc1cc..0000000000 --- a/docs/api/utils/amount-formatter.md +++ /dev/null @@ -1,69 +0,0 @@ - - -## @aeternity/aepp-sdk/es/utils/amount-formatter -Amount Formatter - -**Example** -```js -import { format, toAettos, AE_AMOUNT_FORMATS } from '@aeternity/aepp-sdk/es/utils/amount-formatter' -``` - -* [@aeternity/aepp-sdk/es/utils/amount-formatter](#module_@aeternity/aepp-sdk/es/utils/amount-formatter) - * [.AE_AMOUNT_FORMATS](#module_@aeternity/aepp-sdk/es/utils/amount-formatter.AE_AMOUNT_FORMATS) - * [.DENOMINATION_MAGNITUDE](#module_@aeternity/aepp-sdk/es/utils/amount-formatter.DENOMINATION_MAGNITUDE) - * [.toAe](#module_@aeternity/aepp-sdk/es/utils/amount-formatter.toAe) ⇒ `String` - * [.toAettos](#module_@aeternity/aepp-sdk/es/utils/amount-formatter.toAettos) ⇒ `String` - * [.formatAmount](#module_@aeternity/aepp-sdk/es/utils/amount-formatter.formatAmount) ⇒ `String` - - - -### @aeternity/aepp-sdk/es/utils/amount-formatter.AE\_AMOUNT\_FORMATS -AE amount formats - -**Kind**: static constant of [`@aeternity/aepp-sdk/es/utils/amount-formatter`](#module_@aeternity/aepp-sdk/es/utils/amount-formatter) - - -### @aeternity/aepp-sdk/es/utils/amount-formatter.DENOMINATION\_MAGNITUDE -DENOMINATION_MAGNITUDE - -**Kind**: static constant of [`@aeternity/aepp-sdk/es/utils/amount-formatter`](#module_@aeternity/aepp-sdk/es/utils/amount-formatter) - - -### @aeternity/aepp-sdk/es/utils/amount-formatter.toAe ⇒ `String` -Convert amount to AE - -**Kind**: static constant of [`@aeternity/aepp-sdk/es/utils/amount-formatter`](#module_@aeternity/aepp-sdk/es/utils/amount-formatter) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| value | `String` \| `Number` \| `BigNumber` | | amount to convert | -| [options] | `Object` | {} | options | -| [options.denomination] | `String` | 'aettos' | denomination of amount, can be ['ae', 'aettos'] | - - - -### @aeternity/aepp-sdk/es/utils/amount-formatter.toAettos ⇒ `String` -Convert amount to aettos - -**Kind**: static constant of [`@aeternity/aepp-sdk/es/utils/amount-formatter`](#module_@aeternity/aepp-sdk/es/utils/amount-formatter) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| value | `String` \| `Number` \| `BigNumber` | | amount to convert | -| [options] | `Object` | {} | options | -| [options.denomination] | `String` | 'ae' | denomination of amount, can be ['ae', 'aettos'] | - - - -### @aeternity/aepp-sdk/es/utils/amount-formatter.formatAmount ⇒ `String` -Convert amount from one to other denomination - -**Kind**: static constant of [`@aeternity/aepp-sdk/es/utils/amount-formatter`](#module_@aeternity/aepp-sdk/es/utils/amount-formatter) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| value | `String` \| `Number` \| `BigNumber` | | amount to convert | -| [options] | `Object` | {} | options | -| [options.denomination] | `String` | 'aettos' | denomination of amount, can be ['ae', 'aettos'] | -| [options.targetDenomination] | `String` | 'aettos' | target denomination, can be ['ae', 'aettos'] | - diff --git a/docs/api/utils/bignumber.md b/docs/api/utils/bignumber.md deleted file mode 100644 index 4308acc4f7..0000000000 --- a/docs/api/utils/bignumber.md +++ /dev/null @@ -1,60 +0,0 @@ - - -## @aeternity/aepp-sdk/es/utils/bignumber -Big Number Helpers - -**Example** -```js -import { parseBigNumber, asBigNumber, isBigNumber, ceil } from '@aeternity/aepp-sdk/es/utils/bignumber' -``` - -* [@aeternity/aepp-sdk/es/utils/bignumber](#module_@aeternity/aepp-sdk/es/utils/bignumber) - * [.parseBigNumber(number)](#module_@aeternity/aepp-sdk/es/utils/bignumber.parseBigNumber) ⇒ `String` - * [.asBigNumber(number)](#module_@aeternity/aepp-sdk/es/utils/bignumber.asBigNumber) ⇒ `BigNumber` - * [.isBigNumber(number)](#module_@aeternity/aepp-sdk/es/utils/bignumber.isBigNumber) ⇒ `Boolean` - * [.ceil(bigNumber)](#module_@aeternity/aepp-sdk/es/utils/bignumber.ceil) ⇒ `BigNumber` - - - -### @aeternity/aepp-sdk/es/utils/bignumber.parseBigNumber(number) ⇒ `String` -Convert number to string - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/bignumber`](#module_@aeternity/aepp-sdk/es/utils/bignumber) - -| Param | Type | Description | -| --- | --- | --- | -| number | `String` \| `Number` \| `BigNumber` | number to convert | - - - -### @aeternity/aepp-sdk/es/utils/bignumber.asBigNumber(number) ⇒ `BigNumber` -Convert number to BigNumber instance - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/bignumber`](#module_@aeternity/aepp-sdk/es/utils/bignumber) - -| Param | Type | Description | -| --- | --- | --- | -| number | `String` \| `Number` \| `BigNumber` | number to convert | - - - -### @aeternity/aepp-sdk/es/utils/bignumber.isBigNumber(number) ⇒ `Boolean` -Check if value is BigNumber, Number or number string representation - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/bignumber`](#module_@aeternity/aepp-sdk/es/utils/bignumber) - -| Param | Type | Description | -| --- | --- | --- | -| number | `String` \| `Number` \| `BigNumber` | number to convert | - - - -### @aeternity/aepp-sdk/es/utils/bignumber.ceil(bigNumber) ⇒ `BigNumber` -BigNumber ceil operation - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/bignumber`](#module_@aeternity/aepp-sdk/es/utils/bignumber) - -| Param | Type | -| --- | --- | -| bigNumber | `String` \| `Number` \| `BigNumber` | - diff --git a/docs/api/utils/bytes.md b/docs/api/utils/bytes.md deleted file mode 100644 index eb306e5e0e..0000000000 --- a/docs/api/utils/bytes.md +++ /dev/null @@ -1,69 +0,0 @@ - - -## @aeternity/aepp-sdk/es/utils/bytes -Bytes module - -**Example** -```js -import * as Crypto from '@aeternity/aepp-sdk/es/utils/bytes' -``` - -* [@aeternity/aepp-sdk/es/utils/bytes](#module_@aeternity/aepp-sdk/es/utils/bytes) - * [.leftPad(length, inputBuffer)](#module_@aeternity/aepp-sdk/es/utils/bytes.leftPad) ⇒ - * [.rightPad(length, inputBuffer)](#module_@aeternity/aepp-sdk/es/utils/bytes.rightPad) ⇒ - * [.bigNumberToByteArray(x)](#module_@aeternity/aepp-sdk/es/utils/bytes.bigNumberToByteArray) ⇒ - * [.str2buf(str, [enc])](#module_@aeternity/aepp-sdk/es/utils/bytes.str2buf) ⇒ `buffer` - - - -### @aeternity/aepp-sdk/es/utils/bytes.leftPad(length, inputBuffer) ⇒ -Left pad the input data with 0 bytes - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/bytes`](#module_@aeternity/aepp-sdk/es/utils/bytes) -**Returns**: the padded data - -| Param | Description | -| --- | --- | -| length | to pad to | -| inputBuffer | data to pad | - - - -### @aeternity/aepp-sdk/es/utils/bytes.rightPad(length, inputBuffer) ⇒ -Right pad the input data with 0 bytes - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/bytes`](#module_@aeternity/aepp-sdk/es/utils/bytes) -**Returns**: the padded data - -| Param | Description | -| --- | --- | -| length | to pad to | -| inputBuffer | data to pad | - - - -### @aeternity/aepp-sdk/es/utils/bytes.bigNumberToByteArray(x) ⇒ -Convert bignumber to byte array - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/bytes`](#module_@aeternity/aepp-sdk/es/utils/bytes) -**Returns**: Buffer - -| Param | Description | -| --- | --- | -| x | bignumber instance | - - - -### @aeternity/aepp-sdk/es/utils/bytes.str2buf(str, [enc]) ⇒ `buffer` -Convert a string to a Buffer. If encoding is not specified, hex-encoding -will be used if the input is valid hex. If the input is valid base64 but -not valid hex, base64 will be used. Otherwise, utf8 will be used. - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/bytes`](#module_@aeternity/aepp-sdk/es/utils/bytes) -**Returns**: `buffer` - Buffer (bytearray) containing the input data. - -| Param | Type | Description | -| --- | --- | --- | -| str | `string` | String to be converted. | -| [enc] | `string` | Encoding of the input string (optional). | - diff --git a/docs/api/utils/crypto.md b/docs/api/utils/crypto.md deleted file mode 100644 index e819f5e95a..0000000000 --- a/docs/api/utils/crypto.md +++ /dev/null @@ -1,543 +0,0 @@ - - -## @aeternity/aepp-sdk/es/utils/crypto -Crypto module - -**Example** -```js -import * as Crypto from '@aeternity/aepp-sdk/es/utils/crypto' -``` - -* [@aeternity/aepp-sdk/es/utils/crypto](#module_@aeternity/aepp-sdk/es/utils/crypto) - * _static_ - * [.decode](#module_@aeternity/aepp-sdk/es/utils/crypto.decode) ⇒ `Array` - * [.formatAddress(format, address)](#module_@aeternity/aepp-sdk/es/utils/crypto.formatAddress) ⇒ `String` - * [.getAddressFromPriv(secret)](#module_@aeternity/aepp-sdk/es/utils/crypto.getAddressFromPriv) ⇒ `String` - * [.isAddressValid(address, prefix)](#module_@aeternity/aepp-sdk/es/utils/crypto.isAddressValid) ⇒ `Boolean` - * [.addressToHex(base58CheckAddress)](#module_@aeternity/aepp-sdk/es/utils/crypto.addressToHex) ⇒ `String` - * [.addressFromDecimal(decimalAddress)](#module_@aeternity/aepp-sdk/es/utils/crypto.addressFromDecimal) ⇒ `String` - * [.hash(input)](#module_@aeternity/aepp-sdk/es/utils/crypto.hash) ⇒ `Buffer` - * [.sha256hash(input)](#module_@aeternity/aepp-sdk/es/utils/crypto.sha256hash) ⇒ `String` - * [.salt()](#module_@aeternity/aepp-sdk/es/utils/crypto.salt) ⇒ `Number` - * [.encodeBase64Check(input)](#module_@aeternity/aepp-sdk/es/utils/crypto.encodeBase64Check) ⇒ `Buffer` - * [.decodeBase64Check(str)](#module_@aeternity/aepp-sdk/es/utils/crypto.decodeBase64Check) ⇒ `Buffer` - * [.encodeBase58Check(input)](#module_@aeternity/aepp-sdk/es/utils/crypto.encodeBase58Check) ⇒ `String` - * [.decodeBase58Check(str)](#module_@aeternity/aepp-sdk/es/utils/crypto.decodeBase58Check) ⇒ `Buffer` - * [.hexStringToByte(str)](#module_@aeternity/aepp-sdk/es/utils/crypto.hexStringToByte) ⇒ `Uint8Array` - * [.encodeUnsigned(value)](#module_@aeternity/aepp-sdk/es/utils/crypto.encodeUnsigned) ⇒ `Buffer` - * [.encodeContractAddress(owner, nonce)](#module_@aeternity/aepp-sdk/es/utils/crypto.encodeContractAddress) ⇒ `String` - * [.generateKeyPairFromSecret(secret)](#module_@aeternity/aepp-sdk/es/utils/crypto.generateKeyPairFromSecret) ⇒ `Object` - * [.generateKeyPair(raw)](#module_@aeternity/aepp-sdk/es/utils/crypto.generateKeyPair) ⇒ `Object` - * [.encryptPublicKey(password, binaryKey)](#module_@aeternity/aepp-sdk/es/utils/crypto.encryptPublicKey) ⇒ `Uint8Array` - * [.encryptPrivateKey(password, binaryKey)](#module_@aeternity/aepp-sdk/es/utils/crypto.encryptPrivateKey) ⇒ `Uint8Array` - * [.encryptKey(password, binaryData)](#module_@aeternity/aepp-sdk/es/utils/crypto.encryptKey) ⇒ `Uint8Array` - * [.decryptKey(password, encrypted)](#module_@aeternity/aepp-sdk/es/utils/crypto.decryptKey) ⇒ `Buffer` - * [.sign(data, privateKey)](#module_@aeternity/aepp-sdk/es/utils/crypto.sign) ⇒ `Buffer` \| `Uint8Array` - * [.verify(str, signature, publicKey)](#module_@aeternity/aepp-sdk/es/utils/crypto.verify) ⇒ `Boolean` - * [.prepareTx(signature, data)](#module_@aeternity/aepp-sdk/es/utils/crypto.prepareTx) ⇒ `Transaction` - * [.aeEncodeKey(binaryKey)](#module_@aeternity/aepp-sdk/es/utils/crypto.aeEncodeKey) ⇒ `String` - * [.generateSaveWallet(password)](#module_@aeternity/aepp-sdk/es/utils/crypto.generateSaveWallet) ⇒ `Object` - * [.decryptPrivateKey(password)](#module_@aeternity/aepp-sdk/es/utils/crypto.decryptPrivateKey) ⇒ `Buffer` - * [.decryptPubKey(password)](#module_@aeternity/aepp-sdk/es/utils/crypto.decryptPubKey) ⇒ `Buffer` - * [.assertedType(data, type, forceError)](#module_@aeternity/aepp-sdk/es/utils/crypto.assertedType) ⇒ `String` \| `Boolean` - * [.decodeTx(txHash)](#module_@aeternity/aepp-sdk/es/utils/crypto.decodeTx) ⇒ `Buffer` - * [.encodeTx(txData)](#module_@aeternity/aepp-sdk/es/utils/crypto.encodeTx) ⇒ `String` - * [.isValidKeypair(privateKey, publicKey)](#module_@aeternity/aepp-sdk/es/utils/crypto.isValidKeypair) ⇒ `Boolean` - * [.envKeypair(env, [force])](#module_@aeternity/aepp-sdk/es/utils/crypto.envKeypair) ⇒ `Object` - * [.encryptData(msg, publicKey)](#module_@aeternity/aepp-sdk/es/utils/crypto.encryptData) ⇒ `Object` - * [.decryptData(secretKey, encryptedData)](#module_@aeternity/aepp-sdk/es/utils/crypto.decryptData) ⇒ `Buffer` \| `null` - * _inner_ - * [~Transaction](#module_@aeternity/aepp-sdk/es/utils/crypto..Transaction) : `Array` - - - -### @aeternity/aepp-sdk/es/utils/crypto.decode ⇒ `Array` -RLP decode - -**Kind**: static constant of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Array` - Array of Buffers containing the original message -**rtype**: `(data: Any) => Buffer[]` - -| Param | Type | Description | -| --- | --- | --- | -| data | `Buffer` \| `String` \| `Integer` \| `Array` | Data to decode | - - - -### @aeternity/aepp-sdk/es/utils/crypto.formatAddress(format, address) ⇒ `String` -Format account address - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `String` - Formatted address -**rtype**: `(format: String, address: String) => tx: Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| format | `String` | Format type | -| address | `String` | Base58check account address | - - - -### @aeternity/aepp-sdk/es/utils/crypto.getAddressFromPriv(secret) ⇒ `String` -Generate address from secret key - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `String` - Public key -**rtype**: `(secret: String) => tx: Promise[String]` - -| Param | Type | Description | -| --- | --- | --- | -| secret | `String` | Private key | - - - -### @aeternity/aepp-sdk/es/utils/crypto.isAddressValid(address, prefix) ⇒ `Boolean` -Check if address is valid - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Boolean` - valid -**rtype**: `(input: String) => valid: Boolean` - -| Param | Type | Description | -| --- | --- | --- | -| address | `String` | Address | -| prefix | `String` | Transaction prefix. Default: 'ak' | - - - -### @aeternity/aepp-sdk/es/utils/crypto.addressToHex(base58CheckAddress) ⇒ `String` -Convert base58Check address to hex string - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `String` - Hex string -**rtype**: `(base58CheckAddress: String) => hexAddress: String` - -| Param | Type | Description | -| --- | --- | --- | -| base58CheckAddress | `String` | Address | - - - -### @aeternity/aepp-sdk/es/utils/crypto.addressFromDecimal(decimalAddress) ⇒ `String` -Parse decimal address and return base58Check encoded address with prefix 'ak' - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `String` - address -**rtype**: `(input: String) => address: String` - -| Param | Type | Description | -| --- | --- | --- | -| decimalAddress | `String` | Address | - - - -### @aeternity/aepp-sdk/es/utils/crypto.hash(input) ⇒ `Buffer` -Calculate 256bits Blake2b hash of `input` - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Buffer` - Hash -**rtype**: `(input: String) => hash: String` - -| Param | Type | Description | -| --- | --- | --- | -| input | `String` \| `Buffer` | Data to hash | - - - -### @aeternity/aepp-sdk/es/utils/crypto.sha256hash(input) ⇒ `String` -Calculate SHA256 hash of `input` - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `String` - Hash -**rtype**: `(input: String) => hash: String` - -| Param | Type | Description | -| --- | --- | --- | -| input | `String` | Data to hash | - - - -### @aeternity/aepp-sdk/es/utils/crypto.salt() ⇒ `Number` -Generate a random salt (positive integer) - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Number` - random salt -**rtype**: `() => salt: Number` - - -### @aeternity/aepp-sdk/es/utils/crypto.encodeBase64Check(input) ⇒ `Buffer` -Base64check encode given `input` - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Buffer` - Base64check encoded data -**rtype**: `(input: String|buffer) => Buffer` - -| Param | Type | Description | -| --- | --- | --- | -| input | `String` | Data to encode | - - - -### @aeternity/aepp-sdk/es/utils/crypto.decodeBase64Check(str) ⇒ `Buffer` -Base64check decode given `str` - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Buffer` - Base64check decoded data -**rtype**: `(str: String) => Buffer` - -| Param | Type | Description | -| --- | --- | --- | -| str | `String` | Data to decode | - - - -### @aeternity/aepp-sdk/es/utils/crypto.encodeBase58Check(input) ⇒ `String` -Base58 encode given `input` - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `String` - Base58 encoded data -**rtype**: `(input: String) => String` - -| Param | Type | Description | -| --- | --- | --- | -| input | `String` \| `Buffer` | Data to encode | - - - -### @aeternity/aepp-sdk/es/utils/crypto.decodeBase58Check(str) ⇒ `Buffer` -Base58 decode given `str` - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Buffer` - Base58 decoded data -**rtype**: `(str: String) => Buffer` - -| Param | Type | Description | -| --- | --- | --- | -| str | `String` | Data to decode | - - - -### @aeternity/aepp-sdk/es/utils/crypto.hexStringToByte(str) ⇒ `Uint8Array` -Conver hex string to Uint8Array - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Uint8Array` - - converted data -**rtype**: `(str: String) => Uint8Array` - -| Param | Type | Description | -| --- | --- | --- | -| str | `String` | Data to conver | - - - -### @aeternity/aepp-sdk/es/utils/crypto.encodeUnsigned(value) ⇒ `Buffer` -Converts a positive integer to the smallest possible -representation in a binary digit representation - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Buffer` - - Encoded data -**rtype**: `(value: Number) => Buffer` - -| Param | Type | Description | -| --- | --- | --- | -| value | `Number` | Value to encode | - - - -### @aeternity/aepp-sdk/es/utils/crypto.encodeContractAddress(owner, nonce) ⇒ `String` -Compute contract address - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `String` - - Contract address -**rtype**: `(owner: String, nonce: Number) => String` - -| Param | Type | Description | -| --- | --- | --- | -| owner | `String` | Address of contract owner | -| nonce | `Number` | Round when contract was created | - - - -### @aeternity/aepp-sdk/es/utils/crypto.generateKeyPairFromSecret(secret) ⇒ `Object` -Generate keyPair from secret key - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Object` - - Object with Private(privateKey) and Public(publicKey) keys -**rtype**: `(secret: Uint8Array) => KeyPair` - -| Param | Type | Description | -| --- | --- | --- | -| secret | `Uint8Array` | secret key | - - - -### @aeternity/aepp-sdk/es/utils/crypto.generateKeyPair(raw) ⇒ `Object` -Generate a random ED25519 keypair - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Object` - Key pair -**rtype**: `(raw: Boolean) => {publicKey: String, secretKey: String} | {publicKey: Buffer, secretKey: Buffer}` - -| Param | Type | Description | -| --- | --- | --- | -| raw | `Boolean` | Whether to return raw (binary) keys | - - - -### @aeternity/aepp-sdk/es/utils/crypto.encryptPublicKey(password, binaryKey) ⇒ `Uint8Array` -Encrypt given public key using `password` - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Uint8Array` - Encrypted key -**rtype**: `(password: String, binaryKey: Buffer) => Uint8Array` - -| Param | Type | Description | -| --- | --- | --- | -| password | `String` | Password to encrypt with | -| binaryKey | `Buffer` | Key to encrypt | - - - -### @aeternity/aepp-sdk/es/utils/crypto.encryptPrivateKey(password, binaryKey) ⇒ `Uint8Array` -Encrypt given private key using `password` - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Uint8Array` - Encrypted key -**rtype**: `(password: String, binaryKey: Buffer) => Uint8Array` - -| Param | Type | Description | -| --- | --- | --- | -| password | `String` | Password to encrypt with | -| binaryKey | `Buffer` | Key to encrypt | - - - -### @aeternity/aepp-sdk/es/utils/crypto.encryptKey(password, binaryData) ⇒ `Uint8Array` -Encrypt given data using `password` - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Uint8Array` - Encrypted data -**rtype**: `(password: String, binaryData: Buffer) => Uint8Array` - -| Param | Type | Description | -| --- | --- | --- | -| password | `String` | Password to encrypt with | -| binaryData | `Buffer` | Data to encrypt | - - - -### @aeternity/aepp-sdk/es/utils/crypto.decryptKey(password, encrypted) ⇒ `Buffer` -Decrypt given data using `password` - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Buffer` - Decrypted data -**rtype**: `(password: String, encrypted: String) => Uint8Array` - -| Param | Type | Description | -| --- | --- | --- | -| password | `String` | Password to decrypt with | -| encrypted | `String` | Data to decrypt | - - - -### @aeternity/aepp-sdk/es/utils/crypto.sign(data, privateKey) ⇒ `Buffer` \| `Uint8Array` -Generate signature - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Buffer` \| `Uint8Array` - Signature -**rtype**: `(data: String|Buffer, privateKey: Buffer) => Buffer` - -| Param | Type | Description | -| --- | --- | --- | -| data | `String` \| `Buffer` | Data to sign | -| privateKey | `String` \| `Buffer` | Key to sign with | - - - -### @aeternity/aepp-sdk/es/utils/crypto.verify(str, signature, publicKey) ⇒ `Boolean` -Verify that signature was signed by public key - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Boolean` - Valid? -**rtype**: `(str: String, signature: Buffer, publicKey: Buffer) => Boolean` - -| Param | Type | Description | -| --- | --- | --- | -| str | `String` \| `Buffer` | Data to verify | -| signature | `Buffer` | Signature to verify | -| publicKey | `Buffer` | Key to verify against | - - - -### @aeternity/aepp-sdk/es/utils/crypto.prepareTx(signature, data) ⇒ `Transaction` -Prepare a transaction for posting to the blockchain - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Transaction` - Transaction -**rtype**: `(signature: Buffer | String, data: Buffer) => Transaction` - -| Param | Type | Description | -| --- | --- | --- | -| signature | `Buffer` | Signature of `data` | -| data | `Buffer` | Transaction data | - - - -### @aeternity/aepp-sdk/es/utils/crypto.aeEncodeKey(binaryKey) ⇒ `String` -æternity readable public keys are the base58-encoded public key, prepended -with 'ak_' - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `String` - Encoded key -**rtype**: `(binaryKey: Buffer) => String` - -| Param | Type | Description | -| --- | --- | --- | -| binaryKey | `Buffer` | Key to encode | - - - -### @aeternity/aepp-sdk/es/utils/crypto.generateSaveWallet(password) ⇒ `Object` -Generate a new key pair using [generateKeyPair](generateKeyPair) and encrypt it using `password` - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Object` - Encrypted key pair -**rtype**: `(password: String) => {publicKey: Uint8Array, secretKey: Uint8Array}` - -| Param | Type | Description | -| --- | --- | --- | -| password | `String` | Password to encrypt with | - - - -### @aeternity/aepp-sdk/es/utils/crypto.decryptPrivateKey(password) ⇒ `Buffer` -Decrypt an encrypted private key - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Buffer` - Decrypted key -**rtype**: `(password: String, encrypted: Buffer) => Buffer` - -| Param | Type | Description | -| --- | --- | --- | -| password | `String` | Password to decrypt with | - - - -### @aeternity/aepp-sdk/es/utils/crypto.decryptPubKey(password) ⇒ `Buffer` -Decrypt an encrypted public key - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Buffer` - Decrypted key -**rtype**: `(password: String, encrypted: Buffer) => Buffer` - -| Param | Type | Description | -| --- | --- | --- | -| password | `String` | Password to decrypt with | - - - -### @aeternity/aepp-sdk/es/utils/crypto.assertedType(data, type, forceError) ⇒ `String` \| `Boolean` -Assert base58 encoded type and return its payload - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `String` \| `Boolean` - Payload -**rtype**: `(data: String, type: String) => String, throws: Error` - -| Param | Type | Description | -| --- | --- | --- | -| data | `String` | ae data | -| type | `String` | Prefix | -| forceError | | | - - - -### @aeternity/aepp-sdk/es/utils/crypto.decodeTx(txHash) ⇒ `Buffer` -Decode a transaction - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Buffer` - Decoded transaction -**rtype**: `(txHash: String) => Buffer` - -| Param | Type | Description | -| --- | --- | --- | -| txHash | `String` | Transaction hash | - - - -### @aeternity/aepp-sdk/es/utils/crypto.encodeTx(txData) ⇒ `String` -Encode a transaction - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `String` - Encoded transaction -**rtype**: `(txData: Transaction) => String` - -| Param | Type | Description | -| --- | --- | --- | -| txData | `Transaction` | Transaction to encode | - - - -### @aeternity/aepp-sdk/es/utils/crypto.isValidKeypair(privateKey, publicKey) ⇒ `Boolean` -Check key pair for validity - -Sign a message, and then verifying that signature - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Boolean` - Valid? -**rtype**: `(privateKey: Buffer, publicKey: Buffer) => Boolean` - -| Param | Type | Description | -| --- | --- | --- | -| privateKey | `Buffer` | Private key to verify | -| publicKey | `Buffer` | Public key to verify | - - - -### @aeternity/aepp-sdk/es/utils/crypto.envKeypair(env, [force]) ⇒ `Object` -Obtain key pair from `env` - -Designed to be used with `env` from nodejs. Assumes enviroment variables -`WALLET_PRIV` and `WALLET_PUB`. - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Object` - Key pair -**rtype**: `(env: Object) => {publicKey: String, secretKey: String}, throws: Error` - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| env | `Object` | | Environment | -| [force] | `Boolean` | false | Force throwing error | - - - -### @aeternity/aepp-sdk/es/utils/crypto.encryptData(msg, publicKey) ⇒ `Object` -This function encrypts a message using base58check encoded and 'ak' prefixed -publicKey such that only the corresponding secretKey will -be able to decrypt - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**rtype**: `(msg: String, publicKey: String) => Object` - -| Param | Type | Description | -| --- | --- | --- | -| msg | `Buffer` | Data to encode | -| publicKey | `String` | Public key | - - - -### @aeternity/aepp-sdk/es/utils/crypto.decryptData(secretKey, encryptedData) ⇒ `Buffer` \| `null` -This function decrypt a message using secret key - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**rtype**: `(secretKey: String, encryptedData: Object) => Buffer|null` - -| Param | Type | Description | -| --- | --- | --- | -| secretKey | `String` | Secret key | -| encryptedData | `Object` | Encrypted data | - - - -### @aeternity/aepp-sdk/es/utils/crypto~Transaction : `Array` -**Kind**: inner typedef of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**rtype**: `Transaction: [tag: Buffer, version: Buffer, [signature: Buffer], data: Buffer]` diff --git a/docs/api/utils/keystore.md b/docs/api/utils/keystore.md deleted file mode 100644 index 25858bda0b..0000000000 --- a/docs/api/utils/keystore.md +++ /dev/null @@ -1,137 +0,0 @@ - - -## @aeternity/aepp-sdk/es/utils/keystore -KeyStore module - -**Example** -```js -import * as Keystore from '@aeternity/aepp-sdk/es/utils/keystore' -``` -**Example** -```js -const { Keystore } = require('@aeternity/aepp-sdk') -``` - -* [@aeternity/aepp-sdk/es/utils/keystore](#module_@aeternity/aepp-sdk/es/utils/keystore) - * _static_ - * [.recover(password, keyObject)](#module_@aeternity/aepp-sdk/es/utils/keystore.recover) ⇒ `Buffer` - * [.dump(name, password, privateKey, nonce, salt, [options])](#module_@aeternity/aepp-sdk/es/utils/keystore.dump) ⇒ `Object` - * _inner_ - * [~str2buf(str, [enc])](#module_@aeternity/aepp-sdk/es/utils/keystore..str2buf) ⇒ `buffer` - * [~encrypt(plaintext, key, nonce, [algo])](#module_@aeternity/aepp-sdk/es/utils/keystore..encrypt) ⇒ `buffer` - * [~decrypt(ciphertext, key, nonce, [algo])](#module_@aeternity/aepp-sdk/es/utils/keystore..decrypt) ⇒ `buffer` - * [~deriveKey(password, nonce, [options])](#module_@aeternity/aepp-sdk/es/utils/keystore..deriveKey) ⇒ `buffer` - * [~marshal(name, derivedKey, privateKey, nonce, salt, [options])](#module_@aeternity/aepp-sdk/es/utils/keystore..marshal) ⇒ `Object` - - - -### @aeternity/aepp-sdk/es/utils/keystore.recover(password, keyObject) ⇒ `Buffer` -Recover plaintext private key from secret-storage key object. - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/keystore`](#module_@aeternity/aepp-sdk/es/utils/keystore) -**Returns**: `Buffer` - Plaintext private key. - -| Param | Type | Description | -| --- | --- | --- | -| password | `String` | Keystore object password. | -| keyObject | `Object` | Keystore object. | - - - -### @aeternity/aepp-sdk/es/utils/keystore.dump(name, password, privateKey, nonce, salt, [options]) ⇒ `Object` -Export private key to keystore secret-storage format. - -**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/keystore`](#module_@aeternity/aepp-sdk/es/utils/keystore) - -| Param | Type | Description | -| --- | --- | --- | -| name | `String` | Key name. | -| password | `String` | User-supplied password. | -| privateKey | `String` | Private key. | -| nonce | `Buffer` | Randomly generated 24byte nonce. | -| salt | `Buffer` | Randomly generated 16byte salt. | -| [options] | `Object` | Encryption parameters. | -| [options.kdf] | `String` | Key derivation function (default: pbkdf2). | -| [options.cipher] | `String` | Symmetric cipher (default: constants.cipher). | -| [options.kdfparams] | `Object` | KDF parameters (default: constants.). | - - - -### @aeternity/aepp-sdk/es/utils/keystore~str2buf(str, [enc]) ⇒ `buffer` -Convert a string to a Buffer. If encoding is not specified, hex-encoding -will be used if the input is valid hex. If the input is valid base64 but -not valid hex, base64 will be used. Otherwise, utf8 will be used. - -**Kind**: inner method of [`@aeternity/aepp-sdk/es/utils/keystore`](#module_@aeternity/aepp-sdk/es/utils/keystore) -**Returns**: `buffer` - Buffer (bytearray) containing the input data. - -| Param | Type | Description | -| --- | --- | --- | -| str | `string` | String to be converted. | -| [enc] | `string` | Encoding of the input string (optional). | - - - -### @aeternity/aepp-sdk/es/utils/keystore~encrypt(plaintext, key, nonce, [algo]) ⇒ `buffer` -Symmetric private key encryption using secret (derived) key. - -**Kind**: inner method of [`@aeternity/aepp-sdk/es/utils/keystore`](#module_@aeternity/aepp-sdk/es/utils/keystore) -**Returns**: `buffer` - Encrypted data. - -| Param | Type | Description | -| --- | --- | --- | -| plaintext | `buffer` \| `string` | Data to be encrypted. | -| key | `buffer` \| `string` | Secret key. | -| nonce | `buffer` \| `string` | Randomly generated nonce. | -| [algo] | `string` | Encryption algorithm (default: DEFAULTS.crypto.symmetric_alg). | - - - -### @aeternity/aepp-sdk/es/utils/keystore~decrypt(ciphertext, key, nonce, [algo]) ⇒ `buffer` -Symmetric private key decryption using secret (derived) key. - -**Kind**: inner method of [`@aeternity/aepp-sdk/es/utils/keystore`](#module_@aeternity/aepp-sdk/es/utils/keystore) -**Returns**: `buffer` - Decrypted data. - -| Param | Type | Description | -| --- | --- | --- | -| ciphertext | `buffer` \| `Uint8Array` | Data to be decrypted. | -| key | `buffer` \| `Uint8Array` | Secret key. | -| nonce | `buffer` \| `Uint8Array` | Nonce from key-object. | -| [algo] | `string` | Encryption algorithm. | - - - -### @aeternity/aepp-sdk/es/utils/keystore~deriveKey(password, nonce, [options]) ⇒ `buffer` -Derive secret key from password with key derivation function. - -**Kind**: inner method of [`@aeternity/aepp-sdk/es/utils/keystore`](#module_@aeternity/aepp-sdk/es/utils/keystore) -**Returns**: `buffer` - Secret key derived from password. - -| Param | Type | Description | -| --- | --- | --- | -| password | `string` | User-supplied password. | -| nonce | `buffer` \| `Uint8Array` | Randomly generated nonce. | -| [options] | `Object` | Encryption parameters. | -| [options.kdf] | `string` | Key derivation function (default: DEFAULTS.crypto.kdf). | -| [options.kdf_params] | `Object` | KDF parameters (default: DEFAULTS.crypto.kdf_params). | - - - -### @aeternity/aepp-sdk/es/utils/keystore~marshal(name, derivedKey, privateKey, nonce, salt, [options]) ⇒ `Object` -Assemble key data object in secret-storage format. - -**Kind**: inner method of [`@aeternity/aepp-sdk/es/utils/keystore`](#module_@aeternity/aepp-sdk/es/utils/keystore) - -| Param | Type | Description | -| --- | --- | --- | -| name | `buffer` | Key name. | -| derivedKey | `buffer` | Password-derived secret key. | -| privateKey | `buffer` | Private key. | -| nonce | `buffer` | Randomly generated 24byte nonce. | -| salt | `buffer` | Randomly generated 16byte salt. | -| [options] | `Object` | Encryption parameters. | -| [options.kdf] | `string` | Key derivation function (default: argon2id). | -| [options.cipher] | `string` | Symmetric cipher (default: constants.cipher). | -| [options.kdf_params] | `Object` | KDF parameters (default: constants.). | - diff --git a/docs/api/utils/swagger.md b/docs/api/utils/swagger.md deleted file mode 100644 index dbb3bc22dc..0000000000 --- a/docs/api/utils/swagger.md +++ /dev/null @@ -1,293 +0,0 @@ - - -## @aeternity/aepp-sdk/es/utils/swagger -Swagger module - -**Example** -```js -import Swagger from '@aeternity/aepp-sdk/es/utils/swagger' -``` - -* [@aeternity/aepp-sdk/es/utils/swagger](#module_@aeternity/aepp-sdk/es/utils/swagger) - * [Swagger(options)](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) ⇒ `Object` ⏏ - * _static_ - * [.expandPath(s)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger.expandPath) ⇒ `String` - * [.conform(value, spec, types)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger.conform) ⇒ `Object` - * [.traverseKeys(fn, o)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger.traverseKeys) ⇒ `Object` - * [.snakizeKeys(o)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger.snakizeKeys) ⇒ `Object` - * [.pascalizeKeys(o)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger.pascalizeKeys) ⇒ `Object` - * [.assertOne(coll)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger.assertOne) ⇒ `Object` - * [.operation(path, method, definition, types)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger.operation) ⇒ `function` - * [.debugSwagger(bool)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger.debugSwagger) ⇒ `Stamp` - * _inner_ - * [~conformTypes](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger..conformTypes) - * [~lookupType(path, spec, types)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger..lookupType) ⇒ `Object` - * [~extendingErrorPath(key, fn)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger..extendingErrorPath) ⇒ `Any` - * [~TypeError(msg, spec, value)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger..TypeError) ⇒ `Error` - * [~conformDispatch(spec)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger..conformDispatch) ⇒ `String` - * [~classifyParameters(parameters)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger..classifyParameters) ⇒ `Array.<Object>` - * [~pascalizeParameters(parameters)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger..pascalizeParameters) ⇒ `Array.<Object>` - * [~operationSignature(name, req, opts)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger..operationSignature) ⇒ `String` - * [~destructureClientError(error)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger..destructureClientError) ⇒ `String` - * [~resolveRef(ref, swag)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger..resolveRef) ⇒ `Object` - - - -### Swagger(options) ⇒ `Object` ⏏ -Swagger Stamp - -**Kind**: Exported function -**Returns**: `Object` - Account instance -**rtype**: `Stamp` - -| Param | Type | Description | -| --- | --- | --- | -| options | `Object` | Initializer object | -| options.swag | `Object` | Swagger definition | -| options.axiosConfig | `Object` | Object with axios configuration. Example { config: {}, errorHandler: (err) => throw err } | - -**Example** -```js -Swagger({swag}) -``` - - -#### Swagger.expandPath(s) ⇒ `String` -Perform path string interpolation - -**Kind**: static method of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) -**Returns**: `String` - Converted string -**rtype**: `(path: String, replacements: Object) => String` - -| Param | Type | Description | -| --- | --- | --- | -| s | `String` | String to convert | - - - -#### Swagger.conform(value, spec, types) ⇒ `Object` -Conform `value` against its `spec` - -**Kind**: static method of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) -**Returns**: `Object` - Conformed value -**rtype**: `(value: Any, spec: Object, types: Object) => Any, throws: Error` - -| Param | Type | Description | -| --- | --- | --- | -| value | `Object` | Value to conform (validate and transform) | -| spec | `Object` | Specification object | -| types | `Object` | Types specification | - - - -#### Swagger.traverseKeys(fn, o) ⇒ `Object` -Key traversal metafunction - -**Kind**: static method of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) -**Returns**: `Object` - Transformed object -**rtype**: `(fn: (s: String) => String) => (o: Object) => Object` - -| Param | Type | Description | -| --- | --- | --- | -| fn | `function` | Key transformation function | -| o | `Object` | Object to traverse | - - - -#### Swagger.snakizeKeys(o) ⇒ `Object` -snake_case key traversal - -**Kind**: static method of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) -**Returns**: `Object` - Transformed object -**rtype**: `(o: Object) => Object` -**See**: pascalToSnake - -| Param | Type | Description | -| --- | --- | --- | -| o | `Object` | Object to traverse | - - - -#### Swagger.pascalizeKeys(o) ⇒ `Object` -PascalCase key traversal - -**Kind**: static method of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) -**Returns**: `Object` - Transformed object -**rtype**: `(o: Object) => Object` -**See**: snakeToPascal - -| Param | Type | Description | -| --- | --- | --- | -| o | `Object` | Object to traverse | - - - -#### Swagger.assertOne(coll) ⇒ `Object` -Assert that `coll` is a sequence with a length of 1 and extract the only element - -**Kind**: static method of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) -**rtype**: `(coll: [...Any]) => Any, throws: Error` - -| Param | Type | -| --- | --- | -| coll | `Array.<Object>` | - - - -#### Swagger.operation(path, method, definition, types) ⇒ `function` -Generate callable operation - -**Kind**: static method of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) -**rtype**: `(path: String, method: String, definition: Object, types: Object) => (instance: Swagger, url: String) => Promise[Any], throws: Error` - -| Param | Type | Description | -| --- | --- | --- | -| path | `String` | Path to call in URL | -| method | `String` | HTTP method | -| definition | `Object` | Complex definition | -| types | `Object` | Swagger types | - - - -#### Swagger.debugSwagger(bool) ⇒ `Stamp` -Reconfigure Swagger to (not) spill debugging logs - -**Kind**: static method of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) -**Returns**: `Stamp` - Reconfigured Swagger Stamp -**rtype**: `(bool: Boolean) => Stamp` - -| Param | Type | Description | -| --- | --- | --- | -| bool | `boolean` | Whether to debug | - - - -#### Swagger~conformTypes -Per-type [conform](conform) dispatcher - -**Kind**: inner constant of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) -**rtype**: `[(dispatch(value: String, spec: Object, types: Object) => Any, throws: Error)...]` - - -#### Swagger~lookupType(path, spec, types) ⇒ `Object` -Lookup type - -**Kind**: inner method of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) -**Returns**: `Object` - Looked up type definition -**rtype**: `(path: [String...], spec: Object, types: Object) => Object` - -| Param | Type | Description | -| --- | --- | --- | -| path | `Array.<String>` | Path to look up | -| spec | `Object` | | -| types | `Object` | | - - - -#### Swagger~extendingErrorPath(key, fn) ⇒ `Any` -Intercept errors thrown by `fn()`, extending them with information from `key` - -**Kind**: inner method of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) -**Returns**: `Any` - Execution result -**rtype**: `(key: String, fn: Function) => Any` - -| Param | Type | Description | -| --- | --- | --- | -| key | `String` | Information to attach | -| fn | `function` | Thunk | - - - -#### Swagger~TypeError(msg, spec, value) ⇒ `Error` -Construct Error with additional type information (not thrown) - -**Kind**: inner method of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) -**Returns**: `Error` - Enhanced Error -**rtype**: `(msg: String, spec: String, value: String) => Error` - -| Param | Type | Description | -| --- | --- | --- | -| msg | `String` | Error message | -| spec | `String` | | -| value | `String` | | - - - -#### Swagger~conformDispatch(spec) ⇒ `String` -[conform](conform) dispatcher - -**Kind**: inner method of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) -**Returns**: `String` - Value to dispatch on -**rtype**: `(spec: Object) => String, throws: Error` - -| Param | Type | -| --- | --- | -| spec | `Object` | - - - -#### Swagger~classifyParameters(parameters) ⇒ `Array.<Object>` -Classify given `parameters` - -**Kind**: inner method of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) -**Returns**: `Array.<Object>` - Classified parameters -**rtype**: `(parameters: [{required: Boolean, in: String}...]) => {pathArgs: [...Object], queryArgs: [...Object], bodyArgs: [...Object], req: [...Object], opts: [...Object]}` - -| Param | Type | Description | -| --- | --- | --- | -| parameters | `Array.<Object>` | Parameters to classify | - - - -#### Swagger~pascalizeParameters(parameters) ⇒ `Array.<Object>` -Convert `name` attributes in `parameters` from snake_case to PascalCase - -**Kind**: inner method of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) -**Returns**: `Array.<Object>` - Pascalized parameters -**rtype**: `(parameters: [{name: String}...]) => [{name: String}...]` - -| Param | Type | Description | -| --- | --- | --- | -| parameters | `Array.<Object>` | Parameters to pascalize | - - - -#### Swagger~operationSignature(name, req, opts) ⇒ `String` -Obtain readable signature for operation - -**Kind**: inner method of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) -**Returns**: `String` - Signature -**rtype**: `(name: String, req: [...Object], opts: [...Object]) => Object` - -| Param | Type | Description | -| --- | --- | --- | -| name | `String` | Name of operation | -| req | `Array.<Object>` | Required parameters to operation | -| opts | `Array.<Object>` | Optional parameters to operation | - - - -#### Swagger~destructureClientError(error) ⇒ `String` -Destructure HTTP client `error` - -**Kind**: inner method of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) -**rtype**: `(error: Error) => String` - -| Param | Type | -| --- | --- | -| error | `Error` | - - - -#### Swagger~resolveRef(ref, swag) ⇒ `Object` -Resolve reference - -**Kind**: inner method of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) -**Returns**: `Object` - Resolved reference definition -**rtype**: `(ref: String, swag: Object) => Object` - -| Param | Type | Description | -| --- | --- | --- | -| ref | `String` | Reference to resolve | -| swag | `Object` | | - diff --git a/docs/examples/node/aecontract.md b/docs/examples/node/aecontract.md deleted file mode 100644 index 7d4fd7bb5b..0000000000 --- a/docs/examples/node/aecontract.md +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - - - -```js -#!/usr/bin/env node - -``` - - - - - - - -# Simple Sophia Contract Compiler - -This script demonstrates how to deal with the different phases of compiling -Sophia contracts to bytecode, deploying the bytecode to get a callable -contract address and ultimately, invoke the deployed contract on the -æternity blockchain. - - - - -```js -/* - * ISC License (ISC) - * Copyright (c) 2018 aeternity developers - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -'use strict' - - -``` - - - - - - - -We'll need the main client module `Ae` in the `Universal` flavor from the SDK. - - - - -```js -const { Universal: Ae, Node } = require('@aeternity/aepp-sdk') -const program = require('commander') -const fs = require('fs') - -async function exec (infile, fn, args) { - if (!infile || !fn) { - program.outputHelp() - process.exit(1) - } - - const code = fs.readFileSync(infile, 'utf-8') - const node = await Node({ url: program.host }) - -``` - - - - - - - -Most methods in the SDK return _Promises_, so the recommended way of -dealing with subsequent actions is `then` chaining with a final `catch` -callback. - - - - - - - - -`Ae` itself is asynchronous as it determines the node's version and -rest interface automatically. Only once the Promise is fulfilled, we know -we have a working ae client. Please take note `Ae` is not a constructor but -a factory factory, which means it's *not* invoked with `new`. -`contractCompile` takes a raw Sophia contract in string form and sends it -off to the node for bytecode compilation. This might in the future be done -without talking to the node, but requires a bytecode compiler -implementation directly in the SDK. - - - - -```js - Ae({ debug: program.debug, process, nodes: [{ name: 'testNode', instance: node }] }).then(ae => { - return ae.contractCompile(code) - -``` - - - - - - - -Invoking `deploy` on the bytecode object will result in the contract -being written to the chain, once the block has been mined. -Sophia contracts always have an `init` method which needs to be invoked, -even when the contract's `state` is `unit` (`()`). The arguments to -`init` have to be provided at deployment time and will be written to the -block as well, together with the contract's bytecode. - - - - -```js - }).then(bytecode => { - console.log(`Obtained bytecode ${bytecode.bytecode}`) - return bytecode.deploy({ initState: program.init }) - -``` - - - - - - - -Once the contract has been successfully mined, we can attempt to invoke -any public function defined within it. The miner who found the next block -will not only be rewarded a fixed amount, but also an amount depending on -the amount of gas spend. - - - - -```js - }).then(deployed => { - console.log(`Contract deployed at ${deployed.address}`) - return deployed.call(fn, { args: args.join(' ') }) - -``` - - - - - - - -The execution result, if successful, will be an AEVM-encoded result -value. Once type decoding will be implemented in the SDK, this value will -not be a hexadecimal string, anymore. - - - - -```js - }).then(value => { - console.log(`Execution result: ${value}`) - }).catch(e => console.log(e.message)) -} - - -``` - - - - - - - -## Command Line Interface - -The `commander` library provides maximum command line parsing convenience. - - - - -```js -program - .version('0.1.0') - .arguments(' [args...]') - .option('-i, --init [state]', 'Arguments to contructor function') - .option('-H, --host [hostname]', 'Node to connect to', 'http://localhost:3013') - .option('--debug', 'Switch on debugging') - .action(exec) - .parse(process.argv) - - -``` - - - - diff --git a/docs/examples/node/aecrypto.md b/docs/examples/node/aecrypto.md deleted file mode 100644 index 59fd809d83..0000000000 --- a/docs/examples/node/aecrypto.md +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - - - -```js -#!/usr/bin/env node - -``` - - - - - - - -# æternity Crypto Helper Script - -This script shows how to use the SDK to generate and decrypt æternity -compliant key pairs, as well as encode and decode transactions. - - - - -```js -/* - * ISC License (ISC) - * Copyright (c) 2018 aeternity developers - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -'use strict' - - -``` - - - - - - - -We'll only load the `Crypto` module from the SDK to work with keys and -transactions. - - - - -```js -const { Crypto, TxBuilder } = require('@aeternity/aepp-sdk') -const program = require('commander') -const fs = require('fs') -const prompt = require('prompt') -const path = require('path') - - -``` - - - - - - - -The `prompt` library provides concealed input of passwords. - - - - -```js -const promptSchema = { - properties: { - password: { - type: 'string', - description: 'Enter your password', - hidden: true, - required: true, - replace: '*', - conform: function (value) { - return true - } - } - } -} - - -``` - - - - - - - -## Key Extraction (from Node nodes) - - - - -```js -function extractReadableKeys (dir, options) { - const pwd = options.input - prompt.start() - prompt.get(promptSchema, (_, { password }) => { - const key = fs.readFileSync(path.join(pwd, dir, 'sign_key')) - const pubKey = fs.readFileSync(path.join(pwd, dir, 'sign_key.pub')) - - const decrypted = Crypto.decryptPrivateKey(password, key) - - const privateHex = Buffer.from(decrypted).toString('hex') - const decryptedPub = Crypto.decryptPubKey(password, pubKey) - - console.log(`Private key (hex): ${privateHex}`) - console.log(`Public key (base check): ak_${Crypto.encodeBase58Check(decryptedPub)}`) - console.log(`Public key (hex): ${decryptedPub.toString('hex')}`) - }) -} - - -``` - - - - - - - -## Key Pair Generation - - - - -```js -function generateKeyPair (name, { output }) { - const { publicKey, secretKey } = Crypto.generateKeyPair() - - const data = [ - [path.join(output, name), secretKey], - [path.join(output, `${name}.pub`), publicKey] - ] - - data.forEach(([path, data]) => { - fs.writeFileSync(path, data) - console.log(`Wrote ${path}`) - }) -} - - -``` - - - - - - - -## Transaction Signing - -This function shows how to use a compliant private key to sign an æternity -transaction and turn it into an RLP-encoded tuple ready for mining - - - - -```js -function signTx (tx, privKey) { - if (!tx.match(/^tx_.+/)) { - throw Error('Not a valid transaction') - } - - const binaryKey = (() => { - if (program.file) { - return fs.readFileSync(program.file) - } else if (privKey) { - return Buffer.from(privKey, 'hex') - } else { - throw Error('Must provide either [privkey] or [file]') - } - })() - - const decryptedKey = program.password ? Crypto.decryptKey(program.password, binaryKey) : binaryKey - - -``` - - - - - - - -Split the base58Check part of the transaction - - - - -```js - const base58CheckTx = tx.split('_')[1] - -``` - - - - - - - -... and sign the binary create_contract transaction - - - - -```js - const binaryTx = Crypto.decodeBase58Check(base58CheckTx) - - const signature = Crypto.sign(binaryTx, decryptedKey) - - -``` - - - - - - - -the signed tx deserializer expects a 4-tuple: - - - - - -```js - const unpackedSignedTx = [ - Buffer.from([11]), - Buffer.from([1]), - [Buffer.from(signature)], - binaryTx - ] - - console.log(Crypto.encodeTx(unpackedSignedTx)) -} - - -``` - - - - - - - -## Transaction Deserialization - -This helper function deserialized the transaction `tx` and prints the result. - - - - -```js -function unpackTx (tx) { - const deserializedTx = TxBuilder.unpackTx(tx) - console.log(JSON.stringify(deserializedTx, undefined, 2)) -} - - -``` - - - - - - - -## Command Line Interface - -The `commander` library provides maximum command line parsing convenience. - - - - -```js -program.version('0.1.0') - -program - .command('decrypt ') - .description('Decrypts public and private key to readable formats for testing purposes') - .option('-i, --input [directory]', 'Directory where to look for keys', '.') - .action(extractReadableKeys) - -program - .command('genkey ') - .description('Generate keypair') - .option('-o, --output [directory]', 'Output directory for the keys', '.') - .action(generateKeyPair) - -program - .command('sign [privkey]') - .option('-p, --password [password]', 'password of the private key') - .option('-f, --file [file]', 'private key file') - .action(signTx) - -program - .command('unpack ') - .action(unpackTx) - -program.parse(process.argv) -if (program.args.length === 0) program.help() - - -``` - - - - diff --git a/docs/examples/node/aewallet.md b/docs/examples/node/aewallet.md deleted file mode 100644 index c9502f1707..0000000000 --- a/docs/examples/node/aewallet.md +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - -```js -#!/usr/bin/env node - -``` - - - - - - - -# Simple AE Token Spending Script - -This script shows how to use the `Wallet` module from the SDK to send AE to -other addresses. - - - - -```js -/* - * ISC License (ISC) - * Copyright (c) 2018 aeternity developers - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -'use strict' - - -``` - - - - - - - -We'll need the main client module `Ae` in the `Universal` flavor from the SDK. - - - - -```js -const { Universal: Ae, Node } = require('@aeternity/aepp-sdk') -const program = require('commander') - -async function spend (receiver, amount, { host, debug }) { - -``` - - - - - - - -This code is relatively simple: We create the Ae client asynchronously and -invoke the spend method on it. Passing in `process` from nodejs will make -the implementation grab the key pair from the `WALLET_PRIV` and -`WALLET_PUB` environment variables, respectively. - - - - -```js - const node = await Node({ url: host }) - Ae({ nodes: [{ name: 'local', instance: node }], debug, process }) - .then(ae => ae.spend(parseInt(amount), receiver)) - .then(tx => console.log('Transaction mined', tx)) - .catch(e => console.log(e.message)) -} - - -``` - - - - - - - -## Command Line Interface - -The `commander` library provides maximum command line parsing convenience. - - - - -```js -program.version('0.1.0') - -program - .command('spend ') - .option('-H, --host [hostname]', 'Node to connect to', 'http://localhost:3013') - .option('--debug', 'Switch on debugging') - .action(spend) - -program.parse(process.argv) -if (program.args.length === 0) program.help() - - -``` - - - - From 80a6a663d3484519f8aedf6af978ff355a838a0d Mon Sep 17 00:00:00 2001 From: Denis Davidyuk Date: Mon, 6 Jul 2020 12:16:50 +1000 Subject: [PATCH 3/5] Move outdated disclaimer to the root readme --- docs/README.md | 3 +++ docs/api/README.md | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) delete mode 100644 docs/api/README.md diff --git a/docs/README.md b/docs/README.md index 7ffa684972..1bcc6c79f7 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,8 @@ # Guides +## ⚠️ Disclaimer +We're doing our best to keep the documentation up to date, but [please let us know if you see some out-of-date file](https://github.com/aeternity/aepp-sdk-js/issues/new). Thanks! + ## Intro There are three different ways of incorporating aepp-sdk-js into your project, depending on the particular scenario: * ES Modules at `es/` (recommended) diff --git a/docs/api/README.md b/docs/api/README.md deleted file mode 100644 index a59055f5a7..0000000000 --- a/docs/api/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# ⚠️ Disclaimer -We're doing our best to keep the API documentation up to date, but [please let us know if you see some out-of-date file](https://github.com/aeternity/aepp-sdk-js/issues/new). Thanks! From 4a36102d8ac77d0e59541d67d58f7d3d97144fe1 Mon Sep 17 00:00:00 2001 From: Denis Davidyuk Date: Mon, 6 Jul 2020 12:24:14 +1000 Subject: [PATCH 4/5] Docs root: Add link to API reference --- docs/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index 1bcc6c79f7..57dc963654 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,4 +1,4 @@ -# Guides +# JavaScript SDK Documentation ## ⚠️ Disclaimer We're doing our best to keep the documentation up to date, but [please let us know if you see some out-of-date file](https://github.com/aeternity/aepp-sdk-js/issues/new). Thanks! @@ -58,5 +58,7 @@ You can use this URL with any releasee on [npmjs](https://www.npmjs.com/package/ - [How to build Wallet app/extension](guides/how-to-build-an-wallet-app-or-extension.md) - [How to build Aepp](guides/how-to-build-aepp-using-new-wallet-api.md) +## [API Reference](api.md) + ## Examples -Check out our [Examples](../examples/README.md) for more. +Check out our [Examples](examples/README.md) for more. From 7c935a2b45b826a3650115f1021f5cfe0b272b28 Mon Sep 17 00:00:00 2001 From: Denis Davidyuk Date: Mon, 6 Jul 2020 12:48:18 +1000 Subject: [PATCH 5/5] travis: Build docs to gh-pages --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.travis.yml b/.travis.yml index ef5642c297..6954dea7a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,16 @@ jobs: - npm run build - npm run test:unit - npm run report-coverage + - npm run docs:docco + - npm run docs:api + deploy: + - provider: pages + skip_cleanup: true + github_token: $GITHUB_TOKEN + keep_history: true + local_dir: docs + on: + branch: develop - stage: Integration tests name: Channel, accounts script: