@aeternity/aepp-sdk 12.0.0 → 12.1.2
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/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.LICENSE.txt +0 -15
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +2 -1
- package/dist/aepp-sdk.browser.js.LICENSE.txt +1 -0
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +20765 -1
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdk.d.ts +7 -7
- package/es/AeSdk.mjs.map +1 -1
- package/es/AeSdkAepp.d.ts +4 -3
- package/es/AeSdkAepp.mjs +2 -1
- package/es/AeSdkAepp.mjs.map +1 -1
- package/es/AeSdkBase.d.ts +22 -21
- package/es/AeSdkBase.mjs +25 -21
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkWallet.d.ts +4 -3
- package/es/AeSdkWallet.mjs +5 -1
- package/es/AeSdkWallet.mjs.map +1 -1
- package/es/Node.d.ts +7 -10
- package/es/Node.mjs +63 -57
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +7 -4
- package/es/account/Base.mjs +3 -3
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Memory.d.ts +5 -4
- package/es/account/Memory.mjs +24 -2
- package/es/account/Memory.mjs.map +1 -1
- package/es/account/Rpc.d.ts +6 -6
- package/es/account/Rpc.mjs +3 -2
- package/es/account/Rpc.mjs.map +1 -1
- package/es/aens.d.ts +27 -14
- package/es/aens.mjs +27 -21
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/Browser.d.ts +2 -1
- package/es/aepp-wallet-communication/connection/Browser.mjs +5 -2
- package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +1 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +1 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +1 -0
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +5 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection-proxy.d.ts +1 -0
- package/es/aepp-wallet-communication/connection-proxy.mjs +1 -0
- package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +1 -0
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +5 -5
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/types.d.ts +8 -8
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
- package/es/aepp-wallet-communication/schema.d.ts +17 -2
- package/es/aepp-wallet-communication/schema.mjs +54 -17
- package/es/aepp-wallet-communication/schema.mjs.map +1 -1
- package/es/aepp-wallet-communication/wallet-detector.d.ts +2 -1
- package/es/aepp-wallet-communication/wallet-detector.mjs +2 -3
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
- package/es/apis/node/models/index.d.ts +6 -2
- package/es/apis/node/models/index.mjs.map +1 -1
- package/es/apis/node/models/mappers.mjs +4 -2
- package/es/apis/node/models/mappers.mjs.map +1 -1
- package/es/chain.d.ts +92 -64
- package/es/chain.mjs +190 -154
- package/es/chain.mjs.map +1 -1
- package/es/channel/handlers.d.ts +3 -3
- package/es/channel/handlers.mjs +42 -44
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/index.d.ts +43 -52
- package/es/channel/index.mjs +46 -49
- package/es/channel/index.mjs.map +1 -1
- package/es/channel/internal.d.ts +16 -15
- package/es/channel/internal.mjs +67 -62
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Compiler.d.ts +1 -0
- package/es/contract/Compiler.mjs +5 -4
- package/es/contract/Compiler.mjs.map +1 -1
- package/es/contract/aci.d.ts +17 -15
- package/es/contract/aci.mjs +58 -45
- package/es/contract/aci.mjs.map +1 -1
- package/es/contract/ga.d.ts +16 -15
- package/es/contract/ga.mjs +12 -7
- package/es/contract/ga.mjs.map +1 -1
- package/es/contract/methods.d.ts +9 -6
- package/es/contract/methods.mjs +9 -6
- package/es/contract/methods.mjs.map +1 -1
- package/es/deprecated/index.d.ts +143 -0
- package/es/deprecated/index.mjs +162 -0
- package/es/deprecated/index.mjs.map +1 -0
- package/es/deprecated/methods.d.ts +18 -0
- package/es/deprecated/methods.mjs +26 -0
- package/es/deprecated/methods.mjs.map +1 -0
- package/es/index.d.ts +4 -1
- package/es/index.mjs +4 -1
- package/es/index.mjs.map +1 -1
- package/es/oracle.d.ts +69 -62
- package/es/oracle.mjs +121 -103
- package/es/oracle.mjs.map +1 -1
- package/es/spend.d.ts +16 -15
- package/es/spend.mjs +19 -30
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/address.d.ts +25 -0
- package/es/tx/builder/address.mjs +45 -0
- package/es/tx/builder/address.mjs.map +1 -0
- package/es/tx/builder/constants.d.ts +55 -26
- package/es/tx/builder/constants.mjs +60 -38
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/field-types/coin-amount.d.ts +13 -0
- package/es/tx/builder/field-types/coin-amount.mjs +26 -0
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -0
- package/es/tx/builder/field-types/deposit.d.ts +15 -0
- package/es/tx/builder/field-types/deposit.mjs +19 -0
- package/es/tx/builder/field-types/deposit.mjs.map +1 -0
- package/es/tx/builder/field-types/fee.d.ts +25 -0
- package/es/tx/{min-fee.mjs → builder/field-types/fee.mjs} +62 -60
- package/es/tx/builder/field-types/fee.mjs.map +1 -0
- package/es/tx/builder/field-types/field.d.ts +6 -0
- package/es/tx/builder/field-types/field.mjs +15 -0
- package/es/tx/builder/field-types/field.mjs.map +1 -0
- package/es/tx/builder/field-types/gas-limit.d.ts +12 -0
- package/es/tx/builder/field-types/gas-limit.mjs +33 -0
- package/es/tx/builder/field-types/gas-limit.mjs.map +1 -0
- package/es/tx/builder/field-types/gas-price.d.ts +8 -0
- package/es/tx/builder/field-types/gas-price.mjs +18 -0
- package/es/tx/builder/field-types/gas-price.mjs.map +1 -0
- package/es/tx/builder/field-types/index.d.ts +70 -0
- package/es/tx/builder/field-types/index.mjs +25 -0
- package/es/tx/builder/field-types/index.mjs.map +1 -0
- package/es/tx/builder/field-types/name-fee.d.ts +20 -0
- package/es/tx/builder/field-types/name-fee.mjs +24 -0
- package/es/tx/builder/field-types/name-fee.mjs.map +1 -0
- package/es/tx/builder/field-types/name-id.d.ts +14 -0
- package/es/tx/builder/field-types/name-id.mjs +19 -0
- package/es/tx/builder/field-types/name-id.mjs.map +1 -0
- package/es/tx/builder/field-types/name.d.ts +13 -0
- package/es/tx/builder/field-types/name.mjs +18 -0
- package/es/tx/builder/field-types/name.mjs.map +1 -0
- package/es/tx/builder/field-types/short-u-int.d.ts +6 -0
- package/es/tx/builder/field-types/short-u-int.mjs +12 -0
- package/es/tx/builder/field-types/short-u-int.mjs.map +1 -0
- package/es/tx/builder/field-types/u-int.d.ts +8 -0
- package/es/tx/builder/field-types/u-int.mjs +14 -0
- package/es/tx/builder/field-types/u-int.mjs.map +1 -0
- package/es/tx/builder/helpers.d.ts +27 -33
- package/es/tx/builder/helpers.mjs +41 -47
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +25 -12
- package/es/tx/builder/index.mjs +74 -83
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +995 -144
- package/es/tx/builder/schema.mjs +121 -170
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/index.d.ts +28 -27
- package/es/tx/index.mjs +97 -117
- package/es/tx/index.mjs.map +1 -1
- package/es/tx/validator.d.ts +4 -3
- package/es/tx/validator.mjs +79 -92
- package/es/tx/validator.mjs.map +1 -1
- package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +1 -1
- package/es/typings/@aeternity__uuid/index.d.mjs.map +1 -1
- package/es/typings/bip32-path/index.d.mjs.map +1 -1
- package/es/typings/blakejs/index.d.mjs.map +1 -1
- package/es/typings/sha-js/index.d.mjs +2 -0
- package/es/typings/sha-js/index.d.mjs.map +1 -0
- package/es/typings/tweetnacl-auth/index.d.mjs.map +1 -1
- package/es/utils/amount-formatter.d.ts +9 -9
- package/es/utils/amount-formatter.mjs +17 -17
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.mjs +7 -7
- package/es/utils/autorest.mjs.map +1 -1
- package/es/utils/bignumber.mjs +2 -1
- package/es/utils/bignumber.mjs.map +1 -1
- package/es/utils/bytes.mjs +1 -1
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/crypto.d.ts +8 -23
- package/es/utils/crypto.mjs +15 -41
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/encoder-types.d.ts +61 -0
- package/es/utils/encoder-types.mjs +36 -0
- package/es/utils/encoder-types.mjs.map +1 -0
- package/es/utils/encoder.d.ts +6 -7
- package/es/utils/encoder.mjs +42 -26
- package/es/utils/encoder.mjs.map +1 -1
- package/es/utils/errors.d.ts +1 -11
- package/es/utils/errors.mjs +4 -20
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/hd-wallet.d.ts +18 -2
- package/es/utils/hd-wallet.mjs +64 -34
- package/es/utils/hd-wallet.mjs.map +1 -1
- package/es/utils/json-big.mjs +2 -2
- package/es/utils/json-big.mjs.map +1 -1
- package/es/utils/keystore.mjs +4 -2
- package/es/utils/keystore.mjs.map +1 -1
- package/es/utils/mptree.d.ts +2 -2
- package/es/utils/mptree.mjs +11 -6
- package/es/utils/mptree.mjs.map +1 -1
- package/es/utils/other.d.ts +8 -2
- package/es/utils/other.mjs +15 -3
- package/es/utils/other.mjs.map +1 -1
- package/es/utils/semver-satisfies.d.ts +1 -1
- package/es/utils/semver-satisfies.mjs +2 -2
- package/es/utils/semver-satisfies.mjs.map +1 -1
- package/es/utils/string.mjs.map +1 -1
- package/package.json +36 -34
- package/src/AeSdk.ts +30 -27
- package/src/AeSdkAepp.ts +93 -84
- package/src/AeSdkBase.ts +148 -130
- package/src/AeSdkWallet.ts +172 -156
- package/src/Node.ts +108 -102
- package/src/account/Base.ts +42 -32
- package/src/account/Memory.ts +45 -30
- package/src/account/Rpc.ts +32 -30
- package/src/aens.ts +124 -108
- package/src/aepp-wallet-communication/connection/Browser.ts +18 -15
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +22 -21
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +63 -52
- package/src/aepp-wallet-communication/connection-proxy.ts +8 -7
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +67 -61
- package/src/aepp-wallet-communication/rpc/types.ts +32 -32
- package/src/aepp-wallet-communication/schema.ts +117 -74
- package/src/aepp-wallet-communication/wallet-detector.ts +29 -28
- package/src/apis/node/code-model-v4.yaml +54 -20
- package/src/apis/node/models/index.ts +6 -2
- package/src/apis/node/models/mappers.ts +4 -2
- package/src/chain.ts +286 -228
- package/src/channel/handlers.ts +424 -372
- package/src/channel/index.ts +285 -251
- package/src/channel/internal.ts +248 -232
- package/src/contract/Compiler.ts +22 -21
- package/src/contract/aci.ts +267 -258
- package/src/contract/ga.ts +93 -72
- package/src/contract/methods.ts +32 -27
- package/src/deprecated/index.ts +172 -0
- package/src/deprecated/methods.ts +25 -0
- package/src/index.ts +37 -32
- package/src/oracle.ts +211 -189
- package/src/spend.ts +82 -70
- package/src/tx/builder/address.ts +50 -0
- package/src/tx/builder/constants.ts +82 -52
- package/src/tx/builder/field-types/coin-amount.ts +27 -0
- package/src/tx/builder/field-types/deposit.ts +21 -0
- package/src/tx/builder/field-types/fee.ts +143 -0
- package/src/tx/builder/field-types/field.ts +9 -0
- package/src/tx/builder/field-types/gas-limit.ts +41 -0
- package/src/tx/builder/field-types/gas-price.ts +16 -0
- package/src/tx/builder/field-types/index.ts +45 -0
- package/src/tx/builder/field-types/name-fee.ts +32 -0
- package/src/tx/builder/field-types/name-id.ts +20 -0
- package/src/tx/builder/field-types/name.ts +18 -0
- package/src/tx/builder/field-types/short-u-int.ts +11 -0
- package/src/tx/builder/field-types/u-int.ts +16 -0
- package/src/tx/builder/helpers.ts +112 -117
- package/src/tx/builder/index.ts +203 -197
- package/src/tx/builder/schema.ts +421 -465
- package/src/tx/index.ts +128 -135
- package/src/tx/validator.ts +165 -161
- package/src/typings/@aeternity__argon2-browser/index.d.ts +1 -1
- package/src/typings/@aeternity__uuid/index.d.ts +3 -1
- package/src/typings/bip32-path/index.d.ts +6 -6
- package/src/typings/blakejs/index.d.ts +4 -32
- package/src/typings/sha-js/index.d.ts +5 -0
- package/src/typings/tweetnacl-auth/index.d.ts +2 -2
- package/src/utils/amount-formatter.ts +41 -41
- package/src/utils/autorest.ts +57 -54
- package/src/utils/bignumber.ts +7 -6
- package/src/utils/bytes.ts +19 -19
- package/src/utils/crypto.ts +82 -94
- package/src/utils/encoder-types.ts +63 -0
- package/src/utils/encoder.ts +104 -56
- package/src/utils/errors.ts +246 -264
- package/src/utils/hd-wallet.ts +114 -82
- package/src/utils/json-big.ts +16 -15
- package/src/utils/keystore.ts +65 -62
- package/src/utils/mptree.ts +59 -56
- package/src/utils/other.ts +26 -18
- package/src/utils/semver-satisfies.ts +15 -11
- package/src/utils/string.ts +10 -10
- package/es/tx/builder/field-types.d.ts +0 -62
- package/es/tx/builder/field-types.mjs +0 -126
- package/es/tx/builder/field-types.mjs.map +0 -1
- package/es/tx/min-fee.d.ts +0 -20
- package/es/tx/min-fee.mjs.map +0 -1
- package/src/tx/builder/field-types.ts +0 -111
- package/src/tx/min-fee.ts +0 -136
package/src/tx/builder/schema.ts
CHANGED
|
@@ -4,96 +4,43 @@
|
|
|
4
4
|
// # RLP version number
|
|
5
5
|
// # https://github.com/aeternity/protocol/blob/master/serializations.md#binary-serialization
|
|
6
6
|
|
|
7
|
-
import BigNumber from 'bignumber.js'
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
import BigNumber from 'bignumber.js';
|
|
8
|
+
import { Tag } from './constants';
|
|
9
|
+
import {
|
|
10
|
+
Field, uInt, shortUInt, coinAmount, name, nameId, nameFee, deposit, gasLimit, gasPrice, fee,
|
|
11
|
+
} from './field-types';
|
|
12
|
+
import { Encoded, Encoding } from '../../utils/encoder';
|
|
13
|
+
import MPTree from '../../utils/mptree';
|
|
14
|
+
import { NamePointer } from '../../apis/node';
|
|
14
15
|
|
|
15
16
|
export enum ORACLE_TTL_TYPES {
|
|
16
17
|
delta = 0,
|
|
17
|
-
block = 1
|
|
18
|
+
block = 1,
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
// # TRANSACTION DEFAULT TTL
|
|
21
|
-
export const TX_TTL = 0
|
|
22
|
+
export const TX_TTL = 0;
|
|
22
23
|
// # ORACLE
|
|
23
|
-
export const QUERY_FEE = 30000
|
|
24
|
-
export const ORACLE_TTL = { type: ORACLE_TTL_TYPES.delta, value: 500 }
|
|
25
|
-
export const QUERY_TTL = { type: ORACLE_TTL_TYPES.delta, value: 10 }
|
|
26
|
-
export const RESPONSE_TTL = { type: ORACLE_TTL_TYPES.delta, value: 10 }
|
|
24
|
+
export const QUERY_FEE = 30000;
|
|
25
|
+
export const ORACLE_TTL = { type: ORACLE_TTL_TYPES.delta, value: 500 };
|
|
26
|
+
export const QUERY_TTL = { type: ORACLE_TTL_TYPES.delta, value: 10 };
|
|
27
|
+
export const RESPONSE_TTL = { type: ORACLE_TTL_TYPES.delta, value: 10 };
|
|
27
28
|
// # CONTRACT
|
|
28
|
-
export const AMOUNT = 0
|
|
29
|
-
export const
|
|
30
|
-
export const MAX_AUTH_FUN_GAS = 50000
|
|
29
|
+
export const AMOUNT = 0;
|
|
30
|
+
export const MAX_AUTH_FUN_GAS = 50000;
|
|
31
31
|
export const DRY_RUN_ACCOUNT = {
|
|
32
32
|
pub: 'ak_11111111111111111111111111111111273Yts',
|
|
33
|
-
amount: 100000000000000000000000000000000000n
|
|
34
|
-
} as const
|
|
33
|
+
amount: 100000000000000000000000000000000000n,
|
|
34
|
+
} as const;
|
|
35
35
|
|
|
36
36
|
export type TxField = [
|
|
37
37
|
name: string,
|
|
38
|
-
type: FIELD_TYPES |
|
|
39
|
-
prefix?:
|
|
40
|
-
]
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Enum with transaction types
|
|
44
|
-
* @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/serializations.md#binary-serialization}
|
|
45
|
-
*/
|
|
46
|
-
export enum TX_TYPE {
|
|
47
|
-
account = 10,
|
|
48
|
-
signed = 11,
|
|
49
|
-
spend = 12,
|
|
50
|
-
oracleRegister = 22,
|
|
51
|
-
oracleQuery = 23,
|
|
52
|
-
oracleResponse = 24,
|
|
53
|
-
oracleExtend = 25,
|
|
54
|
-
nameClaim = 32,
|
|
55
|
-
namePreClaim = 33,
|
|
56
|
-
nameUpdate = 34,
|
|
57
|
-
nameRevoke = 35,
|
|
58
|
-
nameTransfer = 36,
|
|
59
|
-
contract = 40,
|
|
60
|
-
contractCallResult = 41,
|
|
61
|
-
contractCreate = 42,
|
|
62
|
-
contractCall = 43,
|
|
63
|
-
channelCreate = 50,
|
|
64
|
-
channelDeposit = 51,
|
|
65
|
-
channelWithdraw = 52,
|
|
66
|
-
channelCloseMutual = 53,
|
|
67
|
-
channelCloseSolo = 54,
|
|
68
|
-
channelSlash = 55,
|
|
69
|
-
channelSettle = 56,
|
|
70
|
-
channelOffChain = 57,
|
|
71
|
-
channel = 58,
|
|
72
|
-
channelSnapshotSolo = 59,
|
|
73
|
-
proofOfInclusion = 60,
|
|
74
|
-
stateTrees = 62,
|
|
75
|
-
merklePatriciaTree = 63,
|
|
76
|
-
merklePatriciaTreeValue = 64,
|
|
77
|
-
sophiaByteCode = 70,
|
|
78
|
-
gaAttach = 80,
|
|
79
|
-
gaMeta = 81,
|
|
80
|
-
payingFor = 82,
|
|
81
|
-
channelForceProgress = 521,
|
|
82
|
-
channelOffChainUpdateTransfer = 570,
|
|
83
|
-
channelOffChainUpdateDeposit = 571,
|
|
84
|
-
channelOffChainUpdateWithdrawal = 572,
|
|
85
|
-
channelOffChainCreateContract = 573,
|
|
86
|
-
channelOffChainCallContract = 574,
|
|
87
|
-
channelReconnect = 575,
|
|
88
|
-
contractsTree = 621,
|
|
89
|
-
contractCallsTree = 622,
|
|
90
|
-
channelsTree = 623,
|
|
91
|
-
nameserviceTree = 624,
|
|
92
|
-
oraclesTree = 625,
|
|
93
|
-
accountsTree = 626
|
|
94
|
-
}
|
|
38
|
+
type: FIELD_TYPES | Field,
|
|
39
|
+
prefix?: Encoding | Encoding[],
|
|
40
|
+
];
|
|
95
41
|
|
|
96
42
|
/**
|
|
43
|
+
* @category transaction builder
|
|
97
44
|
* @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}
|
|
98
45
|
*/
|
|
99
46
|
export enum VM_VERSIONS {
|
|
@@ -103,53 +50,60 @@ export enum VM_VERSIONS {
|
|
|
103
50
|
SOPHIA_IMPROVEMENTS_FORTUNA = 4,
|
|
104
51
|
FATE = 5,
|
|
105
52
|
SOPHIA_IMPROVEMENTS_LIMA = 6,
|
|
106
|
-
FATE_2 = 7
|
|
53
|
+
FATE_2 = 7,
|
|
107
54
|
}
|
|
108
55
|
|
|
109
56
|
/**
|
|
57
|
+
* @category transaction builder
|
|
110
58
|
* @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}
|
|
111
59
|
*/
|
|
112
60
|
export enum ABI_VERSIONS {
|
|
113
61
|
NO_ABI = 0,
|
|
114
62
|
SOPHIA = 1,
|
|
115
|
-
FATE = 3
|
|
63
|
+
FATE = 3,
|
|
116
64
|
}
|
|
117
65
|
|
|
66
|
+
/**
|
|
67
|
+
* @category transaction builder
|
|
68
|
+
*/
|
|
118
69
|
export enum PROTOCOL_VERSIONS {
|
|
119
|
-
IRIS = 5
|
|
70
|
+
IRIS = 5,
|
|
120
71
|
}
|
|
121
72
|
|
|
122
73
|
// First abi/vm by default
|
|
123
74
|
export const PROTOCOL_VM_ABI = {
|
|
124
75
|
[PROTOCOL_VERSIONS.IRIS]: {
|
|
125
|
-
[
|
|
126
|
-
vmVersion: [VM_VERSIONS.FATE_2], abiVersion: [ABI_VERSIONS.FATE]
|
|
76
|
+
[Tag.ContractCreateTx]: {
|
|
77
|
+
vmVersion: [VM_VERSIONS.FATE_2], abiVersion: [ABI_VERSIONS.FATE],
|
|
127
78
|
},
|
|
128
79
|
// TODO: Ensure that AEVM (SOPHIA?) is still available here
|
|
129
|
-
[
|
|
130
|
-
vmVersion: [], abiVersion: [ABI_VERSIONS.FATE, ABI_VERSIONS.SOPHIA]
|
|
80
|
+
[Tag.ContractCallTx]: {
|
|
81
|
+
vmVersion: [], abiVersion: [ABI_VERSIONS.FATE, ABI_VERSIONS.SOPHIA],
|
|
131
82
|
},
|
|
132
|
-
[
|
|
133
|
-
vmVersion: [], abiVersion: [ABI_VERSIONS.NO_ABI, ABI_VERSIONS.SOPHIA]
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
} as const
|
|
83
|
+
[Tag.OracleRegisterTx]: {
|
|
84
|
+
vmVersion: [], abiVersion: [ABI_VERSIONS.NO_ABI, ABI_VERSIONS.SOPHIA],
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
} as const;
|
|
137
88
|
|
|
138
|
-
type PrefixType<Prefix> = Prefix extends
|
|
139
|
-
?
|
|
140
|
-
: Prefix extends readonly
|
|
141
|
-
?
|
|
142
|
-
:
|
|
89
|
+
type PrefixType<Prefix> = Prefix extends Encoding
|
|
90
|
+
? Encoded.Generic<Prefix>
|
|
91
|
+
: Prefix extends readonly Encoding[]
|
|
92
|
+
? Encoded.Generic<Prefix[number]>
|
|
93
|
+
: Encoded.Generic<any>;
|
|
143
94
|
|
|
95
|
+
/**
|
|
96
|
+
* @category transaction builder
|
|
97
|
+
*/
|
|
144
98
|
export interface CtVersion {
|
|
145
|
-
vmVersion: VM_VERSIONS
|
|
146
|
-
abiVersion: ABI_VERSIONS
|
|
99
|
+
vmVersion: VM_VERSIONS;
|
|
100
|
+
abiVersion: ABI_VERSIONS;
|
|
147
101
|
}
|
|
148
102
|
|
|
103
|
+
/**
|
|
104
|
+
* @category transaction builder
|
|
105
|
+
*/
|
|
149
106
|
export enum FIELD_TYPES {
|
|
150
|
-
int,
|
|
151
|
-
shortInt,
|
|
152
|
-
amount,
|
|
153
107
|
id,
|
|
154
108
|
ids,
|
|
155
109
|
string,
|
|
@@ -171,59 +125,56 @@ export enum FIELD_TYPES {
|
|
|
171
125
|
ttlType,
|
|
172
126
|
sophiaCodeTypeInfo,
|
|
173
127
|
payload,
|
|
174
|
-
stateTree
|
|
128
|
+
stateTree,
|
|
175
129
|
}
|
|
176
130
|
|
|
177
|
-
interface BuildFieldTypes<Prefix extends undefined |
|
|
178
|
-
[FIELD_TYPES.
|
|
179
|
-
[FIELD_TYPES.
|
|
180
|
-
[FIELD_TYPES.
|
|
181
|
-
[FIELD_TYPES.
|
|
182
|
-
[FIELD_TYPES.
|
|
183
|
-
[FIELD_TYPES.
|
|
184
|
-
[FIELD_TYPES.
|
|
185
|
-
[FIELD_TYPES.
|
|
186
|
-
[FIELD_TYPES.
|
|
187
|
-
[FIELD_TYPES.
|
|
188
|
-
[FIELD_TYPES.
|
|
189
|
-
[FIELD_TYPES.
|
|
190
|
-
[FIELD_TYPES.
|
|
191
|
-
[FIELD_TYPES.
|
|
192
|
-
[FIELD_TYPES.
|
|
193
|
-
[FIELD_TYPES.
|
|
194
|
-
[FIELD_TYPES.
|
|
195
|
-
[FIELD_TYPES.
|
|
196
|
-
[FIELD_TYPES.
|
|
197
|
-
[FIELD_TYPES.
|
|
198
|
-
[FIELD_TYPES.
|
|
199
|
-
[FIELD_TYPES.
|
|
200
|
-
[FIELD_TYPES.sophiaCodeTypeInfo]: any
|
|
201
|
-
[FIELD_TYPES.payload]: string | undefined
|
|
202
|
-
[FIELD_TYPES.stateTree]: any
|
|
131
|
+
interface BuildFieldTypes<Prefix extends undefined | Encoding | readonly Encoding[]> {
|
|
132
|
+
[FIELD_TYPES.id]: PrefixType<Prefix>;
|
|
133
|
+
[FIELD_TYPES.ids]: Array<Encoded.Generic<Prefix extends Encoding[] ? Prefix : any>>;
|
|
134
|
+
[FIELD_TYPES.string]: string;
|
|
135
|
+
[FIELD_TYPES.binary]: PrefixType<Prefix>;
|
|
136
|
+
[FIELD_TYPES.bool]: Boolean;
|
|
137
|
+
[FIELD_TYPES.hex]: string;
|
|
138
|
+
[FIELD_TYPES.rlpBinary]: any;
|
|
139
|
+
[FIELD_TYPES.rlpBinaries]: any[];
|
|
140
|
+
[FIELD_TYPES.rawBinary]: Uint8Array;
|
|
141
|
+
[FIELD_TYPES.signatures]: Uint8Array[];
|
|
142
|
+
[FIELD_TYPES.pointers]: NamePointer[];
|
|
143
|
+
[FIELD_TYPES.offChainUpdates]: any;
|
|
144
|
+
[FIELD_TYPES.callStack]: any;
|
|
145
|
+
[FIELD_TYPES.proofOfInclusion]: any;
|
|
146
|
+
[FIELD_TYPES.mptrees]: MPTree[];
|
|
147
|
+
[FIELD_TYPES.callReturnType]: any;
|
|
148
|
+
[FIELD_TYPES.ctVersion]: CtVersion;
|
|
149
|
+
[FIELD_TYPES.abiVersion]: ABI_VERSIONS;
|
|
150
|
+
[FIELD_TYPES.ttlType]: ORACLE_TTL_TYPES;
|
|
151
|
+
[FIELD_TYPES.sophiaCodeTypeInfo]: any;
|
|
152
|
+
[FIELD_TYPES.payload]: string | undefined;
|
|
153
|
+
[FIELD_TYPES.stateTree]: any;
|
|
203
154
|
}
|
|
204
155
|
|
|
205
156
|
// based on https://stackoverflow.com/a/50375286/6176994
|
|
206
157
|
type UnionToIntersection<Union> =
|
|
207
158
|
(Union extends any ? (k: Union) => void : never) extends ((k: infer Intersection) => void)
|
|
208
|
-
? Intersection : never
|
|
159
|
+
? Intersection : never;
|
|
209
160
|
|
|
210
161
|
type TxElem = readonly [string, FIELD_TYPES | Field]
|
|
211
|
-
| readonly [string, FIELD_TYPES,
|
|
162
|
+
| readonly [string, FIELD_TYPES, Encoding | readonly Encoding[]];
|
|
212
163
|
|
|
213
164
|
type BuildTxArgBySchemaType<
|
|
214
165
|
Type extends FIELD_TYPES | Field,
|
|
215
|
-
Prefix extends undefined |
|
|
166
|
+
Prefix extends undefined | Encoding | readonly Encoding[],
|
|
216
167
|
> =
|
|
217
|
-
Type extends
|
|
168
|
+
Type extends Field
|
|
218
169
|
? Parameters<Type['serialize']>[0]
|
|
219
170
|
: Type extends FIELD_TYPES
|
|
220
171
|
? BuildFieldTypes<Prefix>[Type]
|
|
221
|
-
: never
|
|
172
|
+
: never;
|
|
222
173
|
|
|
223
174
|
type NullablePartial<
|
|
224
175
|
T,
|
|
225
|
-
NK extends keyof T = { [K in keyof T]: undefined extends T[K] ? K : never }[keyof T]
|
|
226
|
-
> = Partial<Pick<T, NK>> & Omit<T, NK
|
|
176
|
+
NK extends keyof T = { [K in keyof T]: undefined extends T[K] ? K : never }[keyof T],
|
|
177
|
+
> = Partial<Pick<T, NK>> & Omit<T, NK>;
|
|
227
178
|
|
|
228
179
|
type BuildTxArgBySchema<SchemaLine> =
|
|
229
180
|
UnionToIntersection<
|
|
@@ -232,417 +183,422 @@ type BuildTxArgBySchema<SchemaLine> =
|
|
|
232
183
|
? NullablePartial<{ [k in Elem[0]]: BuildTxArgBySchemaType<Elem[1], Elem[2]> }>
|
|
233
184
|
: never
|
|
234
185
|
: never
|
|
235
|
-
|
|
186
|
+
>;
|
|
236
187
|
|
|
237
188
|
export type RawTxObject<Tx extends TxSchema> = {
|
|
238
|
-
[k in keyof Tx]
|
|
239
|
-
}
|
|
189
|
+
[k in keyof Tx]-?: Tx[k] extends BigNumber ? string : Tx[k]
|
|
190
|
+
};
|
|
240
191
|
|
|
241
192
|
const BASE_TX = [
|
|
242
|
-
['tag',
|
|
243
|
-
['VSN',
|
|
244
|
-
] as const
|
|
193
|
+
['tag', shortUInt],
|
|
194
|
+
['VSN', shortUInt],
|
|
195
|
+
] as const;
|
|
245
196
|
|
|
246
197
|
export const TX_SCHEMA = {
|
|
247
|
-
[
|
|
198
|
+
[Tag.Account]: {
|
|
199
|
+
1: [
|
|
200
|
+
...BASE_TX,
|
|
201
|
+
['nonce', shortUInt],
|
|
202
|
+
['balance', uInt],
|
|
203
|
+
],
|
|
248
204
|
2: [
|
|
249
205
|
...BASE_TX,
|
|
250
|
-
['flags',
|
|
251
|
-
['nonce',
|
|
252
|
-
['balance',
|
|
253
|
-
['gaContract', FIELD_TYPES.id, [
|
|
254
|
-
['gaAuthFun', FIELD_TYPES.binary,
|
|
255
|
-
]
|
|
206
|
+
['flags', uInt],
|
|
207
|
+
['nonce', shortUInt],
|
|
208
|
+
['balance', uInt],
|
|
209
|
+
['gaContract', FIELD_TYPES.id, [Encoding.ContractAddress, Encoding.Name]],
|
|
210
|
+
['gaAuthFun', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
211
|
+
],
|
|
256
212
|
},
|
|
257
|
-
[
|
|
213
|
+
[Tag.SignedTx]: {
|
|
258
214
|
1: [
|
|
259
215
|
...BASE_TX,
|
|
260
216
|
['signatures', FIELD_TYPES.signatures],
|
|
261
|
-
['encodedTx', FIELD_TYPES.rlpBinary]
|
|
262
|
-
]
|
|
217
|
+
['encodedTx', FIELD_TYPES.rlpBinary],
|
|
218
|
+
],
|
|
263
219
|
},
|
|
264
|
-
[
|
|
220
|
+
[Tag.SpendTx]: {
|
|
265
221
|
1: [
|
|
266
222
|
...BASE_TX,
|
|
267
|
-
['senderId', FIELD_TYPES.id,
|
|
268
|
-
['recipientId', FIELD_TYPES.id, [
|
|
269
|
-
['amount',
|
|
270
|
-
['fee',
|
|
271
|
-
['ttl',
|
|
272
|
-
['nonce',
|
|
273
|
-
['payload', FIELD_TYPES.payload]
|
|
274
|
-
]
|
|
223
|
+
['senderId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
224
|
+
['recipientId', FIELD_TYPES.id, [Encoding.AccountAddress, Encoding.Name]],
|
|
225
|
+
['amount', coinAmount],
|
|
226
|
+
['fee', fee],
|
|
227
|
+
['ttl', shortUInt],
|
|
228
|
+
['nonce', shortUInt],
|
|
229
|
+
['payload', FIELD_TYPES.payload],
|
|
230
|
+
],
|
|
275
231
|
},
|
|
276
|
-
[
|
|
232
|
+
[Tag.NamePreclaimTx]: {
|
|
277
233
|
1: [
|
|
278
234
|
...BASE_TX,
|
|
279
|
-
['accountId', FIELD_TYPES.id,
|
|
280
|
-
['nonce',
|
|
281
|
-
['commitmentId', FIELD_TYPES.id,
|
|
282
|
-
['fee',
|
|
283
|
-
['ttl',
|
|
284
|
-
]
|
|
235
|
+
['accountId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
236
|
+
['nonce', shortUInt],
|
|
237
|
+
['commitmentId', FIELD_TYPES.id, Encoding.Commitment],
|
|
238
|
+
['fee', fee],
|
|
239
|
+
['ttl', shortUInt],
|
|
240
|
+
],
|
|
285
241
|
},
|
|
286
|
-
[
|
|
242
|
+
[Tag.NameClaimTx]: {
|
|
287
243
|
2: [
|
|
288
244
|
...BASE_TX,
|
|
289
|
-
['accountId', FIELD_TYPES.id,
|
|
290
|
-
['nonce',
|
|
291
|
-
['name',
|
|
292
|
-
['nameSalt',
|
|
293
|
-
['nameFee',
|
|
294
|
-
['fee',
|
|
295
|
-
['ttl',
|
|
296
|
-
]
|
|
245
|
+
['accountId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
246
|
+
['nonce', shortUInt],
|
|
247
|
+
['name', name],
|
|
248
|
+
['nameSalt', uInt],
|
|
249
|
+
['nameFee', nameFee],
|
|
250
|
+
['fee', fee],
|
|
251
|
+
['ttl', shortUInt],
|
|
252
|
+
],
|
|
297
253
|
},
|
|
298
|
-
[
|
|
254
|
+
[Tag.NameUpdateTx]: {
|
|
299
255
|
1: [
|
|
300
256
|
...BASE_TX,
|
|
301
|
-
['accountId', FIELD_TYPES.id,
|
|
302
|
-
['nonce',
|
|
303
|
-
['nameId',
|
|
304
|
-
['nameTtl',
|
|
257
|
+
['accountId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
258
|
+
['nonce', shortUInt],
|
|
259
|
+
['nameId', nameId],
|
|
260
|
+
['nameTtl', uInt],
|
|
305
261
|
['pointers', FIELD_TYPES.pointers],
|
|
306
|
-
['clientTtl',
|
|
307
|
-
['fee',
|
|
308
|
-
['ttl',
|
|
309
|
-
]
|
|
262
|
+
['clientTtl', shortUInt],
|
|
263
|
+
['fee', fee],
|
|
264
|
+
['ttl', shortUInt],
|
|
265
|
+
],
|
|
310
266
|
},
|
|
311
|
-
[
|
|
267
|
+
[Tag.NameTransferTx]: {
|
|
312
268
|
1: [
|
|
313
269
|
...BASE_TX,
|
|
314
|
-
['accountId', FIELD_TYPES.id,
|
|
315
|
-
['nonce',
|
|
316
|
-
['nameId',
|
|
317
|
-
['recipientId', FIELD_TYPES.id, [
|
|
318
|
-
['fee',
|
|
319
|
-
['ttl',
|
|
320
|
-
]
|
|
270
|
+
['accountId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
271
|
+
['nonce', shortUInt],
|
|
272
|
+
['nameId', nameId],
|
|
273
|
+
['recipientId', FIELD_TYPES.id, [Encoding.AccountAddress, Encoding.Name]],
|
|
274
|
+
['fee', fee],
|
|
275
|
+
['ttl', shortUInt],
|
|
276
|
+
],
|
|
321
277
|
},
|
|
322
|
-
[
|
|
278
|
+
[Tag.NameRevokeTx]: {
|
|
323
279
|
1: [
|
|
324
280
|
...BASE_TX,
|
|
325
|
-
['accountId', FIELD_TYPES.id,
|
|
326
|
-
['nonce',
|
|
327
|
-
['nameId',
|
|
328
|
-
['fee',
|
|
329
|
-
['ttl',
|
|
330
|
-
]
|
|
281
|
+
['accountId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
282
|
+
['nonce', shortUInt],
|
|
283
|
+
['nameId', nameId],
|
|
284
|
+
['fee', fee],
|
|
285
|
+
['ttl', shortUInt],
|
|
286
|
+
],
|
|
331
287
|
},
|
|
332
|
-
[
|
|
288
|
+
[Tag.Contract]: {
|
|
333
289
|
1: [
|
|
334
290
|
...BASE_TX,
|
|
335
|
-
['owner', FIELD_TYPES.id,
|
|
291
|
+
['owner', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
336
292
|
['ctVersion', FIELD_TYPES.ctVersion],
|
|
337
|
-
['code', FIELD_TYPES.binary,
|
|
338
|
-
['log', FIELD_TYPES.binary,
|
|
293
|
+
['code', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
294
|
+
['log', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
339
295
|
['active', FIELD_TYPES.bool],
|
|
340
|
-
['referers', FIELD_TYPES.ids,
|
|
341
|
-
['deposit',
|
|
342
|
-
]
|
|
296
|
+
['referers', FIELD_TYPES.ids, Encoding.AccountAddress],
|
|
297
|
+
['deposit', deposit],
|
|
298
|
+
],
|
|
343
299
|
},
|
|
344
|
-
[
|
|
300
|
+
[Tag.ContractCreateTx]: {
|
|
345
301
|
1: [
|
|
346
302
|
...BASE_TX,
|
|
347
|
-
['ownerId', FIELD_TYPES.id,
|
|
348
|
-
['nonce',
|
|
349
|
-
['code', FIELD_TYPES.binary,
|
|
303
|
+
['ownerId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
304
|
+
['nonce', shortUInt],
|
|
305
|
+
['code', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
350
306
|
['ctVersion', FIELD_TYPES.ctVersion],
|
|
351
|
-
['fee',
|
|
352
|
-
['ttl',
|
|
353
|
-
['deposit',
|
|
354
|
-
['amount',
|
|
355
|
-
['gasLimit',
|
|
356
|
-
['gasPrice',
|
|
357
|
-
['callData', FIELD_TYPES.binary,
|
|
358
|
-
]
|
|
307
|
+
['fee', fee],
|
|
308
|
+
['ttl', shortUInt],
|
|
309
|
+
['deposit', deposit],
|
|
310
|
+
['amount', coinAmount],
|
|
311
|
+
['gasLimit', gasLimit],
|
|
312
|
+
['gasPrice', gasPrice],
|
|
313
|
+
['callData', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
314
|
+
],
|
|
359
315
|
},
|
|
360
|
-
[
|
|
316
|
+
[Tag.ContractCallTx]: {
|
|
361
317
|
1: [
|
|
362
318
|
...BASE_TX,
|
|
363
|
-
['callerId', FIELD_TYPES.id,
|
|
364
|
-
['nonce',
|
|
365
|
-
['contractId', FIELD_TYPES.id, [
|
|
319
|
+
['callerId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
320
|
+
['nonce', shortUInt],
|
|
321
|
+
['contractId', FIELD_TYPES.id, [Encoding.ContractAddress, Encoding.Name]],
|
|
366
322
|
['abiVersion', FIELD_TYPES.abiVersion],
|
|
367
|
-
['fee',
|
|
368
|
-
['ttl',
|
|
369
|
-
['amount',
|
|
370
|
-
['gasLimit',
|
|
371
|
-
['gasPrice',
|
|
372
|
-
['callData', FIELD_TYPES.binary,
|
|
373
|
-
]
|
|
374
|
-
},
|
|
375
|
-
[
|
|
376
|
-
1: [
|
|
377
|
-
...BASE_TX,
|
|
378
|
-
['callerId', FIELD_TYPES.id,
|
|
379
|
-
['callerNonce',
|
|
380
|
-
['height',
|
|
381
|
-
['contractId', FIELD_TYPES.id,
|
|
382
|
-
['gasPrice',
|
|
383
|
-
['gasUsed',
|
|
384
|
-
['returnValue', FIELD_TYPES.binary,
|
|
323
|
+
['fee', fee],
|
|
324
|
+
['ttl', shortUInt],
|
|
325
|
+
['amount', coinAmount],
|
|
326
|
+
['gasLimit', gasLimit],
|
|
327
|
+
['gasPrice', gasPrice],
|
|
328
|
+
['callData', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
329
|
+
],
|
|
330
|
+
},
|
|
331
|
+
[Tag.ContractCall]: {
|
|
332
|
+
1: [
|
|
333
|
+
...BASE_TX,
|
|
334
|
+
['callerId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
335
|
+
['callerNonce', shortUInt],
|
|
336
|
+
['height', shortUInt],
|
|
337
|
+
['contractId', FIELD_TYPES.id, Encoding.ContractAddress],
|
|
338
|
+
['gasPrice', gasPrice],
|
|
339
|
+
['gasUsed', shortUInt],
|
|
340
|
+
['returnValue', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
385
341
|
['returnType', FIELD_TYPES.callReturnType],
|
|
386
342
|
// TODO: add serialization for
|
|
387
343
|
// <log> :: [ { <address> :: id, [ <topics> :: binary() ], <data> :: binary() } ]
|
|
388
|
-
['log', FIELD_TYPES.rawBinary]
|
|
389
|
-
]
|
|
344
|
+
['log', FIELD_TYPES.rawBinary],
|
|
345
|
+
],
|
|
390
346
|
},
|
|
391
|
-
[
|
|
347
|
+
[Tag.OracleRegisterTx]: {
|
|
392
348
|
1: [
|
|
393
349
|
...BASE_TX,
|
|
394
|
-
['accountId', FIELD_TYPES.id,
|
|
395
|
-
['nonce',
|
|
350
|
+
['accountId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
351
|
+
['nonce', shortUInt],
|
|
396
352
|
['queryFormat', FIELD_TYPES.string],
|
|
397
353
|
['responseFormat', FIELD_TYPES.string],
|
|
398
|
-
['queryFee',
|
|
354
|
+
['queryFee', coinAmount],
|
|
399
355
|
['oracleTtlType', FIELD_TYPES.ttlType],
|
|
400
|
-
['oracleTtlValue',
|
|
401
|
-
['fee',
|
|
402
|
-
['ttl',
|
|
403
|
-
['abiVersion', FIELD_TYPES.abiVersion]
|
|
404
|
-
]
|
|
356
|
+
['oracleTtlValue', shortUInt],
|
|
357
|
+
['fee', fee],
|
|
358
|
+
['ttl', shortUInt],
|
|
359
|
+
['abiVersion', FIELD_TYPES.abiVersion],
|
|
360
|
+
],
|
|
405
361
|
},
|
|
406
|
-
[
|
|
362
|
+
[Tag.OracleExtendTx]: {
|
|
407
363
|
1: [
|
|
408
364
|
...BASE_TX,
|
|
409
|
-
['oracleId', FIELD_TYPES.id, [
|
|
410
|
-
['nonce',
|
|
365
|
+
['oracleId', FIELD_TYPES.id, [Encoding.OracleAddress, Encoding.Name]],
|
|
366
|
+
['nonce', shortUInt],
|
|
411
367
|
['oracleTtlType', FIELD_TYPES.ttlType],
|
|
412
|
-
['oracleTtlValue',
|
|
413
|
-
['fee',
|
|
414
|
-
['ttl',
|
|
415
|
-
]
|
|
368
|
+
['oracleTtlValue', shortUInt],
|
|
369
|
+
['fee', fee],
|
|
370
|
+
['ttl', shortUInt],
|
|
371
|
+
],
|
|
416
372
|
},
|
|
417
|
-
[
|
|
373
|
+
[Tag.OracleQueryTx]: {
|
|
418
374
|
1: [
|
|
419
375
|
...BASE_TX,
|
|
420
|
-
['senderId', FIELD_TYPES.id,
|
|
421
|
-
['nonce',
|
|
422
|
-
['oracleId', FIELD_TYPES.id, [
|
|
376
|
+
['senderId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
377
|
+
['nonce', shortUInt],
|
|
378
|
+
['oracleId', FIELD_TYPES.id, [Encoding.OracleAddress, Encoding.Name]],
|
|
423
379
|
['query', FIELD_TYPES.string],
|
|
424
|
-
['queryFee',
|
|
380
|
+
['queryFee', coinAmount],
|
|
425
381
|
['queryTtlType', FIELD_TYPES.ttlType],
|
|
426
|
-
['queryTtlValue',
|
|
382
|
+
['queryTtlValue', shortUInt],
|
|
427
383
|
['responseTtlType', FIELD_TYPES.ttlType],
|
|
428
|
-
['responseTtlValue',
|
|
429
|
-
['fee',
|
|
430
|
-
['ttl',
|
|
431
|
-
]
|
|
384
|
+
['responseTtlValue', shortUInt],
|
|
385
|
+
['fee', fee],
|
|
386
|
+
['ttl', shortUInt],
|
|
387
|
+
],
|
|
432
388
|
},
|
|
433
|
-
[
|
|
389
|
+
[Tag.OracleResponseTx]: {
|
|
434
390
|
1: [
|
|
435
391
|
...BASE_TX,
|
|
436
|
-
['oracleId', FIELD_TYPES.id,
|
|
437
|
-
['nonce',
|
|
438
|
-
['queryId', FIELD_TYPES.binary,
|
|
392
|
+
['oracleId', FIELD_TYPES.id, Encoding.OracleAddress],
|
|
393
|
+
['nonce', shortUInt],
|
|
394
|
+
['queryId', FIELD_TYPES.binary, Encoding.OracleQueryId],
|
|
439
395
|
['response', FIELD_TYPES.string],
|
|
440
396
|
['responseTtlType', FIELD_TYPES.ttlType],
|
|
441
|
-
['responseTtlValue',
|
|
442
|
-
['fee',
|
|
443
|
-
['ttl',
|
|
444
|
-
]
|
|
397
|
+
['responseTtlValue', shortUInt],
|
|
398
|
+
['fee', fee],
|
|
399
|
+
['ttl', shortUInt],
|
|
400
|
+
],
|
|
445
401
|
},
|
|
446
|
-
[
|
|
402
|
+
[Tag.ChannelCreateTx]: {
|
|
447
403
|
2: [
|
|
448
404
|
...BASE_TX,
|
|
449
|
-
['initiator', FIELD_TYPES.id,
|
|
450
|
-
['initiatorAmount',
|
|
451
|
-
['responder', FIELD_TYPES.id,
|
|
452
|
-
['responderAmount',
|
|
453
|
-
['channelReserve',
|
|
454
|
-
['lockPeriod',
|
|
455
|
-
['ttl',
|
|
456
|
-
['fee',
|
|
405
|
+
['initiator', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
406
|
+
['initiatorAmount', uInt],
|
|
407
|
+
['responder', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
408
|
+
['responderAmount', uInt],
|
|
409
|
+
['channelReserve', uInt],
|
|
410
|
+
['lockPeriod', uInt],
|
|
411
|
+
['ttl', shortUInt],
|
|
412
|
+
['fee', fee],
|
|
457
413
|
['initiatorDelegateIds', FIELD_TYPES.string],
|
|
458
414
|
['responderDelegateIds', FIELD_TYPES.string],
|
|
459
415
|
['stateHash', FIELD_TYPES.binary, 'st'],
|
|
460
|
-
['nonce',
|
|
461
|
-
]
|
|
416
|
+
['nonce', shortUInt],
|
|
417
|
+
],
|
|
462
418
|
},
|
|
463
|
-
[
|
|
419
|
+
[Tag.ChannelCloseMutualTx]: {
|
|
464
420
|
1: [
|
|
465
421
|
...BASE_TX,
|
|
466
|
-
['channelId', FIELD_TYPES.id,
|
|
467
|
-
['fromId', FIELD_TYPES.id,
|
|
468
|
-
['initiatorAmountFinal',
|
|
469
|
-
['responderAmountFinal',
|
|
470
|
-
['ttl',
|
|
471
|
-
['fee',
|
|
472
|
-
['nonce',
|
|
473
|
-
]
|
|
422
|
+
['channelId', FIELD_TYPES.id, Encoding.Channel],
|
|
423
|
+
['fromId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
424
|
+
['initiatorAmountFinal', uInt],
|
|
425
|
+
['responderAmountFinal', uInt],
|
|
426
|
+
['ttl', shortUInt],
|
|
427
|
+
['fee', fee],
|
|
428
|
+
['nonce', shortUInt],
|
|
429
|
+
],
|
|
474
430
|
},
|
|
475
|
-
[
|
|
431
|
+
[Tag.ChannelCloseSoloTx]: {
|
|
476
432
|
1: [
|
|
477
433
|
...BASE_TX,
|
|
478
|
-
['channelId', FIELD_TYPES.id,
|
|
479
|
-
['fromId', FIELD_TYPES.id,
|
|
434
|
+
['channelId', FIELD_TYPES.id, Encoding.Channel],
|
|
435
|
+
['fromId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
480
436
|
['payload', FIELD_TYPES.binary, 'tx'],
|
|
481
437
|
['poi', FIELD_TYPES.binary, 'pi'],
|
|
482
|
-
['ttl',
|
|
483
|
-
['fee',
|
|
484
|
-
['nonce',
|
|
485
|
-
]
|
|
438
|
+
['ttl', shortUInt],
|
|
439
|
+
['fee', fee],
|
|
440
|
+
['nonce', shortUInt],
|
|
441
|
+
],
|
|
486
442
|
},
|
|
487
|
-
[
|
|
443
|
+
[Tag.ChannelSlashTx]: {
|
|
488
444
|
1: [
|
|
489
445
|
...BASE_TX,
|
|
490
|
-
['channelId', FIELD_TYPES.id,
|
|
491
|
-
['fromId', FIELD_TYPES.id,
|
|
446
|
+
['channelId', FIELD_TYPES.id, Encoding.Channel],
|
|
447
|
+
['fromId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
492
448
|
['payload', FIELD_TYPES.binary, 'tx'],
|
|
493
449
|
['poi', FIELD_TYPES.binary, 'pi'],
|
|
494
|
-
['ttl',
|
|
495
|
-
['fee',
|
|
496
|
-
['nonce',
|
|
497
|
-
]
|
|
450
|
+
['ttl', shortUInt],
|
|
451
|
+
['fee', fee],
|
|
452
|
+
['nonce', shortUInt],
|
|
453
|
+
],
|
|
498
454
|
},
|
|
499
|
-
[
|
|
455
|
+
[Tag.ChannelDepositTx]: {
|
|
500
456
|
1: [
|
|
501
457
|
...BASE_TX,
|
|
502
|
-
['channelId', FIELD_TYPES.id,
|
|
503
|
-
['fromId', FIELD_TYPES.id,
|
|
504
|
-
['amount',
|
|
505
|
-
['ttl',
|
|
506
|
-
['fee',
|
|
458
|
+
['channelId', FIELD_TYPES.id, Encoding.Channel],
|
|
459
|
+
['fromId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
460
|
+
['amount', uInt],
|
|
461
|
+
['ttl', shortUInt],
|
|
462
|
+
['fee', fee],
|
|
507
463
|
['stateHash', FIELD_TYPES.binary, 'st'],
|
|
508
|
-
['round',
|
|
509
|
-
['nonce',
|
|
510
|
-
]
|
|
464
|
+
['round', shortUInt],
|
|
465
|
+
['nonce', shortUInt],
|
|
466
|
+
],
|
|
511
467
|
},
|
|
512
|
-
[
|
|
468
|
+
[Tag.ChannelWithdrawTx]: {
|
|
513
469
|
1: [
|
|
514
470
|
...BASE_TX,
|
|
515
|
-
['channelId', FIELD_TYPES.id,
|
|
516
|
-
['toId', FIELD_TYPES.id,
|
|
517
|
-
['amount',
|
|
518
|
-
['ttl',
|
|
519
|
-
['fee',
|
|
471
|
+
['channelId', FIELD_TYPES.id, Encoding.Channel],
|
|
472
|
+
['toId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
473
|
+
['amount', uInt],
|
|
474
|
+
['ttl', shortUInt],
|
|
475
|
+
['fee', fee],
|
|
520
476
|
['stateHash', FIELD_TYPES.binary, 'st'],
|
|
521
|
-
['round',
|
|
522
|
-
['nonce',
|
|
523
|
-
]
|
|
477
|
+
['round', shortUInt],
|
|
478
|
+
['nonce', shortUInt],
|
|
479
|
+
],
|
|
524
480
|
},
|
|
525
|
-
[
|
|
481
|
+
[Tag.ChannelSettleTx]: {
|
|
526
482
|
1: [
|
|
527
483
|
...BASE_TX,
|
|
528
|
-
['channelId', FIELD_TYPES.id,
|
|
529
|
-
['fromId', FIELD_TYPES.id,
|
|
530
|
-
['initiatorAmountFinal',
|
|
531
|
-
['responderAmountFinal',
|
|
532
|
-
['ttl',
|
|
533
|
-
['fee',
|
|
534
|
-
['nonce',
|
|
535
|
-
]
|
|
484
|
+
['channelId', FIELD_TYPES.id, Encoding.Channel],
|
|
485
|
+
['fromId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
486
|
+
['initiatorAmountFinal', uInt],
|
|
487
|
+
['responderAmountFinal', uInt],
|
|
488
|
+
['ttl', shortUInt],
|
|
489
|
+
['fee', fee],
|
|
490
|
+
['nonce', shortUInt],
|
|
491
|
+
],
|
|
536
492
|
},
|
|
537
|
-
[
|
|
493
|
+
[Tag.ChannelForceProgressTx]: {
|
|
538
494
|
1: [
|
|
539
495
|
...BASE_TX,
|
|
540
|
-
['channelId', FIELD_TYPES.id,
|
|
541
|
-
['fromId', FIELD_TYPES.id,
|
|
496
|
+
['channelId', FIELD_TYPES.id, Encoding.Channel],
|
|
497
|
+
['fromId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
542
498
|
['payload', FIELD_TYPES.binary, 'tx'],
|
|
543
|
-
['round',
|
|
544
|
-
['update', FIELD_TYPES.binary,
|
|
499
|
+
['round', shortUInt],
|
|
500
|
+
['update', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
545
501
|
['stateHash', FIELD_TYPES.binary, 'st'],
|
|
546
502
|
['offChainTrees', FIELD_TYPES.stateTree],
|
|
547
|
-
['ttl',
|
|
548
|
-
['fee',
|
|
549
|
-
['nonce',
|
|
550
|
-
]
|
|
503
|
+
['ttl', shortUInt],
|
|
504
|
+
['fee', fee],
|
|
505
|
+
['nonce', shortUInt],
|
|
506
|
+
],
|
|
551
507
|
},
|
|
552
|
-
[
|
|
508
|
+
[Tag.ChannelOffChainTx]: {
|
|
553
509
|
2: [
|
|
554
510
|
...BASE_TX,
|
|
555
|
-
['channelId', FIELD_TYPES.id,
|
|
556
|
-
['round',
|
|
557
|
-
['stateHash', FIELD_TYPES.binary, 'st']
|
|
558
|
-
]
|
|
511
|
+
['channelId', FIELD_TYPES.id, Encoding.Channel],
|
|
512
|
+
['round', shortUInt],
|
|
513
|
+
['stateHash', FIELD_TYPES.binary, 'st'],
|
|
514
|
+
],
|
|
559
515
|
},
|
|
560
|
-
[
|
|
516
|
+
[Tag.Channel]: {
|
|
561
517
|
3: [
|
|
562
518
|
...BASE_TX,
|
|
563
|
-
['initiator', FIELD_TYPES.id,
|
|
564
|
-
['responder', FIELD_TYPES.id,
|
|
565
|
-
['channelAmount',
|
|
566
|
-
['initiatorAmount',
|
|
567
|
-
['responderAmount',
|
|
568
|
-
['channelReserve',
|
|
519
|
+
['initiator', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
520
|
+
['responder', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
521
|
+
['channelAmount', uInt],
|
|
522
|
+
['initiatorAmount', uInt],
|
|
523
|
+
['responderAmount', uInt],
|
|
524
|
+
['channelReserve', uInt],
|
|
569
525
|
['initiatorDelegateIds', FIELD_TYPES.ids],
|
|
570
526
|
['responderDelegateIds', FIELD_TYPES.ids],
|
|
571
527
|
['stateHash', FIELD_TYPES.hex],
|
|
572
|
-
['round',
|
|
573
|
-
['soloRound',
|
|
574
|
-
['lockPeriod',
|
|
575
|
-
['lockedUntil',
|
|
576
|
-
['initiatorAuth', FIELD_TYPES.binary,
|
|
577
|
-
['responderAuth', FIELD_TYPES.binary,
|
|
578
|
-
]
|
|
528
|
+
['round', shortUInt],
|
|
529
|
+
['soloRound', uInt],
|
|
530
|
+
['lockPeriod', uInt],
|
|
531
|
+
['lockedUntil', uInt],
|
|
532
|
+
['initiatorAuth', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
533
|
+
['responderAuth', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
534
|
+
],
|
|
579
535
|
},
|
|
580
|
-
[
|
|
536
|
+
[Tag.ChannelSnapshotSoloTx]: {
|
|
581
537
|
1: [
|
|
582
538
|
...BASE_TX,
|
|
583
|
-
['channelId', FIELD_TYPES.id,
|
|
584
|
-
['fromId', FIELD_TYPES.id,
|
|
539
|
+
['channelId', FIELD_TYPES.id, Encoding.Channel],
|
|
540
|
+
['fromId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
585
541
|
['payload', FIELD_TYPES.binary, 'tx'],
|
|
586
|
-
['ttl',
|
|
587
|
-
['fee',
|
|
588
|
-
['nonce',
|
|
589
|
-
]
|
|
542
|
+
['ttl', shortUInt],
|
|
543
|
+
['fee', fee],
|
|
544
|
+
['nonce', shortUInt],
|
|
545
|
+
],
|
|
590
546
|
},
|
|
591
|
-
[
|
|
547
|
+
[Tag.ChannelOffChainUpdateTransfer]: {
|
|
592
548
|
1: [
|
|
593
549
|
...BASE_TX,
|
|
594
|
-
['from', FIELD_TYPES.id,
|
|
595
|
-
['to', FIELD_TYPES.id,
|
|
596
|
-
['amount',
|
|
597
|
-
]
|
|
550
|
+
['from', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
551
|
+
['to', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
552
|
+
['amount', uInt],
|
|
553
|
+
],
|
|
598
554
|
},
|
|
599
|
-
[
|
|
555
|
+
[Tag.ChannelOffChainUpdateDeposit]: {
|
|
600
556
|
1: [
|
|
601
557
|
...BASE_TX,
|
|
602
|
-
['from', FIELD_TYPES.id,
|
|
603
|
-
['amount',
|
|
604
|
-
]
|
|
558
|
+
['from', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
559
|
+
['amount', uInt],
|
|
560
|
+
],
|
|
605
561
|
},
|
|
606
|
-
[
|
|
562
|
+
[Tag.ChannelOffChainUpdateWithdraw]: {
|
|
607
563
|
1: [
|
|
608
564
|
...BASE_TX,
|
|
609
|
-
['from', FIELD_TYPES.id,
|
|
610
|
-
['amount',
|
|
611
|
-
]
|
|
565
|
+
['from', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
566
|
+
['amount', uInt],
|
|
567
|
+
],
|
|
612
568
|
},
|
|
613
|
-
[
|
|
569
|
+
[Tag.ChannelOffChainUpdateCreateContract]: {
|
|
614
570
|
1: [
|
|
615
571
|
...BASE_TX,
|
|
616
|
-
['owner', FIELD_TYPES.id,
|
|
572
|
+
['owner', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
617
573
|
['ctVersion', FIELD_TYPES.ctVersion],
|
|
618
|
-
['code', FIELD_TYPES.binary,
|
|
619
|
-
['deposit',
|
|
620
|
-
['callData', FIELD_TYPES.binary,
|
|
621
|
-
]
|
|
574
|
+
['code', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
575
|
+
['deposit', uInt],
|
|
576
|
+
['callData', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
577
|
+
],
|
|
622
578
|
},
|
|
623
|
-
[
|
|
579
|
+
[Tag.ChannelOffChainUpdateCallContract]: {
|
|
624
580
|
1: [
|
|
625
581
|
...BASE_TX,
|
|
626
|
-
['caller', FIELD_TYPES.id,
|
|
627
|
-
['contract', FIELD_TYPES.id,
|
|
582
|
+
['caller', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
583
|
+
['contract', FIELD_TYPES.id, Encoding.ContractAddress],
|
|
628
584
|
['abiVersion', FIELD_TYPES.abiVersion],
|
|
629
|
-
['amount',
|
|
630
|
-
['callData', FIELD_TYPES.binary,
|
|
585
|
+
['amount', uInt],
|
|
586
|
+
['callData', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
631
587
|
['callStack', FIELD_TYPES.callStack],
|
|
632
|
-
['gasPrice',
|
|
633
|
-
['gasLimit',
|
|
634
|
-
]
|
|
588
|
+
['gasPrice', gasPrice],
|
|
589
|
+
['gasLimit', gasLimit],
|
|
590
|
+
],
|
|
635
591
|
},
|
|
636
|
-
[
|
|
592
|
+
[Tag.ChannelClientReconnectTx]: {
|
|
637
593
|
1: [
|
|
638
594
|
...BASE_TX,
|
|
639
|
-
['channelId', FIELD_TYPES.id,
|
|
640
|
-
['round',
|
|
595
|
+
['channelId', FIELD_TYPES.id, Encoding.Channel],
|
|
596
|
+
['round', shortUInt],
|
|
641
597
|
['role', FIELD_TYPES.string],
|
|
642
|
-
['pubkey', FIELD_TYPES.id,
|
|
643
|
-
]
|
|
598
|
+
['pubkey', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
599
|
+
],
|
|
644
600
|
},
|
|
645
|
-
[
|
|
601
|
+
[Tag.TreesPoi]: {
|
|
646
602
|
1: [
|
|
647
603
|
...BASE_TX,
|
|
648
604
|
['accounts', FIELD_TYPES.mptrees],
|
|
@@ -650,10 +606,10 @@ export const TX_SCHEMA = {
|
|
|
650
606
|
['channels', FIELD_TYPES.mptrees],
|
|
651
607
|
['contracts', FIELD_TYPES.mptrees],
|
|
652
608
|
['ns', FIELD_TYPES.mptrees],
|
|
653
|
-
['oracles', FIELD_TYPES.mptrees]
|
|
654
|
-
]
|
|
609
|
+
['oracles', FIELD_TYPES.mptrees],
|
|
610
|
+
],
|
|
655
611
|
},
|
|
656
|
-
[
|
|
612
|
+
[Tag.StateTrees]: {
|
|
657
613
|
1: [
|
|
658
614
|
...BASE_TX,
|
|
659
615
|
['contracts', FIELD_TYPES.rlpBinary],
|
|
@@ -661,111 +617,111 @@ export const TX_SCHEMA = {
|
|
|
661
617
|
['channels', FIELD_TYPES.rlpBinary],
|
|
662
618
|
['ns', FIELD_TYPES.rlpBinary],
|
|
663
619
|
['oracles', FIELD_TYPES.rlpBinary],
|
|
664
|
-
['accounts', FIELD_TYPES.rlpBinary]
|
|
665
|
-
]
|
|
620
|
+
['accounts', FIELD_TYPES.rlpBinary],
|
|
621
|
+
],
|
|
666
622
|
},
|
|
667
|
-
[
|
|
623
|
+
[Tag.Mtree]: {
|
|
668
624
|
1: [
|
|
669
625
|
...BASE_TX,
|
|
670
|
-
['values', FIELD_TYPES.rlpBinaries]
|
|
671
|
-
]
|
|
626
|
+
['values', FIELD_TYPES.rlpBinaries],
|
|
627
|
+
],
|
|
672
628
|
},
|
|
673
|
-
[
|
|
629
|
+
[Tag.MtreeValue]: {
|
|
674
630
|
1: [
|
|
675
631
|
...BASE_TX,
|
|
676
632
|
['key', FIELD_TYPES.hex],
|
|
677
|
-
['value', FIELD_TYPES.rawBinary]
|
|
678
|
-
]
|
|
633
|
+
['value', FIELD_TYPES.rawBinary],
|
|
634
|
+
],
|
|
679
635
|
},
|
|
680
|
-
[
|
|
636
|
+
[Tag.ContractsMtree]: {
|
|
681
637
|
1: [
|
|
682
638
|
...BASE_TX,
|
|
683
|
-
['contracts', FIELD_TYPES.rlpBinary]
|
|
684
|
-
]
|
|
639
|
+
['contracts', FIELD_TYPES.rlpBinary],
|
|
640
|
+
],
|
|
685
641
|
},
|
|
686
|
-
[
|
|
642
|
+
[Tag.CallsMtree]: {
|
|
687
643
|
1: [
|
|
688
644
|
...BASE_TX,
|
|
689
|
-
['calls', FIELD_TYPES.rlpBinary]
|
|
690
|
-
]
|
|
645
|
+
['calls', FIELD_TYPES.rlpBinary],
|
|
646
|
+
],
|
|
691
647
|
},
|
|
692
|
-
[
|
|
648
|
+
[Tag.ChannelsMtree]: {
|
|
693
649
|
1: [
|
|
694
650
|
...BASE_TX,
|
|
695
|
-
['channels', FIELD_TYPES.rlpBinary]
|
|
696
|
-
]
|
|
651
|
+
['channels', FIELD_TYPES.rlpBinary],
|
|
652
|
+
],
|
|
697
653
|
},
|
|
698
|
-
[
|
|
654
|
+
[Tag.NameserviceMtree]: {
|
|
699
655
|
1: [
|
|
700
656
|
...BASE_TX,
|
|
701
|
-
['mtree', FIELD_TYPES.rlpBinary]
|
|
702
|
-
]
|
|
657
|
+
['mtree', FIELD_TYPES.rlpBinary],
|
|
658
|
+
],
|
|
703
659
|
},
|
|
704
|
-
[
|
|
660
|
+
[Tag.OraclesMtree]: {
|
|
705
661
|
1: [
|
|
706
662
|
...BASE_TX,
|
|
707
|
-
['otree', FIELD_TYPES.rlpBinary]
|
|
708
|
-
]
|
|
663
|
+
['otree', FIELD_TYPES.rlpBinary],
|
|
664
|
+
],
|
|
709
665
|
},
|
|
710
|
-
[
|
|
666
|
+
[Tag.AccountsMtree]: {
|
|
711
667
|
1: [
|
|
712
668
|
...BASE_TX,
|
|
713
|
-
['accounts', FIELD_TYPES.rlpBinary]
|
|
714
|
-
]
|
|
669
|
+
['accounts', FIELD_TYPES.rlpBinary],
|
|
670
|
+
],
|
|
715
671
|
},
|
|
716
|
-
[
|
|
672
|
+
[Tag.GaAttachTx]: {
|
|
717
673
|
1: [
|
|
718
674
|
...BASE_TX,
|
|
719
|
-
['ownerId', FIELD_TYPES.id,
|
|
720
|
-
['nonce',
|
|
721
|
-
['code', FIELD_TYPES.binary,
|
|
675
|
+
['ownerId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
676
|
+
['nonce', shortUInt],
|
|
677
|
+
['code', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
722
678
|
['authFun', FIELD_TYPES.rawBinary],
|
|
723
679
|
['ctVersion', FIELD_TYPES.ctVersion],
|
|
724
|
-
['fee',
|
|
725
|
-
['ttl',
|
|
726
|
-
['gasLimit',
|
|
727
|
-
['gasPrice',
|
|
728
|
-
['callData', FIELD_TYPES.binary,
|
|
729
|
-
]
|
|
730
|
-
},
|
|
731
|
-
[
|
|
680
|
+
['fee', fee],
|
|
681
|
+
['ttl', shortUInt],
|
|
682
|
+
['gasLimit', gasLimit],
|
|
683
|
+
['gasPrice', gasPrice],
|
|
684
|
+
['callData', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
685
|
+
],
|
|
686
|
+
},
|
|
687
|
+
[Tag.GaMetaTx]: {
|
|
732
688
|
2: [
|
|
733
689
|
...BASE_TX,
|
|
734
|
-
['gaId', FIELD_TYPES.id,
|
|
735
|
-
['authData', FIELD_TYPES.binary,
|
|
690
|
+
['gaId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
691
|
+
['authData', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
736
692
|
['abiVersion', FIELD_TYPES.abiVersion],
|
|
737
|
-
['fee',
|
|
738
|
-
['gasLimit',
|
|
739
|
-
['gasPrice',
|
|
740
|
-
['tx', FIELD_TYPES.rlpBinary]
|
|
741
|
-
]
|
|
693
|
+
['fee', fee],
|
|
694
|
+
['gasLimit', gasLimit],
|
|
695
|
+
['gasPrice', gasPrice],
|
|
696
|
+
['tx', FIELD_TYPES.rlpBinary],
|
|
697
|
+
],
|
|
742
698
|
},
|
|
743
|
-
[
|
|
699
|
+
[Tag.PayingForTx]: {
|
|
744
700
|
1: [
|
|
745
701
|
...BASE_TX,
|
|
746
|
-
['payerId', FIELD_TYPES.id,
|
|
747
|
-
['nonce',
|
|
748
|
-
['fee',
|
|
749
|
-
['tx', FIELD_TYPES.rlpBinary]
|
|
750
|
-
]
|
|
702
|
+
['payerId', FIELD_TYPES.id, Encoding.AccountAddress],
|
|
703
|
+
['nonce', shortUInt],
|
|
704
|
+
['fee', fee],
|
|
705
|
+
['tx', FIELD_TYPES.rlpBinary],
|
|
706
|
+
],
|
|
751
707
|
},
|
|
752
|
-
[
|
|
708
|
+
[Tag.CompilerSophia]: {
|
|
753
709
|
3: [
|
|
754
710
|
...BASE_TX,
|
|
755
711
|
['sourceCodeHash', FIELD_TYPES.rawBinary],
|
|
756
712
|
['typeInfo', FIELD_TYPES.sophiaCodeTypeInfo],
|
|
757
713
|
['byteCode', FIELD_TYPES.rawBinary],
|
|
758
714
|
['compilerVersion', FIELD_TYPES.string],
|
|
759
|
-
['payable', FIELD_TYPES.bool]
|
|
760
|
-
]
|
|
761
|
-
}
|
|
762
|
-
} as const
|
|
715
|
+
['payable', FIELD_TYPES.bool],
|
|
716
|
+
],
|
|
717
|
+
},
|
|
718
|
+
} as const;
|
|
763
719
|
|
|
764
720
|
export type TxTypeSchemas = {
|
|
765
|
-
[key in
|
|
721
|
+
[key in Tag]: BuildTxArgBySchema<
|
|
766
722
|
typeof TX_SCHEMA[key][keyof typeof TX_SCHEMA[key]]
|
|
767
723
|
>
|
|
768
|
-
}
|
|
724
|
+
};
|
|
769
725
|
|
|
770
|
-
export type TxSchema = TxTypeSchemas[
|
|
771
|
-
export type TxParamsCommon = Partial<UnionToIntersection<TxSchema
|
|
726
|
+
export type TxSchema = TxTypeSchemas[Tag];
|
|
727
|
+
export type TxParamsCommon = Partial<UnionToIntersection<TxSchema>>;
|