@aeternity/aepp-sdk 12.1.2 → 13.0.0-alpha.0
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.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 +6580 -8860
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdk.d.ts +7 -3
- package/es/AeSdk.mjs +17 -22
- package/es/AeSdk.mjs.map +1 -1
- package/es/AeSdkAepp.d.ts +6 -5
- package/es/AeSdkAepp.mjs +7 -30
- package/es/AeSdkAepp.mjs.map +1 -1
- package/es/AeSdkBase.d.ts +18 -140
- package/es/AeSdkBase.mjs +27 -185
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkMethods.d.ts +124 -0
- package/es/AeSdkMethods.mjs +122 -0
- package/es/AeSdkMethods.mjs.map +1 -0
- package/es/AeSdkWallet.d.ts +7 -21
- package/es/AeSdkWallet.mjs +38 -86
- package/es/AeSdkWallet.mjs.map +1 -1
- package/es/Node.d.ts +7 -12
- package/es/Node.mjs +34 -47
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +24 -40
- package/es/account/Base.mjs +1 -101
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Generalized.d.ts +16 -0
- package/es/account/Generalized.mjs +111 -0
- package/es/account/Generalized.mjs.map +1 -0
- package/es/account/Ledger.d.ts +28 -0
- package/es/account/Ledger.mjs +101 -0
- package/es/account/Ledger.mjs.map +1 -0
- package/es/account/LedgerFactory.d.ts +39 -0
- package/es/account/LedgerFactory.mjs +81 -0
- package/es/account/LedgerFactory.mjs.map +1 -0
- package/es/account/Memory.d.ts +13 -17
- package/es/account/Memory.mjs +43 -65
- package/es/account/Memory.mjs.map +1 -1
- package/es/account/Rpc.d.ts +6 -8
- package/es/account/Rpc.mjs +14 -32
- package/es/account/Rpc.mjs.map +1 -1
- package/es/aens.d.ts +3 -3
- package/es/aens.mjs +42 -41
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/Browser.mjs +9 -13
- package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +3 -7
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +0 -31
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +3 -3
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +4 -41
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/types.d.ts +7 -1
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
- package/es/aepp-wallet-communication/schema.mjs +14 -68
- package/es/aepp-wallet-communication/schema.mjs.map +1 -1
- package/es/aepp-wallet-communication/wallet-detector.mjs +0 -3
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
- package/es/apis/compiler/compiler.d.ts +23 -29
- package/es/apis/compiler/compiler.mjs +128 -189
- package/es/apis/compiler/compiler.mjs.map +1 -1
- package/es/apis/compiler/index.mjs.map +1 -1
- package/es/apis/compiler/models/index.d.ts +82 -135
- package/es/apis/compiler/models/index.mjs +1 -47
- package/es/apis/compiler/models/index.mjs.map +1 -1
- package/es/apis/compiler/models/mappers.d.ts +8 -8
- package/es/apis/compiler/models/mappers.mjs +165 -183
- package/es/apis/compiler/models/mappers.mjs.map +1 -1
- package/es/apis/compiler/models/parameters.d.ts +0 -1
- package/es/apis/compiler/models/parameters.mjs +5 -9
- package/es/apis/compiler/models/parameters.mjs.map +1 -1
- package/es/apis/node/index.mjs.map +1 -1
- package/es/apis/node/models/index.d.ts +48 -48
- package/es/apis/node/models/mappers.mjs +12 -6
- package/es/apis/node/models/mappers.mjs.map +1 -1
- package/es/apis/node/models/parameters.mjs.map +1 -1
- package/es/apis/node/node.mjs +43 -84
- package/es/apis/node/node.mjs.map +1 -1
- package/es/chain.d.ts +1 -1
- package/es/chain.mjs +33 -58
- package/es/chain.mjs.map +1 -1
- package/es/channel/Base.d.ts +195 -0
- package/es/channel/Base.mjs +290 -0
- package/es/channel/Base.mjs.map +1 -0
- package/es/channel/Contract.d.ts +247 -0
- package/es/channel/Contract.mjs +420 -0
- package/es/channel/Contract.mjs.map +1 -0
- package/es/channel/Spend.d.ts +217 -0
- package/es/channel/Spend.mjs +383 -0
- package/es/channel/Spend.mjs.map +1 -0
- package/es/channel/handlers.d.ts +8 -21
- package/es/channel/handlers.mjs +141 -891
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/internal.d.ts +27 -21
- package/es/channel/internal.mjs +98 -190
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/{Compiler.d.ts → CompilerHttp.d.ts} +3 -3
- package/es/contract/{Compiler.mjs → CompilerHttp.mjs} +8 -13
- package/es/contract/CompilerHttp.mjs.map +1 -0
- package/es/contract/Contract.d.ts +235 -0
- package/es/contract/Contract.mjs +534 -0
- package/es/contract/Contract.mjs.map +1 -0
- package/es/contract/ga.d.ts +7 -33
- package/es/contract/ga.mjs +20 -112
- package/es/contract/ga.mjs.map +1 -1
- package/es/index.d.ts +9 -6
- package/es/index.mjs +8 -6
- package/es/index.mjs.map +1 -1
- package/es/oracle.d.ts +5 -5
- package/es/oracle.mjs +33 -39
- package/es/oracle.mjs.map +1 -1
- package/es/spend.d.ts +3 -3
- package/es/spend.mjs +17 -20
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/constants.d.ts +2 -1
- package/es/tx/builder/constants.mjs +12 -12
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/field-types/address.d.ts +15 -0
- package/es/tx/builder/field-types/address.mjs +42 -0
- package/es/tx/builder/field-types/address.mjs.map +1 -0
- package/es/tx/builder/field-types/addresses.d.ts +6 -0
- package/es/tx/builder/field-types/addresses.mjs +13 -0
- package/es/tx/builder/field-types/addresses.mjs.map +1 -0
- package/es/tx/builder/field-types/coin-amount.d.ts +1 -2
- package/es/tx/builder/field-types/coin-amount.mjs +4 -12
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
- package/es/tx/builder/field-types/deposit.d.ts +0 -1
- package/es/tx/builder/field-types/deposit.mjs +2 -4
- package/es/tx/builder/field-types/deposit.mjs.map +1 -1
- package/es/tx/builder/field-types/enumeration.d.ts +5 -0
- package/es/tx/builder/field-types/enumeration.mjs +21 -0
- package/es/tx/builder/field-types/enumeration.mjs.map +1 -0
- package/es/tx/builder/field-types/fee.d.ts +1 -9
- package/es/tx/builder/field-types/fee.mjs +9 -25
- package/es/tx/builder/field-types/fee.mjs.map +1 -1
- package/es/tx/builder/field-types/field.mjs +0 -2
- package/es/tx/builder/field-types/field.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-limit.mjs +4 -9
- package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-price.d.ts +1 -2
- package/es/tx/builder/field-types/gas-price.mjs +3 -7
- package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
- package/es/tx/builder/field-types/index.d.ts +23 -11
- package/es/tx/builder/field-types/index.mjs +10 -3
- package/es/tx/builder/field-types/index.mjs.map +1 -1
- package/es/tx/builder/field-types/name-fee.d.ts +0 -1
- package/es/tx/builder/field-types/name-fee.mjs +3 -5
- package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
- package/es/tx/builder/field-types/name-id.d.ts +1 -4
- package/es/tx/builder/field-types/name-id.mjs +4 -10
- package/es/tx/builder/field-types/name-id.mjs.map +1 -1
- package/es/tx/builder/field-types/name.mjs +0 -2
- package/es/tx/builder/field-types/name.mjs.map +1 -1
- package/es/tx/builder/field-types/pointers.d.ts +23 -0
- package/es/tx/builder/field-types/pointers.mjs +36 -0
- package/es/tx/builder/field-types/pointers.mjs.map +1 -0
- package/es/tx/builder/field-types/short-u-int.mjs +0 -2
- package/es/tx/builder/field-types/short-u-int.mjs.map +1 -1
- package/es/tx/builder/field-types/u-int.d.ts +1 -1
- package/es/tx/builder/field-types/u-int.mjs +3 -4
- package/es/tx/builder/field-types/u-int.mjs.map +1 -1
- package/es/tx/builder/helpers.d.ts +2 -32
- package/es/tx/builder/helpers.mjs +19 -71
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +1 -21
- package/es/tx/builder/index.mjs +29 -148
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +336 -176
- package/es/tx/builder/schema.mjs +71 -78
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/index.d.ts +3 -33
- package/es/tx/index.mjs +26 -43
- package/es/tx/index.mjs.map +1 -1
- package/es/tx/validator.d.ts +2 -2
- package/es/tx/validator.mjs +86 -59
- package/es/tx/validator.mjs.map +1 -1
- package/es/typings/{@aeternity__argon2-browser → @aeternity__aepp-calldata}/index.d.mjs +0 -0
- package/es/typings/@aeternity__aepp-calldata/index.d.mjs.map +1 -0
- package/es/utils/amount-formatter.mjs +4 -10
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.d.ts +1 -0
- package/es/utils/autorest.mjs +17 -19
- package/es/utils/autorest.mjs.map +1 -1
- package/es/utils/bignumber.mjs +4 -7
- package/es/utils/bignumber.mjs.map +1 -1
- package/es/utils/bytes.d.ts +0 -17
- package/es/utils/bytes.mjs +6 -35
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/crypto.d.ts +15 -8
- package/es/utils/crypto.mjs +40 -40
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/encoder-types.d.ts +28 -28
- package/es/utils/encoder-types.mjs +0 -1
- package/es/utils/encoder-types.mjs.map +1 -1
- package/es/utils/encoder.d.ts +0 -1
- package/es/utils/encoder.mjs +7 -15
- package/es/utils/encoder.mjs.map +1 -1
- package/es/utils/errors.d.ts +12 -6
- package/es/utils/errors.mjs +87 -163
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/hd-wallet.d.ts +27 -19
- package/es/utils/hd-wallet.mjs +42 -26
- package/es/utils/hd-wallet.mjs.map +1 -1
- package/es/utils/json-big.mjs +0 -8
- package/es/utils/json-big.mjs.map +1 -1
- package/es/utils/keystore.d.ts +2 -0
- package/es/utils/keystore.mjs +37 -36
- package/es/utils/keystore.mjs.map +1 -1
- package/es/utils/mptree.d.ts +1 -1
- package/es/utils/mptree.mjs +4 -26
- package/es/utils/mptree.mjs.map +1 -1
- package/es/utils/other.d.ts +3 -1
- package/es/utils/other.mjs +11 -7
- package/es/utils/other.mjs.map +1 -1
- package/es/utils/semver-satisfies.mjs +0 -3
- package/es/utils/semver-satisfies.mjs.map +1 -1
- package/es/utils/string.d.ts +0 -12
- package/es/utils/string.mjs +1 -21
- package/es/utils/string.mjs.map +1 -1
- package/package.json +87 -48
- package/src/AeSdk.ts +15 -11
- package/src/AeSdkAepp.ts +9 -7
- package/src/AeSdkBase.ts +28 -202
- package/src/AeSdkMethods.ts +170 -0
- package/src/AeSdkWallet.ts +16 -47
- package/src/Node.ts +11 -15
- package/src/account/Base.ts +29 -75
- package/src/account/Generalized.ts +98 -0
- package/src/account/Ledger.ts +131 -0
- package/src/account/LedgerFactory.ts +86 -0
- package/src/account/Memory.ts +46 -60
- package/src/account/Rpc.ts +17 -26
- package/src/aens.ts +10 -9
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +5 -4
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +3 -3
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +2 -2
- package/src/aepp-wallet-communication/rpc/types.ts +11 -1
- package/src/aepp-wallet-communication/schema.ts +18 -18
- package/src/apis/compiler/code-model-v4.yaml +681 -888
- package/src/apis/compiler/compiler.ts +113 -154
- package/src/apis/compiler/models/index.ts +80 -140
- package/src/apis/compiler/models/mappers.ts +165 -183
- package/src/apis/compiler/models/parameters.ts +6 -12
- package/src/chain.ts +6 -3
- package/src/channel/Base.ts +327 -0
- package/src/channel/Contract.ts +487 -0
- package/src/channel/Spend.ts +403 -0
- package/src/channel/handlers.ts +154 -573
- package/src/channel/internal.ts +113 -142
- package/src/contract/{Compiler.ts → CompilerHttp.ts} +5 -5
- package/src/contract/Contract.ts +620 -0
- package/src/contract/ga.ts +18 -104
- package/src/index.ts +9 -8
- package/src/oracle.ts +7 -7
- package/src/spend.ts +5 -13
- package/src/tx/builder/constants.ts +1 -0
- package/src/tx/builder/field-types/address.ts +52 -0
- package/src/tx/builder/field-types/addresses.ts +18 -0
- package/src/tx/builder/field-types/coin-amount.ts +2 -8
- package/src/tx/builder/field-types/enumeration.ts +21 -0
- package/src/tx/builder/field-types/fee.ts +1 -3
- package/src/tx/builder/field-types/gas-limit.ts +2 -2
- package/src/tx/builder/field-types/gas-price.ts +0 -2
- package/src/tx/builder/field-types/index.ts +16 -6
- package/src/tx/builder/field-types/name-fee.ts +1 -1
- package/src/tx/builder/field-types/name-id.ts +7 -10
- package/src/tx/builder/field-types/pointers.ts +41 -0
- package/src/tx/builder/field-types/u-int.ts +3 -2
- package/src/tx/builder/helpers.ts +10 -60
- package/src/tx/builder/index.ts +6 -65
- package/src/tx/builder/schema.ts +89 -100
- package/src/tx/index.ts +19 -15
- package/src/tx/validator.ts +36 -18
- package/src/typings/@aeternity__aepp-calldata/index.d.ts +20 -0
- package/src/utils/autorest.ts +16 -1
- package/src/utils/bytes.ts +5 -33
- package/src/utils/crypto.ts +23 -16
- package/src/utils/encoder.ts +0 -1
- package/src/utils/errors.ts +18 -12
- package/src/utils/hd-wallet.ts +30 -9
- package/src/utils/keystore.ts +24 -21
- package/src/utils/other.ts +16 -1
- package/src/utils/string.ts +0 -20
- package/types-legacy/ts4.2/AeSdk.d.ts +41 -0
- package/types-legacy/ts4.2/AeSdkAepp.d.ts +71 -0
- package/types-legacy/ts4.2/AeSdkBase.d.ts +91 -0
- package/types-legacy/ts4.2/AeSdkMethods.d.ts +141 -0
- package/types-legacy/ts4.2/AeSdkWallet.d.ts +90 -0
- package/types-legacy/ts4.2/Node.d.ts +78 -0
- package/types-legacy/ts4.2/account/Base.d.ts +52 -0
- package/types-legacy/ts4.2/account/Generalized.d.ts +16 -0
- package/types-legacy/ts4.2/account/Ledger.d.ts +28 -0
- package/types-legacy/ts4.2/account/LedgerFactory.d.ts +39 -0
- package/types-legacy/ts4.2/account/Memory.d.ts +22 -0
- package/types-legacy/ts4.2/account/Rpc.d.ts +25 -0
- package/types-legacy/ts4.2/aens.d.ts +222 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/connection/Browser.d.ts +33 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserRuntime.d.ts +18 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/connection-proxy.d.ts +11 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +83 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +133 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/wallet-detector.d.ts +25 -0
- package/types-legacy/ts4.2/apis/compiler/compiler.d.ts +86 -0
- package/types-legacy/ts4.2/apis/compiler/index.d.ts +2 -0
- package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +195 -0
- package/types-legacy/ts4.2/apis/compiler/models/mappers.d.ts +23 -0
- package/types-legacy/ts4.2/apis/compiler/models/parameters.d.ts +12 -0
- package/types-legacy/ts4.2/apis/node/index.d.ts +2 -0
- package/types-legacy/ts4.2/apis/node/models/index.d.ts +1065 -0
- package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +95 -0
- package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +17 -0
- package/types-legacy/ts4.2/apis/node/node.d.ts +215 -0
- package/types-legacy/ts4.2/chain.d.ts +248 -0
- package/types-legacy/ts4.2/channel/Base.d.ts +194 -0
- package/types-legacy/ts4.2/channel/Contract.d.ts +247 -0
- package/types-legacy/ts4.2/channel/Spend.d.ts +217 -0
- package/types-legacy/ts4.2/channel/handlers.d.ts +21 -0
- package/types-legacy/ts4.2/channel/internal.d.ts +107 -0
- package/types-legacy/ts4.2/contract/CompilerHttp.d.ts +18 -0
- package/types-legacy/ts4.2/contract/Contract.d.ts +237 -0
- package/types-legacy/ts4.2/contract/ga.d.ts +43 -0
- package/types-legacy/ts4.2/globals.d.ts +16 -0
- package/types-legacy/ts4.2/index.d.ts +39 -0
- package/types-legacy/ts4.2/oracle.d.ts +161 -0
- package/types-legacy/ts4.2/spend.d.ts +62 -0
- package/types-legacy/ts4.2/tx/builder/constants.d.ts +71 -0
- package/types-legacy/ts4.2/tx/builder/field-types/address.d.ts +22 -0
- package/types-legacy/ts4.2/tx/builder/field-types/addresses.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +12 -0
- package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +14 -0
- package/types-legacy/ts4.2/tx/builder/field-types/enumeration.d.ts +5 -0
- package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +17 -0
- package/types-legacy/ts4.2/tx/builder/field-types/field.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/gas-limit.d.ts +12 -0
- package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +85 -0
- package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +19 -0
- package/types-legacy/ts4.2/tx/builder/field-types/name-id.d.ts +11 -0
- package/types-legacy/ts4.2/tx/builder/field-types/name.d.ts +13 -0
- package/types-legacy/ts4.2/tx/builder/field-types/pointers.d.ts +26 -0
- package/types-legacy/ts4.2/tx/builder/field-types/short-u-int.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/u-int.d.ts +8 -0
- package/types-legacy/ts4.2/tx/builder/helpers.d.ts +112 -0
- package/types-legacy/ts4.2/tx/builder/index.d.ts +68 -0
- package/types-legacy/ts4.2/tx/builder/schema.d.ts +2963 -0
- package/types-legacy/ts4.2/tx/index.d.ts +34 -0
- package/types-legacy/ts4.2/tx/validator.d.ts +20 -0
- package/types-legacy/ts4.2/utils/amount-formatter.d.ts +42 -0
- package/types-legacy/ts4.2/utils/autorest.d.ts +7 -0
- package/types-legacy/ts4.2/utils/bignumber.d.ts +13 -0
- package/types-legacy/ts4.2/utils/bytes.d.ts +9 -0
- package/types-legacy/ts4.2/utils/crypto.d.ts +95 -0
- package/types-legacy/ts4.2/utils/encoder-types.d.ts +61 -0
- package/types-legacy/ts4.2/utils/encoder.d.ts +24 -0
- package/types-legacy/ts4.2/utils/errors.d.ts +480 -0
- package/types-legacy/ts4.2/utils/hd-wallet.d.ts +65 -0
- package/types-legacy/ts4.2/utils/json-big.d.ts +5 -0
- package/types-legacy/ts4.2/utils/keystore.d.ts +53 -0
- package/types-legacy/ts4.2/utils/mptree.d.ts +32 -0
- package/types-legacy/ts4.2/utils/other.d.ts +31 -0
- package/types-legacy/ts4.2/utils/semver-satisfies.d.ts +1 -0
- package/types-legacy/ts4.2/utils/string.d.ts +12 -0
- package/types-legacy/ts4.5/AeSdk.d.ts +41 -0
- package/types-legacy/ts4.5/AeSdkAepp.d.ts +71 -0
- package/types-legacy/ts4.5/AeSdkBase.d.ts +91 -0
- package/types-legacy/ts4.5/AeSdkMethods.d.ts +141 -0
- package/types-legacy/ts4.5/AeSdkWallet.d.ts +90 -0
- package/types-legacy/ts4.5/Node.d.ts +78 -0
- package/types-legacy/ts4.5/account/Base.d.ts +52 -0
- package/types-legacy/ts4.5/account/Generalized.d.ts +16 -0
- package/types-legacy/ts4.5/account/Ledger.d.ts +28 -0
- package/types-legacy/ts4.5/account/LedgerFactory.d.ts +39 -0
- package/types-legacy/ts4.5/account/Memory.d.ts +22 -0
- package/types-legacy/ts4.5/account/Rpc.d.ts +25 -0
- package/types-legacy/ts4.5/aens.d.ts +222 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/connection/Browser.d.ts +33 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserRuntime.d.ts +18 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/connection-proxy.d.ts +11 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +83 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +133 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/wallet-detector.d.ts +25 -0
- package/types-legacy/ts4.5/apis/compiler/compiler.d.ts +86 -0
- package/types-legacy/ts4.5/apis/compiler/index.d.ts +2 -0
- package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +195 -0
- package/types-legacy/ts4.5/apis/compiler/models/mappers.d.ts +23 -0
- package/types-legacy/ts4.5/apis/compiler/models/parameters.d.ts +12 -0
- package/types-legacy/ts4.5/apis/node/index.d.ts +2 -0
- package/types-legacy/ts4.5/apis/node/models/index.d.ts +1065 -0
- package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +95 -0
- package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +17 -0
- package/types-legacy/ts4.5/apis/node/node.d.ts +215 -0
- package/types-legacy/ts4.5/chain.d.ts +248 -0
- package/types-legacy/ts4.5/channel/Base.d.ts +194 -0
- package/types-legacy/ts4.5/channel/Contract.d.ts +247 -0
- package/types-legacy/ts4.5/channel/Spend.d.ts +217 -0
- package/types-legacy/ts4.5/channel/handlers.d.ts +21 -0
- package/types-legacy/ts4.5/channel/internal.d.ts +107 -0
- package/types-legacy/ts4.5/contract/CompilerHttp.d.ts +18 -0
- package/types-legacy/ts4.5/contract/Contract.d.ts +237 -0
- package/types-legacy/ts4.5/contract/ga.d.ts +43 -0
- package/types-legacy/ts4.5/index.d.ts +38 -0
- package/types-legacy/ts4.5/oracle.d.ts +161 -0
- package/types-legacy/ts4.5/spend.d.ts +62 -0
- package/types-legacy/ts4.5/tx/builder/constants.d.ts +71 -0
- package/types-legacy/ts4.5/tx/builder/field-types/address.d.ts +22 -0
- package/types-legacy/ts4.5/tx/builder/field-types/addresses.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +12 -0
- package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +14 -0
- package/types-legacy/ts4.5/tx/builder/field-types/enumeration.d.ts +5 -0
- package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +17 -0
- package/types-legacy/ts4.5/tx/builder/field-types/field.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/gas-limit.d.ts +12 -0
- package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +85 -0
- package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +19 -0
- package/types-legacy/ts4.5/tx/builder/field-types/name-id.d.ts +11 -0
- package/types-legacy/ts4.5/tx/builder/field-types/name.d.ts +13 -0
- package/types-legacy/ts4.5/tx/builder/field-types/pointers.d.ts +26 -0
- package/types-legacy/ts4.5/tx/builder/field-types/short-u-int.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/u-int.d.ts +8 -0
- package/types-legacy/ts4.5/tx/builder/helpers.d.ts +112 -0
- package/types-legacy/ts4.5/tx/builder/index.d.ts +68 -0
- package/types-legacy/ts4.5/tx/builder/schema.d.ts +2963 -0
- package/types-legacy/ts4.5/tx/index.d.ts +34 -0
- package/types-legacy/ts4.5/tx/validator.d.ts +20 -0
- package/types-legacy/ts4.5/utils/amount-formatter.d.ts +42 -0
- package/types-legacy/ts4.5/utils/autorest.d.ts +7 -0
- package/types-legacy/ts4.5/utils/bignumber.d.ts +13 -0
- package/types-legacy/ts4.5/utils/bytes.d.ts +9 -0
- package/types-legacy/ts4.5/utils/crypto.d.ts +95 -0
- package/types-legacy/ts4.5/utils/encoder-types.d.ts +61 -0
- package/types-legacy/ts4.5/utils/encoder.d.ts +24 -0
- package/types-legacy/ts4.5/utils/errors.d.ts +480 -0
- package/types-legacy/ts4.5/utils/hd-wallet.d.ts +65 -0
- package/types-legacy/ts4.5/utils/json-big.d.ts +5 -0
- package/types-legacy/ts4.5/utils/keystore.d.ts +53 -0
- package/types-legacy/ts4.5/utils/mptree.d.ts +32 -0
- package/types-legacy/ts4.5/utils/other.d.ts +31 -0
- package/types-legacy/ts4.5/utils/semver-satisfies.d.ts +1 -0
- package/types-legacy/ts4.5/utils/string.d.ts +12 -0
- package/es/channel/index.d.ts +0 -625
- package/es/channel/index.mjs +0 -975
- package/es/channel/index.mjs.map +0 -1
- package/es/contract/Compiler.mjs.map +0 -1
- package/es/contract/aci.d.ts +0 -127
- package/es/contract/aci.mjs +0 -509
- package/es/contract/aci.mjs.map +0 -1
- package/es/contract/methods.d.ts +0 -71
- package/es/contract/methods.mjs +0 -104
- package/es/contract/methods.mjs.map +0 -1
- package/es/deprecated/index.d.ts +0 -143
- package/es/deprecated/index.mjs +0 -162
- package/es/deprecated/index.mjs.map +0 -1
- package/es/deprecated/methods.d.ts +0 -18
- package/es/deprecated/methods.mjs +0 -26
- package/es/deprecated/methods.mjs.map +0 -1
- package/es/tx/builder/address.d.ts +0 -25
- package/es/tx/builder/address.mjs +0 -45
- package/es/tx/builder/address.mjs.map +0 -1
- package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +0 -1
- package/src/channel/index.ts +0 -1025
- package/src/contract/aci.ts +0 -538
- package/src/contract/methods.ts +0 -123
- package/src/deprecated/index.ts +0 -172
- package/src/deprecated/methods.ts +0 -25
- package/src/tx/builder/address.ts +0 -50
- package/src/typings/@aeternity__argon2-browser/index.d.ts +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","names":["BigNumber","mapObject","NAME_TTL","NAME_MAX_TTL","NAME_MAX_CLIENT_TTL","CLIENT_TTL","MIN_GAS_PRICE","NAME_FEE_MULTIPLIER","NAME_FEE_BID_INCREMENT","NAME_BID_TIMEOUT_BLOCKS","NAME_MAX_LENGTH_FEE","NAME_BID_MAX_LENGTH","NAME_BID_RANGES","key","value","times","Tag"],"sources":["../../../src/tx/builder/constants.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { mapObject } from '../../utils/other';\n\n// # AENS\nexport type AensName = `${string}.chain`;\nexport const NAME_TTL = 180000;\n// # max number of block into the future that the name is going to be available\n// # https://github.com/aeternity/protocol/blob/epoch-v0.22.0/AENS.md#update\n// # https://github.com/aeternity/protocol/blob/44a93d3aab957ca820183c3520b9daf6b0fedff4/AENS.md#aens-entry\nexport const NAME_MAX_TTL = 36000;\nexport const NAME_MAX_CLIENT_TTL = 84600;\nexport const CLIENT_TTL = NAME_MAX_CLIENT_TTL;\nexport const MIN_GAS_PRICE = 1e9;\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L67\nexport const NAME_FEE_MULTIPLIER = 1e14; // 100000000000000\nexport const NAME_FEE_BID_INCREMENT = 0.05; // # the increment is in percentage\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L272\nexport const NAME_BID_TIMEOUT_BLOCKS = 480; // # ~1 day\n// # this is the max length for a domain that requires a base fee to be paid\nexport const NAME_MAX_LENGTH_FEE = 31;\nexport const NAME_BID_MAX_LENGTH = 12; // # this is the max length for a domain to be part of a bid\n// # https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L290\n// # https://github.com/aeternity/protocol/blob/master/AENS.md#protocol-fees-and-protection-times\n// # bid ranges:\nexport const NAME_BID_RANGES = mapObject({\n 31: 3,\n 30: 5,\n 29: 8,\n 28: 13,\n 27: 21,\n 26: 34,\n 25: 55,\n 24: 89,\n 23: 144,\n 22: 233,\n 21: 377,\n 20: 610,\n 19: 987,\n 18: 1597,\n 17: 2584,\n 16: 4181,\n 15: 6765,\n 14: 10946,\n 13: 17711,\n 12: 28657,\n 11: 46368,\n 10: 75025,\n 9: 121393,\n 8: 196418,\n 7: 317811,\n 6: 514229,\n 5: 832040,\n 4: 1346269,\n 3: 2178309,\n 2: 3524578,\n 1: 5702887,\n}, ([key, value]) => [key, new BigNumber(value).times(NAME_FEE_MULTIPLIER)]);\n\n/**\n * Enum with tag types\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/serializations.md#binary-serialization}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_chain_objects.erl#L39-L97}\n */\n// TODO: implement serialisation for commented-out tags\nexport enum Tag {\n Account = 10,\n SignedTx = 11,\n SpendTx = 12,\n // Oracle = 20,\n // OracleQuery = 21,\n OracleRegisterTx = 22,\n OracleQueryTx = 23,\n OracleResponseTx = 24,\n OracleExtendTx = 25,\n // Name = 30,\n // NameCommitment = 31,\n NameClaimTx = 32,\n NamePreclaimTx = 33,\n NameUpdateTx = 34,\n NameRevokeTx = 35,\n NameTransferTx = 36,\n // NameAuction = 37,\n Contract = 40,\n ContractCall = 41,\n ContractCreateTx = 42,\n ContractCallTx = 43,\n ChannelCreateTx = 50,\n // ChannelSetDelegatesTx = 501,\n ChannelDepositTx = 51,\n ChannelWithdrawTx = 52,\n ChannelForceProgressTx = 521,\n ChannelCloseMutualTx = 53,\n ChannelCloseSoloTx = 54,\n ChannelSlashTx = 55,\n ChannelSettleTx = 56,\n ChannelOffChainTx = 57,\n ChannelOffChainUpdateTransfer = 570,\n ChannelOffChainUpdateDeposit = 571,\n ChannelOffChainUpdateWithdraw = 572,\n ChannelOffChainUpdateCreateContract = 573,\n ChannelOffChainUpdateCallContract = 574,\n // ChannelOffChainUpdateMeta = 576,\n ChannelClientReconnectTx = 575,\n Channel = 58,\n ChannelSnapshotSoloTx = 59,\n TreesPoi = 60,\n // TreesDb = 61,\n StateTrees = 62,\n Mtree = 63,\n MtreeValue = 64,\n ContractsMtree = 621,\n CallsMtree = 622,\n ChannelsMtree = 623,\n NameserviceMtree = 624,\n OraclesMtree = 625,\n AccountsMtree = 626,\n CompilerSophia = 70,\n GaAttachTx = 80,\n GaMetaTx = 81,\n PayingForTx = 82,\n // KeyBlock = 100,\n // MicroBlock = 101,\n // LightMicroBlock = 102,\n // Pof = 200,\n}\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":["BigNumber","mapObject","MAX_AUTH_FUN_GAS","NAME_TTL","NAME_MAX_TTL","NAME_MAX_CLIENT_TTL","CLIENT_TTL","MIN_GAS_PRICE","NAME_FEE_MULTIPLIER","NAME_FEE_BID_INCREMENT","NAME_BID_TIMEOUT_BLOCKS","NAME_MAX_LENGTH_FEE","NAME_BID_MAX_LENGTH","NAME_BID_RANGES","key","value","times","Tag"],"sources":["../../../src/tx/builder/constants.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { mapObject } from '../../utils/other';\n\nexport const MAX_AUTH_FUN_GAS = 50000;\n// # AENS\nexport type AensName = `${string}.chain`;\nexport const NAME_TTL = 180000;\n// # max number of block into the future that the name is going to be available\n// # https://github.com/aeternity/protocol/blob/epoch-v0.22.0/AENS.md#update\n// # https://github.com/aeternity/protocol/blob/44a93d3aab957ca820183c3520b9daf6b0fedff4/AENS.md#aens-entry\nexport const NAME_MAX_TTL = 36000;\nexport const NAME_MAX_CLIENT_TTL = 84600;\nexport const CLIENT_TTL = NAME_MAX_CLIENT_TTL;\nexport const MIN_GAS_PRICE = 1e9;\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L67\nexport const NAME_FEE_MULTIPLIER = 1e14; // 100000000000000\nexport const NAME_FEE_BID_INCREMENT = 0.05; // # the increment is in percentage\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L272\nexport const NAME_BID_TIMEOUT_BLOCKS = 480; // # ~1 day\n// # this is the max length for a domain that requires a base fee to be paid\nexport const NAME_MAX_LENGTH_FEE = 31;\nexport const NAME_BID_MAX_LENGTH = 12; // # this is the max length for a domain to be part of a bid\n// # https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L290\n// # https://github.com/aeternity/protocol/blob/master/AENS.md#protocol-fees-and-protection-times\n// # bid ranges:\nexport const NAME_BID_RANGES = mapObject({\n 31: 3,\n 30: 5,\n 29: 8,\n 28: 13,\n 27: 21,\n 26: 34,\n 25: 55,\n 24: 89,\n 23: 144,\n 22: 233,\n 21: 377,\n 20: 610,\n 19: 987,\n 18: 1597,\n 17: 2584,\n 16: 4181,\n 15: 6765,\n 14: 10946,\n 13: 17711,\n 12: 28657,\n 11: 46368,\n 10: 75025,\n 9: 121393,\n 8: 196418,\n 7: 317811,\n 6: 514229,\n 5: 832040,\n 4: 1346269,\n 3: 2178309,\n 2: 3524578,\n 1: 5702887,\n}, ([key, value]) => [key, new BigNumber(value).times(NAME_FEE_MULTIPLIER)]);\n\n/**\n * Enum with tag types\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/serializations.md#binary-serialization}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_chain_objects.erl#L39-L97}\n */\n// TODO: implement serialisation for commented-out tags\nexport enum Tag {\n Account = 10,\n SignedTx = 11,\n SpendTx = 12,\n // Oracle = 20,\n // OracleQuery = 21,\n OracleRegisterTx = 22,\n OracleQueryTx = 23,\n OracleResponseTx = 24,\n OracleExtendTx = 25,\n // Name = 30,\n // NameCommitment = 31,\n NameClaimTx = 32,\n NamePreclaimTx = 33,\n NameUpdateTx = 34,\n NameRevokeTx = 35,\n NameTransferTx = 36,\n // NameAuction = 37,\n Contract = 40,\n ContractCall = 41,\n ContractCreateTx = 42,\n ContractCallTx = 43,\n ChannelCreateTx = 50,\n // ChannelSetDelegatesTx = 501,\n ChannelDepositTx = 51,\n ChannelWithdrawTx = 52,\n ChannelForceProgressTx = 521,\n ChannelCloseMutualTx = 53,\n ChannelCloseSoloTx = 54,\n ChannelSlashTx = 55,\n ChannelSettleTx = 56,\n ChannelOffChainTx = 57,\n ChannelOffChainUpdateTransfer = 570,\n ChannelOffChainUpdateDeposit = 571,\n ChannelOffChainUpdateWithdraw = 572,\n ChannelOffChainUpdateCreateContract = 573,\n ChannelOffChainUpdateCallContract = 574,\n // ChannelOffChainUpdateMeta = 576,\n ChannelClientReconnectTx = 575,\n Channel = 58,\n ChannelSnapshotSoloTx = 59,\n TreesPoi = 60,\n // TreesDb = 61,\n StateTrees = 62,\n Mtree = 63,\n MtreeValue = 64,\n ContractsMtree = 621,\n CallsMtree = 622,\n ChannelsMtree = 623,\n NameserviceMtree = 624,\n OraclesMtree = 625,\n AccountsMtree = 626,\n CompilerSophia = 70,\n GaAttachTx = 80,\n GaMetaTx = 81,\n PayingForTx = 82,\n // KeyBlock = 100,\n // MicroBlock = 101,\n // LightMicroBlock = 102,\n // Pof = 200,\n}\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,cAAc;AAAC,SAC5BC,SAAS;AAElB,OAAO,MAAMC,gBAAgB,GAAG,KAAK;AACrC;;AAEA,OAAO,MAAMC,QAAQ,GAAG,MAAM;AAC9B;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAG,KAAK;A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GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;AAAA,GAAHA,GAAG,KAAHA,GAAG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Encoding } from '../../../utils/encoder';
|
|
3
|
+
/**
|
|
4
|
+
* Map of prefix to ID tag constant
|
|
5
|
+
* @see {@link https://github.com/aeternity/protocol/blob/master/serializations.md#the-id-type}
|
|
6
|
+
* @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_id.erl#L97-L102}
|
|
7
|
+
* @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L163-L168}
|
|
8
|
+
*/
|
|
9
|
+
declare const idTagToEncoding: readonly [Encoding.AccountAddress, Encoding.Name, Encoding.Commitment, Encoding.OracleAddress, Encoding.ContractAddress, Encoding.Channel];
|
|
10
|
+
export type AddressEncodings = typeof idTagToEncoding[number];
|
|
11
|
+
export default function genAddressField<Encoding extends AddressEncodings>(): {
|
|
12
|
+
serialize: (value: `${Encoding}_${string}`) => Buffer;
|
|
13
|
+
deserialize: (value: Buffer) => `${Encoding}_${string}`;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import _buffer from "buffer";
|
|
2
|
+
const {
|
|
3
|
+
Buffer: _Buffer
|
|
4
|
+
} = _buffer;
|
|
5
|
+
import { PrefixNotFoundError, TagNotFoundError } from "../../../utils/errors.mjs";
|
|
6
|
+
import { toBytes } from "../../../utils/bytes.mjs";
|
|
7
|
+
import { decode, encode, Encoding } from "../../../utils/encoder.mjs";
|
|
8
|
+
import { isItemOfArray } from "../../../utils/other.mjs";
|
|
9
|
+
/**
|
|
10
|
+
* Map of prefix to ID tag constant
|
|
11
|
+
* @see {@link https://github.com/aeternity/protocol/blob/master/serializations.md#the-id-type}
|
|
12
|
+
* @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_id.erl#L97-L102}
|
|
13
|
+
* @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L163-L168}
|
|
14
|
+
*/
|
|
15
|
+
const idTagToEncoding = [Encoding.AccountAddress, Encoding.Name, Encoding.Commitment, Encoding.OracleAddress, Encoding.ContractAddress, Encoding.Channel];
|
|
16
|
+
export default function genAddressField() {
|
|
17
|
+
return {
|
|
18
|
+
/**
|
|
19
|
+
* Utility function to create and _id type
|
|
20
|
+
* @param hashId - Encoded hash
|
|
21
|
+
* @returns Buffer Buffer with ID tag and decoded HASh
|
|
22
|
+
*/
|
|
23
|
+
serialize(hashId) {
|
|
24
|
+
const encoding = hashId.slice(0, 2);
|
|
25
|
+
if (!isItemOfArray(encoding, idTagToEncoding)) throw new TagNotFoundError(encoding);
|
|
26
|
+
const idTag = idTagToEncoding.indexOf(encoding) + 1;
|
|
27
|
+
return _Buffer.from([...toBytes(idTag), ...decode(hashId)]);
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* Utility function to read and _id type
|
|
31
|
+
* @param buf - Data
|
|
32
|
+
* @returns Encoded hash string with prefix
|
|
33
|
+
*/
|
|
34
|
+
deserialize(buf) {
|
|
35
|
+
const idTag = _Buffer.from(buf).readUIntBE(0, 1);
|
|
36
|
+
const encoding = idTagToEncoding[idTag - 1];
|
|
37
|
+
if (encoding == null) throw new PrefixNotFoundError(idTag);
|
|
38
|
+
return encode(buf.subarray(1), encoding);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=address.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.mjs","names":["PrefixNotFoundError","TagNotFoundError","toBytes","decode","encode","Encoding","isItemOfArray","idTagToEncoding","AccountAddress","Name","Commitment","OracleAddress","ContractAddress","Channel","genAddressField","serialize","hashId","encoding","slice","idTag","indexOf","from","deserialize","buf","readUIntBE","subarray"],"sources":["../../../../src/tx/builder/field-types/address.ts"],"sourcesContent":["import { PrefixNotFoundError, TagNotFoundError } from '../../../utils/errors';\nimport { toBytes } from '../../../utils/bytes';\nimport { decode, encode, Encoding } from '../../../utils/encoder';\nimport { isItemOfArray } from '../../../utils/other';\n\n/**\n * Map of prefix to ID tag constant\n * @see {@link https://github.com/aeternity/protocol/blob/master/serializations.md#the-id-type}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_id.erl#L97-L102}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L163-L168}\n */\nconst idTagToEncoding = [\n Encoding.AccountAddress,\n Encoding.Name,\n Encoding.Commitment,\n Encoding.OracleAddress,\n Encoding.ContractAddress,\n Encoding.Channel,\n] as const;\n\nexport type AddressEncodings = typeof idTagToEncoding[number];\n\nexport default function genAddressField<Encoding extends AddressEncodings>(): {\n serialize: (value: `${Encoding}_${string}`) => Buffer;\n deserialize: (value: Buffer) => `${Encoding}_${string}`;\n} {\n return {\n /**\n * Utility function to create and _id type\n * @param hashId - Encoded hash\n * @returns Buffer Buffer with ID tag and decoded HASh\n */\n serialize(hashId) {\n const encoding = hashId.slice(0, 2);\n if (!isItemOfArray(encoding, idTagToEncoding)) throw new TagNotFoundError(encoding);\n const idTag = idTagToEncoding.indexOf(encoding) + 1;\n return Buffer.from([...toBytes(idTag), ...decode(hashId)]);\n },\n\n /**\n * Utility function to read and _id type\n * @param buf - Data\n * @returns Encoded hash string with prefix\n */\n deserialize(buf) {\n const idTag = Buffer.from(buf).readUIntBE(0, 1);\n const encoding = idTagToEncoding[idTag - 1];\n if (encoding == null) throw new PrefixNotFoundError(idTag);\n return encode(buf.subarray(1), encoding) as `${Encoding}_${string}`;\n },\n };\n}\n"],"mappings":";;;;SAASA,mBAAmB,EAAEC,gBAAgB;AAAA,SACrCC,OAAO;AAAA,SACPC,MAAM,EAAEC,MAAM,EAAEC,QAAQ;AAAA,SACxBC,aAAa;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAG,CACtBF,QAAQ,CAACG,cAAc,EACvBH,QAAQ,CAACI,IAAI,EACbJ,QAAQ,CAACK,UAAU,EACnBL,QAAQ,CAACM,aAAa,EACtBN,QAAQ,CAACO,eAAe,EACxBP,QAAQ,CAACQ,OAAO,CACR;AAIV,eAAe,SAASC,eAAe,GAGrC;EACA,OAAO;IACL;AACJ;AACA;AACA;AACA;IACIC,SAAS,CAACC,MAAM,EAAE;MAChB,MAAMC,QAAQ,GAAGD,MAAM,CAACE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;MACnC,IAAI,CAACZ,aAAa,CAACW,QAAQ,EAAEV,eAAe,CAAC,EAAE,MAAM,IAAIN,gBAAgB,CAACgB,QAAQ,CAAC;MACnF,MAAME,KAAK,GAAGZ,eAAe,CAACa,OAAO,CAACH,QAAQ,CAAC,GAAG,CAAC;MACnD,OAAO,QAAOI,IAAI,CAAC,CAAC,GAAGnB,OAAO,CAACiB,KAAK,CAAC,EAAE,GAAGhB,MAAM,CAACa,MAAM,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED;AACJ;AACA;AACA;AACA;IACIM,WAAW,CAACC,GAAG,EAAE;MACf,MAAMJ,KAAK,GAAG,QAAOE,IAAI,CAACE,GAAG,CAAC,CAACC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC;MAC/C,MAAMP,QAAQ,GAAGV,eAAe,CAACY,KAAK,GAAG,CAAC,CAAC;MAC3C,IAAIF,QAAQ,IAAI,IAAI,EAAE,MAAM,IAAIjB,mBAAmB,CAACmB,KAAK,CAAC;MAC1D,OAAOf,MAAM,CAACmB,GAAG,CAACE,QAAQ,CAAC,CAAC,CAAC,EAAER,QAAQ,CAAC;IAC1C;EACF,CAAC;AACH"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { AddressEncodings } from './address';
|
|
3
|
+
export default function genAddressesField<Encoding extends AddressEncodings>(): {
|
|
4
|
+
serialize: (value: Array<`${Encoding}_${string}`>) => Buffer[];
|
|
5
|
+
deserialize: (value: Buffer[]) => Array<`${Encoding}_${string}`>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import genAddressField from "./address.mjs";
|
|
2
|
+
export default function genAddressesField() {
|
|
3
|
+
const address = genAddressField();
|
|
4
|
+
return {
|
|
5
|
+
serialize(addresses) {
|
|
6
|
+
return addresses.map(address.serialize);
|
|
7
|
+
},
|
|
8
|
+
deserialize(addresses) {
|
|
9
|
+
return addresses.map(address.deserialize);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=addresses.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addresses.mjs","names":["genAddressField","genAddressesField","address","serialize","addresses","map","deserialize"],"sources":["../../../../src/tx/builder/field-types/addresses.ts"],"sourcesContent":["import genAddressField, { AddressEncodings } from './address';\n\nexport default function genAddressesField<Encoding extends AddressEncodings>(): {\n serialize: (value: Array<`${Encoding}_${string}`>) => Buffer[];\n deserialize: (value: Buffer[]) => Array<`${Encoding}_${string}`>;\n} {\n const address = genAddressField<Encoding>();\n\n return {\n serialize(addresses) {\n return addresses.map(address.serialize);\n },\n\n deserialize(addresses) {\n return addresses.map(address.deserialize);\n },\n };\n}\n"],"mappings":"OAAOA,eAAe;AAEtB,eAAe,SAASC,iBAAiB,GAGvC;EACA,MAAMC,OAAO,GAAGF,eAAe,EAAY;EAE3C,OAAO;IACLG,SAAS,CAACC,SAAS,EAAE;MACnB,OAAOA,SAAS,CAACC,GAAG,CAACH,OAAO,CAACC,SAAS,CAAC;IACzC,CAAC;IAEDG,WAAW,CAACF,SAAS,EAAE;MACrB,OAAOA,SAAS,CAACC,GAAG,CAACH,OAAO,CAACI,WAAW,CAAC;IAC3C;EACF,CAAC;AACH"}
|
|
@@ -6,8 +6,7 @@ export interface Options {
|
|
|
6
6
|
}
|
|
7
7
|
declare const _default: {
|
|
8
8
|
serializeAettos(value: string | undefined): string;
|
|
9
|
-
|
|
10
|
-
serialize(value: Int, options: Options): Buffer;
|
|
9
|
+
serialize(value: Int | undefined, { denomination, ...options }: Options): Buffer;
|
|
11
10
|
deserialize(value: Buffer): string;
|
|
12
11
|
};
|
|
13
12
|
export default _default;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import uInt from "./u-int.mjs";
|
|
2
2
|
import { formatAmount } from "../../../utils/amount-formatter.mjs";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export default {
|
|
4
|
+
...uInt,
|
|
6
5
|
serializeAettos(value) {
|
|
7
|
-
|
|
8
|
-
return value;
|
|
6
|
+
return value !== null && value !== void 0 ? value : '0';
|
|
9
7
|
},
|
|
10
|
-
|
|
11
|
-
serializeOptional(value, _ref) {
|
|
8
|
+
serialize(value, _ref) {
|
|
12
9
|
let {
|
|
13
10
|
denomination,
|
|
14
11
|
...options
|
|
@@ -16,11 +13,6 @@ export default { ...uInt,
|
|
|
16
13
|
return uInt.serialize(this.serializeAettos(value != null ? formatAmount(value, {
|
|
17
14
|
denomination
|
|
18
15
|
}) : value, options));
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
serialize(value, options) {
|
|
22
|
-
return this.serializeOptional(value, options);
|
|
23
16
|
}
|
|
24
|
-
|
|
25
17
|
};
|
|
26
18
|
//# sourceMappingURL=coin-amount.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coin-amount.mjs","names":["uInt","formatAmount","
|
|
1
|
+
{"version":3,"file":"coin-amount.mjs","names":["uInt","formatAmount","serializeAettos","value","serialize","denomination","options"],"sources":["../../../../src/tx/builder/field-types/coin-amount.ts"],"sourcesContent":["import uInt, { Int } from './u-int';\nimport { AE_AMOUNT_FORMATS, formatAmount } from '../../../utils/amount-formatter';\n\nexport interface Options { denomination?: AE_AMOUNT_FORMATS }\n\nexport default {\n ...uInt,\n\n serializeAettos(value: string | undefined): string {\n return value ?? '0';\n },\n\n serialize(value: Int | undefined, { denomination, ...options }: Options): Buffer {\n return uInt.serialize(\n this.serializeAettos(\n value != null ? formatAmount(value, { denomination }) : value,\n options,\n ),\n );\n },\n};\n"],"mappings":"OAAOA,IAAI;AAAA,SACiBC,YAAY;AAIxC,eAAe;EACb,GAAGD,IAAI;EAEPE,eAAe,CAACC,KAAyB,EAAU;IACjD,OAAOA,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,GAAG;EACrB,CAAC;EAEDC,SAAS,CAACD,KAAsB,QAAiD;IAAA,IAA/C;MAAEE,YAAY;MAAE,GAAGC;IAAiB,CAAC;IACrE,OAAON,IAAI,CAACI,SAAS,CACnB,IAAI,CAACF,eAAe,CAClBC,KAAK,IAAI,IAAI,GAAGF,YAAY,CAACE,KAAK,EAAE;MAAEE;IAAa,CAAC,CAAC,GAAGF,KAAK,EAC7DG,OAAO,CACR,CACF;EACH;AACF,CAAC"}
|
|
@@ -9,7 +9,6 @@ declare const _default: {
|
|
|
9
9
|
*/
|
|
10
10
|
serialize(value: Int | undefined, options: Parameters<(typeof coinAmount)['serialize']>[1]): Buffer;
|
|
11
11
|
serializeAettos(value: string | undefined): string;
|
|
12
|
-
serializeOptional(value: Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
|
|
13
12
|
deserialize(value: Buffer): string;
|
|
14
13
|
};
|
|
15
14
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import coinAmount from "./coin-amount.mjs";
|
|
2
2
|
import { IllegalArgumentError } from "../../../utils/errors.mjs";
|
|
3
|
-
export default {
|
|
4
|
-
|
|
3
|
+
export default {
|
|
4
|
+
...coinAmount,
|
|
5
5
|
/**
|
|
6
6
|
* @param value - Deposit value in string format. Should be equal to '0'.
|
|
7
7
|
* @param options - Options
|
|
@@ -9,11 +9,9 @@ export default { ...coinAmount,
|
|
|
9
9
|
*/
|
|
10
10
|
serialize(value, options) {
|
|
11
11
|
var _value;
|
|
12
|
-
|
|
13
12
|
(_value = value) !== null && _value !== void 0 ? _value : value = 0;
|
|
14
13
|
if (+value !== 0) throw new IllegalArgumentError(`Contract deposit is not refundable, so it should be equal 0, got ${value.toString()} instead`);
|
|
15
14
|
return coinAmount.serialize(value, options);
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
};
|
|
19
17
|
//# sourceMappingURL=deposit.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deposit.mjs","names":["coinAmount","IllegalArgumentError","serialize","value","options","toString"],"sources":["../../../../src/tx/builder/field-types/deposit.ts"],"sourcesContent":["import coinAmount from './coin-amount';\nimport { Int } from './u-int';\nimport { IllegalArgumentError } from '../../../utils/errors';\n\nexport default {\n ...coinAmount,\n\n /**\n * @param value - Deposit value in string format. Should be equal to '0'.\n * @param options - Options\n * @returns Deposit value Buffer.\n */\n serialize(\n value: Int | undefined,\n options: Parameters<typeof coinAmount['serialize']>[1],\n ): Buffer {\n value ??= 0;\n if (+value !== 0) throw new IllegalArgumentError(`Contract deposit is not refundable, so it should be equal 0, got ${value.toString()} instead`);\n return coinAmount.serialize(value, options);\n },\n};\n"],"mappings":"OAAOA,
|
|
1
|
+
{"version":3,"file":"deposit.mjs","names":["coinAmount","IllegalArgumentError","serialize","value","options","toString"],"sources":["../../../../src/tx/builder/field-types/deposit.ts"],"sourcesContent":["import coinAmount from './coin-amount';\nimport { Int } from './u-int';\nimport { IllegalArgumentError } from '../../../utils/errors';\n\nexport default {\n ...coinAmount,\n\n /**\n * @param value - Deposit value in string format. Should be equal to '0'.\n * @param options - Options\n * @returns Deposit value Buffer.\n */\n serialize(\n value: Int | undefined,\n options: Parameters<typeof coinAmount['serialize']>[1],\n ): Buffer {\n value ??= 0;\n if (+value !== 0) throw new IllegalArgumentError(`Contract deposit is not refundable, so it should be equal 0, got ${value.toString()} instead`);\n return coinAmount.serialize(value, options);\n },\n};\n"],"mappings":"OAAOA,UAAU;AAAA,SAERC,oBAAoB;AAE7B,eAAe;EACb,GAAGD,UAAU;EAEb;AACF;AACA;AACA;AACA;EACEE,SAAS,CACPC,KAAsB,EACtBC,OAAsD,EAC9C;IAAA;IACR,UAAAD,KAAK,2CAALA,KAAK,GAAK,CAAC;IACX,IAAI,CAACA,KAAK,KAAK,CAAC,EAAE,MAAM,IAAIF,oBAAoB,CAAE,oEAAmEE,KAAK,CAACE,QAAQ,EAAG,UAAS,CAAC;IAChJ,OAAOL,UAAU,CAACE,SAAS,CAACC,KAAK,EAAEC,OAAO,CAAC;EAC7C;AACF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _buffer from "buffer";
|
|
2
|
+
const {
|
|
3
|
+
Buffer: _Buffer
|
|
4
|
+
} = _buffer;
|
|
5
|
+
import { ArgumentError } from "../../../utils/errors.mjs";
|
|
6
|
+
export default function genEnumerationField() {
|
|
7
|
+
return {
|
|
8
|
+
serialize(value) {
|
|
9
|
+
if (typeof value !== 'number') throw new ArgumentError('value', 'to be a number', value);
|
|
10
|
+
if (value > 0xff) throw new ArgumentError('value', 'to be less than 256', value);
|
|
11
|
+
return _Buffer.from([value]);
|
|
12
|
+
},
|
|
13
|
+
deserialize(buffer) {
|
|
14
|
+
if (buffer.length !== 1) {
|
|
15
|
+
throw new ArgumentError('buffer', 'to have single element', buffer.length);
|
|
16
|
+
}
|
|
17
|
+
return buffer[0];
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=enumeration.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enumeration.mjs","names":["ArgumentError","genEnumerationField","serialize","value","from","deserialize","buffer","length"],"sources":["../../../../src/tx/builder/field-types/enumeration.ts"],"sourcesContent":["import { ArgumentError } from '../../../utils/errors';\n\nexport default function genEnumerationField<Enum extends number>(): {\n serialize: (value: Enum) => Buffer;\n deserialize: (value: Buffer) => Enum;\n} {\n return {\n serialize(value) {\n if (typeof value !== 'number') throw new ArgumentError('value', 'to be a number', value);\n if (value > 0xff) throw new ArgumentError('value', 'to be less than 256', value);\n return Buffer.from([value]);\n },\n\n deserialize(buffer) {\n if (buffer.length !== 1) {\n throw new ArgumentError('buffer', 'to have single element', buffer.length);\n }\n return buffer[0] as Enum;\n },\n };\n}\n"],"mappings":";;;;SAASA,aAAa;AAEtB,eAAe,SAASC,mBAAmB,GAGzC;EACA,OAAO;IACLC,SAAS,CAACC,KAAK,EAAE;MACf,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE,MAAM,IAAIH,aAAa,CAAC,OAAO,EAAE,gBAAgB,EAAEG,KAAK,CAAC;MACxF,IAAIA,KAAK,GAAG,IAAI,EAAE,MAAM,IAAIH,aAAa,CAAC,OAAO,EAAE,qBAAqB,EAAEG,KAAK,CAAC;MAChF,OAAO,QAAOC,IAAI,CAAC,CAACD,KAAK,CAAC,CAAC;IAC7B,CAAC;IAEDE,WAAW,CAACC,MAAM,EAAE;MAClB,IAAIA,MAAM,CAACC,MAAM,KAAK,CAAC,EAAE;QACvB,MAAM,IAAIP,aAAa,CAAC,QAAQ,EAAE,wBAAwB,EAAEM,MAAM,CAACC,MAAM,CAAC;MAC5E;MACA,OAAOD,MAAM,CAAC,CAAC,CAAC;IAClB;EACF,CAAC;AACH"}
|
|
@@ -5,21 +5,13 @@ import { Tag } from '../constants';
|
|
|
5
5
|
* Calculate fee based on tx type and params
|
|
6
6
|
*/
|
|
7
7
|
export declare function buildFee(txType: Tag, buildTx: any): BigNumber;
|
|
8
|
-
/**
|
|
9
|
-
* Calculate min fee
|
|
10
|
-
* @category transaction builder
|
|
11
|
-
* @param txType - Transaction type
|
|
12
|
-
* @param rebuildTx - Callback to get built transaction with specific fee
|
|
13
|
-
*/
|
|
14
|
-
export declare function calculateMinFee(txType: Tag, rebuildTx: (value: BigNumber) => any): BigNumber;
|
|
15
8
|
declare const _default: {
|
|
16
9
|
serializeAettos(_value: string | undefined, { txType, rebuildTx, _computingMinFee }: {
|
|
17
10
|
txType: Tag;
|
|
18
11
|
rebuildTx: (params: any) => any;
|
|
19
12
|
_computingMinFee?: string | undefined;
|
|
20
13
|
}): string;
|
|
21
|
-
serialize
|
|
22
|
-
serializeOptional(value: import("./u-int").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
|
|
14
|
+
serialize(value: import("./u-int").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
|
|
23
15
|
deserialize(value: Buffer): string;
|
|
24
16
|
};
|
|
25
17
|
export default _default;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
2
1
|
import BigNumber from 'bignumber.js';
|
|
3
2
|
import { IllegalArgumentError } from "../../../utils/errors.mjs";
|
|
4
3
|
import { MIN_GAS_PRICE, Tag } from "../constants.mjs";
|
|
@@ -7,6 +6,7 @@ import { isKeyOfObject } from "../../../utils/other.mjs";
|
|
|
7
6
|
const BASE_GAS = 15000;
|
|
8
7
|
const GAS_PER_BYTE = 20;
|
|
9
8
|
const KEY_BLOCK_INTERVAL = 3;
|
|
9
|
+
|
|
10
10
|
/**
|
|
11
11
|
* Calculate the Base fee gas
|
|
12
12
|
* @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}
|
|
@@ -17,10 +17,8 @@ const KEY_BLOCK_INTERVAL = 3;
|
|
|
17
17
|
* TX_FEE_BASE('channelForceProgress') => new BigNumber(30 * 15000)
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
20
|
const TX_FEE_BASE_GAS = txType => {
|
|
22
21
|
var _feeFactors;
|
|
23
|
-
|
|
24
22
|
const feeFactors = {
|
|
25
23
|
[Tag.ChannelForceProgressTx]: 30,
|
|
26
24
|
[Tag.ChannelOffChainTx]: 0,
|
|
@@ -38,6 +36,7 @@ const TX_FEE_BASE_GAS = txType => {
|
|
|
38
36
|
const factor = (_feeFactors = feeFactors[txType]) !== null && _feeFactors !== void 0 ? _feeFactors : 1;
|
|
39
37
|
return new BigNumber(factor * BASE_GAS);
|
|
40
38
|
};
|
|
39
|
+
|
|
41
40
|
/**
|
|
42
41
|
* Calculate fee for Other types of transactions
|
|
43
42
|
* @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}
|
|
@@ -53,30 +52,24 @@ const TX_FEE_BASE_GAS = txType => {
|
|
|
53
52
|
* => new BigNumber(10).times(20).plus(Math.ceil(32000 * 10 / Math.floor(60 * 24 * 365 / 2)))
|
|
54
53
|
* ```
|
|
55
54
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
55
|
const TX_FEE_OTHER_GAS = (txType, txSize, _ref) => {
|
|
59
56
|
let {
|
|
60
57
|
relativeTtl,
|
|
61
58
|
innerTxSize
|
|
62
59
|
} = _ref;
|
|
63
|
-
|
|
64
60
|
switch (txType) {
|
|
65
61
|
case Tag.OracleRegisterTx:
|
|
66
62
|
case Tag.OracleExtendTx:
|
|
67
63
|
case Tag.OracleQueryTx:
|
|
68
64
|
case Tag.OracleResponseTx:
|
|
69
65
|
return new BigNumber(txSize).times(GAS_PER_BYTE).plus(Math.ceil(32000 * relativeTtl / Math.floor(60 * 24 * 365 / KEY_BLOCK_INTERVAL)));
|
|
70
|
-
|
|
71
66
|
case Tag.GaMetaTx:
|
|
72
67
|
case Tag.PayingForTx:
|
|
73
68
|
return new BigNumber(txSize).minus(innerTxSize).times(GAS_PER_BYTE);
|
|
74
|
-
|
|
75
69
|
default:
|
|
76
70
|
return new BigNumber(txSize).times(GAS_PER_BYTE);
|
|
77
71
|
}
|
|
78
72
|
};
|
|
79
|
-
|
|
80
73
|
function getOracleRelativeTtl(params, txType) {
|
|
81
74
|
const ttlKeys = {
|
|
82
75
|
[Tag.OracleRegisterTx]: 'oracleTtlValue',
|
|
@@ -87,14 +80,11 @@ function getOracleRelativeTtl(params, txType) {
|
|
|
87
80
|
if (!isKeyOfObject(txType, ttlKeys)) return 1;
|
|
88
81
|
return params[ttlKeys[txType]];
|
|
89
82
|
}
|
|
83
|
+
|
|
90
84
|
/**
|
|
91
85
|
* Calculate fee based on tx type and params
|
|
92
86
|
*/
|
|
93
|
-
|
|
94
|
-
|
|
95
87
|
export function buildFee(txType, buildTx) {
|
|
96
|
-
var _context;
|
|
97
|
-
|
|
98
88
|
const {
|
|
99
89
|
rlpEncoded: {
|
|
100
90
|
length
|
|
@@ -103,29 +93,27 @@ export function buildFee(txType, buildTx) {
|
|
|
103
93
|
} = buildTx;
|
|
104
94
|
return TX_FEE_BASE_GAS(txType).plus(TX_FEE_OTHER_GAS(txType, length, {
|
|
105
95
|
relativeTtl: getOracleRelativeTtl(txObject, txType),
|
|
106
|
-
innerTxSize:
|
|
96
|
+
innerTxSize: [Tag.GaMetaTx, Tag.PayingForTx].includes(txType) ? txObject.tx.tx.encodedTx.rlpEncoded.length : 0
|
|
107
97
|
})).times(MIN_GAS_PRICE);
|
|
108
98
|
}
|
|
99
|
+
|
|
109
100
|
/**
|
|
110
101
|
* Calculate min fee
|
|
111
102
|
* @category transaction builder
|
|
112
103
|
* @param txType - Transaction type
|
|
113
104
|
* @param rebuildTx - Callback to get built transaction with specific fee
|
|
114
105
|
*/
|
|
115
|
-
|
|
116
|
-
export function calculateMinFee(txType, rebuildTx) {
|
|
106
|
+
function calculateMinFee(txType, rebuildTx) {
|
|
117
107
|
let fee = new BigNumber(0);
|
|
118
108
|
let previousFee;
|
|
119
|
-
|
|
120
109
|
do {
|
|
121
110
|
previousFee = fee;
|
|
122
111
|
fee = buildFee(txType, rebuildTx(fee));
|
|
123
112
|
} while (!fee.eq(previousFee));
|
|
124
|
-
|
|
125
113
|
return fee;
|
|
126
114
|
}
|
|
127
|
-
export default {
|
|
128
|
-
|
|
115
|
+
export default {
|
|
116
|
+
...coinAmount,
|
|
129
117
|
serializeAettos(_value, _ref2) {
|
|
130
118
|
let {
|
|
131
119
|
txType,
|
|
@@ -137,14 +125,10 @@ export default { ...coinAmount,
|
|
|
137
125
|
_computingMinFee: fee
|
|
138
126
|
}));
|
|
139
127
|
const value = new BigNumber(_value !== null && _value !== void 0 ? _value : minFee);
|
|
140
|
-
|
|
141
128
|
if (minFee.gt(value)) {
|
|
142
129
|
throw new IllegalArgumentError(`Fee ${value.toString()} must be bigger then ${minFee}`);
|
|
143
130
|
}
|
|
144
|
-
|
|
145
131
|
return value.toFixed();
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
serialize: coinAmount.serializeOptional
|
|
132
|
+
}
|
|
149
133
|
};
|
|
150
134
|
//# sourceMappingURL=fee.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fee.mjs","names":["BigNumber","IllegalArgumentError","MIN_GAS_PRICE","Tag","coinAmount","isKeyOfObject","BASE_GAS","GAS_PER_BYTE","KEY_BLOCK_INTERVAL","TX_FEE_BASE_GAS","txType","feeFactors","ChannelForceProgressTx","ChannelOffChainTx","ChannelOffChainUpdateCallContract","ChannelOffChainUpdateCreateContract","ChannelOffChainUpdateDeposit","ChannelOffChainUpdateWithdraw","ChannelOffChainUpdateTransfer","ContractCreateTx","ContractCallTx","GaAttachTx","GaMetaTx","PayingForTx","factor","TX_FEE_OTHER_GAS","txSize","relativeTtl","innerTxSize","OracleRegisterTx","OracleExtendTx","OracleQueryTx","OracleResponseTx","times","plus","Math","ceil","floor","minus","getOracleRelativeTtl","params","ttlKeys","buildFee","buildTx","rlpEncoded","length","txObject","tx","encodedTx","calculateMinFee","rebuildTx","fee","previousFee","eq","serializeAettos","_value","_computingMinFee","minFee","value","gt","toString","toFixed"
|
|
1
|
+
{"version":3,"file":"fee.mjs","names":["BigNumber","IllegalArgumentError","MIN_GAS_PRICE","Tag","coinAmount","isKeyOfObject","BASE_GAS","GAS_PER_BYTE","KEY_BLOCK_INTERVAL","TX_FEE_BASE_GAS","txType","feeFactors","ChannelForceProgressTx","ChannelOffChainTx","ChannelOffChainUpdateCallContract","ChannelOffChainUpdateCreateContract","ChannelOffChainUpdateDeposit","ChannelOffChainUpdateWithdraw","ChannelOffChainUpdateTransfer","ContractCreateTx","ContractCallTx","GaAttachTx","GaMetaTx","PayingForTx","factor","TX_FEE_OTHER_GAS","txSize","relativeTtl","innerTxSize","OracleRegisterTx","OracleExtendTx","OracleQueryTx","OracleResponseTx","times","plus","Math","ceil","floor","minus","getOracleRelativeTtl","params","ttlKeys","buildFee","buildTx","rlpEncoded","length","txObject","includes","tx","encodedTx","calculateMinFee","rebuildTx","fee","previousFee","eq","serializeAettos","_value","_computingMinFee","minFee","value","gt","toString","toFixed"],"sources":["../../../../src/tx/builder/field-types/fee.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { IllegalArgumentError } from '../../../utils/errors';\nimport { MIN_GAS_PRICE, Tag } from '../constants';\nimport coinAmount from './coin-amount';\nimport { isKeyOfObject } from '../../../utils/other';\n\nconst BASE_GAS = 15000;\nconst GAS_PER_BYTE = 20;\nconst KEY_BLOCK_INTERVAL = 3;\n\n/**\n * Calculate the Base fee gas\n * @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}\n * @param txType - The transaction type\n * @returns The base fee\n * @example\n * ```js\n * TX_FEE_BASE('channelForceProgress') => new BigNumber(30 * 15000)\n * ```\n */\nconst TX_FEE_BASE_GAS = (txType: Tag): BigNumber => {\n const feeFactors = {\n [Tag.ChannelForceProgressTx]: 30,\n [Tag.ChannelOffChainTx]: 0,\n [Tag.ChannelOffChainUpdateCallContract]: 0,\n [Tag.ChannelOffChainUpdateCreateContract]: 0,\n [Tag.ChannelOffChainUpdateDeposit]: 0,\n [Tag.ChannelOffChainUpdateWithdraw]: 0,\n [Tag.ChannelOffChainUpdateTransfer]: 0,\n [Tag.ContractCreateTx]: 5,\n [Tag.ContractCallTx]: 12,\n [Tag.GaAttachTx]: 5,\n [Tag.GaMetaTx]: 5,\n [Tag.PayingForTx]: 1 / 5,\n } as const;\n const factor = feeFactors[txType as keyof typeof feeFactors] ?? 1;\n return new BigNumber(factor * BASE_GAS);\n};\n\n/**\n * Calculate fee for Other types of transactions\n * @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}\n * @param txType - The transaction type\n * @param txSize - The transaction size\n * @returns parameters - The transaction parameters\n * @returns parameters.relativeTtl - The relative ttl\n * @returns parameters.innerTxSize - The size of the inner transaction\n * @returns The Other fee\n * @example\n * ```js\n * TX_FEE_OTHER_GAS('oracleResponse',10, { relativeTtl: 10, innerTxSize: 10 })\n * => new BigNumber(10).times(20).plus(Math.ceil(32000 * 10 / Math.floor(60 * 24 * 365 / 2)))\n * ```\n */\nconst TX_FEE_OTHER_GAS = (\n txType: Tag,\n txSize: number,\n { relativeTtl, innerTxSize }: { relativeTtl: number; innerTxSize: number },\n): BigNumber => {\n switch (txType) {\n case Tag.OracleRegisterTx:\n case Tag.OracleExtendTx:\n case Tag.OracleQueryTx:\n case Tag.OracleResponseTx:\n return new BigNumber(txSize)\n .times(GAS_PER_BYTE)\n .plus(\n Math.ceil((32000 * relativeTtl) / Math.floor((60 * 24 * 365) / KEY_BLOCK_INTERVAL)),\n );\n case Tag.GaMetaTx:\n case Tag.PayingForTx:\n return new BigNumber(txSize).minus(innerTxSize).times(GAS_PER_BYTE);\n default:\n return new BigNumber(txSize).times(GAS_PER_BYTE);\n }\n};\n\nfunction getOracleRelativeTtl(params: any, txType: Tag): number {\n const ttlKeys = {\n [Tag.OracleRegisterTx]: 'oracleTtlValue',\n [Tag.OracleExtendTx]: 'oracleTtlValue',\n [Tag.OracleQueryTx]: 'queryTtlValue',\n [Tag.OracleResponseTx]: 'responseTtlValue',\n } as const;\n\n if (!isKeyOfObject(txType, ttlKeys)) return 1;\n return params[ttlKeys[txType]];\n}\n\n/**\n * Calculate fee based on tx type and params\n */\nexport function buildFee(txType: Tag, buildTx: any): BigNumber {\n const { rlpEncoded: { length }, txObject } = buildTx;\n\n return TX_FEE_BASE_GAS(txType)\n .plus(TX_FEE_OTHER_GAS(txType, length, {\n relativeTtl: getOracleRelativeTtl(txObject, txType),\n innerTxSize: [Tag.GaMetaTx, Tag.PayingForTx].includes(txType)\n ? txObject.tx.tx.encodedTx.rlpEncoded.length\n : 0,\n }))\n .times(MIN_GAS_PRICE);\n}\n\n/**\n * Calculate min fee\n * @category transaction builder\n * @param txType - Transaction type\n * @param rebuildTx - Callback to get built transaction with specific fee\n */\nfunction calculateMinFee(\n txType: Tag,\n rebuildTx: (value: BigNumber) => any,\n): BigNumber {\n let fee = new BigNumber(0);\n let previousFee;\n do {\n previousFee = fee;\n fee = buildFee(txType, rebuildTx(fee));\n } while (!fee.eq(previousFee));\n return fee;\n}\n\nexport default {\n ...coinAmount,\n\n serializeAettos(\n _value: string | undefined,\n { txType, rebuildTx, _computingMinFee }:\n { txType: Tag; rebuildTx: (params: any) => any; _computingMinFee?: string },\n ): string {\n if (_computingMinFee != null) return _computingMinFee;\n const minFee = calculateMinFee(txType, (fee) => rebuildTx({ _computingMinFee: fee }));\n const value = new BigNumber(_value ?? minFee);\n if (minFee.gt(value)) {\n throw new IllegalArgumentError(`Fee ${value.toString()} must be bigger then ${minFee}`);\n }\n return value.toFixed();\n },\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,cAAc;AAAC,SAC5BC,oBAAoB;AAAA,SACpBC,aAAa,EAAEC,GAAG;AAAA,OACpBC,UAAU;AAAA,SACRC,aAAa;AAEtB,MAAMC,QAAQ,GAAG,KAAK;AACtB,MAAMC,YAAY,GAAG,EAAE;AACvB,MAAMC,kBAAkB,GAAG,CAAC;;AAE5B;AACA;AACA;AACA;AACA;AACA;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","names":["serialize","value","from","deserialize","toString"],"sources":["../../../../src/tx/builder/field-types/field.ts"],"sourcesContent":["export default {\n serialize(value: string): Buffer {\n return Buffer.from(value);\n },\n\n deserialize(value: Buffer): string {\n return value.toString();\n },\n};\n"],"mappings":";;;;AAAA,eAAe;EACbA,SAAS,CAACC,
|
|
1
|
+
{"version":3,"file":"field.mjs","names":["serialize","value","from","deserialize","toString"],"sources":["../../../../src/tx/builder/field-types/field.ts"],"sourcesContent":["export default {\n serialize(value: string): Buffer {\n return Buffer.from(value);\n },\n\n deserialize(value: Buffer): string {\n return value.toString();\n },\n};\n"],"mappings":";;;;AAAA,eAAe;EACbA,SAAS,CAACC,KAAa,EAAU;IAC/B,OAAO,QAAOC,IAAI,CAACD,KAAK,CAAC;EAC3B,CAAC;EAEDE,WAAW,CAACF,KAAa,EAAU;IACjC,OAAOA,KAAK,CAACG,QAAQ,EAAE;EACzB;AACF,CAAC"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { IllegalArgumentError } from "../../../utils/errors.mjs";
|
|
2
|
-
import { MIN_GAS_PRICE } from "../constants.mjs";
|
|
2
|
+
import { MIN_GAS_PRICE, Tag, MAX_AUTH_FUN_GAS } from "../constants.mjs";
|
|
3
3
|
import shortUInt from "./short-u-int.mjs";
|
|
4
4
|
import { buildFee } from "./fee.mjs";
|
|
5
|
-
|
|
6
5
|
function calculateGasLimitMax(txType, gasMax, rebuildTx) {
|
|
7
6
|
return gasMax - +buildFee(txType, rebuildTx(gasMax)).dividedBy(MIN_GAS_PRICE);
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export default {
|
|
9
|
+
...shortUInt,
|
|
12
10
|
serialize(_value, _ref) {
|
|
13
11
|
let {
|
|
14
12
|
txType,
|
|
@@ -17,17 +15,14 @@ export default { ...shortUInt,
|
|
|
17
15
|
_computingGasLimit
|
|
18
16
|
} = _ref;
|
|
19
17
|
if (_computingGasLimit != null) return shortUInt.serialize(_computingGasLimit);
|
|
20
|
-
const gasLimitMax = calculateGasLimitMax(txType, gasMax, gasLimit => rebuildTx({
|
|
18
|
+
const gasLimitMax = txType === Tag.GaMetaTx ? MAX_AUTH_FUN_GAS : calculateGasLimitMax(txType, gasMax, gasLimit => rebuildTx({
|
|
21
19
|
_computingGasLimit: gasLimit
|
|
22
20
|
}));
|
|
23
21
|
const value = _value !== null && _value !== void 0 ? _value : gasLimitMax;
|
|
24
|
-
|
|
25
22
|
if (value > gasLimitMax) {
|
|
26
23
|
throw new IllegalArgumentError(`Gas limit ${value} must be less or equal to ${gasLimitMax}`);
|
|
27
24
|
}
|
|
28
|
-
|
|
29
25
|
return shortUInt.serialize(value);
|
|
30
26
|
}
|
|
31
|
-
|
|
32
27
|
};
|
|
33
28
|
//# sourceMappingURL=gas-limit.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gas-limit.mjs","names":["IllegalArgumentError","MIN_GAS_PRICE","shortUInt","buildFee","calculateGasLimitMax","txType","gasMax","rebuildTx","dividedBy","serialize","_value","_computingGasLimit","gasLimitMax","gasLimit","value"],"sources":["../../../../src/tx/builder/field-types/gas-limit.ts"],"sourcesContent":["import { IllegalArgumentError } from '../../../utils/errors';\nimport { MIN_GAS_PRICE, Tag } from '../constants';\nimport shortUInt from './short-u-int';\nimport { buildFee } from './fee';\n\nfunction calculateGasLimitMax(\n txType: Tag,\n gasMax: number,\n rebuildTx: (value: number) => any,\n): number {\n return gasMax - +buildFee(txType, rebuildTx(gasMax)).dividedBy(MIN_GAS_PRICE);\n}\n\nexport default {\n ...shortUInt,\n\n serialize(\n _value: number | undefined,\n {\n txType, rebuildTx, gasMax = 6e6, _computingGasLimit,\n }: {\n txType: Tag;\n rebuildTx: (params: any) => any;\n gasMax: number;\n _computingGasLimit?: number;\n },\n ): Buffer {\n if (_computingGasLimit != null) return shortUInt.serialize(_computingGasLimit);\n\n const gasLimitMax = calculateGasLimitMax(\n txType,\n gasMax,\n (gasLimit) => rebuildTx({ _computingGasLimit: gasLimit }),\n );\n const value = _value ?? gasLimitMax;\n if (value > gasLimitMax) {\n throw new IllegalArgumentError(`Gas limit ${value} must be less or equal to ${gasLimitMax}`);\n }\n return shortUInt.serialize(value);\n },\n};\n"],"mappings":"SAASA,
|
|
1
|
+
{"version":3,"file":"gas-limit.mjs","names":["IllegalArgumentError","MIN_GAS_PRICE","Tag","MAX_AUTH_FUN_GAS","shortUInt","buildFee","calculateGasLimitMax","txType","gasMax","rebuildTx","dividedBy","serialize","_value","_computingGasLimit","gasLimitMax","GaMetaTx","gasLimit","value"],"sources":["../../../../src/tx/builder/field-types/gas-limit.ts"],"sourcesContent":["import { IllegalArgumentError } from '../../../utils/errors';\nimport { MIN_GAS_PRICE, Tag, MAX_AUTH_FUN_GAS } from '../constants';\nimport shortUInt from './short-u-int';\nimport { buildFee } from './fee';\n\nfunction calculateGasLimitMax(\n txType: Tag,\n gasMax: number,\n rebuildTx: (value: number) => any,\n): number {\n return gasMax - +buildFee(txType, rebuildTx(gasMax)).dividedBy(MIN_GAS_PRICE);\n}\n\nexport default {\n ...shortUInt,\n\n serialize(\n _value: number | undefined,\n {\n txType, rebuildTx, gasMax = 6e6, _computingGasLimit,\n }: {\n txType: Tag;\n rebuildTx: (params: any) => any;\n gasMax: number;\n _computingGasLimit?: number;\n },\n ): Buffer {\n if (_computingGasLimit != null) return shortUInt.serialize(_computingGasLimit);\n\n const gasLimitMax = txType === Tag.GaMetaTx ? MAX_AUTH_FUN_GAS : calculateGasLimitMax(\n txType,\n gasMax,\n (gasLimit) => rebuildTx({ _computingGasLimit: gasLimit }),\n );\n const value = _value ?? gasLimitMax;\n if (value > gasLimitMax) {\n throw new IllegalArgumentError(`Gas limit ${value} must be less or equal to ${gasLimitMax}`);\n }\n return shortUInt.serialize(value);\n },\n};\n"],"mappings":"SAASA,oBAAoB;AAAA,SACpBC,aAAa,EAAEC,GAAG,EAAEC,gBAAgB;AAAA,OACtCC,SAAS;AAAA,SACPC,QAAQ;AAEjB,SAASC,oBAAoB,CAC3BC,MAAW,EACXC,MAAc,EACdC,SAAiC,EACzB;EACR,OAAOD,MAAM,GAAG,CAACH,QAAQ,CAACE,MAAM,EAAEE,SAAS,CAACD,MAAM,CAAC,CAAC,CAACE,SAAS,CAACT,aAAa,CAAC;AAC/E;AAEA,eAAe;EACb,GAAGG,SAAS;EAEZO,SAAS,CACPC,MAA0B,QASlB;IAAA,IARR;MACEL,MAAM;MAAEE,SAAS;MAAED,MAAM,GAAG,GAAG;MAAEK;IAMnC,CAAC;IAED,IAAIA,kBAAkB,IAAI,IAAI,EAAE,OAAOT,SAAS,CAACO,SAAS,CAACE,kBAAkB,CAAC;IAE9E,MAAMC,WAAW,GAAGP,MAAM,KAAKL,GAAG,CAACa,QAAQ,GAAGZ,gBAAgB,GAAGG,oBAAoB,CACnFC,MAAM,EACNC,MAAM,EACLQ,QAAQ,IAAKP,SAAS,CAAC;MAAEI,kBAAkB,EAAEG;IAAS,CAAC,CAAC,CAC1D;IACD,MAAMC,KAAK,GAAGL,MAAM,aAANA,MAAM,cAANA,MAAM,GAAIE,WAAW;IACnC,IAAIG,KAAK,GAAGH,WAAW,EAAE;MACvB,MAAM,IAAId,oBAAoB,CAAE,aAAYiB,KAAM,6BAA4BH,WAAY,EAAC,CAAC;IAC9F;IACA,OAAOV,SAAS,CAACO,SAAS,CAACM,KAAK,CAAC;EACnC;AACF,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
declare const _default: {
|
|
3
3
|
serializeAettos(value?: string | undefined): string;
|
|
4
|
-
serialize
|
|
5
|
-
serializeOptional(value: import("./u-int").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
|
|
4
|
+
serialize(value: import("./u-int").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
|
|
6
5
|
deserialize(value: Buffer): string;
|
|
7
6
|
};
|
|
8
7
|
export default _default;
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import coinAmount from "./coin-amount.mjs";
|
|
2
2
|
import { IllegalArgumentError } from "../../../utils/errors.mjs";
|
|
3
3
|
import { MIN_GAS_PRICE } from "../constants.mjs";
|
|
4
|
-
export default {
|
|
5
|
-
|
|
4
|
+
export default {
|
|
5
|
+
...coinAmount,
|
|
6
6
|
serializeAettos() {
|
|
7
7
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MIN_GAS_PRICE.toString();
|
|
8
|
-
|
|
9
8
|
if (+value < MIN_GAS_PRICE) {
|
|
10
9
|
throw new IllegalArgumentError(`Gas price ${value.toString()} must be bigger then ${MIN_GAS_PRICE}`);
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
return value;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
serialize: coinAmount.serializeOptional
|
|
12
|
+
}
|
|
17
13
|
};
|
|
18
14
|
//# sourceMappingURL=gas-price.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gas-price.mjs","names":["coinAmount","IllegalArgumentError","MIN_GAS_PRICE","serializeAettos","value","toString"
|
|
1
|
+
{"version":3,"file":"gas-price.mjs","names":["coinAmount","IllegalArgumentError","MIN_GAS_PRICE","serializeAettos","value","toString"],"sources":["../../../../src/tx/builder/field-types/gas-price.ts"],"sourcesContent":["import coinAmount from './coin-amount';\nimport { IllegalArgumentError } from '../../../utils/errors';\nimport { MIN_GAS_PRICE } from '../constants';\n\nexport default {\n ...coinAmount,\n\n serializeAettos(value: string | undefined = MIN_GAS_PRICE.toString()): string {\n if (+value < MIN_GAS_PRICE) {\n throw new IllegalArgumentError(`Gas price ${value.toString()} must be bigger then ${MIN_GAS_PRICE}`);\n }\n return value;\n },\n};\n"],"mappings":"OAAOA,UAAU;AAAA,SACRC,oBAAoB;AAAA,SACpBC,aAAa;AAEtB,eAAe;EACb,GAAGF,UAAU;EAEbG,eAAe,GAA+D;IAAA,IAA9DC,KAAyB,uEAAGF,aAAa,CAACG,QAAQ,EAAE;IAClE,IAAI,CAACD,KAAK,GAAGF,aAAa,EAAE;MAC1B,MAAM,IAAID,oBAAoB,CAAE,aAAYG,KAAK,CAACC,QAAQ,EAAG,wBAAuBH,aAAc,EAAC,CAAC;IACtG;IACA,OAAOE,KAAK;EACd;AACF,CAAC"}
|