@aeternity/aepp-sdk 13.0.0-alpha.0 → 13.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/aesophia_cli +0 -0
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +1 -1
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +4206 -1127
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdkBase.d.ts +3 -3
- package/es/AeSdkBase.mjs +4 -0
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkMethods.d.ts +3 -4
- package/es/AeSdkMethods.mjs.map +1 -1
- package/es/Node.d.ts +4 -3
- package/es/Node.mjs +1 -1
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +2 -2
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Generalized.mjs +5 -3
- package/es/account/Generalized.mjs.map +1 -1
- package/es/account/Ledger.mjs +2 -1
- package/es/account/Ledger.mjs.map +1 -1
- package/es/account/Memory.mjs +2 -1
- package/es/account/Memory.mjs.map +1 -1
- package/es/aens.d.ts +1 -1
- package/es/aens.mjs +5 -1
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +1 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +19 -4
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/chain.d.ts +9 -1
- package/es/chain.mjs +4 -1
- package/es/chain.mjs.map +1 -1
- package/es/channel/Base.d.ts +6 -1
- package/es/channel/Base.mjs +9 -6
- package/es/channel/Base.mjs.map +1 -1
- package/es/channel/Contract.d.ts +8 -7
- package/es/channel/Contract.mjs +1 -1
- package/es/channel/Contract.mjs.map +1 -1
- package/es/channel/Spend.d.ts +3 -1
- package/es/channel/Spend.mjs +4 -2
- package/es/channel/Spend.mjs.map +1 -1
- package/es/channel/handlers.mjs +11 -9
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/internal.mjs +3 -1
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Contract.d.ts +21 -46
- package/es/contract/Contract.mjs +69 -52
- package/es/contract/Contract.mjs.map +1 -1
- package/es/contract/compiler/Base.d.ts +81 -0
- package/es/contract/compiler/Base.mjs +5 -0
- package/es/contract/compiler/Base.mjs.map +1 -0
- package/es/contract/compiler/Cli.d.ts +23 -0
- package/es/contract/compiler/Cli.mjs +155 -0
- package/es/contract/compiler/Cli.mjs.map +1 -0
- package/es/contract/compiler/Http.d.ts +32 -0
- package/es/contract/{CompilerHttp.mjs → compiler/Http.mjs} +64 -9
- package/es/contract/compiler/Http.mjs.map +1 -0
- package/es/contract/compiler/HttpNode.d.ts +17 -0
- package/es/contract/compiler/HttpNode.mjs +26 -0
- package/es/contract/compiler/HttpNode.mjs.map +1 -0
- package/es/contract/compiler/getFileSystem.d.ts +6 -0
- package/es/contract/compiler/getFileSystem.mjs +40 -0
- package/es/contract/compiler/getFileSystem.mjs.map +1 -0
- package/es/contract/ga.d.ts +5 -4
- package/es/contract/ga.mjs +11 -2
- package/es/contract/ga.mjs.map +1 -1
- package/es/index-browser.d.ts +39 -0
- package/es/index-browser.mjs +55 -0
- package/es/index-browser.mjs.map +1 -0
- package/es/index.d.ts +4 -38
- package/es/index.mjs +4 -53
- package/es/index.mjs.map +1 -1
- package/es/oracle.mjs +1 -1
- package/es/oracle.mjs.map +1 -1
- package/es/spend.mjs +1 -3
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/constants.d.ts +28 -1
- package/es/tx/builder/constants.mjs +32 -3
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/field-types/abi-version.d.ts +10 -0
- package/es/tx/builder/field-types/abi-version.mjs +20 -0
- package/es/tx/builder/field-types/abi-version.mjs.map +1 -0
- package/es/tx/builder/field-types/address.d.ts +5 -6
- package/es/tx/builder/field-types/address.mjs +17 -8
- package/es/tx/builder/field-types/address.mjs.map +1 -1
- package/es/tx/builder/field-types/array.d.ts +7 -0
- package/es/tx/builder/field-types/array.mjs +11 -0
- package/es/tx/builder/field-types/array.mjs.map +1 -0
- package/es/tx/builder/field-types/boolean.d.ts +6 -0
- package/es/tx/builder/field-types/boolean.mjs +13 -0
- package/es/tx/builder/field-types/boolean.mjs.map +1 -0
- package/es/tx/builder/field-types/coin-amount.d.ts +1 -1
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
- package/es/tx/builder/field-types/ct-version.d.ts +30 -0
- package/es/tx/builder/field-types/ct-version.mjs +48 -0
- package/es/tx/builder/field-types/ct-version.mjs.map +1 -0
- package/es/tx/builder/field-types/deposit.d.ts +1 -1
- package/es/tx/builder/field-types/deposit.mjs.map +1 -1
- package/es/tx/builder/field-types/encoded.d.ts +6 -0
- package/es/tx/builder/field-types/encoded.mjs +21 -0
- package/es/tx/builder/field-types/encoded.mjs.map +1 -0
- package/es/tx/builder/field-types/entry.d.ts +11 -0
- package/es/tx/builder/field-types/entry.mjs +31 -0
- package/es/tx/builder/field-types/entry.mjs.map +1 -0
- package/es/tx/builder/field-types/enumeration.d.ts +5 -3
- package/es/tx/builder/field-types/enumeration.mjs +11 -2
- package/es/tx/builder/field-types/enumeration.mjs.map +1 -1
- package/es/tx/builder/field-types/fee.d.ts +10 -7
- package/es/tx/builder/field-types/fee.mjs +24 -20
- package/es/tx/builder/field-types/fee.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-limit.d.ts +5 -2
- package/es/tx/builder/field-types/gas-limit.mjs +9 -6
- package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-price.d.ts +1 -1
- package/es/tx/builder/field-types/index.d.ts +66 -28
- package/es/tx/builder/field-types/index.mjs +30 -12
- package/es/tx/builder/field-types/index.mjs.map +1 -1
- package/es/tx/builder/field-types/mptree.d.ts +37 -0
- package/es/tx/builder/field-types/mptree.mjs +268 -0
- package/es/tx/builder/field-types/mptree.mjs.map +1 -0
- package/es/tx/builder/field-types/name-fee.d.ts +1 -2
- package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
- package/es/tx/builder/field-types/name-id.mjs +2 -1
- package/es/tx/builder/field-types/name-id.mjs.map +1 -1
- package/es/tx/builder/field-types/pointers.mjs +2 -2
- package/es/tx/builder/field-types/pointers.mjs.map +1 -1
- package/es/tx/builder/field-types/raw.d.ts +6 -0
- package/es/tx/builder/field-types/raw.mjs +13 -0
- package/es/tx/builder/field-types/raw.mjs.map +1 -0
- package/es/tx/builder/field-types/short-u-int-const.d.ts +5 -0
- package/es/tx/builder/field-types/short-u-int-const.mjs +16 -0
- package/es/tx/builder/field-types/short-u-int-const.mjs.map +1 -0
- package/es/tx/builder/field-types/string.d.ts +6 -0
- package/es/tx/builder/field-types/string.mjs +10 -0
- package/es/tx/builder/field-types/string.mjs.map +1 -0
- package/es/tx/builder/field-types/u-int.d.ts +1 -2
- package/es/tx/builder/field-types/u-int.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +11 -29
- package/es/tx/builder/index.mjs +50 -211
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +2111 -571
- package/es/tx/builder/schema.mjs +57 -125
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/index.d.ts +5 -20
- package/es/tx/index.mjs +31 -88
- package/es/tx/index.mjs.map +1 -1
- package/es/tx/validator.d.ts +3 -5
- package/es/tx/validator.mjs +82 -95
- package/es/tx/validator.mjs.map +1 -1
- package/es/utils/bytes.mjs +1 -1
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/errors.d.ts +3 -8
- package/es/utils/errors.mjs +1 -11
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/other.d.ts +1 -1
- package/package.json +35 -27
- package/src/AeSdkBase.ts +6 -3
- package/src/AeSdkMethods.ts +3 -4
- package/src/Node.ts +6 -3
- package/src/account/Base.ts +2 -2
- package/src/account/Generalized.ts +2 -2
- package/src/account/Ledger.ts +1 -1
- package/src/account/Memory.ts +1 -1
- package/src/aens.ts +3 -2
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +18 -7
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +2 -2
- package/src/chain.ts +5 -3
- package/src/channel/Base.ts +13 -5
- package/src/channel/Contract.ts +11 -10
- package/src/channel/Spend.ts +7 -2
- package/src/channel/handlers.ts +10 -9
- package/src/channel/internal.ts +1 -1
- package/src/contract/Contract.ts +69 -79
- package/src/contract/compiler/Base.ts +94 -0
- package/src/contract/compiler/Cli.ts +134 -0
- package/src/contract/compiler/Http.ts +124 -0
- package/src/contract/compiler/HttpNode.ts +26 -0
- package/src/contract/compiler/getFileSystem.ts +42 -0
- package/src/contract/ga.ts +9 -6
- package/src/index-browser.ts +58 -0
- package/src/index.ts +4 -56
- package/src/oracle.ts +1 -1
- package/src/spend.ts +1 -1
- package/src/tx/builder/constants.ts +32 -3
- package/src/tx/builder/field-types/abi-version.ts +21 -0
- package/src/tx/builder/field-types/address.ts +23 -13
- package/src/tx/builder/field-types/array.ts +19 -0
- package/src/tx/builder/field-types/boolean.ts +9 -0
- package/src/tx/builder/field-types/coin-amount.ts +2 -1
- package/src/tx/builder/field-types/ct-version.ts +50 -0
- package/src/tx/builder/field-types/deposit.ts +1 -1
- package/src/tx/builder/field-types/encoded.ts +27 -0
- package/src/tx/builder/field-types/entry.ts +31 -0
- package/src/tx/builder/field-types/enumeration.ts +15 -4
- package/src/tx/builder/field-types/fee.ts +38 -18
- package/src/tx/builder/field-types/gas-limit.ts +12 -7
- package/src/tx/builder/field-types/index.ts +46 -17
- package/src/tx/builder/field-types/mptree.ts +242 -0
- package/src/tx/builder/field-types/name-fee.ts +1 -2
- package/src/tx/builder/field-types/name-id.ts +1 -1
- package/src/tx/builder/field-types/pointers.ts +2 -2
- package/src/tx/builder/field-types/raw.ts +9 -0
- package/src/tx/builder/field-types/short-u-int-const.ts +20 -0
- package/src/tx/builder/field-types/string.ts +11 -0
- package/src/tx/builder/field-types/u-int.ts +1 -3
- package/src/tx/builder/index.ts +63 -247
- package/src/tx/builder/schema.ts +273 -323
- package/src/tx/index.ts +37 -104
- package/src/tx/validator.ts +72 -95
- package/src/utils/bytes.ts +1 -1
- package/src/utils/errors.ts +4 -13
- package/types-legacy/ts4.2/AeSdkBase.d.ts +3 -3
- package/types-legacy/ts4.2/AeSdkMethods.d.ts +3 -4
- package/types-legacy/ts4.2/Node.d.ts +3 -3
- package/types-legacy/ts4.2/account/Base.d.ts +2 -2
- package/types-legacy/ts4.2/aens.d.ts +1 -1
- package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserRuntime.d.ts +1 -0
- package/types-legacy/ts4.2/chain.d.ts +9 -1
- package/types-legacy/ts4.2/channel/Base.d.ts +6 -1
- package/types-legacy/ts4.2/channel/Contract.d.ts +8 -7
- package/types-legacy/ts4.2/channel/Spend.d.ts +3 -1
- package/types-legacy/ts4.2/contract/Contract.d.ts +21 -46
- package/types-legacy/ts4.2/contract/compiler/Base.d.ts +81 -0
- package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +23 -0
- package/types-legacy/ts4.2/contract/compiler/Http.d.ts +32 -0
- package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +17 -0
- package/types-legacy/ts4.2/contract/compiler/getFileSystem.d.ts +6 -0
- package/types-legacy/ts4.2/contract/ga.d.ts +5 -4
- package/types-legacy/ts4.2/index-browser.d.ts +39 -0
- package/types-legacy/ts4.2/index.d.ts +4 -38
- package/types-legacy/ts4.2/tx/builder/constants.d.ts +28 -1
- package/types-legacy/ts4.2/tx/builder/field-types/abi-version.d.ts +10 -0
- package/types-legacy/ts4.2/tx/builder/field-types/address.d.ts +11 -12
- package/types-legacy/ts4.2/tx/builder/field-types/array.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/field-types/boolean.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/ct-version.d.ts +42 -0
- package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/encoded.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/entry.d.ts +11 -0
- package/types-legacy/ts4.2/tx/builder/field-types/enumeration.d.ts +5 -3
- package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +10 -7
- package/types-legacy/ts4.2/tx/builder/field-types/gas-limit.d.ts +5 -2
- package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +72 -28
- package/types-legacy/ts4.2/tx/builder/field-types/mptree.d.ts +43 -0
- package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +1 -2
- package/types-legacy/ts4.2/tx/builder/field-types/raw.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/short-u-int-const.d.ts +5 -0
- package/types-legacy/ts4.2/tx/builder/field-types/string.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/u-int.d.ts +1 -2
- package/types-legacy/ts4.2/tx/builder/index.d.ts +11 -29
- package/types-legacy/ts4.2/tx/builder/schema.d.ts +2380 -668
- package/types-legacy/ts4.2/tx/index.d.ts +5 -20
- package/types-legacy/ts4.2/tx/validator.d.ts +3 -5
- package/types-legacy/ts4.2/utils/errors.d.ts +3 -8
- package/types-legacy/ts4.2/utils/other.d.ts +1 -1
- package/types-legacy/ts4.5/AeSdkBase.d.ts +3 -3
- package/types-legacy/ts4.5/AeSdkMethods.d.ts +3 -4
- package/types-legacy/ts4.5/Node.d.ts +3 -3
- package/types-legacy/ts4.5/account/Base.d.ts +2 -2
- package/types-legacy/ts4.5/aens.d.ts +1 -1
- package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserRuntime.d.ts +1 -0
- package/types-legacy/ts4.5/chain.d.ts +9 -1
- package/types-legacy/ts4.5/channel/Base.d.ts +6 -1
- package/types-legacy/ts4.5/channel/Contract.d.ts +8 -7
- package/types-legacy/ts4.5/channel/Spend.d.ts +3 -1
- package/types-legacy/ts4.5/contract/Contract.d.ts +21 -46
- package/types-legacy/ts4.5/contract/compiler/Base.d.ts +81 -0
- package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +23 -0
- package/types-legacy/ts4.5/contract/compiler/Http.d.ts +32 -0
- package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +17 -0
- package/types-legacy/ts4.5/contract/compiler/getFileSystem.d.ts +6 -0
- package/types-legacy/ts4.5/contract/ga.d.ts +5 -4
- package/types-legacy/ts4.5/index-browser.d.ts +39 -0
- package/types-legacy/ts4.5/index.d.ts +4 -38
- package/types-legacy/ts4.5/tx/builder/constants.d.ts +28 -1
- package/types-legacy/ts4.5/tx/builder/field-types/abi-version.d.ts +10 -0
- package/types-legacy/ts4.5/tx/builder/field-types/address.d.ts +11 -12
- package/types-legacy/ts4.5/tx/builder/field-types/array.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/field-types/boolean.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/ct-version.d.ts +42 -0
- package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/encoded.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/entry.d.ts +11 -0
- package/types-legacy/ts4.5/tx/builder/field-types/enumeration.d.ts +5 -3
- package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +10 -7
- package/types-legacy/ts4.5/tx/builder/field-types/gas-limit.d.ts +5 -2
- package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +72 -28
- package/types-legacy/ts4.5/tx/builder/field-types/mptree.d.ts +43 -0
- package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +1 -2
- package/types-legacy/ts4.5/tx/builder/field-types/raw.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/short-u-int-const.d.ts +5 -0
- package/types-legacy/ts4.5/tx/builder/field-types/string.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/u-int.d.ts +1 -2
- package/types-legacy/ts4.5/tx/builder/index.d.ts +11 -29
- package/types-legacy/ts4.5/tx/builder/schema.d.ts +2380 -668
- package/types-legacy/ts4.5/tx/index.d.ts +5 -20
- package/types-legacy/ts4.5/tx/validator.d.ts +3 -5
- package/types-legacy/ts4.5/utils/errors.d.ts +3 -8
- package/types-legacy/ts4.5/utils/other.d.ts +1 -1
- package/es/contract/CompilerHttp.d.ts +0 -18
- package/es/contract/CompilerHttp.mjs.map +0 -1
- package/es/tx/builder/field-types/addresses.d.ts +0 -6
- package/es/tx/builder/field-types/addresses.mjs +0 -13
- package/es/tx/builder/field-types/addresses.mjs.map +0 -1
- package/es/utils/mptree.d.ts +0 -26
- package/es/utils/mptree.mjs +0 -143
- package/es/utils/mptree.mjs.map +0 -1
- package/src/contract/CompilerHttp.ts +0 -67
- package/src/tx/builder/field-types/addresses.ts +0 -18
- package/src/utils/mptree.ts +0 -145
- package/types-legacy/ts4.2/contract/CompilerHttp.d.ts +0 -18
- package/types-legacy/ts4.2/tx/builder/field-types/addresses.d.ts +0 -6
- package/types-legacy/ts4.2/utils/mptree.d.ts +0 -32
- package/types-legacy/ts4.5/contract/CompilerHttp.d.ts +0 -18
- package/types-legacy/ts4.5/tx/builder/field-types/addresses.d.ts +0 -6
- package/types-legacy/ts4.5/utils/mptree.d.ts +0 -32
package/src/tx/builder/schema.ts
CHANGED
|
@@ -8,12 +8,12 @@ import BigNumber from 'bignumber.js';
|
|
|
8
8
|
import { Tag } from './constants';
|
|
9
9
|
import {
|
|
10
10
|
Field, uInt, shortUInt, coinAmount, name, nameId, nameFee, deposit, gasLimit, gasPrice, fee,
|
|
11
|
-
address,
|
|
11
|
+
address, pointers, entry, enumeration, mptree, shortUIntConst, string, encoded, raw,
|
|
12
|
+
array, boolean, ctVersion, abiVersion,
|
|
12
13
|
} from './field-types';
|
|
13
|
-
import {
|
|
14
|
-
import MPTree from '../../utils/mptree';
|
|
14
|
+
import { Encoding } from '../../utils/encoder';
|
|
15
15
|
import { UnionToIntersection } from '../../utils/other';
|
|
16
|
-
import {
|
|
16
|
+
import { idTagToEncoding } from './field-types/address';
|
|
17
17
|
|
|
18
18
|
export enum ORACLE_TTL_TYPES {
|
|
19
19
|
delta = 0,
|
|
@@ -35,130 +35,18 @@ export const DRY_RUN_ACCOUNT = {
|
|
|
35
35
|
|
|
36
36
|
export type TxField = [
|
|
37
37
|
name: string,
|
|
38
|
-
type:
|
|
39
|
-
prefix?: Encoding | Encoding[],
|
|
38
|
+
type: Field,
|
|
40
39
|
];
|
|
41
40
|
|
|
42
|
-
/**
|
|
43
|
-
* @category transaction builder
|
|
44
|
-
* @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}
|
|
45
|
-
*/
|
|
46
|
-
export enum VM_VERSIONS {
|
|
47
|
-
NO_VM = 0,
|
|
48
|
-
SOPHIA = 1,
|
|
49
|
-
SOPHIA_IMPROVEMENTS_MINERVA = 3,
|
|
50
|
-
SOPHIA_IMPROVEMENTS_FORTUNA = 4,
|
|
51
|
-
FATE = 5,
|
|
52
|
-
SOPHIA_IMPROVEMENTS_LIMA = 6,
|
|
53
|
-
FATE_2 = 7,
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* @category transaction builder
|
|
58
|
-
* @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}
|
|
59
|
-
*/
|
|
60
|
-
export enum ABI_VERSIONS {
|
|
61
|
-
NO_ABI = 0,
|
|
62
|
-
SOPHIA = 1,
|
|
63
|
-
FATE = 3,
|
|
64
|
-
}
|
|
65
|
-
|
|
66
41
|
export enum CallReturnType {
|
|
67
42
|
Ok = 0,
|
|
68
43
|
Error = 1,
|
|
69
44
|
Revert = 2,
|
|
70
45
|
}
|
|
71
46
|
|
|
72
|
-
|
|
73
|
-
* @category transaction builder
|
|
74
|
-
*/
|
|
75
|
-
export enum PROTOCOL_VERSIONS {
|
|
76
|
-
IRIS = 5,
|
|
77
|
-
}
|
|
47
|
+
type TxElem = readonly [string, Field];
|
|
78
48
|
|
|
79
|
-
|
|
80
|
-
export const PROTOCOL_VM_ABI = {
|
|
81
|
-
[PROTOCOL_VERSIONS.IRIS]: {
|
|
82
|
-
[Tag.ContractCreateTx]: {
|
|
83
|
-
vmVersion: [VM_VERSIONS.FATE_2], abiVersion: [ABI_VERSIONS.FATE],
|
|
84
|
-
},
|
|
85
|
-
// TODO: Ensure that AEVM (SOPHIA?) is still available here
|
|
86
|
-
[Tag.ContractCallTx]: {
|
|
87
|
-
vmVersion: [], abiVersion: [ABI_VERSIONS.FATE, ABI_VERSIONS.SOPHIA],
|
|
88
|
-
},
|
|
89
|
-
[Tag.OracleRegisterTx]: {
|
|
90
|
-
vmVersion: [], abiVersion: [ABI_VERSIONS.NO_ABI, ABI_VERSIONS.SOPHIA],
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
} as const;
|
|
94
|
-
|
|
95
|
-
type PrefixType<Prefix> = Prefix extends Encoding
|
|
96
|
-
? Encoded.Generic<Prefix>
|
|
97
|
-
: Prefix extends readonly Encoding[]
|
|
98
|
-
? Encoded.Generic<Prefix[number]>
|
|
99
|
-
: Encoded.Generic<any>;
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* @category transaction builder
|
|
103
|
-
*/
|
|
104
|
-
export interface CtVersion {
|
|
105
|
-
vmVersion: VM_VERSIONS;
|
|
106
|
-
abiVersion: ABI_VERSIONS;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* @category transaction builder
|
|
111
|
-
*/
|
|
112
|
-
export enum FIELD_TYPES {
|
|
113
|
-
string,
|
|
114
|
-
binary,
|
|
115
|
-
bool,
|
|
116
|
-
hex,
|
|
117
|
-
rlpBinary,
|
|
118
|
-
rlpBinaries,
|
|
119
|
-
rawBinary,
|
|
120
|
-
signatures,
|
|
121
|
-
offChainUpdates,
|
|
122
|
-
callStack,
|
|
123
|
-
proofOfInclusion,
|
|
124
|
-
mptrees,
|
|
125
|
-
ctVersion,
|
|
126
|
-
sophiaCodeTypeInfo,
|
|
127
|
-
payload,
|
|
128
|
-
stateTree,
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
interface BuildFieldTypes<Prefix extends undefined | Encoding | readonly Encoding[]> {
|
|
132
|
-
[FIELD_TYPES.string]: string;
|
|
133
|
-
[FIELD_TYPES.binary]: PrefixType<Prefix>;
|
|
134
|
-
[FIELD_TYPES.bool]: Boolean;
|
|
135
|
-
[FIELD_TYPES.hex]: string;
|
|
136
|
-
[FIELD_TYPES.rlpBinary]: any;
|
|
137
|
-
[FIELD_TYPES.rlpBinaries]: any[];
|
|
138
|
-
[FIELD_TYPES.rawBinary]: Uint8Array;
|
|
139
|
-
[FIELD_TYPES.signatures]: Uint8Array[];
|
|
140
|
-
[FIELD_TYPES.offChainUpdates]: any;
|
|
141
|
-
[FIELD_TYPES.callStack]: any;
|
|
142
|
-
[FIELD_TYPES.proofOfInclusion]: any;
|
|
143
|
-
[FIELD_TYPES.mptrees]: MPTree[];
|
|
144
|
-
[FIELD_TYPES.ctVersion]: CtVersion;
|
|
145
|
-
[FIELD_TYPES.sophiaCodeTypeInfo]: any;
|
|
146
|
-
[FIELD_TYPES.payload]: string | undefined;
|
|
147
|
-
[FIELD_TYPES.stateTree]: any;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
type TxElem = readonly [string, FIELD_TYPES | Field]
|
|
151
|
-
| readonly [string, FIELD_TYPES, Encoding | readonly Encoding[]];
|
|
152
|
-
|
|
153
|
-
type BuildTxArgBySchemaType<
|
|
154
|
-
Type extends FIELD_TYPES | Field,
|
|
155
|
-
Prefix extends undefined | Encoding | readonly Encoding[],
|
|
156
|
-
> =
|
|
157
|
-
Type extends Field
|
|
158
|
-
? Parameters<Type['serialize']>[0]
|
|
159
|
-
: Type extends FIELD_TYPES
|
|
160
|
-
? BuildFieldTypes<Prefix>[Type]
|
|
161
|
-
: never;
|
|
49
|
+
type BuildTxArgBySchemaType<Type extends Field> = Parameters<Type['serialize']>[0];
|
|
162
50
|
|
|
163
51
|
type NullablePartial<
|
|
164
52
|
T,
|
|
@@ -169,7 +57,7 @@ type BuildTxArgBySchema<SchemaLine> =
|
|
|
169
57
|
UnionToIntersection<
|
|
170
58
|
SchemaLine extends ReadonlyArray<infer Elem>
|
|
171
59
|
? Elem extends TxElem
|
|
172
|
-
? NullablePartial<{ [k in Elem[0]]: BuildTxArgBySchemaType<Elem[1]
|
|
60
|
+
? NullablePartial<{ [k in Elem[0]]: BuildTxArgBySchemaType<Elem[1]> }>
|
|
173
61
|
: never
|
|
174
62
|
: never
|
|
175
63
|
>;
|
|
@@ -178,60 +66,75 @@ export type RawTxObject<Tx extends TxSchema> = {
|
|
|
178
66
|
[k in keyof Tx]-?: Tx[k] extends BigNumber ? string : Tx[k]
|
|
179
67
|
};
|
|
180
68
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
] as const;
|
|
185
|
-
|
|
69
|
+
/**
|
|
70
|
+
* @see {@link https://github.com/aeternity/protocol/blob/c007deeac4a01e401238412801ac7084ac72d60e/serializations.md#accounts-version-1-basic-accounts}
|
|
71
|
+
*/
|
|
186
72
|
export const TX_SCHEMA = {
|
|
187
73
|
[Tag.Account]: {
|
|
188
74
|
1: [
|
|
189
|
-
|
|
75
|
+
['tag', shortUIntConst(Tag.Account)],
|
|
76
|
+
['version', shortUIntConst(1)],
|
|
190
77
|
['nonce', shortUInt],
|
|
191
78
|
['balance', uInt],
|
|
192
79
|
],
|
|
193
80
|
2: [
|
|
194
|
-
|
|
81
|
+
['tag', shortUIntConst(Tag.Account)],
|
|
82
|
+
['version', shortUIntConst(2)],
|
|
195
83
|
['flags', uInt],
|
|
196
84
|
['nonce', shortUInt],
|
|
197
85
|
['balance', uInt],
|
|
198
|
-
['gaContract', address
|
|
199
|
-
['gaAuthFun',
|
|
86
|
+
['gaContract', address(Encoding.ContractAddress, Encoding.Name)],
|
|
87
|
+
['gaAuthFun', encoded(Encoding.ContractBytearray)],
|
|
200
88
|
],
|
|
201
89
|
},
|
|
202
90
|
[Tag.SignedTx]: {
|
|
203
91
|
1: [
|
|
204
|
-
|
|
205
|
-
['
|
|
206
|
-
['
|
|
92
|
+
['tag', shortUIntConst(Tag.SignedTx)],
|
|
93
|
+
['version', shortUIntConst(1)],
|
|
94
|
+
['signatures', array(raw)],
|
|
95
|
+
['encodedTx', entry()],
|
|
207
96
|
],
|
|
208
97
|
},
|
|
209
98
|
[Tag.SpendTx]: {
|
|
210
99
|
1: [
|
|
211
|
-
|
|
212
|
-
['
|
|
213
|
-
['
|
|
100
|
+
['tag', shortUIntConst(Tag.SpendTx)],
|
|
101
|
+
['version', shortUIntConst(1)],
|
|
102
|
+
['senderId', address(Encoding.AccountAddress)],
|
|
103
|
+
['recipientId', address(Encoding.AccountAddress, Encoding.Name)],
|
|
214
104
|
['amount', coinAmount],
|
|
215
105
|
['fee', fee],
|
|
216
106
|
['ttl', shortUInt],
|
|
217
107
|
['nonce', shortUInt],
|
|
218
|
-
['payload',
|
|
108
|
+
['payload', encoded(Encoding.Bytearray, true)],
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
[Tag.Name]: {
|
|
112
|
+
1: [
|
|
113
|
+
['tag', shortUIntConst(Tag.Name)],
|
|
114
|
+
['version', shortUIntConst(1)],
|
|
115
|
+
['accountId', address(Encoding.AccountAddress)],
|
|
116
|
+
['nameTtl', shortUInt],
|
|
117
|
+
['status', raw],
|
|
118
|
+
['clientTtl', shortUInt],
|
|
119
|
+
['pointers', pointers],
|
|
219
120
|
],
|
|
220
121
|
},
|
|
221
122
|
[Tag.NamePreclaimTx]: {
|
|
222
123
|
1: [
|
|
223
|
-
|
|
224
|
-
['
|
|
124
|
+
['tag', shortUIntConst(Tag.NamePreclaimTx)],
|
|
125
|
+
['version', shortUIntConst(1)],
|
|
126
|
+
['accountId', address(Encoding.AccountAddress)],
|
|
225
127
|
['nonce', shortUInt],
|
|
226
|
-
['commitmentId', address
|
|
128
|
+
['commitmentId', address(Encoding.Commitment)],
|
|
227
129
|
['fee', fee],
|
|
228
130
|
['ttl', shortUInt],
|
|
229
131
|
],
|
|
230
132
|
},
|
|
231
133
|
[Tag.NameClaimTx]: {
|
|
232
134
|
2: [
|
|
233
|
-
|
|
234
|
-
['
|
|
135
|
+
['tag', shortUIntConst(Tag.NameClaimTx)],
|
|
136
|
+
['version', shortUIntConst(2)],
|
|
137
|
+
['accountId', address(Encoding.AccountAddress)],
|
|
235
138
|
['nonce', shortUInt],
|
|
236
139
|
['name', name],
|
|
237
140
|
['nameSalt', uInt],
|
|
@@ -242,8 +145,9 @@ export const TX_SCHEMA = {
|
|
|
242
145
|
},
|
|
243
146
|
[Tag.NameUpdateTx]: {
|
|
244
147
|
1: [
|
|
245
|
-
|
|
246
|
-
['
|
|
148
|
+
['tag', shortUIntConst(Tag.NameUpdateTx)],
|
|
149
|
+
['version', shortUIntConst(1)],
|
|
150
|
+
['accountId', address(Encoding.AccountAddress)],
|
|
247
151
|
['nonce', shortUInt],
|
|
248
152
|
['nameId', nameId],
|
|
249
153
|
['nameTtl', shortUInt],
|
|
@@ -255,19 +159,21 @@ export const TX_SCHEMA = {
|
|
|
255
159
|
},
|
|
256
160
|
[Tag.NameTransferTx]: {
|
|
257
161
|
1: [
|
|
258
|
-
|
|
259
|
-
['
|
|
162
|
+
['tag', shortUIntConst(Tag.NameTransferTx)],
|
|
163
|
+
['version', shortUIntConst(1)],
|
|
164
|
+
['accountId', address(Encoding.AccountAddress)],
|
|
260
165
|
['nonce', shortUInt],
|
|
261
166
|
['nameId', nameId],
|
|
262
|
-
['recipientId', address
|
|
167
|
+
['recipientId', address(Encoding.AccountAddress, Encoding.Name)],
|
|
263
168
|
['fee', fee],
|
|
264
169
|
['ttl', shortUInt],
|
|
265
170
|
],
|
|
266
171
|
},
|
|
267
172
|
[Tag.NameRevokeTx]: {
|
|
268
173
|
1: [
|
|
269
|
-
|
|
270
|
-
['
|
|
174
|
+
['tag', shortUIntConst(Tag.NameRevokeTx)],
|
|
175
|
+
['version', shortUIntConst(1)],
|
|
176
|
+
['accountId', address(Encoding.AccountAddress)],
|
|
271
177
|
['nonce', shortUInt],
|
|
272
178
|
['nameId', nameId],
|
|
273
179
|
['fee', fee],
|
|
@@ -276,84 +182,102 @@ export const TX_SCHEMA = {
|
|
|
276
182
|
},
|
|
277
183
|
[Tag.Contract]: {
|
|
278
184
|
1: [
|
|
279
|
-
|
|
280
|
-
['
|
|
281
|
-
['
|
|
282
|
-
['
|
|
283
|
-
['
|
|
284
|
-
['
|
|
285
|
-
['
|
|
185
|
+
['tag', shortUIntConst(Tag.Contract)],
|
|
186
|
+
['version', shortUIntConst(1)],
|
|
187
|
+
['owner', address(Encoding.AccountAddress)],
|
|
188
|
+
['ctVersion', ctVersion],
|
|
189
|
+
['code', encoded(Encoding.ContractBytearray)],
|
|
190
|
+
['log', encoded(Encoding.ContractBytearray)],
|
|
191
|
+
['active', boolean],
|
|
192
|
+
['referers', array(address(Encoding.AccountAddress))],
|
|
286
193
|
['deposit', deposit],
|
|
287
194
|
],
|
|
288
195
|
},
|
|
289
196
|
[Tag.ContractCreateTx]: {
|
|
290
197
|
1: [
|
|
291
|
-
|
|
292
|
-
['
|
|
198
|
+
['tag', shortUIntConst(Tag.ContractCreateTx)],
|
|
199
|
+
['version', shortUIntConst(1)],
|
|
200
|
+
['ownerId', address(Encoding.AccountAddress)],
|
|
293
201
|
['nonce', shortUInt],
|
|
294
|
-
['code',
|
|
295
|
-
['ctVersion',
|
|
202
|
+
['code', encoded(Encoding.ContractBytearray)],
|
|
203
|
+
['ctVersion', ctVersion],
|
|
296
204
|
['fee', fee],
|
|
297
205
|
['ttl', shortUInt],
|
|
298
206
|
['deposit', deposit],
|
|
299
207
|
['amount', coinAmount],
|
|
300
208
|
['gasLimit', gasLimit],
|
|
301
209
|
['gasPrice', gasPrice],
|
|
302
|
-
['callData',
|
|
210
|
+
['callData', encoded(Encoding.ContractBytearray)],
|
|
303
211
|
],
|
|
304
212
|
},
|
|
305
213
|
[Tag.ContractCallTx]: {
|
|
306
214
|
1: [
|
|
307
|
-
|
|
308
|
-
['
|
|
215
|
+
['tag', shortUIntConst(Tag.ContractCallTx)],
|
|
216
|
+
['version', shortUIntConst(1)],
|
|
217
|
+
['callerId', address(Encoding.AccountAddress)],
|
|
309
218
|
['nonce', shortUInt],
|
|
310
|
-
['contractId', address
|
|
311
|
-
['abiVersion',
|
|
219
|
+
['contractId', address(Encoding.ContractAddress, Encoding.Name)],
|
|
220
|
+
['abiVersion', abiVersion],
|
|
312
221
|
['fee', fee],
|
|
313
222
|
['ttl', shortUInt],
|
|
314
223
|
['amount', coinAmount],
|
|
315
224
|
['gasLimit', gasLimit],
|
|
316
225
|
['gasPrice', gasPrice],
|
|
317
|
-
['callData',
|
|
226
|
+
['callData', encoded(Encoding.ContractBytearray)],
|
|
318
227
|
],
|
|
319
228
|
},
|
|
320
229
|
[Tag.ContractCall]: {
|
|
321
230
|
1: [
|
|
322
|
-
|
|
323
|
-
['
|
|
231
|
+
['tag', shortUIntConst(Tag.ContractCall)],
|
|
232
|
+
['version', shortUIntConst(1)],
|
|
233
|
+
['callerId', address(Encoding.AccountAddress)],
|
|
324
234
|
['callerNonce', shortUInt],
|
|
325
235
|
['height', shortUInt],
|
|
326
|
-
['contractId', address
|
|
236
|
+
['contractId', address(Encoding.ContractAddress)],
|
|
327
237
|
['gasPrice', gasPrice],
|
|
328
238
|
['gasUsed', shortUInt],
|
|
329
|
-
['returnValue',
|
|
330
|
-
['returnType', enumeration
|
|
239
|
+
['returnValue', encoded(Encoding.ContractBytearray)],
|
|
240
|
+
['returnType', enumeration(CallReturnType)],
|
|
331
241
|
// TODO: add serialization for
|
|
332
242
|
// <log> :: [ { <address> :: id, [ <topics> :: binary() ], <data> :: binary() } ]
|
|
333
|
-
['log',
|
|
243
|
+
['log', raw],
|
|
244
|
+
],
|
|
245
|
+
},
|
|
246
|
+
[Tag.Oracle]: {
|
|
247
|
+
1: [
|
|
248
|
+
['tag', shortUIntConst(Tag.Oracle)],
|
|
249
|
+
['version', shortUIntConst(1)],
|
|
250
|
+
['accountId', address(Encoding.AccountAddress)],
|
|
251
|
+
['queryFormat', string],
|
|
252
|
+
['responseFormat', string],
|
|
253
|
+
['queryFee', coinAmount],
|
|
254
|
+
['oracleTtlValue', shortUInt],
|
|
255
|
+
['abiVersion', abiVersion],
|
|
334
256
|
],
|
|
335
257
|
},
|
|
336
258
|
[Tag.OracleRegisterTx]: {
|
|
337
259
|
1: [
|
|
338
|
-
|
|
339
|
-
['
|
|
260
|
+
['tag', shortUIntConst(Tag.OracleRegisterTx)],
|
|
261
|
+
['version', shortUIntConst(1)],
|
|
262
|
+
['accountId', address(Encoding.AccountAddress)],
|
|
340
263
|
['nonce', shortUInt],
|
|
341
|
-
['queryFormat',
|
|
342
|
-
['responseFormat',
|
|
264
|
+
['queryFormat', string],
|
|
265
|
+
['responseFormat', string],
|
|
343
266
|
['queryFee', coinAmount],
|
|
344
|
-
['oracleTtlType', enumeration
|
|
267
|
+
['oracleTtlType', enumeration(ORACLE_TTL_TYPES)],
|
|
345
268
|
['oracleTtlValue', shortUInt],
|
|
346
269
|
['fee', fee],
|
|
347
270
|
['ttl', shortUInt],
|
|
348
|
-
['abiVersion',
|
|
271
|
+
['abiVersion', abiVersion],
|
|
349
272
|
],
|
|
350
273
|
},
|
|
351
274
|
[Tag.OracleExtendTx]: {
|
|
352
275
|
1: [
|
|
353
|
-
|
|
354
|
-
['
|
|
276
|
+
['tag', shortUIntConst(Tag.OracleExtendTx)],
|
|
277
|
+
['version', shortUIntConst(1)],
|
|
278
|
+
['oracleId', address(Encoding.OracleAddress, Encoding.Name)],
|
|
355
279
|
['nonce', shortUInt],
|
|
356
|
-
['oracleTtlType', enumeration
|
|
280
|
+
['oracleTtlType', enumeration(ORACLE_TTL_TYPES)],
|
|
357
281
|
['oracleTtlValue', shortUInt],
|
|
358
282
|
['fee', fee],
|
|
359
283
|
['ttl', shortUInt],
|
|
@@ -361,15 +285,16 @@ export const TX_SCHEMA = {
|
|
|
361
285
|
},
|
|
362
286
|
[Tag.OracleQueryTx]: {
|
|
363
287
|
1: [
|
|
364
|
-
|
|
365
|
-
['
|
|
288
|
+
['tag', shortUIntConst(Tag.OracleQueryTx)],
|
|
289
|
+
['version', shortUIntConst(1)],
|
|
290
|
+
['senderId', address(Encoding.AccountAddress)],
|
|
366
291
|
['nonce', shortUInt],
|
|
367
|
-
['oracleId', address
|
|
368
|
-
['query',
|
|
292
|
+
['oracleId', address(Encoding.OracleAddress, Encoding.Name)],
|
|
293
|
+
['query', string],
|
|
369
294
|
['queryFee', coinAmount],
|
|
370
|
-
['queryTtlType', enumeration
|
|
295
|
+
['queryTtlType', enumeration(ORACLE_TTL_TYPES)],
|
|
371
296
|
['queryTtlValue', shortUInt],
|
|
372
|
-
['responseTtlType', enumeration
|
|
297
|
+
['responseTtlType', enumeration(ORACLE_TTL_TYPES)],
|
|
373
298
|
['responseTtlValue', shortUInt],
|
|
374
299
|
['fee', fee],
|
|
375
300
|
['ttl', shortUInt],
|
|
@@ -377,12 +302,13 @@ export const TX_SCHEMA = {
|
|
|
377
302
|
},
|
|
378
303
|
[Tag.OracleResponseTx]: {
|
|
379
304
|
1: [
|
|
380
|
-
|
|
381
|
-
['
|
|
305
|
+
['tag', shortUIntConst(Tag.OracleResponseTx)],
|
|
306
|
+
['version', shortUIntConst(1)],
|
|
307
|
+
['oracleId', address(Encoding.OracleAddress)],
|
|
382
308
|
['nonce', shortUInt],
|
|
383
|
-
['queryId',
|
|
384
|
-
['response',
|
|
385
|
-
['responseTtlType', enumeration
|
|
309
|
+
['queryId', encoded(Encoding.OracleQueryId)],
|
|
310
|
+
['response', string],
|
|
311
|
+
['responseTtlType', enumeration(ORACLE_TTL_TYPES)],
|
|
386
312
|
['responseTtlValue', shortUInt],
|
|
387
313
|
['fee', fee],
|
|
388
314
|
['ttl', shortUInt],
|
|
@@ -390,26 +316,28 @@ export const TX_SCHEMA = {
|
|
|
390
316
|
},
|
|
391
317
|
[Tag.ChannelCreateTx]: {
|
|
392
318
|
2: [
|
|
393
|
-
|
|
394
|
-
['
|
|
319
|
+
['tag', shortUIntConst(Tag.ChannelCreateTx)],
|
|
320
|
+
['version', shortUIntConst(2)],
|
|
321
|
+
['initiator', address(Encoding.AccountAddress)],
|
|
395
322
|
['initiatorAmount', uInt],
|
|
396
|
-
['responder', address
|
|
323
|
+
['responder', address(Encoding.AccountAddress)],
|
|
397
324
|
['responderAmount', uInt],
|
|
398
325
|
['channelReserve', uInt],
|
|
399
326
|
['lockPeriod', uInt],
|
|
400
327
|
['ttl', shortUInt],
|
|
401
328
|
['fee', fee],
|
|
402
|
-
['initiatorDelegateIds',
|
|
403
|
-
['responderDelegateIds',
|
|
404
|
-
['stateHash',
|
|
329
|
+
['initiatorDelegateIds', array(address(...idTagToEncoding))],
|
|
330
|
+
['responderDelegateIds', array(address(...idTagToEncoding))],
|
|
331
|
+
['stateHash', encoded(Encoding.State)],
|
|
405
332
|
['nonce', shortUInt],
|
|
406
333
|
],
|
|
407
334
|
},
|
|
408
335
|
[Tag.ChannelCloseMutualTx]: {
|
|
409
336
|
1: [
|
|
410
|
-
|
|
411
|
-
['
|
|
412
|
-
['
|
|
337
|
+
['tag', shortUIntConst(Tag.ChannelCloseMutualTx)],
|
|
338
|
+
['version', shortUIntConst(1)],
|
|
339
|
+
['channelId', address(Encoding.Channel)],
|
|
340
|
+
['fromId', address(Encoding.AccountAddress)],
|
|
413
341
|
['initiatorAmountFinal', uInt],
|
|
414
342
|
['responderAmountFinal', uInt],
|
|
415
343
|
['ttl', shortUInt],
|
|
@@ -419,11 +347,12 @@ export const TX_SCHEMA = {
|
|
|
419
347
|
},
|
|
420
348
|
[Tag.ChannelCloseSoloTx]: {
|
|
421
349
|
1: [
|
|
422
|
-
|
|
423
|
-
['
|
|
424
|
-
['
|
|
425
|
-
['
|
|
426
|
-
['
|
|
350
|
+
['tag', shortUIntConst(Tag.ChannelCloseSoloTx)],
|
|
351
|
+
['version', shortUIntConst(1)],
|
|
352
|
+
['channelId', address(Encoding.Channel)],
|
|
353
|
+
['fromId', address(Encoding.AccountAddress)],
|
|
354
|
+
['payload', encoded(Encoding.Transaction)],
|
|
355
|
+
['poi', entry(Tag.TreesPoi)],
|
|
427
356
|
['ttl', shortUInt],
|
|
428
357
|
['fee', fee],
|
|
429
358
|
['nonce', shortUInt],
|
|
@@ -431,11 +360,12 @@ export const TX_SCHEMA = {
|
|
|
431
360
|
},
|
|
432
361
|
[Tag.ChannelSlashTx]: {
|
|
433
362
|
1: [
|
|
434
|
-
|
|
435
|
-
['
|
|
436
|
-
['
|
|
437
|
-
['
|
|
438
|
-
['
|
|
363
|
+
['tag', shortUIntConst(Tag.ChannelSlashTx)],
|
|
364
|
+
['version', shortUIntConst(1)],
|
|
365
|
+
['channelId', address(Encoding.Channel)],
|
|
366
|
+
['fromId', address(Encoding.AccountAddress)],
|
|
367
|
+
['payload', encoded(Encoding.Transaction)],
|
|
368
|
+
['poi', entry(Tag.TreesPoi)],
|
|
439
369
|
['ttl', shortUInt],
|
|
440
370
|
['fee', fee],
|
|
441
371
|
['nonce', shortUInt],
|
|
@@ -443,35 +373,38 @@ export const TX_SCHEMA = {
|
|
|
443
373
|
},
|
|
444
374
|
[Tag.ChannelDepositTx]: {
|
|
445
375
|
1: [
|
|
446
|
-
|
|
447
|
-
['
|
|
448
|
-
['
|
|
376
|
+
['tag', shortUIntConst(Tag.ChannelDepositTx)],
|
|
377
|
+
['version', shortUIntConst(1)],
|
|
378
|
+
['channelId', address(Encoding.Channel)],
|
|
379
|
+
['fromId', address(Encoding.AccountAddress)],
|
|
449
380
|
['amount', uInt],
|
|
450
381
|
['ttl', shortUInt],
|
|
451
382
|
['fee', fee],
|
|
452
|
-
['stateHash',
|
|
383
|
+
['stateHash', encoded(Encoding.State)],
|
|
453
384
|
['round', shortUInt],
|
|
454
385
|
['nonce', shortUInt],
|
|
455
386
|
],
|
|
456
387
|
},
|
|
457
388
|
[Tag.ChannelWithdrawTx]: {
|
|
458
389
|
1: [
|
|
459
|
-
|
|
460
|
-
['
|
|
461
|
-
['
|
|
390
|
+
['tag', shortUIntConst(Tag.ChannelWithdrawTx)],
|
|
391
|
+
['version', shortUIntConst(1)],
|
|
392
|
+
['channelId', address(Encoding.Channel)],
|
|
393
|
+
['toId', address(Encoding.AccountAddress)],
|
|
462
394
|
['amount', uInt],
|
|
463
395
|
['ttl', shortUInt],
|
|
464
396
|
['fee', fee],
|
|
465
|
-
['stateHash',
|
|
397
|
+
['stateHash', encoded(Encoding.State)],
|
|
466
398
|
['round', shortUInt],
|
|
467
399
|
['nonce', shortUInt],
|
|
468
400
|
],
|
|
469
401
|
},
|
|
470
402
|
[Tag.ChannelSettleTx]: {
|
|
471
403
|
1: [
|
|
472
|
-
|
|
473
|
-
['
|
|
474
|
-
['
|
|
404
|
+
['tag', shortUIntConst(Tag.ChannelSettleTx)],
|
|
405
|
+
['version', shortUIntConst(1)],
|
|
406
|
+
['channelId', address(Encoding.Channel)],
|
|
407
|
+
['fromId', address(Encoding.AccountAddress)],
|
|
475
408
|
['initiatorAmountFinal', uInt],
|
|
476
409
|
['responderAmountFinal', uInt],
|
|
477
410
|
['ttl', shortUInt],
|
|
@@ -481,14 +414,15 @@ export const TX_SCHEMA = {
|
|
|
481
414
|
},
|
|
482
415
|
[Tag.ChannelForceProgressTx]: {
|
|
483
416
|
1: [
|
|
484
|
-
|
|
485
|
-
['
|
|
486
|
-
['
|
|
487
|
-
['
|
|
417
|
+
['tag', shortUIntConst(Tag.ChannelForceProgressTx)],
|
|
418
|
+
['version', shortUIntConst(1)],
|
|
419
|
+
['channelId', address(Encoding.Channel)],
|
|
420
|
+
['fromId', address(Encoding.AccountAddress)],
|
|
421
|
+
['payload', encoded(Encoding.Transaction)],
|
|
488
422
|
['round', shortUInt],
|
|
489
|
-
['update',
|
|
490
|
-
['stateHash',
|
|
491
|
-
['offChainTrees',
|
|
423
|
+
['update', encoded(Encoding.ContractBytearray)],
|
|
424
|
+
['stateHash', encoded(Encoding.State)],
|
|
425
|
+
['offChainTrees', encoded(Encoding.StateTrees)],
|
|
492
426
|
['ttl', shortUInt],
|
|
493
427
|
['fee', fee],
|
|
494
428
|
['nonce', shortUInt],
|
|
@@ -496,38 +430,41 @@ export const TX_SCHEMA = {
|
|
|
496
430
|
},
|
|
497
431
|
[Tag.ChannelOffChainTx]: {
|
|
498
432
|
2: [
|
|
499
|
-
|
|
500
|
-
['
|
|
433
|
+
['tag', shortUIntConst(Tag.ChannelOffChainTx)],
|
|
434
|
+
['version', shortUIntConst(2)],
|
|
435
|
+
['channelId', address(Encoding.Channel)],
|
|
501
436
|
['round', shortUInt],
|
|
502
|
-
['stateHash',
|
|
437
|
+
['stateHash', encoded(Encoding.State)],
|
|
503
438
|
],
|
|
504
439
|
},
|
|
505
440
|
[Tag.Channel]: {
|
|
506
441
|
3: [
|
|
507
|
-
|
|
508
|
-
['
|
|
509
|
-
['
|
|
442
|
+
['tag', shortUIntConst(Tag.Channel)],
|
|
443
|
+
['version', shortUIntConst(3)],
|
|
444
|
+
['initiator', address(Encoding.AccountAddress)],
|
|
445
|
+
['responder', address(Encoding.AccountAddress)],
|
|
510
446
|
['channelAmount', uInt],
|
|
511
447
|
['initiatorAmount', uInt],
|
|
512
448
|
['responderAmount', uInt],
|
|
513
449
|
['channelReserve', uInt],
|
|
514
|
-
['initiatorDelegateIds',
|
|
515
|
-
['responderDelegateIds',
|
|
516
|
-
['stateHash',
|
|
450
|
+
['initiatorDelegateIds', array(address(...idTagToEncoding))],
|
|
451
|
+
['responderDelegateIds', array(address(...idTagToEncoding))],
|
|
452
|
+
['stateHash', encoded(Encoding.State)],
|
|
517
453
|
['round', shortUInt],
|
|
518
454
|
['soloRound', uInt],
|
|
519
455
|
['lockPeriod', uInt],
|
|
520
456
|
['lockedUntil', uInt],
|
|
521
|
-
['initiatorAuth',
|
|
522
|
-
['responderAuth',
|
|
457
|
+
['initiatorAuth', encoded(Encoding.ContractBytearray)],
|
|
458
|
+
['responderAuth', encoded(Encoding.ContractBytearray)],
|
|
523
459
|
],
|
|
524
460
|
},
|
|
525
461
|
[Tag.ChannelSnapshotSoloTx]: {
|
|
526
462
|
1: [
|
|
527
|
-
|
|
528
|
-
['
|
|
529
|
-
['
|
|
530
|
-
['
|
|
463
|
+
['tag', shortUIntConst(Tag.ChannelSnapshotSoloTx)],
|
|
464
|
+
['version', shortUIntConst(1)],
|
|
465
|
+
['channelId', address(Encoding.Channel)],
|
|
466
|
+
['fromId', address(Encoding.AccountAddress)],
|
|
467
|
+
['payload', encoded(Encoding.Transaction)],
|
|
531
468
|
['ttl', shortUInt],
|
|
532
469
|
['fee', fee],
|
|
533
470
|
['nonce', shortUInt],
|
|
@@ -535,181 +472,194 @@ export const TX_SCHEMA = {
|
|
|
535
472
|
},
|
|
536
473
|
[Tag.ChannelOffChainUpdateTransfer]: {
|
|
537
474
|
1: [
|
|
538
|
-
|
|
539
|
-
['
|
|
540
|
-
['
|
|
475
|
+
['tag', shortUIntConst(Tag.ChannelOffChainUpdateTransfer)],
|
|
476
|
+
['version', shortUIntConst(1)],
|
|
477
|
+
['from', address(Encoding.AccountAddress)],
|
|
478
|
+
['to', address(Encoding.AccountAddress)],
|
|
541
479
|
['amount', uInt],
|
|
542
480
|
],
|
|
543
481
|
},
|
|
544
482
|
[Tag.ChannelOffChainUpdateDeposit]: {
|
|
545
483
|
1: [
|
|
546
|
-
|
|
547
|
-
['
|
|
484
|
+
['tag', shortUIntConst(Tag.ChannelOffChainUpdateDeposit)],
|
|
485
|
+
['version', shortUIntConst(1)],
|
|
486
|
+
['from', address(Encoding.AccountAddress)],
|
|
548
487
|
['amount', uInt],
|
|
549
488
|
],
|
|
550
489
|
},
|
|
551
490
|
[Tag.ChannelOffChainUpdateWithdraw]: {
|
|
552
491
|
1: [
|
|
553
|
-
|
|
554
|
-
['
|
|
492
|
+
['tag', shortUIntConst(Tag.ChannelOffChainUpdateWithdraw)],
|
|
493
|
+
['version', shortUIntConst(1)],
|
|
494
|
+
['from', address(Encoding.AccountAddress)],
|
|
555
495
|
['amount', uInt],
|
|
556
496
|
],
|
|
557
497
|
},
|
|
558
498
|
[Tag.ChannelOffChainUpdateCreateContract]: {
|
|
559
499
|
1: [
|
|
560
|
-
|
|
561
|
-
['
|
|
562
|
-
['
|
|
563
|
-
['
|
|
500
|
+
['tag', shortUIntConst(Tag.ChannelOffChainUpdateCreateContract)],
|
|
501
|
+
['version', shortUIntConst(1)],
|
|
502
|
+
['owner', address(Encoding.AccountAddress)],
|
|
503
|
+
['ctVersion', ctVersion],
|
|
504
|
+
['code', encoded(Encoding.ContractBytearray)],
|
|
564
505
|
['deposit', uInt],
|
|
565
|
-
['callData',
|
|
506
|
+
['callData', encoded(Encoding.ContractBytearray)],
|
|
566
507
|
],
|
|
567
508
|
},
|
|
568
509
|
[Tag.ChannelOffChainUpdateCallContract]: {
|
|
569
510
|
1: [
|
|
570
|
-
|
|
571
|
-
['
|
|
572
|
-
['
|
|
573
|
-
['
|
|
511
|
+
['tag', shortUIntConst(Tag.ChannelOffChainUpdateCallContract)],
|
|
512
|
+
['version', shortUIntConst(1)],
|
|
513
|
+
['caller', address(Encoding.AccountAddress)],
|
|
514
|
+
['contract', address(Encoding.ContractAddress)],
|
|
515
|
+
['abiVersion', abiVersion],
|
|
574
516
|
['amount', uInt],
|
|
575
|
-
['callData',
|
|
576
|
-
['callStack',
|
|
517
|
+
['callData', encoded(Encoding.ContractBytearray)],
|
|
518
|
+
['callStack', raw],
|
|
577
519
|
['gasPrice', gasPrice],
|
|
578
520
|
['gasLimit', gasLimit],
|
|
579
521
|
],
|
|
580
522
|
},
|
|
581
523
|
[Tag.ChannelClientReconnectTx]: {
|
|
582
524
|
1: [
|
|
583
|
-
|
|
584
|
-
['
|
|
525
|
+
['tag', shortUIntConst(Tag.ChannelClientReconnectTx)],
|
|
526
|
+
['version', shortUIntConst(1)],
|
|
527
|
+
['channelId', address(Encoding.Channel)],
|
|
585
528
|
['round', shortUInt],
|
|
586
|
-
['role',
|
|
587
|
-
['pubkey', address
|
|
529
|
+
['role', string],
|
|
530
|
+
['pubkey', address(Encoding.AccountAddress)],
|
|
588
531
|
],
|
|
589
532
|
},
|
|
590
533
|
[Tag.TreesPoi]: {
|
|
591
534
|
1: [
|
|
592
|
-
|
|
593
|
-
['
|
|
594
|
-
['
|
|
595
|
-
['
|
|
596
|
-
['
|
|
597
|
-
['
|
|
598
|
-
['
|
|
535
|
+
['tag', shortUIntConst(Tag.TreesPoi)],
|
|
536
|
+
['version', shortUIntConst(1)],
|
|
537
|
+
['accounts', array(mptree(Encoding.AccountAddress, Tag.Account))],
|
|
538
|
+
['calls', array(mptree(Encoding.Bytearray, Tag.ContractCall))],
|
|
539
|
+
['channels', array(mptree(Encoding.Channel, Tag.Channel))],
|
|
540
|
+
['contracts', array(mptree(Encoding.ContractAddress, Tag.Contract))],
|
|
541
|
+
['ns', array(mptree(Encoding.Name, Tag.Name))],
|
|
542
|
+
['oracles', array(mptree(Encoding.OracleAddress, Tag.Oracle))],
|
|
599
543
|
],
|
|
600
544
|
},
|
|
601
545
|
[Tag.StateTrees]: {
|
|
602
546
|
1: [
|
|
603
|
-
|
|
604
|
-
['
|
|
605
|
-
['
|
|
606
|
-
['
|
|
607
|
-
['
|
|
608
|
-
['
|
|
609
|
-
['
|
|
547
|
+
['tag', shortUIntConst(Tag.StateTrees)],
|
|
548
|
+
['version', shortUIntConst(1)],
|
|
549
|
+
['contracts', entry()],
|
|
550
|
+
['calls', entry()],
|
|
551
|
+
['channels', entry()],
|
|
552
|
+
['ns', entry()],
|
|
553
|
+
['oracles', entry()],
|
|
554
|
+
['accounts', entry()],
|
|
610
555
|
],
|
|
611
556
|
},
|
|
612
557
|
[Tag.Mtree]: {
|
|
613
558
|
1: [
|
|
614
|
-
|
|
615
|
-
['
|
|
559
|
+
['tag', shortUIntConst(Tag.Mtree)],
|
|
560
|
+
['version', shortUIntConst(1)],
|
|
561
|
+
['values', array(entry())],
|
|
616
562
|
],
|
|
617
563
|
},
|
|
618
564
|
[Tag.MtreeValue]: {
|
|
619
565
|
1: [
|
|
620
|
-
|
|
621
|
-
['
|
|
622
|
-
['
|
|
566
|
+
['tag', shortUIntConst(Tag.MtreeValue)],
|
|
567
|
+
['version', shortUIntConst(1)],
|
|
568
|
+
['key', raw],
|
|
569
|
+
['value', raw],
|
|
623
570
|
],
|
|
624
571
|
},
|
|
625
572
|
[Tag.ContractsMtree]: {
|
|
626
573
|
1: [
|
|
627
|
-
|
|
628
|
-
['
|
|
574
|
+
['tag', shortUIntConst(Tag.ContractsMtree)],
|
|
575
|
+
['version', shortUIntConst(1)],
|
|
576
|
+
['contracts', entry()],
|
|
629
577
|
],
|
|
630
578
|
},
|
|
631
579
|
[Tag.CallsMtree]: {
|
|
632
580
|
1: [
|
|
633
|
-
|
|
634
|
-
['
|
|
581
|
+
['tag', shortUIntConst(Tag.CallsMtree)],
|
|
582
|
+
['version', shortUIntConst(1)],
|
|
583
|
+
['calls', entry()],
|
|
635
584
|
],
|
|
636
585
|
},
|
|
637
586
|
[Tag.ChannelsMtree]: {
|
|
638
587
|
1: [
|
|
639
|
-
|
|
640
|
-
['
|
|
588
|
+
['tag', shortUIntConst(Tag.ChannelsMtree)],
|
|
589
|
+
['version', shortUIntConst(1)],
|
|
590
|
+
['channels', entry()],
|
|
641
591
|
],
|
|
642
592
|
},
|
|
643
593
|
[Tag.NameserviceMtree]: {
|
|
644
594
|
1: [
|
|
645
|
-
|
|
646
|
-
['
|
|
595
|
+
['tag', shortUIntConst(Tag.NameserviceMtree)],
|
|
596
|
+
['version', shortUIntConst(1)],
|
|
597
|
+
['mtree', entry()],
|
|
647
598
|
],
|
|
648
599
|
},
|
|
649
600
|
[Tag.OraclesMtree]: {
|
|
650
601
|
1: [
|
|
651
|
-
|
|
652
|
-
['
|
|
602
|
+
['tag', shortUIntConst(Tag.OraclesMtree)],
|
|
603
|
+
['version', shortUIntConst(1)],
|
|
604
|
+
['otree', entry()],
|
|
653
605
|
],
|
|
654
606
|
},
|
|
655
607
|
[Tag.AccountsMtree]: {
|
|
656
608
|
1: [
|
|
657
|
-
|
|
658
|
-
['
|
|
609
|
+
['tag', shortUIntConst(Tag.AccountsMtree)],
|
|
610
|
+
['version', shortUIntConst(1)],
|
|
611
|
+
['accounts', entry()],
|
|
659
612
|
],
|
|
660
613
|
},
|
|
661
614
|
[Tag.GaAttachTx]: {
|
|
662
615
|
1: [
|
|
663
|
-
|
|
664
|
-
['
|
|
616
|
+
['tag', shortUIntConst(Tag.GaAttachTx)],
|
|
617
|
+
['version', shortUIntConst(1)],
|
|
618
|
+
['ownerId', address(Encoding.AccountAddress)],
|
|
665
619
|
['nonce', shortUInt],
|
|
666
|
-
['code',
|
|
667
|
-
['authFun',
|
|
668
|
-
['ctVersion',
|
|
620
|
+
['code', encoded(Encoding.ContractBytearray)],
|
|
621
|
+
['authFun', raw],
|
|
622
|
+
['ctVersion', ctVersion],
|
|
669
623
|
['fee', fee],
|
|
670
624
|
['ttl', shortUInt],
|
|
671
625
|
['gasLimit', gasLimit],
|
|
672
626
|
['gasPrice', gasPrice],
|
|
673
|
-
['callData',
|
|
627
|
+
['callData', encoded(Encoding.ContractBytearray)],
|
|
674
628
|
],
|
|
675
629
|
},
|
|
676
630
|
[Tag.GaMetaTx]: {
|
|
677
631
|
2: [
|
|
678
|
-
|
|
679
|
-
['
|
|
680
|
-
['
|
|
681
|
-
['
|
|
632
|
+
['tag', shortUIntConst(Tag.GaMetaTx)],
|
|
633
|
+
['version', shortUIntConst(2)],
|
|
634
|
+
['gaId', address(Encoding.AccountAddress)],
|
|
635
|
+
['authData', encoded(Encoding.ContractBytearray)],
|
|
636
|
+
['abiVersion', abiVersion],
|
|
682
637
|
['fee', fee],
|
|
683
638
|
['gasLimit', gasLimit],
|
|
684
639
|
['gasPrice', gasPrice],
|
|
685
|
-
['tx',
|
|
640
|
+
['tx', entry()],
|
|
686
641
|
],
|
|
687
642
|
},
|
|
688
643
|
[Tag.PayingForTx]: {
|
|
689
644
|
1: [
|
|
690
|
-
|
|
691
|
-
['
|
|
645
|
+
['tag', shortUIntConst(Tag.PayingForTx)],
|
|
646
|
+
['version', shortUIntConst(1)],
|
|
647
|
+
['payerId', address(Encoding.AccountAddress)],
|
|
692
648
|
['nonce', shortUInt],
|
|
693
649
|
['fee', fee],
|
|
694
|
-
['tx',
|
|
695
|
-
],
|
|
696
|
-
},
|
|
697
|
-
[Tag.CompilerSophia]: {
|
|
698
|
-
3: [
|
|
699
|
-
...BASE_TX,
|
|
700
|
-
['sourceCodeHash', FIELD_TYPES.rawBinary],
|
|
701
|
-
['typeInfo', FIELD_TYPES.sophiaCodeTypeInfo],
|
|
702
|
-
['byteCode', FIELD_TYPES.rawBinary],
|
|
703
|
-
['compilerVersion', FIELD_TYPES.string],
|
|
704
|
-
['payable', FIELD_TYPES.bool],
|
|
650
|
+
['tx', entry()],
|
|
705
651
|
],
|
|
706
652
|
},
|
|
707
653
|
} as const;
|
|
708
654
|
|
|
655
|
+
type TxTypeSchemasNotCombined = {
|
|
656
|
+
[tag in Tag]: {
|
|
657
|
+
[ver in keyof typeof TX_SCHEMA[tag]]: BuildTxArgBySchema<typeof TX_SCHEMA[tag][ver]>
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
|
|
709
661
|
export type TxTypeSchemas = {
|
|
710
|
-
[key in Tag]:
|
|
711
|
-
typeof TX_SCHEMA[key][keyof typeof TX_SCHEMA[key]]
|
|
712
|
-
>
|
|
662
|
+
[key in Tag]: TxTypeSchemasNotCombined[key][keyof TxTypeSchemasNotCombined[key]]
|
|
713
663
|
};
|
|
714
664
|
|
|
715
665
|
export type TxSchema = TxTypeSchemas[Tag];
|