@aeternity/aepp-sdk 13.2.2 → 13.3.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/LICENSE +1 -1
- package/README.md +1 -1
- package/bin/aesophia_cli +0 -0
- package/bin/aesophia_cli_8 +0 -0
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +1 -1
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +9171 -7086
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdk.d.ts +3 -0
- package/es/AeSdk.mjs +12 -12
- package/es/AeSdk.mjs.map +1 -1
- package/es/AeSdkAepp.d.ts +0 -1
- package/es/AeSdkAepp.mjs +12 -16
- package/es/AeSdkAepp.mjs.map +1 -1
- package/es/AeSdkBase.d.ts +61 -6
- package/es/AeSdkBase.mjs +150 -69
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkMethods.d.ts +19 -7
- package/es/AeSdkMethods.mjs +39 -38
- package/es/AeSdkMethods.mjs.map +1 -1
- package/es/AeSdkWallet.mjs +86 -55
- package/es/AeSdkWallet.mjs.map +1 -1
- package/es/Middleware.mjs +31 -27
- package/es/Middleware.mjs.map +1 -1
- package/es/MiddlewareSubscriber.mjs +5 -14
- package/es/MiddlewareSubscriber.mjs.map +1 -1
- package/es/Node.d.ts +10 -2
- package/es/Node.mjs +53 -54
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +39 -3
- package/es/account/Base.mjs +35 -1
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Generalized.d.ts +2 -0
- package/es/account/Generalized.mjs +15 -6
- package/es/account/Generalized.mjs.map +1 -1
- package/es/account/Ledger.d.ts +2 -0
- package/es/account/Ledger.mjs +14 -5
- package/es/account/Ledger.mjs.map +1 -1
- package/es/account/LedgerFactory.mjs +4 -6
- package/es/account/LedgerFactory.mjs.map +1 -1
- package/es/account/Memory.d.ts +15 -4
- package/es/account/Memory.mjs +96 -31
- package/es/account/Memory.mjs.map +1 -1
- package/es/account/Rpc.d.ts +16 -5
- package/es/account/Rpc.mjs +94 -21
- package/es/account/Rpc.mjs.map +1 -1
- package/es/aens.d.ts +17 -44
- package/es/aens.mjs +32 -71
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/Browser.mjs +3 -4
- package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +7 -5
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +8 -9
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +7 -7
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/types.d.ts +14 -0
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
- package/es/aepp-wallet-communication/schema.d.ts +2 -0
- package/es/aepp-wallet-communication/schema.mjs +2 -0
- package/es/aepp-wallet-communication/schema.mjs.map +1 -1
- package/es/aepp-wallet-communication/wallet-detector.mjs +4 -5
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
- package/es/apis/compiler/compiler.mjs.map +1 -1
- package/es/apis/compiler/models/index.d.ts +1 -0
- package/es/apis/compiler/models/index.mjs.map +1 -1
- package/es/apis/compiler/models/mappers.mjs +13 -0
- package/es/apis/compiler/models/mappers.mjs.map +1 -1
- package/es/apis/compiler/models/parameters.mjs.map +1 -1
- package/es/apis/middleware/middleware.d.ts +23 -5
- package/es/apis/middleware/middleware.mjs +114 -18
- package/es/apis/middleware/middleware.mjs.map +1 -1
- package/es/apis/middleware/models/index.d.ts +164 -15
- package/es/apis/middleware/models/index.mjs +53 -3
- package/es/apis/middleware/models/index.mjs.map +1 -1
- package/es/apis/middleware/models/mappers.d.ts +8 -1
- package/es/apis/middleware/models/mappers.mjs +376 -3
- package/es/apis/middleware/models/mappers.mjs.map +1 -1
- package/es/apis/middleware/models/parameters.d.ts +6 -3
- package/es/apis/middleware/models/parameters.mjs +38 -11
- package/es/apis/middleware/models/parameters.mjs.map +1 -1
- package/es/apis/node/models/index.d.ts +66 -2
- package/es/apis/node/models/index.mjs.map +1 -1
- package/es/apis/node/models/mappers.d.ts +5 -1
- package/es/apis/node/models/mappers.mjs +229 -7
- package/es/apis/node/models/mappers.mjs.map +1 -1
- package/es/apis/node/models/parameters.d.ts +2 -2
- package/es/apis/node/models/parameters.mjs +2 -2
- package/es/apis/node/models/parameters.mjs.map +1 -1
- package/es/apis/node/node.d.ts +24 -3
- package/es/apis/node/node.mjs +135 -3
- package/es/apis/node/node.mjs.map +1 -1
- package/es/chain.d.ts +14 -44
- package/es/chain.mjs +125 -219
- package/es/chain.mjs.map +1 -1
- package/es/channel/Base.d.ts +3 -47
- package/es/channel/Base.mjs +21 -54
- package/es/channel/Base.mjs.map +1 -1
- package/es/channel/Contract.d.ts +16 -25
- package/es/channel/Contract.mjs +39 -63
- package/es/channel/Contract.mjs.map +1 -1
- package/es/channel/Spend.d.ts +0 -8
- package/es/channel/Spend.mjs +17 -29
- package/es/channel/Spend.mjs.map +1 -1
- package/es/channel/handlers.mjs +1 -1
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/internal.d.ts +104 -5
- package/es/channel/internal.mjs +26 -34
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Contract.d.ts +9 -1
- package/es/contract/Contract.mjs +67 -73
- package/es/contract/Contract.mjs.map +1 -1
- package/es/contract/compiler/Base.d.ts +14 -8
- package/es/contract/compiler/Base.mjs.map +1 -1
- package/es/contract/compiler/Cli.d.ts +5 -9
- package/es/contract/compiler/Cli.mjs +45 -23
- package/es/contract/compiler/Cli.mjs.map +1 -1
- package/es/contract/compiler/Cli8.d.ts +13 -0
- package/es/contract/compiler/Cli8.mjs +22 -0
- package/es/contract/compiler/Cli8.mjs.map +1 -0
- package/es/contract/compiler/Http.d.ts +3 -9
- package/es/contract/compiler/Http.mjs +28 -16
- package/es/contract/compiler/Http.mjs.map +1 -1
- package/es/contract/compiler/HttpNode.d.ts +2 -5
- package/es/contract/compiler/HttpNode.mjs.map +1 -1
- package/es/contract/delegation-signature.d.ts +2 -1
- package/es/contract/delegation-signature.mjs +18 -14
- package/es/contract/delegation-signature.mjs.map +1 -1
- package/es/contract/ga.d.ts +1 -2
- package/es/contract/ga.mjs +23 -25
- package/es/contract/ga.mjs.map +1 -1
- package/es/deprecated.d.ts +38 -0
- package/es/deprecated.mjs +45 -0
- package/es/deprecated.mjs.map +1 -1
- package/es/index-browser.d.ts +10 -5
- package/es/index-browser.mjs +9 -5
- package/es/index-browser.mjs.map +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.mjs +1 -0
- package/es/index.mjs.map +1 -1
- package/es/oracle.d.ts +6 -37
- package/es/oracle.mjs +32 -66
- package/es/oracle.mjs.map +1 -1
- package/es/send-transaction.d.ts +53 -0
- package/es/send-transaction.mjs +109 -0
- package/es/send-transaction.mjs.map +1 -0
- package/es/spend.d.ts +4 -3
- package/es/spend.mjs +6 -1
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/common.d.ts +29 -0
- package/es/tx/builder/common.mjs +42 -0
- package/es/tx/builder/common.mjs.map +1 -0
- package/es/tx/builder/constants.d.ts +4 -4
- package/es/tx/builder/constants.mjs +6 -15
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/delegation/index.d.ts +20 -0
- package/es/tx/builder/delegation/index.mjs +24 -0
- package/es/tx/builder/delegation/index.mjs.map +1 -0
- package/es/tx/builder/delegation/schema.d.ts +130 -0
- package/es/tx/builder/delegation/schema.generated.d.ts +141 -0
- package/es/tx/builder/delegation/schema.generated.mjs +2 -0
- package/es/tx/builder/delegation/schema.generated.mjs.map +1 -0
- package/es/tx/builder/delegation/schema.mjs +54 -0
- package/es/tx/builder/delegation/schema.mjs.map +1 -0
- package/es/tx/builder/field-types/abi-version.mjs +8 -11
- package/es/tx/builder/field-types/abi-version.mjs.map +1 -1
- package/es/tx/builder/field-types/address.mjs +1 -4
- package/es/tx/builder/field-types/address.mjs.map +1 -1
- package/es/tx/builder/field-types/coin-amount.d.ts +2 -2
- package/es/tx/builder/field-types/coin-amount.mjs +6 -6
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
- package/es/tx/builder/field-types/ct-version.mjs +3 -4
- package/es/tx/builder/field-types/ct-version.mjs.map +1 -1
- package/es/tx/builder/field-types/entry.mjs +7 -13
- package/es/tx/builder/field-types/entry.mjs.map +1 -1
- package/es/tx/builder/field-types/fee.d.ts +19 -11
- package/es/tx/builder/field-types/fee.mjs +56 -38
- package/es/tx/builder/field-types/fee.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-limit.mjs +13 -15
- package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-price.d.ts +10 -2
- package/es/tx/builder/field-types/gas-price.mjs +52 -3
- package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
- package/es/tx/builder/field-types/index.d.ts +31 -29
- package/es/tx/builder/field-types/index.mjs +31 -29
- package/es/tx/builder/field-types/index.mjs.map +1 -1
- package/es/tx/builder/field-types/map.mjs +20 -31
- package/es/tx/builder/field-types/map.mjs.map +1 -1
- package/es/tx/builder/field-types/mptree.mjs +14 -29
- package/es/tx/builder/field-types/mptree.mjs.map +1 -1
- package/es/tx/builder/field-types/name-fee.d.ts +1 -1
- package/es/tx/builder/field-types/name-fee.mjs +1 -1
- package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
- package/es/tx/builder/field-types/nonce.d.ts +1 -0
- package/es/tx/builder/field-types/nonce.mjs +2 -0
- package/es/tx/builder/field-types/nonce.mjs.map +1 -1
- package/es/tx/builder/field-types/pointers.mjs +4 -7
- package/es/tx/builder/field-types/pointers.mjs.map +1 -1
- package/es/tx/builder/field-types/pointers2.d.ts +23 -0
- package/es/tx/builder/field-types/pointers2.mjs +65 -0
- package/es/tx/builder/field-types/pointers2.mjs.map +1 -0
- package/es/tx/builder/field-types/query-fee.d.ts +19 -0
- package/es/tx/builder/field-types/query-fee.mjs +20 -0
- package/es/tx/builder/field-types/query-fee.mjs.map +1 -0
- package/es/tx/builder/field-types/ttl.d.ts +9 -1
- package/es/tx/builder/field-types/ttl.mjs +19 -8
- package/es/tx/builder/field-types/ttl.mjs.map +1 -1
- package/es/tx/builder/field-types/with-default.d.ts +7 -0
- package/es/tx/builder/field-types/with-default.mjs +9 -0
- package/es/tx/builder/field-types/with-default.mjs.map +1 -0
- package/es/tx/builder/field-types/with-formatting.d.ts +7 -0
- package/es/tx/builder/field-types/with-formatting.mjs +9 -0
- package/es/tx/builder/field-types/with-formatting.mjs.map +1 -0
- package/es/tx/builder/field-types/wrapped.mjs +6 -8
- package/es/tx/builder/field-types/wrapped.mjs.map +1 -1
- package/es/tx/builder/helpers.d.ts +2 -2
- package/es/tx/builder/helpers.mjs +12 -21
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +17 -10
- package/es/tx/builder/index.mjs +39 -65
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +478 -257
- package/es/tx/builder/schema.generated.d.ts +39 -3
- package/es/tx/builder/schema.generated.mjs.map +1 -1
- package/es/tx/builder/schema.mjs +48 -36
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/execution-cost.d.ts +6 -5
- package/es/tx/execution-cost.mjs +16 -17
- package/es/tx/execution-cost.mjs.map +1 -1
- package/es/tx/transaction-signer.mjs +1 -4
- package/es/tx/transaction-signer.mjs.map +1 -1
- package/es/tx/validator.mjs +61 -42
- package/es/tx/validator.mjs.map +1 -1
- package/es/utils/amount-formatter.mjs +15 -22
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.d.ts +2 -3
- package/es/utils/autorest.mjs +40 -24
- package/es/utils/autorest.mjs.map +1 -1
- package/es/utils/bytes.mjs +1 -2
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/crypto.d.ts +8 -4
- package/es/utils/crypto.mjs +17 -13
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/errors.d.ts +6 -0
- package/es/utils/errors.mjs +12 -6
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/hd-wallet.d.ts +2 -0
- package/es/utils/hd-wallet.mjs +6 -5
- package/es/utils/hd-wallet.mjs.map +1 -1
- package/es/utils/json-big.mjs +2 -10
- package/es/utils/json-big.mjs.map +1 -1
- package/es/utils/jwt.d.ts +53 -0
- package/es/utils/jwt.mjs +120 -0
- package/es/utils/jwt.mjs.map +1 -0
- package/es/utils/keystore.d.ts +6 -2
- package/es/utils/keystore.mjs +8 -16
- package/es/utils/keystore.mjs.map +1 -1
- package/es/utils/typed-data.mjs +1 -0
- package/es/utils/typed-data.mjs.map +1 -1
- package/es/utils/wrap-proxy.d.ts +2 -0
- package/es/utils/wrap-proxy.mjs +15 -0
- package/es/utils/wrap-proxy.mjs.map +1 -0
- package/package.json +57 -51
- package/src/AeSdk.ts +3 -0
- package/src/AeSdkAepp.ts +0 -1
- package/src/AeSdkBase.ts +97 -10
- package/src/AeSdkMethods.ts +37 -33
- package/src/AeSdkWallet.ts +22 -3
- package/src/Middleware.ts +16 -8
- package/src/MiddlewareSubscriber.ts +1 -1
- package/src/Node.ts +37 -18
- package/src/account/Base.ts +62 -3
- package/src/account/Generalized.ts +10 -0
- package/src/account/Ledger.ts +10 -0
- package/src/account/Memory.ts +83 -9
- package/src/account/Rpc.ts +69 -6
- package/src/aens.ts +35 -56
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +3 -0
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +2 -2
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +4 -2
- package/src/aepp-wallet-communication/rpc/types.ts +13 -0
- package/src/aepp-wallet-communication/schema.ts +2 -0
- package/src/apis/compiler/compiler.ts +93 -93
- package/src/apis/compiler/models/index.ts +1 -0
- package/src/apis/compiler/models/mappers.ts +178 -165
- package/src/apis/compiler/models/parameters.ts +18 -18
- package/src/apis/middleware/middleware.ts +462 -341
- package/src/apis/middleware/models/index.ts +258 -56
- package/src/apis/middleware/models/mappers.ts +2357 -1919
- package/src/apis/middleware/models/parameters.ts +172 -142
- package/src/apis/node/models/index.ts +79 -2
- package/src/apis/node/models/mappers.ts +1529 -1302
- package/src/apis/node/models/parameters.ts +51 -51
- package/src/apis/node/node.ts +420 -275
- package/src/chain.ts +42 -128
- package/src/channel/Base.ts +14 -47
- package/src/channel/Contract.ts +18 -26
- package/src/channel/Spend.ts +0 -8
- package/src/channel/internal.ts +115 -13
- package/src/contract/Contract.ts +26 -8
- package/src/contract/compiler/Base.ts +15 -8
- package/src/contract/compiler/Cli.ts +37 -21
- package/src/contract/compiler/Cli8.ts +17 -0
- package/src/contract/compiler/Http.ts +24 -14
- package/src/contract/compiler/HttpNode.ts +2 -2
- package/src/contract/delegation-signature.ts +11 -5
- package/src/contract/ga.ts +4 -3
- package/src/deprecated.ts +36 -0
- package/src/index-browser.ts +14 -7
- package/src/index.ts +1 -0
- package/src/oracle.ts +11 -54
- package/src/send-transaction.ts +136 -0
- package/src/spend.ts +25 -11
- package/src/tx/builder/common.ts +74 -0
- package/src/tx/builder/constants.ts +6 -9
- package/src/tx/builder/delegation/index.ts +28 -0
- package/src/tx/builder/delegation/schema.generated.ts +143 -0
- package/src/tx/builder/delegation/schema.ts +61 -0
- package/src/tx/builder/field-types/coin-amount.ts +3 -2
- package/src/tx/builder/field-types/entry.ts +1 -4
- package/src/tx/builder/field-types/fee.ts +71 -43
- package/src/tx/builder/field-types/gas-limit.ts +4 -4
- package/src/tx/builder/field-types/gas-price.ts +58 -2
- package/src/tx/builder/field-types/index.ts +31 -59
- package/src/tx/builder/field-types/name-fee.ts +1 -1
- package/src/tx/builder/field-types/nonce.ts +7 -1
- package/src/tx/builder/field-types/pointers2.ts +62 -0
- package/src/tx/builder/field-types/query-fee.ts +25 -0
- package/src/tx/builder/field-types/ttl.ts +13 -3
- package/src/tx/builder/field-types/with-default.ts +18 -0
- package/src/tx/builder/field-types/with-formatting.ts +18 -0
- package/src/tx/builder/helpers.ts +2 -2
- package/src/tx/builder/index.ts +42 -59
- package/src/tx/builder/schema.generated.ts +39 -3
- package/src/tx/builder/schema.ts +55 -29
- package/src/tx/execution-cost.ts +6 -5
- package/src/tx/validator.ts +31 -5
- package/src/utils/autorest.ts +36 -27
- package/src/utils/crypto.ts +23 -13
- package/src/utils/errors.ts +10 -0
- package/src/utils/hd-wallet.ts +2 -0
- package/src/utils/jwt.ts +126 -0
- package/src/utils/keystore.ts +6 -2
- package/src/utils/wrap-proxy.ts +24 -0
- package/types-legacy/ts4.2/AeSdk.d.ts +3 -0
- package/types-legacy/ts4.2/AeSdkAepp.d.ts +0 -1
- package/types-legacy/ts4.2/AeSdkBase.d.ts +61 -6
- package/types-legacy/ts4.2/AeSdkMethods.d.ts +19 -7
- package/types-legacy/ts4.2/Node.d.ts +14 -1
- package/types-legacy/ts4.2/account/Base.d.ts +39 -3
- package/types-legacy/ts4.2/account/Generalized.d.ts +2 -0
- package/types-legacy/ts4.2/account/Ledger.d.ts +2 -0
- package/types-legacy/ts4.2/account/Memory.d.ts +15 -4
- package/types-legacy/ts4.2/account/Rpc.d.ts +16 -5
- package/types-legacy/ts4.2/aens.d.ts +17 -44
- package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +14 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +2 -0
- package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +1 -0
- package/types-legacy/ts4.2/apis/middleware/middleware.d.ts +23 -5
- package/types-legacy/ts4.2/apis/middleware/models/index.d.ts +164 -15
- package/types-legacy/ts4.2/apis/middleware/models/mappers.d.ts +8 -1
- package/types-legacy/ts4.2/apis/middleware/models/parameters.d.ts +6 -3
- package/types-legacy/ts4.2/apis/node/models/index.d.ts +66 -2
- package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +5 -1
- package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +2 -2
- package/types-legacy/ts4.2/apis/node/node.d.ts +24 -3
- package/types-legacy/ts4.2/chain.d.ts +14 -44
- package/types-legacy/ts4.2/channel/Base.d.ts +3 -47
- package/types-legacy/ts4.2/channel/Contract.d.ts +16 -25
- package/types-legacy/ts4.2/channel/Spend.d.ts +0 -8
- package/types-legacy/ts4.2/channel/internal.d.ts +104 -5
- package/types-legacy/ts4.2/contract/Contract.d.ts +9 -1
- package/types-legacy/ts4.2/contract/compiler/Base.d.ts +14 -8
- package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +5 -9
- package/types-legacy/ts4.2/contract/compiler/Cli8.d.ts +13 -0
- package/types-legacy/ts4.2/contract/compiler/Http.d.ts +3 -9
- package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +2 -5
- package/types-legacy/ts4.2/contract/delegation-signature.d.ts +2 -1
- package/types-legacy/ts4.2/contract/ga.d.ts +1 -2
- package/types-legacy/ts4.2/deprecated.d.ts +38 -0
- package/types-legacy/ts4.2/index-browser.d.ts +10 -5
- package/types-legacy/ts4.2/index.d.ts +1 -0
- package/types-legacy/ts4.2/oracle.d.ts +6 -37
- package/types-legacy/ts4.2/send-transaction.d.ts +53 -0
- package/types-legacy/ts4.2/spend.d.ts +4 -3
- package/types-legacy/ts4.2/tx/builder/common.d.ts +32 -0
- package/types-legacy/ts4.2/tx/builder/constants.d.ts +4 -4
- package/types-legacy/ts4.2/tx/builder/delegation/index.d.ts +20 -0
- package/types-legacy/ts4.2/tx/builder/delegation/schema.d.ts +136 -0
- package/types-legacy/ts4.2/tx/builder/delegation/schema.generated.d.ts +141 -0
- package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +2 -2
- package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +19 -11
- package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +10 -2
- package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +31 -29
- package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/nonce.d.ts +1 -0
- package/types-legacy/ts4.2/tx/builder/field-types/pointers2.d.ts +26 -0
- package/types-legacy/ts4.2/tx/builder/field-types/query-fee.d.ts +19 -0
- package/types-legacy/ts4.2/tx/builder/field-types/ttl.d.ts +9 -1
- package/types-legacy/ts4.2/tx/builder/field-types/with-default.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/field-types/with-formatting.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/helpers.d.ts +2 -2
- package/types-legacy/ts4.2/tx/builder/index.d.ts +17 -10
- package/types-legacy/ts4.2/tx/builder/schema.d.ts +482 -257
- package/types-legacy/ts4.2/tx/builder/schema.generated.d.ts +39 -3
- package/types-legacy/ts4.2/tx/execution-cost.d.ts +6 -5
- package/types-legacy/ts4.2/utils/autorest.d.ts +2 -3
- package/types-legacy/ts4.2/utils/crypto.d.ts +8 -4
- package/types-legacy/ts4.2/utils/errors.d.ts +6 -0
- package/types-legacy/ts4.2/utils/hd-wallet.d.ts +2 -0
- package/types-legacy/ts4.2/utils/jwt.d.ts +53 -0
- package/types-legacy/ts4.2/utils/keystore.d.ts +6 -2
- package/types-legacy/ts4.2/utils/wrap-proxy.d.ts +2 -0
- package/types-legacy/ts4.5/AeSdk.d.ts +3 -0
- package/types-legacy/ts4.5/AeSdkAepp.d.ts +0 -1
- package/types-legacy/ts4.5/AeSdkBase.d.ts +61 -6
- package/types-legacy/ts4.5/AeSdkMethods.d.ts +19 -7
- package/types-legacy/ts4.5/Node.d.ts +14 -1
- package/types-legacy/ts4.5/account/Base.d.ts +39 -3
- package/types-legacy/ts4.5/account/Generalized.d.ts +2 -0
- package/types-legacy/ts4.5/account/Ledger.d.ts +2 -0
- package/types-legacy/ts4.5/account/Memory.d.ts +15 -4
- package/types-legacy/ts4.5/account/Rpc.d.ts +16 -5
- package/types-legacy/ts4.5/aens.d.ts +17 -44
- package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +14 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +2 -0
- package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +1 -0
- package/types-legacy/ts4.5/apis/middleware/middleware.d.ts +23 -5
- package/types-legacy/ts4.5/apis/middleware/models/index.d.ts +164 -15
- package/types-legacy/ts4.5/apis/middleware/models/mappers.d.ts +8 -1
- package/types-legacy/ts4.5/apis/middleware/models/parameters.d.ts +6 -3
- package/types-legacy/ts4.5/apis/node/models/index.d.ts +66 -2
- package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +5 -1
- package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +2 -2
- package/types-legacy/ts4.5/apis/node/node.d.ts +24 -3
- package/types-legacy/ts4.5/chain.d.ts +14 -44
- package/types-legacy/ts4.5/channel/Base.d.ts +3 -47
- package/types-legacy/ts4.5/channel/Contract.d.ts +16 -25
- package/types-legacy/ts4.5/channel/Spend.d.ts +0 -8
- package/types-legacy/ts4.5/channel/internal.d.ts +104 -5
- package/types-legacy/ts4.5/contract/Contract.d.ts +9 -1
- package/types-legacy/ts4.5/contract/compiler/Base.d.ts +14 -8
- package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +5 -9
- package/types-legacy/ts4.5/contract/compiler/Cli8.d.ts +13 -0
- package/types-legacy/ts4.5/contract/compiler/Http.d.ts +3 -9
- package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +2 -5
- package/types-legacy/ts4.5/contract/delegation-signature.d.ts +2 -1
- package/types-legacy/ts4.5/contract/ga.d.ts +1 -2
- package/types-legacy/ts4.5/deprecated.d.ts +38 -0
- package/types-legacy/ts4.5/index-browser.d.ts +10 -5
- package/types-legacy/ts4.5/index.d.ts +1 -0
- package/types-legacy/ts4.5/oracle.d.ts +6 -37
- package/types-legacy/ts4.5/send-transaction.d.ts +53 -0
- package/types-legacy/ts4.5/spend.d.ts +4 -3
- package/types-legacy/ts4.5/tx/builder/common.d.ts +32 -0
- package/types-legacy/ts4.5/tx/builder/constants.d.ts +4 -4
- package/types-legacy/ts4.5/tx/builder/delegation/index.d.ts +20 -0
- package/types-legacy/ts4.5/tx/builder/delegation/schema.d.ts +136 -0
- package/types-legacy/ts4.5/tx/builder/delegation/schema.generated.d.ts +141 -0
- package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +2 -2
- package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +19 -11
- package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +10 -2
- package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +31 -29
- package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/nonce.d.ts +1 -0
- package/types-legacy/ts4.5/tx/builder/field-types/pointers2.d.ts +26 -0
- package/types-legacy/ts4.5/tx/builder/field-types/query-fee.d.ts +19 -0
- package/types-legacy/ts4.5/tx/builder/field-types/ttl.d.ts +9 -1
- package/types-legacy/ts4.5/tx/builder/field-types/with-default.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/field-types/with-formatting.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/helpers.d.ts +2 -2
- package/types-legacy/ts4.5/tx/builder/index.d.ts +17 -10
- package/types-legacy/ts4.5/tx/builder/schema.d.ts +482 -257
- package/types-legacy/ts4.5/tx/builder/schema.generated.d.ts +39 -3
- package/types-legacy/ts4.5/tx/execution-cost.d.ts +6 -5
- package/types-legacy/ts4.5/utils/autorest.d.ts +2 -3
- package/types-legacy/ts4.5/utils/crypto.d.ts +8 -4
- package/types-legacy/ts4.5/utils/errors.d.ts +6 -0
- package/types-legacy/ts4.5/utils/hd-wallet.d.ts +2 -0
- package/types-legacy/ts4.5/utils/jwt.d.ts +53 -0
- package/types-legacy/ts4.5/utils/keystore.d.ts +6 -2
- package/types-legacy/ts4.5/utils/wrap-proxy.d.ts +2 -0
- package/es/tx/builder/field-types/deposit.d.ts +0 -15
- package/es/tx/builder/field-types/deposit.mjs +0 -18
- package/es/tx/builder/field-types/deposit.mjs.map +0 -1
- package/src/tx/builder/field-types/deposit.ts +0 -23
- package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +0 -15
- package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +0 -15
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
|
-
import { IllegalArgumentError } from "../../../utils/errors.mjs";
|
|
2
|
+
import { ArgumentError, IllegalArgumentError } from "../../../utils/errors.mjs";
|
|
3
3
|
import { MIN_GAS_PRICE, Tag } from "../constants.mjs";
|
|
4
|
+
import uInt from "./u-int.mjs";
|
|
4
5
|
import coinAmount from "./coin-amount.mjs";
|
|
6
|
+
import { getCachedIncreasedGasPrice } from "./gas-price.mjs";
|
|
5
7
|
import { isKeyOfObject } from "../../../utils/other.mjs";
|
|
6
8
|
import { decode } from "../../../utils/encoder.mjs";
|
|
7
9
|
const BASE_GAS = 15000;
|
|
@@ -9,25 +11,20 @@ const GAS_PER_BYTE = 20;
|
|
|
9
11
|
const KEY_BLOCK_INTERVAL = 3;
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
|
-
* Calculate the
|
|
14
|
+
* Calculate the base gas
|
|
13
15
|
* @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}
|
|
14
16
|
* @param txType - The transaction type
|
|
15
|
-
* @returns The base
|
|
17
|
+
* @returns The base gas
|
|
16
18
|
* @example
|
|
17
19
|
* ```js
|
|
18
|
-
*
|
|
20
|
+
* TX_BASE_GAS(Tag.ChannelForceProgressTx) => 30 * 15000
|
|
19
21
|
* ```
|
|
20
22
|
*/
|
|
21
|
-
const
|
|
23
|
+
const TX_BASE_GAS = txType => {
|
|
22
24
|
var _feeFactors;
|
|
23
25
|
const feeFactors = {
|
|
24
26
|
[Tag.ChannelForceProgressTx]: 30,
|
|
25
27
|
[Tag.ChannelOffChainTx]: 0,
|
|
26
|
-
[Tag.ChannelOffChainUpdateCallContract]: 0,
|
|
27
|
-
[Tag.ChannelOffChainUpdateCreateContract]: 0,
|
|
28
|
-
[Tag.ChannelOffChainUpdateDeposit]: 0,
|
|
29
|
-
[Tag.ChannelOffChainUpdateWithdraw]: 0,
|
|
30
|
-
[Tag.ChannelOffChainUpdateTransfer]: 0,
|
|
31
28
|
[Tag.ContractCreateTx]: 5,
|
|
32
29
|
[Tag.ContractCallTx]: 12,
|
|
33
30
|
[Tag.GaAttachTx]: 5,
|
|
@@ -35,40 +32,39 @@ const TX_FEE_BASE_GAS = txType => {
|
|
|
35
32
|
[Tag.PayingForTx]: 1 / 5
|
|
36
33
|
};
|
|
37
34
|
const factor = (_feeFactors = feeFactors[txType]) !== null && _feeFactors !== void 0 ? _feeFactors : 1;
|
|
38
|
-
return
|
|
35
|
+
return factor * BASE_GAS;
|
|
39
36
|
};
|
|
40
37
|
|
|
41
38
|
/**
|
|
42
|
-
* Calculate
|
|
39
|
+
* Calculate gas for other types of transactions
|
|
43
40
|
* @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}
|
|
44
41
|
* @param txType - The transaction type
|
|
45
42
|
* @param txSize - The transaction size
|
|
46
43
|
* @returns parameters - The transaction parameters
|
|
47
44
|
* @returns parameters.relativeTtl - The relative ttl
|
|
48
45
|
* @returns parameters.innerTxSize - The size of the inner transaction
|
|
49
|
-
* @returns The
|
|
46
|
+
* @returns The other gas
|
|
50
47
|
* @example
|
|
51
48
|
* ```js
|
|
52
|
-
*
|
|
53
|
-
* =>
|
|
49
|
+
* TX_OTHER_GAS(Tag.OracleResponseTx, 10, { relativeTtl: 12, innerTxSize: 0 })
|
|
50
|
+
* => 10 * 20 + Math.ceil(32000 * 12 / Math.floor(60 * 24 * 365 / 3))
|
|
54
51
|
* ```
|
|
55
52
|
*/
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
} = _ref;
|
|
53
|
+
const TX_OTHER_GAS = (txType, txSize, {
|
|
54
|
+
relativeTtl,
|
|
55
|
+
innerTxSize
|
|
56
|
+
}) => {
|
|
61
57
|
switch (txType) {
|
|
62
58
|
case Tag.OracleRegisterTx:
|
|
63
59
|
case Tag.OracleExtendTx:
|
|
64
60
|
case Tag.OracleQueryTx:
|
|
65
61
|
case Tag.OracleResponseTx:
|
|
66
|
-
return
|
|
62
|
+
return txSize * GAS_PER_BYTE + Math.ceil(32000 * relativeTtl / Math.floor(60 * 24 * 365 / KEY_BLOCK_INTERVAL));
|
|
67
63
|
case Tag.GaMetaTx:
|
|
68
64
|
case Tag.PayingForTx:
|
|
69
|
-
return
|
|
65
|
+
return (txSize - innerTxSize) * GAS_PER_BYTE;
|
|
70
66
|
default:
|
|
71
|
-
return
|
|
67
|
+
return txSize * GAS_PER_BYTE;
|
|
72
68
|
}
|
|
73
69
|
};
|
|
74
70
|
function getOracleRelativeTtl(params) {
|
|
@@ -86,9 +82,9 @@ function getOracleRelativeTtl(params) {
|
|
|
86
82
|
}
|
|
87
83
|
|
|
88
84
|
/**
|
|
89
|
-
* Calculate
|
|
85
|
+
* Calculate gas based on tx type and params
|
|
90
86
|
*/
|
|
91
|
-
export function
|
|
87
|
+
export function buildGas(builtTx, unpackTx, buildTx) {
|
|
92
88
|
const {
|
|
93
89
|
length
|
|
94
90
|
} = decode(builtTx);
|
|
@@ -97,10 +93,10 @@ export function buildFee(builtTx, unpackTx, buildTx) {
|
|
|
97
93
|
if (txObject.tag === Tag.GaMetaTx || txObject.tag === Tag.PayingForTx) {
|
|
98
94
|
innerTxSize = decode(buildTx(txObject.tx.encodedTx)).length;
|
|
99
95
|
}
|
|
100
|
-
return
|
|
96
|
+
return TX_BASE_GAS(txObject.tag) + TX_OTHER_GAS(txObject.tag, length, {
|
|
101
97
|
relativeTtl: getOracleRelativeTtl(txObject),
|
|
102
98
|
innerTxSize
|
|
103
|
-
})
|
|
99
|
+
});
|
|
104
100
|
}
|
|
105
101
|
|
|
106
102
|
/**
|
|
@@ -113,30 +109,52 @@ function calculateMinFee(rebuildTx, unpackTx, buildTx) {
|
|
|
113
109
|
let previousFee;
|
|
114
110
|
do {
|
|
115
111
|
previousFee = fee;
|
|
116
|
-
fee =
|
|
112
|
+
fee = new BigNumber(MIN_GAS_PRICE).times(buildGas(rebuildTx(fee), unpackTx, buildTx));
|
|
117
113
|
} while (!fee.eq(previousFee));
|
|
118
114
|
return fee;
|
|
119
115
|
}
|
|
116
|
+
|
|
117
|
+
// TODO: Get rid of this workaround. Transaction builder can't accept/return gas price instead of
|
|
118
|
+
// fee because it may get a decimal gas price. So, it should accept the optional `gasPrice` even
|
|
119
|
+
// if it is not a contract-related transaction. And use this `gasPrice` to calculate `fee`.
|
|
120
|
+
const gasPricePrefix = '_gas-price:';
|
|
120
121
|
export default {
|
|
121
122
|
...coinAmount,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
123
|
+
async prepare(value, params, {
|
|
124
|
+
onNode
|
|
125
|
+
}) {
|
|
126
|
+
if (value != null) return value;
|
|
127
|
+
if (onNode == null) {
|
|
128
|
+
throw new ArgumentError('onNode', 'provided (or provide `fee` instead)', onNode);
|
|
129
|
+
}
|
|
130
|
+
const gasPrice = await getCachedIncreasedGasPrice(onNode);
|
|
131
|
+
if (gasPrice === 0n) return undefined;
|
|
132
|
+
return gasPricePrefix + gasPrice;
|
|
133
|
+
},
|
|
134
|
+
serializeAettos(_value, {
|
|
135
|
+
rebuildTx,
|
|
136
|
+
unpackTx,
|
|
137
|
+
buildTx,
|
|
138
|
+
_computingMinFee
|
|
139
|
+
}, {
|
|
140
|
+
_canIncreaseFee
|
|
141
|
+
}) {
|
|
130
142
|
if (_computingMinFee != null) return _computingMinFee.toFixed();
|
|
131
143
|
const minFee = calculateMinFee(fee => rebuildTx({
|
|
132
144
|
_computingMinFee: fee
|
|
133
145
|
}), unpackTx, buildTx);
|
|
134
|
-
const value = new BigNumber(_value !== null && _value !== void 0 ? _value : minFee);
|
|
146
|
+
const value = (_value === null || _value === void 0 ? void 0 : _value.startsWith(gasPricePrefix)) === true ? minFee.dividedBy(MIN_GAS_PRICE).times(_value.replace(gasPricePrefix, '')) : new BigNumber(_value !== null && _value !== void 0 ? _value : minFee);
|
|
135
147
|
if (minFee.gt(value)) {
|
|
136
|
-
if (
|
|
148
|
+
if (_canIncreaseFee === true) return minFee.toFixed();
|
|
137
149
|
throw new IllegalArgumentError(`Fee ${value.toString()} must be bigger than ${minFee}`);
|
|
138
150
|
}
|
|
139
151
|
return value.toFixed();
|
|
152
|
+
},
|
|
153
|
+
serialize(value, params, options) {
|
|
154
|
+
if (typeof value === 'string' && value.startsWith(gasPricePrefix)) {
|
|
155
|
+
return uInt.serialize(this.serializeAettos(value, params, options));
|
|
156
|
+
}
|
|
157
|
+
return coinAmount.serialize.call(this, value, params, options);
|
|
140
158
|
}
|
|
141
159
|
};
|
|
142
160
|
//# sourceMappingURL=fee.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fee.mjs","names":["BigNumber","IllegalArgumentError","MIN_GAS_PRICE","Tag","coinAmount","isKeyOfObject","decode","BASE_GAS","GAS_PER_BYTE","KEY_BLOCK_INTERVAL","TX_FEE_BASE_GAS","txType","_feeFactors","feeFactors","ChannelForceProgressTx","ChannelOffChainTx","ChannelOffChainUpdateCallContract","ChannelOffChainUpdateCreateContract","ChannelOffChainUpdateDeposit","ChannelOffChainUpdateWithdraw","ChannelOffChainUpdateTransfer","ContractCreateTx","ContractCallTx","GaAttachTx","GaMetaTx","PayingForTx","factor","TX_FEE_OTHER_GAS","txSize","_ref","relativeTtl","innerTxSize","OracleRegisterTx","OracleExtendTx","OracleQueryTx","OracleResponseTx","times","plus","Math","ceil","floor","minus","getOracleRelativeTtl","params","ttlKeys","tag","buildFee","builtTx","unpackTx","buildTx","length","txObject","tx","encodedTx","calculateMinFee","rebuildTx","fee","previousFee","eq","serializeAettos","_value","_ref2","_computingMinFee","_pickBiggerFee","toFixed","minFee","value","gt","toString"],"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';\nimport { decode, Encoded } from '../../../utils/encoder';\nimport type { unpackTx as unpackTxType, buildTx as buildTxType } from '../index';\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): 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 const { tag } = params;\n if (!isKeyOfObject(tag, ttlKeys)) return 1;\n return params[ttlKeys[tag]];\n}\n\n/**\n * Calculate fee based on tx type and params\n */\nexport function buildFee(\n builtTx: Encoded.Transaction,\n unpackTx: typeof unpackTxType,\n buildTx: typeof buildTxType,\n): BigNumber {\n const { length } = decode(builtTx);\n const txObject = unpackTx(builtTx);\n\n let innerTxSize = 0;\n if (txObject.tag === Tag.GaMetaTx || txObject.tag === Tag.PayingForTx) {\n innerTxSize = decode(buildTx(txObject.tx.encodedTx)).length;\n }\n\n return TX_FEE_BASE_GAS(txObject.tag)\n .plus(TX_FEE_OTHER_GAS(txObject.tag, length, {\n relativeTtl: getOracleRelativeTtl(txObject), innerTxSize,\n }))\n .times(MIN_GAS_PRICE);\n}\n\n/**\n * Calculate min fee\n * @category transaction builder\n * @param rebuildTx - Callback to get built transaction with specific fee\n */\nfunction calculateMinFee(\n rebuildTx: (value: BigNumber) => Encoded.Transaction,\n unpackTx: typeof unpackTxType,\n buildTx: typeof buildTxType,\n): BigNumber {\n let fee = new BigNumber(0);\n let previousFee;\n do {\n previousFee = fee;\n fee = buildFee(rebuildTx(fee), unpackTx, buildTx);\n } while (!fee.eq(previousFee));\n return fee;\n}\n\nexport default {\n ...coinAmount,\n\n serializeAettos(\n _value: string | undefined,\n {\n rebuildTx, unpackTx, buildTx, _computingMinFee, _pickBiggerFee,\n }: {\n rebuildTx: (params: any) => Encoded.Transaction;\n unpackTx: typeof unpackTxType;\n buildTx: typeof buildTxType;\n _computingMinFee?: BigNumber;\n _pickBiggerFee?: boolean;\n },\n ): string {\n if (_computingMinFee != null) return _computingMinFee.toFixed();\n const minFee = calculateMinFee(\n (fee) => rebuildTx({ _computingMinFee: fee }),\n unpackTx,\n buildTx,\n );\n const value = new BigNumber(_value ?? minFee);\n if (minFee.gt(value)) {\n if (_pickBiggerFee === true) return minFee.toFixed();\n throw new IllegalArgumentError(`Fee ${value.toString()} must be bigger than ${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;AAAA,SACbC,MAAM;AAGf,MAAMC,QAAQ,GAAG,KAAK;AACtB,MAAMC,YAAY,GAAG,EAAE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BAAgB,EAAEN;IAAI,CAAC,CAAC,EAC7CR,QAAQ,EACRC,OACF,CAAC;IACD,MAAMiB,KAAK,GAAG,IAAIlE,SAAS,CAAC4D,MAAM,aAANA,MAAM,cAANA,MAAM,GAAIK,MAAM,CAAC;IAC7C,IAAIA,MAAM,CAACE,EAAE,CAACD,KAAK,CAAC,EAAE;MACpB,IAAIH,cAAc,KAAK,IAAI,EAAE,OAAOE,MAAM,CAACD,OAAO,CAAC,CAAC;MACpD,MAAM,IAAI/D,oBAAoB,CAAE,OAAMiE,KAAK,CAACE,QAAQ,CAAC,CAAE,wBAAuBH,MAAO,EAAC,CAAC;IACzF;IACA,OAAOC,KAAK,CAACF,OAAO,CAAC,CAAC;EACxB;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"fee.mjs","names":["BigNumber","ArgumentError","IllegalArgumentError","MIN_GAS_PRICE","Tag","uInt","coinAmount","getCachedIncreasedGasPrice","isKeyOfObject","decode","BASE_GAS","GAS_PER_BYTE","KEY_BLOCK_INTERVAL","TX_BASE_GAS","txType","_feeFactors","feeFactors","ChannelForceProgressTx","ChannelOffChainTx","ContractCreateTx","ContractCallTx","GaAttachTx","GaMetaTx","PayingForTx","factor","TX_OTHER_GAS","txSize","relativeTtl","innerTxSize","OracleRegisterTx","OracleExtendTx","OracleQueryTx","OracleResponseTx","Math","ceil","floor","getOracleRelativeTtl","params","ttlKeys","tag","buildGas","builtTx","unpackTx","buildTx","length","txObject","tx","encodedTx","calculateMinFee","rebuildTx","fee","previousFee","times","eq","gasPricePrefix","prepare","value","onNode","gasPrice","undefined","serializeAettos","_value","_computingMinFee","_canIncreaseFee","toFixed","minFee","startsWith","dividedBy","replace","gt","toString","serialize","options","call"],"sources":["../../../../src/tx/builder/field-types/fee.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { ArgumentError, IllegalArgumentError } from '../../../utils/errors';\nimport { Int, MIN_GAS_PRICE, Tag } from '../constants';\nimport uInt from './u-int';\nimport coinAmount from './coin-amount';\nimport { getCachedIncreasedGasPrice } from './gas-price';\nimport { isKeyOfObject } from '../../../utils/other';\nimport { decode, Encoded } from '../../../utils/encoder';\nimport type { unpackTx as unpackTxType, buildTx as buildTxType } from '../index';\nimport Node from '../../../Node';\n\nconst BASE_GAS = 15000;\nconst GAS_PER_BYTE = 20;\nconst KEY_BLOCK_INTERVAL = 3;\n\n/**\n * Calculate the base 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 gas\n * @example\n * ```js\n * TX_BASE_GAS(Tag.ChannelForceProgressTx) => 30 * 15000\n * ```\n */\nconst TX_BASE_GAS = (txType: Tag): number => {\n const feeFactors = {\n [Tag.ChannelForceProgressTx]: 30,\n [Tag.ChannelOffChainTx]: 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 factor * BASE_GAS;\n};\n\n/**\n * Calculate gas 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 gas\n * @example\n * ```js\n * TX_OTHER_GAS(Tag.OracleResponseTx, 10, { relativeTtl: 12, innerTxSize: 0 })\n * => 10 * 20 + Math.ceil(32000 * 12 / Math.floor(60 * 24 * 365 / 3))\n * ```\n */\nconst TX_OTHER_GAS = (\n txType: Tag,\n txSize: number,\n { relativeTtl, innerTxSize }: { relativeTtl: number; innerTxSize: number },\n): number => {\n switch (txType) {\n case Tag.OracleRegisterTx:\n case Tag.OracleExtendTx:\n case Tag.OracleQueryTx:\n case Tag.OracleResponseTx:\n return txSize * GAS_PER_BYTE\n + Math.ceil((32000 * relativeTtl) / Math.floor((60 * 24 * 365) / KEY_BLOCK_INTERVAL));\n case Tag.GaMetaTx:\n case Tag.PayingForTx:\n return (txSize - innerTxSize) * GAS_PER_BYTE;\n default:\n return txSize * GAS_PER_BYTE;\n }\n};\n\nfunction getOracleRelativeTtl(params: any): 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 const { tag } = params;\n if (!isKeyOfObject(tag, ttlKeys)) return 1;\n return params[ttlKeys[tag]];\n}\n\n/**\n * Calculate gas based on tx type and params\n */\nexport function buildGas(\n builtTx: Encoded.Transaction,\n unpackTx: typeof unpackTxType,\n buildTx: typeof buildTxType,\n): number {\n const { length } = decode(builtTx);\n const txObject = unpackTx(builtTx);\n\n let innerTxSize = 0;\n if (txObject.tag === Tag.GaMetaTx || txObject.tag === Tag.PayingForTx) {\n innerTxSize = decode(buildTx(txObject.tx.encodedTx)).length;\n }\n\n return TX_BASE_GAS(txObject.tag)\n + TX_OTHER_GAS(txObject.tag, length, {\n relativeTtl: getOracleRelativeTtl(txObject), innerTxSize,\n });\n}\n\n/**\n * Calculate min fee\n * @category transaction builder\n * @param rebuildTx - Callback to get built transaction with specific fee\n */\nfunction calculateMinFee(\n rebuildTx: (value: BigNumber) => Encoded.Transaction,\n unpackTx: typeof unpackTxType,\n buildTx: typeof buildTxType,\n): BigNumber {\n let fee = new BigNumber(0);\n let previousFee;\n do {\n previousFee = fee;\n fee = new BigNumber(MIN_GAS_PRICE).times(buildGas(rebuildTx(fee), unpackTx, buildTx));\n } while (!fee.eq(previousFee));\n return fee;\n}\n\n// TODO: Get rid of this workaround. Transaction builder can't accept/return gas price instead of\n// fee because it may get a decimal gas price. So, it should accept the optional `gasPrice` even\n// if it is not a contract-related transaction. And use this `gasPrice` to calculate `fee`.\nconst gasPricePrefix = '_gas-price:';\n\nexport interface SerializeAettosParams {\n rebuildTx: (params: any) => Encoded.Transaction;\n unpackTx: typeof unpackTxType;\n buildTx: typeof buildTxType;\n _computingMinFee?: BigNumber;\n}\n\nexport default {\n ...coinAmount,\n\n async prepare(\n value: Int | undefined,\n params: {},\n { onNode }: { onNode?: Node },\n ): Promise<Int | undefined> {\n if (value != null) return value;\n if (onNode == null) {\n throw new ArgumentError('onNode', 'provided (or provide `fee` instead)', onNode);\n }\n const gasPrice = await getCachedIncreasedGasPrice(onNode);\n if (gasPrice === 0n) return undefined;\n return gasPricePrefix + gasPrice;\n },\n\n serializeAettos(\n _value: string | undefined,\n {\n rebuildTx, unpackTx, buildTx, _computingMinFee,\n }: SerializeAettosParams,\n { _canIncreaseFee }: { _canIncreaseFee?: boolean },\n ): string {\n if (_computingMinFee != null) return _computingMinFee.toFixed();\n const minFee = calculateMinFee(\n (fee) => rebuildTx({ _computingMinFee: fee }),\n unpackTx,\n buildTx,\n );\n const value = _value?.startsWith(gasPricePrefix) === true\n ? minFee.dividedBy(MIN_GAS_PRICE).times(_value.replace(gasPricePrefix, ''))\n : new BigNumber(_value ?? minFee);\n if (minFee.gt(value)) {\n if (_canIncreaseFee === true) return minFee.toFixed();\n throw new IllegalArgumentError(`Fee ${value.toString()} must be bigger than ${minFee}`);\n }\n return value.toFixed();\n },\n\n serialize(\n value: Parameters<typeof coinAmount.serialize>[0],\n params: Parameters<typeof coinAmount.serialize>[1] & SerializeAettosParams,\n options: { _canIncreaseFee?: boolean } & Parameters<typeof coinAmount.serialize>[2],\n ): Buffer {\n if (typeof value === 'string' && value.startsWith(gasPricePrefix)) {\n return uInt.serialize(this.serializeAettos(value, params, options));\n }\n return coinAmount.serialize.call(this, value, params, options);\n },\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,cAAc;AAAC,SAC5BC,aAAa,EAAEC,oBAAoB;AAAA,SAC9BC,aAAa,EAAEC,GAAG;AAAA,OACzBC,IAAI;AAAA,OACJC,UA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-
import {
|
|
2
|
+
import { Tag, MAX_AUTH_FUN_GAS } from "../constants.mjs";
|
|
3
3
|
import shortUInt from "./short-u-int.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { buildGas } from "./fee.mjs";
|
|
5
5
|
function calculateGasLimitMax(gasMax, rebuildTx, unpackTx, buildTx) {
|
|
6
|
-
return gasMax - +
|
|
6
|
+
return gasMax - +buildGas(rebuildTx(gasMax), unpackTx, buildTx);
|
|
7
7
|
}
|
|
8
8
|
export default {
|
|
9
9
|
...shortUInt,
|
|
10
|
-
serialize(_value,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
gasMax = 6e6
|
|
20
|
-
} = _ref2;
|
|
10
|
+
serialize(_value, {
|
|
11
|
+
tag,
|
|
12
|
+
rebuildTx,
|
|
13
|
+
unpackTx,
|
|
14
|
+
buildTx,
|
|
15
|
+
_computingGasLimit
|
|
16
|
+
}, {
|
|
17
|
+
gasMax = 6e6
|
|
18
|
+
}) {
|
|
21
19
|
if (_computingGasLimit != null) return shortUInt.serialize(_computingGasLimit);
|
|
22
20
|
const gasLimitMax = tag === Tag.GaMetaTx ? MAX_AUTH_FUN_GAS : calculateGasLimitMax(gasMax, gasLimit => rebuildTx({
|
|
23
21
|
_computingGasLimit: gasLimit,
|
|
24
|
-
|
|
22
|
+
_canIncreaseFee: true
|
|
25
23
|
}), unpackTx, buildTx);
|
|
26
24
|
const value = _value !== null && _value !== void 0 ? _value : gasLimitMax;
|
|
27
25
|
if (value > gasLimitMax) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gas-limit.mjs","names":["IllegalArgumentError","
|
|
1
|
+
{"version":3,"file":"gas-limit.mjs","names":["IllegalArgumentError","Tag","MAX_AUTH_FUN_GAS","shortUInt","buildGas","calculateGasLimitMax","gasMax","rebuildTx","unpackTx","buildTx","serialize","_value","tag","_computingGasLimit","gasLimitMax","GaMetaTx","gasLimit","_canIncreaseFee","value"],"sources":["../../../../src/tx/builder/field-types/gas-limit.ts"],"sourcesContent":["import { IllegalArgumentError } from '../../../utils/errors';\nimport { Tag, MAX_AUTH_FUN_GAS } from '../constants';\nimport shortUInt from './short-u-int';\nimport { buildGas } from './fee';\nimport type { unpackTx as unpackTxType, buildTx as buildTxType } from '../index';\n\nfunction calculateGasLimitMax(\n gasMax: number,\n rebuildTx: (value: number) => any,\n unpackTx: typeof unpackTxType,\n buildTx: typeof buildTxType,\n): number {\n return gasMax - +buildGas(rebuildTx(gasMax), unpackTx, buildTx);\n}\n\nexport default {\n ...shortUInt,\n\n serialize(\n _value: number | undefined,\n {\n tag, rebuildTx, unpackTx, buildTx, _computingGasLimit,\n }: {\n tag: Tag;\n rebuildTx: (params: any) => any;\n unpackTx: typeof unpackTxType;\n buildTx: typeof buildTxType;\n _computingGasLimit?: number;\n },\n { gasMax = 6e6 }: { gasMax?: number },\n ): Buffer {\n if (_computingGasLimit != null) return shortUInt.serialize(_computingGasLimit);\n\n const gasLimitMax = tag === Tag.GaMetaTx ? MAX_AUTH_FUN_GAS : calculateGasLimitMax(\n gasMax,\n (gasLimit) => rebuildTx({ _computingGasLimit: gasLimit, _canIncreaseFee: true }),\n unpackTx,\n buildTx,\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,GAAG,EAAEC,gBAAgB;AAAA,OACvBC,SAAS;AAAA,SACPC,QAAQ;AAGjB,SAASC,oBAAoBA,CAC3BC,MAAc,EACdC,SAAiC,EACjCC,QAA6B,EAC7BC,OAA2B,EACnB;EACR,OAAOH,MAAM,GAAG,CAACF,QAAQ,CAACG,SAAS,CAACD,MAAM,CAAC,EAAEE,QAAQ,EAAEC,OAAO,CAAC;AACjE;AAEA,eAAe;EACb,GAAGN,SAAS;EAEZO,SAASA,CACPC,MAA0B,EAC1B;IACEC,GAAG;IAAEL,SAAS;IAAEC,QAAQ;IAAEC,OAAO;IAAEI;EAOrC,CAAC,EACD;IAAEP,MAAM,GAAG;EAAyB,CAAC,EAC7B;IACR,IAAIO,kBAAkB,IAAI,IAAI,EAAE,OAAOV,SAAS,CAACO,SAAS,CAACG,kBAAkB,CAAC;IAE9E,MAAMC,WAAW,GAAGF,GAAG,KAAKX,GAAG,CAACc,QAAQ,GAAGb,gBAAgB,GAAGG,oBAAoB,CAChFC,MAAM,EACLU,QAAQ,IAAKT,SAAS,CAAC;MAAEM,kBAAkB,EAAEG,QAAQ;MAAEC,eAAe,EAAE;IAAK,CAAC,CAAC,EAChFT,QAAQ,EACRC,OACF,CAAC;IACD,MAAMS,KAAK,GAAGP,MAAM,aAANA,MAAM,cAANA,MAAM,GAAIG,WAAW;IACnC,IAAII,KAAK,GAAGJ,WAAW,EAAE;MACvB,MAAM,IAAId,oBAAoB,CAAE,aAAYkB,KAAM,6BAA4BJ,WAAY,EAAC,CAAC;IAC9F;IACA,OAAOX,SAAS,CAACO,SAAS,CAACQ,KAAK,CAAC;EACnC;AACF,CAAC"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import { Int } from '../constants';
|
|
3
|
+
import Node from '../../../Node';
|
|
4
|
+
import { AE_AMOUNT_FORMATS } from '../../../utils/amount-formatter';
|
|
5
|
+
export declare function getCachedIncreasedGasPrice(node: Node): Promise<bigint>;
|
|
2
6
|
declare const _default: {
|
|
7
|
+
prepare(value: Int | undefined, params: {}, { onNode, denomination }: {
|
|
8
|
+
onNode?: Node | undefined;
|
|
9
|
+
denomination?: AE_AMOUNT_FORMATS | undefined;
|
|
10
|
+
}): Promise<Int | undefined>;
|
|
3
11
|
serializeAettos(value?: string | undefined): string;
|
|
4
|
-
serialize(value:
|
|
5
|
-
denomination?:
|
|
12
|
+
serialize(value: Int | undefined, params: {}, { denomination, ...options }: {
|
|
13
|
+
denomination?: AE_AMOUNT_FORMATS | undefined;
|
|
6
14
|
}): Buffer;
|
|
7
15
|
deserialize(value: Buffer): string;
|
|
8
16
|
};
|
|
@@ -1,10 +1,59 @@
|
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
1
2
|
import coinAmount from "./coin-amount.mjs";
|
|
2
|
-
import { IllegalArgumentError } from "../../../utils/errors.mjs";
|
|
3
|
+
import { ArgumentError, IllegalArgumentError } from "../../../utils/errors.mjs";
|
|
3
4
|
import { MIN_GAS_PRICE } from "../constants.mjs";
|
|
5
|
+
import { formatAmount } from "../../../utils/amount-formatter.mjs";
|
|
6
|
+
import semverSatisfies from "../../../utils/semver-satisfies.mjs";
|
|
7
|
+
const gasPriceCache = new WeakMap();
|
|
8
|
+
export async function getCachedIncreasedGasPrice(node) {
|
|
9
|
+
const cache = gasPriceCache.get(node);
|
|
10
|
+
if (cache != null && cache.time > Date.now() - 20 * 1000) {
|
|
11
|
+
return cache.gasPrice;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// TODO: remove after requiring node@6.13.0
|
|
15
|
+
const {
|
|
16
|
+
nodeVersion
|
|
17
|
+
} = await node._getCachedStatus();
|
|
18
|
+
// TODO: remove remove '6.12.0+' check after releasing 6.13.0
|
|
19
|
+
if (!nodeVersion.startsWith('6.12.0+') && !semverSatisfies(nodeVersion, '6.13.0', '7.0.0')) {
|
|
20
|
+
return 0n;
|
|
21
|
+
}
|
|
22
|
+
const {
|
|
23
|
+
minGasPrice,
|
|
24
|
+
utilization
|
|
25
|
+
} = (await node.getRecentGasPrices())[0];
|
|
26
|
+
let gasPrice = utilization < 70 ? 0n : BigInt(new BigNumber(minGasPrice.toString()).times(1.01).integerValue().toFixed());
|
|
27
|
+
const maxSafeGasPrice = BigInt(MIN_GAS_PRICE) * 100000n; // max microblock fee is 600ae or 35usd
|
|
28
|
+
if (gasPrice > maxSafeGasPrice) {
|
|
29
|
+
console.warn([`Estimated gas price ${gasPrice} exceeds the maximum safe value for unknown reason.`, `It will be limited to ${maxSafeGasPrice}.`, 'To overcome this restriction provide `gasPrice`/`fee` in options.'].join(' '));
|
|
30
|
+
gasPrice = maxSafeGasPrice;
|
|
31
|
+
}
|
|
32
|
+
gasPriceCache.set(node, {
|
|
33
|
+
gasPrice,
|
|
34
|
+
time: Date.now()
|
|
35
|
+
});
|
|
36
|
+
return gasPrice;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// TODO: use withFormatting after using a single type for coins representation
|
|
4
40
|
export default {
|
|
5
41
|
...coinAmount,
|
|
6
|
-
|
|
7
|
-
|
|
42
|
+
async prepare(value, params, {
|
|
43
|
+
onNode,
|
|
44
|
+
denomination
|
|
45
|
+
}) {
|
|
46
|
+
if (value != null) return value;
|
|
47
|
+
if (onNode == null) {
|
|
48
|
+
throw new ArgumentError('onNode', 'provided (or provide `gasPrice` instead)', onNode);
|
|
49
|
+
}
|
|
50
|
+
const gasPrice = await getCachedIncreasedGasPrice(onNode);
|
|
51
|
+
if (gasPrice === 0n) return undefined;
|
|
52
|
+
return formatAmount(gasPrice, {
|
|
53
|
+
targetDenomination: denomination
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
serializeAettos(value = MIN_GAS_PRICE.toString()) {
|
|
8
57
|
if (+value < MIN_GAS_PRICE) {
|
|
9
58
|
throw new IllegalArgumentError(`Gas price ${value.toString()} must be bigger than ${MIN_GAS_PRICE}`);
|
|
10
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gas-price.mjs","names":["coinAmount","IllegalArgumentError","MIN_GAS_PRICE","
|
|
1
|
+
{"version":3,"file":"gas-price.mjs","names":["BigNumber","coinAmount","ArgumentError","IllegalArgumentError","MIN_GAS_PRICE","formatAmount","semverSatisfies","gasPriceCache","WeakMap","getCachedIncreasedGasPrice","node","cache","get","time","Date","now","gasPrice","nodeVersion","_getCachedStatus","startsWith","minGasPrice","utilization","getRecentGasPrices","BigInt","toString","times","integerValue","toFixed","maxSafeGasPrice","console","warn","join","set","prepare","value","params","onNode","denomination","undefined","targetDenomination","serializeAettos"],"sources":["../../../../src/tx/builder/field-types/gas-price.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport coinAmount from './coin-amount';\nimport { ArgumentError, IllegalArgumentError } from '../../../utils/errors';\nimport { Int, MIN_GAS_PRICE } from '../constants';\nimport Node from '../../../Node';\nimport { AE_AMOUNT_FORMATS, formatAmount } from '../../../utils/amount-formatter';\nimport semverSatisfies from '../../../utils/semver-satisfies';\n\nconst gasPriceCache: WeakMap<Node, { time: number; gasPrice: bigint }> = new WeakMap();\n\nexport async function getCachedIncreasedGasPrice(node: Node): Promise<bigint> {\n const cache = gasPriceCache.get(node);\n if (cache != null && cache.time > Date.now() - 20 * 1000) {\n return cache.gasPrice;\n }\n\n // TODO: remove after requiring node@6.13.0\n const { nodeVersion } = await node._getCachedStatus();\n // TODO: remove remove '6.12.0+' check after releasing 6.13.0\n if (!nodeVersion.startsWith('6.12.0+') && !semverSatisfies(nodeVersion, '6.13.0', '7.0.0')) {\n return 0n;\n }\n\n const { minGasPrice, utilization } = (await node.getRecentGasPrices())[0];\n let gasPrice = utilization < 70 ? 0n : BigInt(\n new BigNumber(minGasPrice.toString()).times(1.01).integerValue().toFixed(),\n );\n\n const maxSafeGasPrice = BigInt(MIN_GAS_PRICE) * 100000n; // max microblock fee is 600ae or 35usd\n if (gasPrice > maxSafeGasPrice) {\n console.warn([\n `Estimated gas price ${gasPrice} exceeds the maximum safe value for unknown reason.`,\n `It will be limited to ${maxSafeGasPrice}.`,\n 'To overcome this restriction provide `gasPrice`/`fee` in options.',\n ].join(' '));\n gasPrice = maxSafeGasPrice;\n }\n\n gasPriceCache.set(node, { gasPrice, time: Date.now() });\n return gasPrice;\n}\n\n// TODO: use withFormatting after using a single type for coins representation\nexport default {\n ...coinAmount,\n\n async prepare(\n value: Int | undefined,\n params: {},\n { onNode, denomination }: {\n onNode?: Node;\n denomination?: AE_AMOUNT_FORMATS;\n },\n ): Promise<Int | undefined> {\n if (value != null) return value;\n if (onNode == null) {\n throw new ArgumentError('onNode', 'provided (or provide `gasPrice` instead)', onNode);\n }\n const gasPrice = await getCachedIncreasedGasPrice(onNode);\n if (gasPrice === 0n) return undefined;\n return formatAmount(gasPrice, { targetDenomination: denomination });\n },\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 than ${MIN_GAS_PRICE}`);\n }\n return value;\n },\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,cAAc;AAAC,OAC9BC,UAAU;AAAA,SACRC,aAAa,EAAEC,oBAAoB;AAAA,SAC9BC,aAAa;AAAA,SAECC,YAAY;AAAA,OACjCC,eAAe;AAEtB,MAAMC,aAAgE,GAAG,IAAIC,OAAO,CAAC,CAAC;AAEtF,OAAO,eAAeC,0BAA0BA,CAACC,IAAU,EAAmB;EAC5E,MAAMC,KAAK,GAAGJ,aAAa,CAACK,GAAG,CAACF,IAAI,CAAC;EACrC,IAAIC,KAAK,IAAI,IAAI,IAAIA,KAAK,CAACE,IAAI,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE;IACxD,OAAOJ,KAAK,CAACK,QAAQ;EACvB;;EAEA;EACA,MAAM;IAAEC;EAAY,CAAC,GAAG,MAAMP,IAAI,CAACQ,gBAAgB,CAAC,CAAC;EACrD;EACA,IAAI,CAACD,WAAW,CAACE,UAAU,CAAC,SAAS,CAAC,IAAI,CAACb,eAAe,CAACW,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE;IAC1F,OAAO,EAAE;EACX;EAEA,MAAM;IAAEG,WAAW;IAAEC;EAAY,CAAC,GAAG,CAAC,MAAMX,IAAI,CAACY,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC;EACzE,IAAIN,QAAQ,GAA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E,IAAI,CAACU,KAAK,GAAG9B,aAAa,EAAE;MAC1B,MAAM,IAAID,oBAAoB,CAAE,aAAY+B,KAAK,CAACV,QAAQ,CAAC,CAAE,wBAAuBpB,aAAc,EAAC,CAAC;IACtG;IACA,OAAO8B,KAAK;EACd;AACF,CAAC"}
|
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
2
|
+
export { default as abiVersion } from './abi-version';
|
|
3
|
+
export { default as address } from './address';
|
|
4
|
+
export { default as array } from './array';
|
|
5
|
+
export { default as boolean } from './boolean';
|
|
6
|
+
export { default as coinAmount } from './coin-amount';
|
|
7
|
+
export { default as ctVersion } from './ct-version';
|
|
8
|
+
export { default as encoded } from './encoded';
|
|
9
|
+
export { default as entry } from './entry';
|
|
10
|
+
export { default as enumeration } from './enumeration';
|
|
11
|
+
export { default as fee } from './fee';
|
|
12
|
+
export { default as field } from './field';
|
|
13
|
+
export { default as gasLimit } from './gas-limit';
|
|
14
|
+
export { default as gasPrice } from './gas-price';
|
|
15
|
+
export { default as map } from './map';
|
|
16
|
+
export { default as mptree } from './mptree';
|
|
17
|
+
export { default as name } from './name';
|
|
18
|
+
export { default as nameFee } from './name-fee';
|
|
19
|
+
export { default as nameId } from './name-id';
|
|
20
|
+
export { default as nonce } from './nonce';
|
|
21
|
+
export { default as pointers } from './pointers';
|
|
22
|
+
export { default as pointers2 } from './pointers2';
|
|
23
|
+
export { default as queryFee } from './query-fee';
|
|
24
|
+
export { default as raw } from './raw';
|
|
25
|
+
export { default as shortUInt } from './short-u-int';
|
|
26
|
+
export { default as shortUIntConst } from './short-u-int-const';
|
|
27
|
+
export { default as string } from './string';
|
|
28
|
+
export { default as ttl } from './ttl';
|
|
29
|
+
export { default as uInt } from './u-int';
|
|
30
|
+
export { default as withDefault } from './with-default';
|
|
31
|
+
export { default as withFormatting } from './with-formatting';
|
|
32
|
+
export { default as wrapped } from './wrapped';
|
|
30
33
|
export type BinaryData = Buffer | Buffer[] | Buffer[][] | Array<[Buffer, Array<[Buffer, Buffer[]]>]>;
|
|
31
34
|
export interface Field {
|
|
32
35
|
serialize: (value: any, options: any, parameters: any) => BinaryData;
|
|
@@ -34,4 +37,3 @@ export interface Field {
|
|
|
34
37
|
deserialize: (value: BinaryData, options: any) => any;
|
|
35
38
|
recursiveType?: boolean;
|
|
36
39
|
}
|
|
37
|
-
export { abiVersion, address, array, boolean, coinAmount, ctVersion, deposit, encoded, entry, enumeration, fee, field, gasLimit, gasPrice, map, mptree, name, nameFee, nameId, nonce, pointers, raw, shortUInt, shortUIntConst, string, ttl, uInt, wrapped, };
|
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export {
|
|
1
|
+
export { default as abiVersion } from "./abi-version.mjs";
|
|
2
|
+
export { default as address } from "./address.mjs";
|
|
3
|
+
export { default as array } from "./array.mjs";
|
|
4
|
+
export { default as boolean } from "./boolean.mjs";
|
|
5
|
+
export { default as coinAmount } from "./coin-amount.mjs";
|
|
6
|
+
export { default as ctVersion } from "./ct-version.mjs";
|
|
7
|
+
export { default as encoded } from "./encoded.mjs";
|
|
8
|
+
export { default as entry } from "./entry.mjs";
|
|
9
|
+
export { default as enumeration } from "./enumeration.mjs";
|
|
10
|
+
export { default as fee } from "./fee.mjs";
|
|
11
|
+
export { default as field } from "./field.mjs";
|
|
12
|
+
export { default as gasLimit } from "./gas-limit.mjs";
|
|
13
|
+
export { default as gasPrice } from "./gas-price.mjs";
|
|
14
|
+
export { default as map } from "./map.mjs";
|
|
15
|
+
export { default as mptree } from "./mptree.mjs";
|
|
16
|
+
export { default as name } from "./name.mjs";
|
|
17
|
+
export { default as nameFee } from "./name-fee.mjs";
|
|
18
|
+
export { default as nameId } from "./name-id.mjs";
|
|
19
|
+
export { default as nonce } from "./nonce.mjs";
|
|
20
|
+
export { default as pointers } from "./pointers.mjs";
|
|
21
|
+
export { default as pointers2 } from "./pointers2.mjs";
|
|
22
|
+
export { default as queryFee } from "./query-fee.mjs";
|
|
23
|
+
export { default as raw } from "./raw.mjs";
|
|
24
|
+
export { default as shortUInt } from "./short-u-int.mjs";
|
|
25
|
+
export { default as shortUIntConst } from "./short-u-int-const.mjs";
|
|
26
|
+
export { default as string } from "./string.mjs";
|
|
27
|
+
export { default as ttl } from "./ttl.mjs";
|
|
28
|
+
export { default as uInt } from "./u-int.mjs";
|
|
29
|
+
export { default as withDefault } from "./with-default.mjs";
|
|
30
|
+
export { default as withFormatting } from "./with-formatting.mjs";
|
|
31
|
+
export { default as wrapped } from "./wrapped.mjs";
|
|
30
32
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["abiVersion","address","array","boolean","coinAmount","ctVersion","
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["default","abiVersion","address","array","boolean","coinAmount","ctVersion","encoded","entry","enumeration","fee","field","gasLimit","gasPrice","map","mptree","name","nameFee","nameId","nonce","pointers","pointers2","queryFee","raw","shortUInt","shortUIntConst","string","ttl","uInt","withDefault","withFormatting","wrapped"],"sources":["../../../../src/tx/builder/field-types/index.ts"],"sourcesContent":["export { default as abiVersion } from './abi-version';\nexport { default as address } from './address';\nexport { default as array } from './array';\nexport { default as boolean } from './boolean';\nexport { default as coinAmount } from './coin-amount';\nexport { default as ctVersion } from './ct-version';\nexport { default as encoded } from './encoded';\nexport { default as entry } from './entry';\nexport { default as enumeration } from './enumeration';\nexport { default as fee } from './fee';\nexport { default as field } from './field';\nexport { default as gasLimit } from './gas-limit';\nexport { default as gasPrice } from './gas-price';\nexport { default as map } from './map';\nexport { default as mptree } from './mptree';\nexport { default as name } from './name';\nexport { default as nameFee } from './name-fee';\nexport { default as nameId } from './name-id';\nexport { default as nonce } from './nonce';\nexport { default as pointers } from './pointers';\nexport { default as pointers2 } from './pointers2';\nexport { default as queryFee } from './query-fee';\nexport { default as raw } from './raw';\nexport { default as shortUInt } from './short-u-int';\nexport { default as shortUIntConst } from './short-u-int-const';\nexport { default as string } from './string';\nexport { default as ttl } from './ttl';\nexport { default as uInt } from './u-int';\nexport { default as withDefault } from './with-default';\nexport { default as withFormatting } from './with-formatting';\nexport { default as wrapped } from './wrapped';\n\nexport type BinaryData = Buffer | Buffer[] | Buffer[][]\n| Array<[Buffer, Array<[Buffer, Buffer[]]>]>;\nexport interface Field {\n serialize: (value: any, options: any, parameters: any) => BinaryData;\n prepare?: (value: any, options: any, parameters: any) => Promise<any>;\n deserialize: (value: BinaryData, options: any) => any;\n recursiveType?: boolean;\n}\n"],"mappings":"SAASA,OAAO,IAAIC,UAAU;AAAA,SACrBD,OAAO,IAAIE,OAAO;AAAA,SAClBF,OAAO,IAAIG,KAAK;AAAA,SAChBH,OAAO,IAAII,OAAO;AAAA,SAClBJ,OAAO,IAAIK,UAAU;AAAA,SACrBL,OAAO,IAAIM,SAAS;AAAA,SACpBN,OAAO,IAAIO,OAAO;AAAA,SAClBP,OAAO,IAAIQ,KAAK;AAAA,SAChBR,OAAO,IAAIS,WAAW;AAAA,SACtBT,OAAO,IAAIU,GAAG;AAAA,SACdV,OAAO,IAAIW,KAAK;AAAA,SAChBX,OAAO,IAAIY,QAAQ;AAAA,SACnBZ,OAAO,IAAIa,QAAQ;AAAA,SACnBb,OAAO,IAAIc,GAAG;AAAA,SACdd,OAAO,IAAIe,MAAM;AAAA,SACjBf,OAAO,IAAIgB,IAAI;AAAA,SACfhB,OAAO,IAAIiB,OAAO;AAAA,SAClBjB,OAAO,IAAIkB,MAAM;AAAA,SACjBlB,OAAO,IAAImB,KAAK;AAAA,SAChBnB,OAAO,IAAIoB,QAAQ;AAAA,SACnBpB,OAAO,IAAIqB,SAAS;AAAA,SACpBrB,OAAO,IAAIsB,QAAQ;AAAA,SACnBtB,OAAO,IAAIuB,GAAG;AAAA,SACdvB,OAAO,IAAIwB,SAAS;AAAA,SACpBxB,OAAO,IAAIyB,cAAc;AAAA,SACzBzB,OAAO,IAAI0B,MAAM;AAAA,SACjB1B,OAAO,IAAI2B,GAAG;AAAA,SACd3B,OAAO,IAAI4B,IAAI;AAAA,SACf5B,OAAO,IAAI6B,WAAW;AAAA,SACtB7B,OAAO,IAAI8B,cAAc;AAAA,SACzB9B,OAAO,IAAI+B,OAAO"}
|