@aeternity/aepp-sdk 13.0.0-alpha.1 → 13.0.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/README.md +1 -1
- package/bin/aesophia_cli +0 -0
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +1 -1
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +1833 -1543
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdk.mjs.map +1 -1
- package/es/AeSdkAepp.d.ts +5 -4
- package/es/AeSdkAepp.mjs +13 -17
- package/es/AeSdkAepp.mjs.map +1 -1
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkMethods.d.ts +11 -12
- package/es/AeSdkMethods.mjs +6 -8
- package/es/AeSdkMethods.mjs.map +1 -1
- package/es/AeSdkWallet.mjs +1 -1
- package/es/AeSdkWallet.mjs.map +1 -1
- package/es/Node.d.ts +5 -1
- package/es/Node.mjs +11 -5
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +11 -6
- package/es/account/Base.mjs +0 -17
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Generalized.mjs +12 -25
- package/es/account/Generalized.mjs.map +1 -1
- package/es/account/Ledger.mjs.map +1 -1
- package/es/account/LedgerFactory.mjs.map +1 -1
- package/es/account/Memory.d.ts +2 -1
- package/es/account/Memory.mjs +9 -21
- package/es/account/Memory.mjs.map +1 -1
- package/es/account/Rpc.mjs.map +1 -1
- package/es/aens.d.ts +12 -14
- package/es/aens.mjs +17 -31
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/Browser.mjs +0 -16
- package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +0 -16
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +0 -16
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection-proxy.mjs +0 -17
- package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +4 -5
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/types.d.ts +6 -2
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
- package/es/aepp-wallet-communication/schema.mjs.map +1 -1
- package/es/aepp-wallet-communication/wallet-detector.mjs +0 -16
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
- package/es/apis/compiler/compiler.d.ts +1 -1
- package/es/apis/compiler/compiler.mjs +4 -20
- package/es/apis/compiler/compiler.mjs.map +1 -1
- package/es/apis/compiler/models/index.d.ts +3 -2
- package/es/apis/compiler/models/index.mjs.map +1 -1
- package/es/apis/compiler/models/mappers.d.ts +1 -1
- package/es/apis/compiler/models/mappers.mjs +19 -2
- package/es/apis/compiler/models/mappers.mjs.map +1 -1
- package/es/apis/node/models/index.d.ts +15 -15
- package/es/apis/node/models/index.mjs.map +1 -1
- package/es/apis/node/models/mappers.d.ts +1 -1
- package/es/apis/node/models/mappers.mjs +2 -1
- 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.mjs +3 -19
- package/es/apis/node/node.mjs.map +1 -1
- package/es/chain.d.ts +8 -8
- package/es/chain.mjs +20 -23
- package/es/chain.mjs.map +1 -1
- package/es/channel/Base.d.ts +25 -12
- package/es/channel/Base.mjs +23 -26
- package/es/channel/Base.mjs.map +1 -1
- package/es/channel/Contract.mjs +8 -21
- package/es/channel/Contract.mjs.map +1 -1
- package/es/channel/Spend.d.ts +4 -2
- package/es/channel/Spend.mjs +0 -16
- package/es/channel/Spend.mjs.map +1 -1
- package/es/channel/handlers.mjs +6 -18
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/internal.d.ts +19 -2
- package/es/channel/internal.mjs +19 -19
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Contract.d.ts +30 -85
- package/es/contract/Contract.mjs +197 -215
- package/es/contract/Contract.mjs.map +1 -1
- package/es/contract/compiler/Base.d.ts +10 -14
- package/es/contract/compiler/Base.mjs.map +1 -1
- package/es/contract/compiler/Cli.mjs +5 -11
- package/es/contract/compiler/Cli.mjs.map +1 -1
- package/es/contract/compiler/Http.mjs +6 -30
- package/es/contract/compiler/Http.mjs.map +1 -1
- package/es/contract/compiler/HttpNode.mjs.map +1 -1
- package/es/contract/compiler/getFileSystem.mjs.map +1 -1
- package/es/contract/delegation-signature.d.ts +43 -0
- package/es/contract/delegation-signature.mjs +45 -0
- package/es/contract/delegation-signature.mjs.map +1 -0
- package/es/contract/ga.d.ts +23 -7
- package/es/contract/ga.mjs +52 -27
- package/es/contract/ga.mjs.map +1 -1
- package/es/index-browser.d.ts +5 -4
- package/es/index-browser.mjs +7 -21
- package/es/index-browser.mjs.map +1 -1
- package/es/oracle.d.ts +12 -17
- package/es/oracle.mjs +28 -48
- package/es/oracle.mjs.map +1 -1
- package/es/spend.d.ts +19 -27
- package/es/spend.mjs +20 -43
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/SchemaTypes.d.ts +37 -0
- package/es/tx/builder/SchemaTypes.mjs +2 -0
- package/es/tx/builder/SchemaTypes.mjs.map +1 -0
- package/es/tx/builder/constants.d.ts +4 -2
- package/es/tx/builder/constants.mjs +2 -0
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/field-types/abi-version.d.ts +11 -2
- package/es/tx/builder/field-types/abi-version.mjs +24 -4
- package/es/tx/builder/field-types/abi-version.mjs.map +1 -1
- package/es/tx/builder/field-types/address.mjs.map +1 -1
- package/es/tx/builder/field-types/array.d.ts +1 -1
- package/es/tx/builder/field-types/array.mjs.map +1 -1
- package/es/tx/builder/field-types/boolean.mjs.map +1 -1
- package/es/tx/builder/field-types/coin-amount.d.ts +3 -4
- package/es/tx/builder/field-types/coin-amount.mjs +4 -5
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
- package/es/tx/builder/field-types/ct-version.d.ts +22 -3
- package/es/tx/builder/field-types/ct-version.mjs +32 -4
- package/es/tx/builder/field-types/ct-version.mjs.map +1 -1
- package/es/tx/builder/field-types/deposit.d.ts +2 -1
- package/es/tx/builder/field-types/deposit.mjs +3 -2
- package/es/tx/builder/field-types/deposit.mjs.map +1 -1
- package/es/tx/builder/field-types/encoded.d.ts +1 -1
- package/es/tx/builder/field-types/encoded.mjs.map +1 -1
- package/es/tx/builder/field-types/entry.mjs +3 -0
- package/es/tx/builder/field-types/entry.mjs.map +1 -1
- package/es/tx/builder/field-types/enumeration.mjs.map +1 -1
- package/es/tx/builder/field-types/fee.d.ts +3 -1
- package/es/tx/builder/field-types/fee.mjs +5 -1
- package/es/tx/builder/field-types/fee.mjs.map +1 -1
- package/es/tx/builder/field-types/field.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-limit.d.ts +3 -2
- package/es/tx/builder/field-types/gas-limit.mjs +4 -2
- package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-price.d.ts +3 -1
- package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
- package/es/tx/builder/field-types/index.d.ts +52 -13
- package/es/tx/builder/field-types/index.mjs +10 -2
- package/es/tx/builder/field-types/index.mjs.map +1 -1
- package/es/tx/builder/field-types/map.d.ts +13 -0
- package/es/tx/builder/field-types/map.mjs +49 -0
- package/es/tx/builder/field-types/map.mjs.map +1 -0
- package/es/tx/builder/field-types/mptree.d.ts +7 -2
- package/es/tx/builder/field-types/mptree.mjs +5 -7
- 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 +2 -2
- package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
- package/es/tx/builder/field-types/name-id.mjs.map +1 -1
- package/es/tx/builder/field-types/name.mjs.map +1 -1
- package/es/tx/builder/field-types/nonce.d.ts +14 -0
- package/es/tx/builder/field-types/nonce.mjs +29 -0
- package/es/tx/builder/field-types/nonce.mjs.map +1 -0
- package/es/tx/builder/field-types/pointers.mjs.map +1 -1
- package/es/tx/builder/field-types/raw.mjs.map +1 -1
- package/es/tx/builder/field-types/short-u-int-const.d.ts +4 -2
- package/es/tx/builder/field-types/short-u-int-const.mjs +12 -8
- package/es/tx/builder/field-types/short-u-int-const.mjs.map +1 -1
- package/es/tx/builder/field-types/short-u-int.mjs.map +1 -1
- package/es/tx/builder/field-types/string.mjs.map +1 -1
- package/es/tx/builder/field-types/ttl.d.ts +11 -0
- package/es/tx/builder/field-types/ttl.mjs +21 -0
- package/es/tx/builder/field-types/ttl.mjs.map +1 -0
- package/es/tx/builder/field-types/u-int.mjs.map +1 -1
- package/es/tx/builder/field-types/wrapped.d.ts +14 -0
- package/es/tx/builder/field-types/wrapped.mjs +22 -0
- package/es/tx/builder/field-types/wrapped.mjs.map +1 -0
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +20 -20
- package/es/tx/builder/index.mjs +54 -64
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +2735 -2865
- package/es/tx/builder/schema.generated.d.ts +2011 -0
- package/es/tx/builder/schema.generated.mjs +2 -0
- package/es/tx/builder/schema.generated.mjs.map +1 -0
- package/es/tx/builder/schema.mjs +459 -155
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/execution-cost.d.ts +35 -0
- package/es/tx/execution-cost.mjs +123 -0
- package/es/tx/execution-cost.mjs.map +1 -0
- package/es/tx/transaction-signer.d.ts +6 -0
- package/es/tx/transaction-signer.mjs +27 -0
- package/es/tx/transaction-signer.mjs.map +1 -0
- package/es/tx/validator.mjs +60 -109
- package/es/tx/validator.mjs.map +1 -1
- package/es/utils/amount-formatter.mjs +0 -16
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.d.ts +3 -2
- package/es/utils/autorest.mjs +43 -11
- package/es/utils/autorest.mjs.map +1 -1
- package/es/utils/bytes.mjs +0 -16
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/crypto.mjs +0 -16
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/encoder.mjs.map +1 -1
- package/es/utils/errors.d.ts +14 -31
- package/es/utils/errors.mjs +3 -33
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/hd-wallet.mjs.map +1 -1
- package/es/utils/json-big.mjs.map +1 -1
- package/es/utils/keystore.mjs.map +1 -1
- package/es/utils/other.d.ts +1 -1
- package/es/utils/other.mjs.map +1 -1
- package/es/utils/semver-satisfies.mjs.map +1 -1
- package/es/utils/string.mjs +0 -17
- package/es/utils/string.mjs.map +1 -1
- package/package.json +34 -30
- package/src/AeSdkAepp.ts +16 -14
- package/src/AeSdkMethods.ts +11 -16
- package/src/AeSdkWallet.ts +1 -1
- package/src/Node.ts +17 -6
- package/src/account/Base.ts +11 -22
- package/src/account/Generalized.ts +9 -24
- package/src/account/Memory.ts +14 -21
- package/src/aens.ts +31 -47
- package/src/aepp-wallet-communication/connection/Browser.ts +0 -17
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +0 -17
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +0 -17
- package/src/aepp-wallet-communication/connection-proxy.ts +0 -17
- package/src/aepp-wallet-communication/rpc/types.ts +7 -2
- package/src/aepp-wallet-communication/wallet-detector.ts +0 -17
- package/src/apis/compiler/compiler.ts +3 -27
- package/src/apis/compiler/models/index.ts +3 -2
- package/src/apis/compiler/models/mappers.ts +15 -2
- package/src/apis/node/models/index.ts +16 -15
- package/src/apis/node/models/mappers.ts +2 -1
- package/src/apis/node/models/parameters.ts +2 -2
- package/src/apis/node/node.ts +3 -27
- package/src/chain.ts +29 -28
- package/src/channel/Base.ts +33 -33
- package/src/channel/Contract.ts +8 -23
- package/src/channel/Spend.ts +2 -17
- package/src/channel/handlers.ts +5 -18
- package/src/channel/internal.ts +40 -22
- package/src/contract/Contract.ts +161 -170
- package/src/contract/compiler/Base.ts +10 -14
- package/src/contract/compiler/Cli.ts +5 -11
- package/src/contract/compiler/Http.ts +6 -25
- package/src/contract/delegation-signature.ts +56 -0
- package/src/contract/ga.ts +53 -32
- package/src/index-browser.ts +15 -21
- package/src/oracle.ts +46 -56
- package/src/spend.ts +33 -67
- package/src/tx/builder/SchemaTypes.ts +79 -0
- package/src/tx/builder/constants.ts +2 -0
- package/src/tx/builder/field-types/abi-version.ts +29 -6
- package/src/tx/builder/field-types/array.ts +1 -1
- package/src/tx/builder/field-types/coin-amount.ts +6 -4
- package/src/tx/builder/field-types/ct-version.ts +37 -4
- package/src/tx/builder/field-types/deposit.ts +3 -1
- package/src/tx/builder/field-types/encoded.ts +1 -1
- package/src/tx/builder/field-types/entry.ts +8 -3
- package/src/tx/builder/field-types/fee.ts +6 -4
- package/src/tx/builder/field-types/gas-limit.ts +2 -2
- package/src/tx/builder/field-types/index.ts +15 -1
- package/src/tx/builder/field-types/map.ts +45 -0
- package/src/tx/builder/field-types/mptree.ts +4 -3
- package/src/tx/builder/field-types/name-fee.ts +2 -1
- package/src/tx/builder/field-types/nonce.ts +40 -0
- package/src/tx/builder/field-types/short-u-int-const.ts +18 -8
- package/src/tx/builder/field-types/ttl.ts +24 -0
- package/src/tx/builder/field-types/wrapped.ts +32 -0
- package/src/tx/builder/index.ts +57 -71
- package/src/tx/builder/schema.generated.ts +2013 -0
- package/src/tx/builder/schema.ts +544 -624
- package/src/tx/execution-cost.ts +146 -0
- package/src/tx/transaction-signer.ts +27 -0
- package/src/tx/validator.ts +60 -91
- package/src/utils/amount-formatter.ts +0 -16
- package/src/utils/autorest.ts +52 -11
- package/src/utils/bytes.ts +0 -16
- package/src/utils/crypto.ts +0 -16
- package/src/utils/errors.ts +16 -45
- package/src/utils/string.ts +0 -17
- package/types-legacy/ts4.2/AeSdkAepp.d.ts +5 -4
- package/types-legacy/ts4.2/AeSdkMethods.d.ts +11 -12
- package/types-legacy/ts4.2/Node.d.ts +5 -1
- package/types-legacy/ts4.2/account/Base.d.ts +11 -6
- package/types-legacy/ts4.2/account/Memory.d.ts +2 -1
- package/types-legacy/ts4.2/aens.d.ts +12 -14
- package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +6 -2
- package/types-legacy/ts4.2/apis/compiler/compiler.d.ts +1 -1
- package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +3 -2
- package/types-legacy/ts4.2/apis/compiler/models/mappers.d.ts +1 -1
- package/types-legacy/ts4.2/apis/node/models/index.d.ts +15 -15
- package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +1 -1
- package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +2 -2
- package/types-legacy/ts4.2/chain.d.ts +8 -8
- package/types-legacy/ts4.2/channel/Base.d.ts +25 -12
- package/types-legacy/ts4.2/channel/Spend.d.ts +4 -2
- package/types-legacy/ts4.2/channel/internal.d.ts +22 -2
- package/types-legacy/ts4.2/contract/Contract.d.ts +29 -84
- package/types-legacy/ts4.2/contract/compiler/Base.d.ts +10 -14
- package/types-legacy/ts4.2/contract/delegation-signature.d.ts +43 -0
- package/types-legacy/ts4.2/contract/ga.d.ts +23 -7
- package/types-legacy/ts4.2/index-browser.d.ts +5 -4
- package/types-legacy/ts4.2/oracle.d.ts +12 -17
- package/types-legacy/ts4.2/spend.d.ts +19 -27
- package/types-legacy/ts4.2/tx/builder/SchemaTypes.d.ts +37 -0
- package/types-legacy/ts4.2/tx/builder/constants.d.ts +4 -2
- package/types-legacy/ts4.2/tx/builder/field-types/abi-version.d.ts +11 -2
- package/types-legacy/ts4.2/tx/builder/field-types/array.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +3 -4
- package/types-legacy/ts4.2/tx/builder/field-types/ct-version.d.ts +33 -3
- package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +2 -1
- package/types-legacy/ts4.2/tx/builder/field-types/encoded.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +3 -1
- package/types-legacy/ts4.2/tx/builder/field-types/gas-limit.d.ts +3 -2
- package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +3 -1
- package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +52 -13
- package/types-legacy/ts4.2/tx/builder/field-types/map.d.ts +13 -0
- package/types-legacy/ts4.2/tx/builder/field-types/mptree.d.ts +7 -2
- 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 +14 -0
- package/types-legacy/ts4.2/tx/builder/field-types/short-u-int-const.d.ts +4 -2
- package/types-legacy/ts4.2/tx/builder/field-types/ttl.d.ts +11 -0
- package/types-legacy/ts4.2/tx/builder/field-types/wrapped.d.ts +14 -0
- package/types-legacy/ts4.2/tx/builder/index.d.ts +23 -20
- package/types-legacy/ts4.2/tx/builder/schema.d.ts +2962 -4629
- package/types-legacy/ts4.2/tx/builder/schema.generated.d.ts +2011 -0
- package/types-legacy/ts4.2/tx/execution-cost.d.ts +35 -0
- package/types-legacy/ts4.2/tx/transaction-signer.d.ts +6 -0
- package/types-legacy/ts4.2/utils/autorest.d.ts +3 -2
- package/types-legacy/ts4.2/utils/errors.d.ts +14 -31
- package/types-legacy/ts4.2/utils/other.d.ts +1 -1
- package/types-legacy/ts4.5/AeSdkAepp.d.ts +5 -4
- package/types-legacy/ts4.5/AeSdkMethods.d.ts +11 -12
- package/types-legacy/ts4.5/Node.d.ts +5 -1
- package/types-legacy/ts4.5/account/Base.d.ts +11 -6
- package/types-legacy/ts4.5/account/Memory.d.ts +2 -1
- package/types-legacy/ts4.5/aens.d.ts +12 -14
- package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +6 -2
- package/types-legacy/ts4.5/apis/compiler/compiler.d.ts +1 -1
- package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +3 -2
- package/types-legacy/ts4.5/apis/compiler/models/mappers.d.ts +1 -1
- package/types-legacy/ts4.5/apis/node/models/index.d.ts +15 -15
- package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +1 -1
- package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +2 -2
- package/types-legacy/ts4.5/chain.d.ts +8 -8
- package/types-legacy/ts4.5/channel/Base.d.ts +25 -12
- package/types-legacy/ts4.5/channel/Spend.d.ts +4 -2
- package/types-legacy/ts4.5/channel/internal.d.ts +22 -2
- package/types-legacy/ts4.5/contract/Contract.d.ts +29 -84
- package/types-legacy/ts4.5/contract/compiler/Base.d.ts +10 -14
- package/types-legacy/ts4.5/contract/delegation-signature.d.ts +43 -0
- package/types-legacy/ts4.5/contract/ga.d.ts +23 -7
- package/types-legacy/ts4.5/index-browser.d.ts +5 -4
- package/types-legacy/ts4.5/oracle.d.ts +12 -17
- package/types-legacy/ts4.5/spend.d.ts +19 -27
- package/types-legacy/ts4.5/tx/builder/SchemaTypes.d.ts +37 -0
- package/types-legacy/ts4.5/tx/builder/constants.d.ts +4 -2
- package/types-legacy/ts4.5/tx/builder/field-types/abi-version.d.ts +11 -2
- package/types-legacy/ts4.5/tx/builder/field-types/array.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +3 -4
- package/types-legacy/ts4.5/tx/builder/field-types/ct-version.d.ts +33 -3
- package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +2 -1
- package/types-legacy/ts4.5/tx/builder/field-types/encoded.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +3 -1
- package/types-legacy/ts4.5/tx/builder/field-types/gas-limit.d.ts +3 -2
- package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +3 -1
- package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +52 -13
- package/types-legacy/ts4.5/tx/builder/field-types/map.d.ts +13 -0
- package/types-legacy/ts4.5/tx/builder/field-types/mptree.d.ts +7 -2
- 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 +14 -0
- package/types-legacy/ts4.5/tx/builder/field-types/short-u-int-const.d.ts +4 -2
- package/types-legacy/ts4.5/tx/builder/field-types/ttl.d.ts +11 -0
- package/types-legacy/ts4.5/tx/builder/field-types/wrapped.d.ts +14 -0
- package/types-legacy/ts4.5/tx/builder/index.d.ts +23 -20
- package/types-legacy/ts4.5/tx/builder/schema.d.ts +2962 -4629
- package/types-legacy/ts4.5/tx/builder/schema.generated.d.ts +2011 -0
- package/types-legacy/ts4.5/tx/execution-cost.d.ts +35 -0
- package/types-legacy/ts4.5/tx/transaction-signer.d.ts +6 -0
- package/types-legacy/ts4.5/utils/autorest.d.ts +3 -2
- package/types-legacy/ts4.5/utils/errors.d.ts +14 -31
- package/types-legacy/ts4.5/utils/other.d.ts +1 -1
- package/es/tx/index.d.ts +0 -19
- package/es/tx/index.mjs +0 -115
- package/es/tx/index.mjs.map +0 -1
- package/src/apis/compiler/code-model-v4.yaml +0 -2442
- package/src/apis/node/code-model-v4.yaml +0 -10080
- package/src/tx/index.ts +0 -129
- package/types-legacy/ts4.2/tx/index.d.ts +0 -19
- package/types-legacy/ts4.5/tx/index.d.ts +0 -19
package/dist/aepp-sdk.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
2
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory(require("@azure/core-rest-pipeline"), require("
|
|
3
|
+
module.exports = factory(require("@azure/core-rest-pipeline"), require("rlp"), require("bignumber.js"), require("bs58"), require("buffer"), require("tweetnacl"), require("varuint-bitcoin"), require("@azure/core-client"), require("@aeternity/uuid"), require("@aeternity/argon2"), require("tweetnacl-auth"), require("bip32-path"), require("aes-js"), require("@aeternity/aepp-calldata"), require("json-bigint"), require("events"), require("websocket"));
|
|
4
4
|
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define(["@azure/core-rest-pipeline", "
|
|
5
|
+
define(["@azure/core-rest-pipeline", "rlp", "bignumber.js", "bs58", "buffer", "tweetnacl", "varuint-bitcoin", "@azure/core-client", "@aeternity/uuid", "@aeternity/argon2", "tweetnacl-auth", "bip32-path", "aes-js", "@aeternity/aepp-calldata", "json-bigint", "events", "websocket"], factory);
|
|
6
6
|
else if(typeof exports === 'object')
|
|
7
|
-
exports["Aeternity"] = factory(require("@azure/core-rest-pipeline"), require("
|
|
7
|
+
exports["Aeternity"] = factory(require("@azure/core-rest-pipeline"), require("rlp"), require("bignumber.js"), require("bs58"), require("buffer"), require("tweetnacl"), require("varuint-bitcoin"), require("@azure/core-client"), require("@aeternity/uuid"), require("@aeternity/argon2"), require("tweetnacl-auth"), require("bip32-path"), require("aes-js"), require("@aeternity/aepp-calldata"), require("json-bigint"), require("events"), require("websocket"));
|
|
8
8
|
else
|
|
9
|
-
root["Aeternity"] = factory(root["@azure/core-rest-pipeline"], root["
|
|
10
|
-
})(global, (__WEBPACK_EXTERNAL_MODULE__5039__,
|
|
9
|
+
root["Aeternity"] = factory(root["@azure/core-rest-pipeline"], root["rlp"], root["bignumber.js"], root["bs58"], root["buffer"], root["tweetnacl"], root["varuint-bitcoin"], root["@azure/core-client"], root["@aeternity/uuid"], root["@aeternity/argon2"], root["tweetnacl-auth"], root["bip32-path"], root["aes-js"], root["@aeternity/aepp-calldata"], root["json-bigint"], root["events"], root["websocket"]);
|
|
10
|
+
})(global, (__WEBPACK_EXTERNAL_MODULE__5039__, __WEBPACK_EXTERNAL_MODULE__3485__, __WEBPACK_EXTERNAL_MODULE__5192__, __WEBPACK_EXTERNAL_MODULE__3783__, __WEBPACK_EXTERNAL_MODULE__9408__, __WEBPACK_EXTERNAL_MODULE__79__, __WEBPACK_EXTERNAL_MODULE__7480__, __WEBPACK_EXTERNAL_MODULE__4711__, __WEBPACK_EXTERNAL_MODULE__3983__, __WEBPACK_EXTERNAL_MODULE__7417__, __WEBPACK_EXTERNAL_MODULE__9882__, __WEBPACK_EXTERNAL_MODULE__1986__, __WEBPACK_EXTERNAL_MODULE__8236__, __WEBPACK_EXTERNAL_MODULE__7946__, __WEBPACK_EXTERNAL_MODULE__2716__, __WEBPACK_EXTERNAL_MODULE__3735__, __WEBPACK_EXTERNAL_MODULE__8079__) => {
|
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
|
12
12
|
/******/ var __webpack_modules__ = ({
|
|
13
13
|
|
|
@@ -662,6 +662,8 @@ module.exports = parent;
|
|
|
662
662
|
|
|
663
663
|
var parent = __webpack_require__(281);
|
|
664
664
|
__webpack_require__(8783);
|
|
665
|
+
__webpack_require__(2731);
|
|
666
|
+
__webpack_require__(5605);
|
|
665
667
|
__webpack_require__(5799);
|
|
666
668
|
__webpack_require__(1943);
|
|
667
669
|
__webpack_require__(6774);
|
|
@@ -1100,6 +1102,18 @@ module.exports = function (object, key, value) {
|
|
|
1100
1102
|
};
|
|
1101
1103
|
|
|
1102
1104
|
|
|
1105
|
+
/***/ }),
|
|
1106
|
+
|
|
1107
|
+
/***/ 9202:
|
|
1108
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1109
|
+
|
|
1110
|
+
var defineProperty = __webpack_require__(5988);
|
|
1111
|
+
|
|
1112
|
+
module.exports = function (target, name, descriptor) {
|
|
1113
|
+
return defineProperty.f(target, name, descriptor);
|
|
1114
|
+
};
|
|
1115
|
+
|
|
1116
|
+
|
|
1103
1117
|
/***/ }),
|
|
1104
1118
|
|
|
1105
1119
|
/***/ 5929:
|
|
@@ -1240,11 +1254,9 @@ module.exports = {
|
|
|
1240
1254
|
/***/ }),
|
|
1241
1255
|
|
|
1242
1256
|
/***/ 2861:
|
|
1243
|
-
/***/ ((module
|
|
1244
|
-
|
|
1245
|
-
var getBuiltIn = __webpack_require__(626);
|
|
1257
|
+
/***/ ((module) => {
|
|
1246
1258
|
|
|
1247
|
-
module.exports =
|
|
1259
|
+
module.exports = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
|
|
1248
1260
|
|
|
1249
1261
|
|
|
1250
1262
|
/***/ }),
|
|
@@ -1376,9 +1388,9 @@ module.exports = function (options, source) {
|
|
|
1376
1388
|
|
|
1377
1389
|
if (USE_NATIVE && typeof targetProperty == typeof sourceProperty) continue;
|
|
1378
1390
|
|
|
1379
|
-
// bind
|
|
1391
|
+
// bind methods to global for calling from export context
|
|
1380
1392
|
if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, global);
|
|
1381
|
-
// wrap global constructors for prevent
|
|
1393
|
+
// wrap global constructors for prevent changes in this version
|
|
1382
1394
|
else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty);
|
|
1383
1395
|
// make static versions for prototype methods
|
|
1384
1396
|
else if (PROTO && isCallable(sourceProperty)) resultProperty = uncurryThis(sourceProperty);
|
|
@@ -1512,6 +1524,22 @@ module.exports = {
|
|
|
1512
1524
|
};
|
|
1513
1525
|
|
|
1514
1526
|
|
|
1527
|
+
/***/ }),
|
|
1528
|
+
|
|
1529
|
+
/***/ 5526:
|
|
1530
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1531
|
+
|
|
1532
|
+
var uncurryThis = __webpack_require__(5329);
|
|
1533
|
+
var aCallable = __webpack_require__(4883);
|
|
1534
|
+
|
|
1535
|
+
module.exports = function (object, key, method) {
|
|
1536
|
+
try {
|
|
1537
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
1538
|
+
return uncurryThis(aCallable(Object.getOwnPropertyDescriptor(object, key)[method]));
|
|
1539
|
+
} catch (error) { /* empty */ }
|
|
1540
|
+
};
|
|
1541
|
+
|
|
1542
|
+
|
|
1515
1543
|
/***/ }),
|
|
1516
1544
|
|
|
1517
1545
|
/***/ 7484:
|
|
@@ -1565,6 +1593,42 @@ module.exports = function (namespace, method) {
|
|
|
1565
1593
|
};
|
|
1566
1594
|
|
|
1567
1595
|
|
|
1596
|
+
/***/ }),
|
|
1597
|
+
|
|
1598
|
+
/***/ 3323:
|
|
1599
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1600
|
+
|
|
1601
|
+
var uncurryThis = __webpack_require__(5329);
|
|
1602
|
+
var isArray = __webpack_require__(1052);
|
|
1603
|
+
var isCallable = __webpack_require__(7475);
|
|
1604
|
+
var classof = __webpack_require__(2532);
|
|
1605
|
+
var toString = __webpack_require__(5803);
|
|
1606
|
+
|
|
1607
|
+
var push = uncurryThis([].push);
|
|
1608
|
+
|
|
1609
|
+
module.exports = function (replacer) {
|
|
1610
|
+
if (isCallable(replacer)) return replacer;
|
|
1611
|
+
if (!isArray(replacer)) return;
|
|
1612
|
+
var rawLength = replacer.length;
|
|
1613
|
+
var keys = [];
|
|
1614
|
+
for (var i = 0; i < rawLength; i++) {
|
|
1615
|
+
var element = replacer[i];
|
|
1616
|
+
if (typeof element == 'string') push(keys, element);
|
|
1617
|
+
else if (typeof element == 'number' || classof(element) == 'Number' || classof(element) == 'String') push(keys, toString(element));
|
|
1618
|
+
}
|
|
1619
|
+
var keysLength = keys.length;
|
|
1620
|
+
var root = true;
|
|
1621
|
+
return function (key, value) {
|
|
1622
|
+
if (root) {
|
|
1623
|
+
root = false;
|
|
1624
|
+
return value;
|
|
1625
|
+
}
|
|
1626
|
+
if (isArray(this)) return value;
|
|
1627
|
+
for (var j = 0; j < keysLength; j++) if (keys[j] === key) return value;
|
|
1628
|
+
};
|
|
1629
|
+
};
|
|
1630
|
+
|
|
1631
|
+
|
|
1568
1632
|
/***/ }),
|
|
1569
1633
|
|
|
1570
1634
|
/***/ 4229:
|
|
@@ -2543,7 +2607,7 @@ exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
|
|
2543
2607
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2544
2608
|
|
|
2545
2609
|
/* eslint-disable no-proto -- safe */
|
|
2546
|
-
var
|
|
2610
|
+
var uncurryThisAccessor = __webpack_require__(5526);
|
|
2547
2611
|
var anObject = __webpack_require__(6059);
|
|
2548
2612
|
var aPossiblePrototype = __webpack_require__(1851);
|
|
2549
2613
|
|
|
@@ -2556,8 +2620,7 @@ module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
|
|
2556
2620
|
var test = {};
|
|
2557
2621
|
var setter;
|
|
2558
2622
|
try {
|
|
2559
|
-
|
|
2560
|
-
setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
|
|
2623
|
+
setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');
|
|
2561
2624
|
setter(test, []);
|
|
2562
2625
|
CORRECT_SETTER = test instanceof Array;
|
|
2563
2626
|
} catch (error) { /* empty */ }
|
|
@@ -2747,10 +2810,10 @@ var store = __webpack_require__(3030);
|
|
|
2747
2810
|
(module.exports = function (key, value) {
|
|
2748
2811
|
return store[key] || (store[key] = value !== undefined ? value : {});
|
|
2749
2812
|
})('versions', []).push({
|
|
2750
|
-
version: '3.
|
|
2813
|
+
version: '3.29.0',
|
|
2751
2814
|
mode: IS_PURE ? 'pure' : 'global',
|
|
2752
|
-
copyright: '© 2014-
|
|
2753
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
2815
|
+
copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
|
|
2816
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.29.0/LICENSE',
|
|
2754
2817
|
source: 'https://github.com/zloirock/core-js'
|
|
2755
2818
|
});
|
|
2756
2819
|
|
|
@@ -3132,21 +3195,15 @@ var uid = __webpack_require__(9418);
|
|
|
3132
3195
|
var NATIVE_SYMBOL = __webpack_require__(3405);
|
|
3133
3196
|
var USE_SYMBOL_AS_UID = __webpack_require__(2302);
|
|
3134
3197
|
|
|
3135
|
-
var WellKnownSymbolsStore = shared('wks');
|
|
3136
3198
|
var Symbol = global.Symbol;
|
|
3137
|
-
var
|
|
3138
|
-
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
|
|
3199
|
+
var WellKnownSymbolsStore = shared('wks');
|
|
3200
|
+
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol['for'] || Symbol : Symbol && Symbol.withoutSetter || uid;
|
|
3139
3201
|
|
|
3140
3202
|
module.exports = function (name) {
|
|
3141
|
-
if (!hasOwn(WellKnownSymbolsStore, name)
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
} else if (USE_SYMBOL_AS_UID && symbolFor) {
|
|
3146
|
-
WellKnownSymbolsStore[name] = symbolFor(description);
|
|
3147
|
-
} else {
|
|
3148
|
-
WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
|
|
3149
|
-
}
|
|
3203
|
+
if (!hasOwn(WellKnownSymbolsStore, name)) {
|
|
3204
|
+
WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name)
|
|
3205
|
+
? Symbol[name]
|
|
3206
|
+
: createWellKnownSymbol('Symbol.' + name);
|
|
3150
3207
|
} return WellKnownSymbolsStore[name];
|
|
3151
3208
|
};
|
|
3152
3209
|
|
|
@@ -3182,15 +3239,13 @@ var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
|
|
|
3182
3239
|
return array.concat()[0] !== array;
|
|
3183
3240
|
});
|
|
3184
3241
|
|
|
3185
|
-
var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
|
|
3186
|
-
|
|
3187
3242
|
var isConcatSpreadable = function (O) {
|
|
3188
3243
|
if (!isObject(O)) return false;
|
|
3189
3244
|
var spreadable = O[IS_CONCAT_SPREADABLE];
|
|
3190
3245
|
return spreadable !== undefined ? !!spreadable : isArray(O);
|
|
3191
3246
|
};
|
|
3192
3247
|
|
|
3193
|
-
var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !
|
|
3248
|
+
var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !arrayMethodHasSpeciesSupport('concat');
|
|
3194
3249
|
|
|
3195
3250
|
// `Array.prototype.concat` method
|
|
3196
3251
|
// https://tc39.es/ecma262/#sec-array.prototype.concat
|
|
@@ -3308,13 +3363,13 @@ var apply = __webpack_require__(9730);
|
|
|
3308
3363
|
var call = __webpack_require__(8834);
|
|
3309
3364
|
var uncurryThis = __webpack_require__(5329);
|
|
3310
3365
|
var fails = __webpack_require__(5981);
|
|
3311
|
-
var isArray = __webpack_require__(1052);
|
|
3312
3366
|
var isCallable = __webpack_require__(7475);
|
|
3313
|
-
var isObject = __webpack_require__(941);
|
|
3314
3367
|
var isSymbol = __webpack_require__(6664);
|
|
3315
3368
|
var arraySlice = __webpack_require__(3765);
|
|
3369
|
+
var getReplacerFunction = __webpack_require__(3323);
|
|
3316
3370
|
var NATIVE_SYMBOL = __webpack_require__(3405);
|
|
3317
3371
|
|
|
3372
|
+
var $String = String;
|
|
3318
3373
|
var $stringify = getBuiltIn('JSON', 'stringify');
|
|
3319
3374
|
var exec = uncurryThis(/./.exec);
|
|
3320
3375
|
var charAt = uncurryThis(''.charAt);
|
|
@@ -3344,13 +3399,13 @@ var ILL_FORMED_UNICODE = fails(function () {
|
|
|
3344
3399
|
|
|
3345
3400
|
var stringifyWithSymbolsFix = function (it, replacer) {
|
|
3346
3401
|
var args = arraySlice(arguments);
|
|
3347
|
-
var $replacer = replacer;
|
|
3348
|
-
if (!
|
|
3349
|
-
|
|
3350
|
-
|
|
3402
|
+
var $replacer = getReplacerFunction(replacer);
|
|
3403
|
+
if (!isCallable($replacer) && (it === undefined || isSymbol(it))) return; // IE8 returns string on undefined
|
|
3404
|
+
args[1] = function (key, value) {
|
|
3405
|
+
// some old implementations (like WebKit) could pass numbers as keys
|
|
3406
|
+
if (isCallable($replacer)) value = call($replacer, this, $String(key), value);
|
|
3351
3407
|
if (!isSymbol(value)) return value;
|
|
3352
3408
|
};
|
|
3353
|
-
args[1] = replacer;
|
|
3354
3409
|
return apply($stringify, null, args);
|
|
3355
3410
|
};
|
|
3356
3411
|
|
|
@@ -3546,6 +3601,7 @@ var definePropertyModule = __webpack_require__(5988);
|
|
|
3546
3601
|
var definePropertiesModule = __webpack_require__(9938);
|
|
3547
3602
|
var propertyIsEnumerableModule = __webpack_require__(6760);
|
|
3548
3603
|
var defineBuiltIn = __webpack_require__(5929);
|
|
3604
|
+
var defineBuiltInAccessor = __webpack_require__(9202);
|
|
3549
3605
|
var shared = __webpack_require__(8726);
|
|
3550
3606
|
var sharedKey = __webpack_require__(4262);
|
|
3551
3607
|
var hiddenKeys = __webpack_require__(7748);
|
|
@@ -3717,7 +3773,7 @@ if (!NATIVE_SYMBOL) {
|
|
|
3717
3773
|
|
|
3718
3774
|
if (DESCRIPTORS) {
|
|
3719
3775
|
// https://github.com/tc39/proposal-Symbol-description
|
|
3720
|
-
|
|
3776
|
+
defineBuiltInAccessor(SymbolPrototype, 'description', {
|
|
3721
3777
|
configurable: true,
|
|
3722
3778
|
get: function description() {
|
|
3723
3779
|
return getInternalState(this).description;
|
|
@@ -4027,6 +4083,75 @@ var defineWellKnownSymbol = __webpack_require__(3464);
|
|
|
4027
4083
|
defineWellKnownSymbol('dispose');
|
|
4028
4084
|
|
|
4029
4085
|
|
|
4086
|
+
/***/ }),
|
|
4087
|
+
|
|
4088
|
+
/***/ 2731:
|
|
4089
|
+
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
|
|
4090
|
+
|
|
4091
|
+
var $ = __webpack_require__(6887);
|
|
4092
|
+
var getBuiltIn = __webpack_require__(626);
|
|
4093
|
+
var uncurryThis = __webpack_require__(5329);
|
|
4094
|
+
|
|
4095
|
+
var Symbol = getBuiltIn('Symbol');
|
|
4096
|
+
var keyFor = Symbol.keyFor;
|
|
4097
|
+
var thisSymbolValue = uncurryThis(Symbol.prototype.valueOf);
|
|
4098
|
+
|
|
4099
|
+
// `Symbol.isRegistered` method
|
|
4100
|
+
// https://tc39.es/proposal-symbol-predicates/#sec-symbol-isregistered
|
|
4101
|
+
$({ target: 'Symbol', stat: true }, {
|
|
4102
|
+
isRegistered: function isRegistered(value) {
|
|
4103
|
+
try {
|
|
4104
|
+
return keyFor(thisSymbolValue(value)) !== undefined;
|
|
4105
|
+
} catch (error) {
|
|
4106
|
+
return false;
|
|
4107
|
+
}
|
|
4108
|
+
}
|
|
4109
|
+
});
|
|
4110
|
+
|
|
4111
|
+
|
|
4112
|
+
/***/ }),
|
|
4113
|
+
|
|
4114
|
+
/***/ 5605:
|
|
4115
|
+
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
|
|
4116
|
+
|
|
4117
|
+
var $ = __webpack_require__(6887);
|
|
4118
|
+
var shared = __webpack_require__(8726);
|
|
4119
|
+
var getBuiltIn = __webpack_require__(626);
|
|
4120
|
+
var uncurryThis = __webpack_require__(5329);
|
|
4121
|
+
var isSymbol = __webpack_require__(6664);
|
|
4122
|
+
var wellKnownSymbol = __webpack_require__(9813);
|
|
4123
|
+
|
|
4124
|
+
var Symbol = getBuiltIn('Symbol');
|
|
4125
|
+
var $isWellKnown = Symbol.isWellKnown;
|
|
4126
|
+
var getOwnPropertyNames = getBuiltIn('Object', 'getOwnPropertyNames');
|
|
4127
|
+
var thisSymbolValue = uncurryThis(Symbol.prototype.valueOf);
|
|
4128
|
+
var WellKnownSymbolsStore = shared('wks');
|
|
4129
|
+
|
|
4130
|
+
for (var i = 0, symbolKeys = getOwnPropertyNames(Symbol), symbolKeysLength = symbolKeys.length; i < symbolKeysLength; i++) {
|
|
4131
|
+
// some old engines throws on access to some keys like `arguments` or `caller`
|
|
4132
|
+
try {
|
|
4133
|
+
var symbolKey = symbolKeys[i];
|
|
4134
|
+
if (isSymbol(Symbol[symbolKey])) wellKnownSymbol(symbolKey);
|
|
4135
|
+
} catch (error) { /* empty */ }
|
|
4136
|
+
}
|
|
4137
|
+
|
|
4138
|
+
// `Symbol.isWellKnown` method
|
|
4139
|
+
// https://tc39.es/proposal-symbol-predicates/#sec-symbol-iswellknown
|
|
4140
|
+
// We should patch it for newly added well-known symbols. If it's not required, this module just will not be injected
|
|
4141
|
+
$({ target: 'Symbol', stat: true, forced: true }, {
|
|
4142
|
+
isWellKnown: function isWellKnown(value) {
|
|
4143
|
+
if ($isWellKnown && $isWellKnown(value)) return true;
|
|
4144
|
+
try {
|
|
4145
|
+
var symbol = thisSymbolValue(value);
|
|
4146
|
+
for (var j = 0, keys = getOwnPropertyNames(WellKnownSymbolsStore), keysLength = keys.length; j < keysLength; j++) {
|
|
4147
|
+
if (WellKnownSymbolsStore[keys[j]] == symbol) return true;
|
|
4148
|
+
}
|
|
4149
|
+
} catch (error) { /* empty */ }
|
|
4150
|
+
return false;
|
|
4151
|
+
}
|
|
4152
|
+
});
|
|
4153
|
+
|
|
4154
|
+
|
|
4030
4155
|
/***/ }),
|
|
4031
4156
|
|
|
4032
4157
|
/***/ 5799:
|
|
@@ -4984,6 +5109,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
4984
5109
|
"DryRunError": () => (/* reexport */ DryRunError),
|
|
4985
5110
|
"DuplicateContractError": () => (/* reexport */ DuplicateContractError),
|
|
4986
5111
|
"DuplicateNodeError": () => (/* reexport */ DuplicateNodeError),
|
|
5112
|
+
"Encoded": () => (/* reexport */ encoder_types_namespaceObject),
|
|
4987
5113
|
"Encoding": () => (/* reexport */ Encoding),
|
|
4988
5114
|
"IllegalArgumentError": () => (/* reexport */ IllegalArgumentError),
|
|
4989
5115
|
"IllegalBidFeeError": () => (/* reexport */ IllegalBidFeeError),
|
|
@@ -4999,7 +5125,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
4999
5125
|
"InvalidRpcMessageError": () => (/* reexport */ InvalidRpcMessageError),
|
|
5000
5126
|
"InvalidSignatureError": () => (/* reexport */ InvalidSignatureError),
|
|
5001
5127
|
"InvalidTxError": () => (/* reexport */ InvalidTxError),
|
|
5002
|
-
"InvalidTxParamsError": () => (/* reexport */ InvalidTxParamsError),
|
|
5003
5128
|
"MAX_AUTH_FUN_GAS": () => (/* reexport */ MAX_AUTH_FUN_GAS),
|
|
5004
5129
|
"MESSAGE_DIRECTION": () => (/* reexport */ MESSAGE_DIRECTION),
|
|
5005
5130
|
"METHODS": () => (/* reexport */ METHODS),
|
|
@@ -5035,7 +5160,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5035
5160
|
"ORACLE_TTL_TYPES": () => (/* reexport */ ORACLE_TTL_TYPES),
|
|
5036
5161
|
"PayloadLengthError": () => (/* reexport */ PayloadLengthError),
|
|
5037
5162
|
"PrefixNotFoundError": () => (/* reexport */ PrefixNotFoundError),
|
|
5038
|
-
"QUERY_FEE": () => (/* reexport */ QUERY_FEE),
|
|
5039
5163
|
"QUERY_TTL": () => (/* reexport */ QUERY_TTL),
|
|
5040
5164
|
"RESPONSE_TTL": () => (/* reexport */ RESPONSE_TTL),
|
|
5041
5165
|
"RPC_STATUS": () => (/* reexport */ RPC_STATUS),
|
|
@@ -5053,8 +5177,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5053
5177
|
"RpcUnsupportedProtocolError": () => (/* reexport */ RpcUnsupportedProtocolError),
|
|
5054
5178
|
"SUBSCRIPTION_TYPES": () => (/* reexport */ SUBSCRIPTION_TYPES),
|
|
5055
5179
|
"SchemaNotFoundError": () => (/* reexport */ SchemaNotFoundError),
|
|
5056
|
-
"TX_SCHEMA": () => (/* reexport */ TX_SCHEMA),
|
|
5057
|
-
"TX_TTL": () => (/* reexport */ TX_TTL),
|
|
5058
5180
|
"Tag": () => (/* reexport */ Tag),
|
|
5059
5181
|
"TagNotFoundError": () => (/* reexport */ TagNotFoundError),
|
|
5060
5182
|
"TransactionError": () => (/* reexport */ TransactionError),
|
|
@@ -5070,15 +5192,12 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5070
5192
|
"UnknownPathNibbleError": () => (/* reexport */ UnknownPathNibbleError),
|
|
5071
5193
|
"UnknownRpcClientError": () => (/* reexport */ UnknownRpcClientError),
|
|
5072
5194
|
"UnsubscribedAccountError": () => (/* reexport */ UnsubscribedAccountError),
|
|
5073
|
-
"UnsupportedABIversionError": () => (/* reexport */ UnsupportedABIversionError),
|
|
5074
5195
|
"UnsupportedPlatformError": () => (/* reexport */ UnsupportedPlatformError),
|
|
5075
5196
|
"UnsupportedProtocolError": () => (/* reexport */ UnsupportedProtocolError),
|
|
5076
|
-
"UnsupportedVMversionError": () => (/* reexport */ UnsupportedVMversionError),
|
|
5077
5197
|
"UnsupportedVersionError": () => (/* reexport */ UnsupportedVersionError),
|
|
5078
5198
|
"VmVersion": () => (/* reexport */ VmVersion),
|
|
5079
5199
|
"WALLET_TYPE": () => (/* reexport */ WALLET_TYPE),
|
|
5080
5200
|
"WalletError": () => (/* reexport */ WalletError),
|
|
5081
|
-
"_buildTx": () => (/* reexport */ _buildTx),
|
|
5082
5201
|
"_getPollInterval": () => (/* reexport */ _getPollInterval),
|
|
5083
5202
|
"aensBid": () => (/* reexport */ aensBid),
|
|
5084
5203
|
"aensClaim": () => (/* reexport */ aensClaim),
|
|
@@ -5089,9 +5208,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5089
5208
|
"aensUpdate": () => (/* reexport */ aensUpdate),
|
|
5090
5209
|
"awaitHeight": () => (/* reexport */ awaitHeight),
|
|
5091
5210
|
"buildAuthTxHash": () => (/* reexport */ buildAuthTxHash),
|
|
5211
|
+
"buildAuthTxHashByGaMetaTx": () => (/* reexport */ buildAuthTxHashByGaMetaTx),
|
|
5092
5212
|
"buildContractId": () => (/* reexport */ buildContractId),
|
|
5093
5213
|
"buildContractIdByContractTx": () => (/* reexport */ buildContractIdByContractTx),
|
|
5094
5214
|
"buildTx": () => (/* reexport */ buildTx),
|
|
5215
|
+
"buildTxAsync": () => (/* reexport */ buildTxAsync),
|
|
5095
5216
|
"buildTxHash": () => (/* reexport */ buildTxHash),
|
|
5096
5217
|
"commitmentHash": () => (/* reexport */ commitmentHash),
|
|
5097
5218
|
"computeAuctionEndBlock": () => (/* reexport */ computeAuctionEndBlock),
|
|
@@ -5119,6 +5240,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5119
5240
|
"getContractByteCode": () => (/* reexport */ getContractByteCode),
|
|
5120
5241
|
"getCurrentGeneration": () => (/* reexport */ getCurrentGeneration),
|
|
5121
5242
|
"getDefaultPointerKey": () => (/* reexport */ getDefaultPointerKey),
|
|
5243
|
+
"getExecutionCost": () => (/* reexport */ getExecutionCost),
|
|
5244
|
+
"getExecutionCostBySignedTx": () => (/* reexport */ getExecutionCostBySignedTx),
|
|
5245
|
+
"getExecutionCostUsingNode": () => (/* reexport */ getExecutionCostUsingNode),
|
|
5122
5246
|
"getFileSystem": () => (/* reexport */ getFileSystem),
|
|
5123
5247
|
"getGeneration": () => (/* reexport */ getGeneration),
|
|
5124
5248
|
"getHdWalletAccountFromSeed": () => (/* reexport */ getHdWalletAccountFromSeed),
|
|
@@ -5133,6 +5257,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5133
5257
|
"getOracleObject": () => (/* reexport */ getOracleObject),
|
|
5134
5258
|
"getQueryObject": () => (/* reexport */ getQueryObject),
|
|
5135
5259
|
"getSaveHDWalletAccounts": () => (/* reexport */ getSaveHDWalletAccounts),
|
|
5260
|
+
"getTransactionSignerAddress": () => (/* reexport */ getTransactionSignerAddress),
|
|
5136
5261
|
"hash": () => (/* reexport */ hash),
|
|
5137
5262
|
"isAddressValid": () => (/* reexport */ isAddressValid),
|
|
5138
5263
|
"isAuctionName": () => (/* reexport */ isAuctionName),
|
|
@@ -5151,7 +5276,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5151
5276
|
"registerOracle": () => (/* reexport */ registerOracle),
|
|
5152
5277
|
"resolveName": () => (/* reexport */ resolveName),
|
|
5153
5278
|
"respondToQuery": () => (/* reexport */ respondToQuery),
|
|
5154
|
-
"send": () => (/* reexport */ send),
|
|
5155
5279
|
"sendTransaction": () => (/* reexport */ sendTransaction),
|
|
5156
5280
|
"sign": () => (/* reexport */ sign),
|
|
5157
5281
|
"signMessage": () => (/* reexport */ signMessage),
|
|
@@ -5169,6 +5293,13 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5169
5293
|
"walletDetector": () => (/* reexport */ wallet_detector)
|
|
5170
5294
|
});
|
|
5171
5295
|
|
|
5296
|
+
// NAMESPACE OBJECT: ./src/utils/encoder-types.ts
|
|
5297
|
+
var encoder_types_namespaceObject = {};
|
|
5298
|
+
__webpack_require__.r(encoder_types_namespaceObject);
|
|
5299
|
+
__webpack_require__.d(encoder_types_namespaceObject, {
|
|
5300
|
+
"Encoding": () => (Encoding)
|
|
5301
|
+
});
|
|
5302
|
+
|
|
5172
5303
|
// NAMESPACE OBJECT: ./src/apis/node/models/mappers.ts
|
|
5173
5304
|
var mappers_namespaceObject = {};
|
|
5174
5305
|
__webpack_require__.r(mappers_namespaceObject);
|
|
@@ -5286,16 +5417,6 @@ __webpack_require__.d(chain_namespaceObject, {
|
|
|
5286
5417
|
"waitForTxConfirm": () => (waitForTxConfirm)
|
|
5287
5418
|
});
|
|
5288
5419
|
|
|
5289
|
-
// NAMESPACE OBJECT: ./src/spend.ts
|
|
5290
|
-
var spend_namespaceObject = {};
|
|
5291
|
-
__webpack_require__.r(spend_namespaceObject);
|
|
5292
|
-
__webpack_require__.d(spend_namespaceObject, {
|
|
5293
|
-
"payForTransaction": () => (payForTransaction),
|
|
5294
|
-
"send": () => (send),
|
|
5295
|
-
"spend": () => (spend),
|
|
5296
|
-
"transferFunds": () => (transferFunds)
|
|
5297
|
-
});
|
|
5298
|
-
|
|
5299
5420
|
// NAMESPACE OBJECT: ./src/aens.ts
|
|
5300
5421
|
var aens_namespaceObject = {};
|
|
5301
5422
|
__webpack_require__.r(aens_namespaceObject);
|
|
@@ -5323,11 +5444,21 @@ __webpack_require__.d(oracle_namespaceObject, {
|
|
|
5323
5444
|
"respondToQuery": () => (respondToQuery)
|
|
5324
5445
|
});
|
|
5325
5446
|
|
|
5447
|
+
// NAMESPACE OBJECT: ./src/spend.ts
|
|
5448
|
+
var spend_namespaceObject = {};
|
|
5449
|
+
__webpack_require__.r(spend_namespaceObject);
|
|
5450
|
+
__webpack_require__.d(spend_namespaceObject, {
|
|
5451
|
+
"payForTransaction": () => (payForTransaction),
|
|
5452
|
+
"spend": () => (spend),
|
|
5453
|
+
"transferFunds": () => (transferFunds)
|
|
5454
|
+
});
|
|
5455
|
+
|
|
5326
5456
|
// NAMESPACE OBJECT: ./src/contract/ga.ts
|
|
5327
5457
|
var ga_namespaceObject = {};
|
|
5328
5458
|
__webpack_require__.r(ga_namespaceObject);
|
|
5329
5459
|
__webpack_require__.d(ga_namespaceObject, {
|
|
5330
5460
|
"buildAuthTxHash": () => (buildAuthTxHash),
|
|
5461
|
+
"buildAuthTxHashByGaMetaTx": () => (buildAuthTxHashByGaMetaTx),
|
|
5331
5462
|
"createGeneralizedAccount": () => (createGeneralizedAccount)
|
|
5332
5463
|
});
|
|
5333
5464
|
|
|
@@ -5337,11 +5468,11 @@ __webpack_require__.r(models_mappers_namespaceObject);
|
|
|
5337
5468
|
__webpack_require__.d(models_mappers_namespaceObject, {
|
|
5338
5469
|
"Aci": () => (Aci),
|
|
5339
5470
|
"ApiVersion": () => (ApiVersion),
|
|
5340
|
-
"ByteCode": () => (mappers_ByteCode),
|
|
5341
5471
|
"ByteCodeInput": () => (ByteCodeInput),
|
|
5342
5472
|
"BytecodeCallResultInput": () => (BytecodeCallResultInput),
|
|
5343
5473
|
"Calldata": () => (Calldata),
|
|
5344
5474
|
"CompileOpts": () => (CompileOpts),
|
|
5475
|
+
"CompileResult": () => (CompileResult),
|
|
5345
5476
|
"CompilerError": () => (mappers_CompilerError),
|
|
5346
5477
|
"CompilerVersion": () => (CompilerVersion),
|
|
5347
5478
|
"Contract": () => (mappers_Contract),
|
|
@@ -5864,7 +5995,7 @@ class MissingContractAddressError extends ContractError {
|
|
|
5864
5995
|
*/
|
|
5865
5996
|
class MissingContractDefError extends ContractError {
|
|
5866
5997
|
constructor() {
|
|
5867
|
-
super('Either ACI or
|
|
5998
|
+
super('Either ACI or sourceCode or sourceCodePath is required');
|
|
5868
5999
|
this.name = 'MissingContractDefError';
|
|
5869
6000
|
}
|
|
5870
6001
|
}
|
|
@@ -6060,16 +6191,6 @@ class InvalidSignatureError extends TransactionError {
|
|
|
6060
6191
|
}
|
|
6061
6192
|
}
|
|
6062
6193
|
|
|
6063
|
-
/**
|
|
6064
|
-
* @category exception
|
|
6065
|
-
*/
|
|
6066
|
-
class InvalidTxParamsError extends TransactionError {
|
|
6067
|
-
constructor(message) {
|
|
6068
|
-
super(message);
|
|
6069
|
-
this.name = 'InvalidTxParamsError';
|
|
6070
|
-
}
|
|
6071
|
-
}
|
|
6072
|
-
|
|
6073
6194
|
/**
|
|
6074
6195
|
* @category exception
|
|
6075
6196
|
*/
|
|
@@ -6084,8 +6205,8 @@ class PrefixNotFoundError extends TransactionError {
|
|
|
6084
6205
|
* @category exception
|
|
6085
6206
|
*/
|
|
6086
6207
|
class SchemaNotFoundError extends TransactionError {
|
|
6087
|
-
constructor(
|
|
6088
|
-
super(`Transaction
|
|
6208
|
+
constructor(key, version) {
|
|
6209
|
+
super(`Transaction schema not implemented for tag ${key} version ${version}`);
|
|
6089
6210
|
this.name = 'SchemaNotFoundError';
|
|
6090
6211
|
}
|
|
6091
6212
|
}
|
|
@@ -6110,26 +6231,6 @@ class TxNotInChainError extends TransactionError {
|
|
|
6110
6231
|
}
|
|
6111
6232
|
}
|
|
6112
6233
|
|
|
6113
|
-
/**
|
|
6114
|
-
* @category exception
|
|
6115
|
-
*/
|
|
6116
|
-
class UnsupportedABIversionError extends TransactionError {
|
|
6117
|
-
constructor(message) {
|
|
6118
|
-
super(message);
|
|
6119
|
-
this.name = 'UnsupportedABIversionError';
|
|
6120
|
-
}
|
|
6121
|
-
}
|
|
6122
|
-
|
|
6123
|
-
/**
|
|
6124
|
-
* @category exception
|
|
6125
|
-
*/
|
|
6126
|
-
class UnsupportedVMversionError extends TransactionError {
|
|
6127
|
-
constructor(message) {
|
|
6128
|
-
super(message);
|
|
6129
|
-
this.name = 'UnsupportedVMversionError';
|
|
6130
|
-
}
|
|
6131
|
-
}
|
|
6132
|
-
|
|
6133
6234
|
/**
|
|
6134
6235
|
* @category exception
|
|
6135
6236
|
*/
|
|
@@ -6160,22 +6261,6 @@ class RpcConnectionError extends WalletError {
|
|
|
6160
6261
|
}
|
|
6161
6262
|
}
|
|
6162
6263
|
;// CONCATENATED MODULE: ./src/utils/amount-formatter.ts
|
|
6163
|
-
/*
|
|
6164
|
-
* ISC License (ISC)
|
|
6165
|
-
* Copyright (c) 2018 aeternity developers
|
|
6166
|
-
*
|
|
6167
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
6168
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
6169
|
-
* copyright notice and this permission notice appear in all copies.
|
|
6170
|
-
*
|
|
6171
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
6172
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
6173
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
6174
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
6175
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
6176
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
6177
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
6178
|
-
*/
|
|
6179
6264
|
|
|
6180
6265
|
|
|
6181
6266
|
|
|
@@ -6464,22 +6549,6 @@ function encode(data, type) {
|
|
|
6464
6549
|
return `${type}_${encoder.encode(data)}`;
|
|
6465
6550
|
}
|
|
6466
6551
|
;// CONCATENATED MODULE: ./src/utils/crypto.ts
|
|
6467
|
-
/*
|
|
6468
|
-
* ISC License (ISC)
|
|
6469
|
-
* Copyright 2018 aeternity developers
|
|
6470
|
-
*
|
|
6471
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
6472
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
6473
|
-
* copyright notice and this permission notice appear in all copies.
|
|
6474
|
-
*
|
|
6475
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
6476
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
6477
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
6478
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
6479
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
6480
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
6481
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
6482
|
-
*/
|
|
6483
6552
|
|
|
6484
6553
|
// js extension is required for mjs build, not importing the whole package to reduce bundle size
|
|
6485
6554
|
// eslint-disable-next-line import/extensions
|
|
@@ -6711,6 +6780,7 @@ let ConsensusProtocolVersion;
|
|
|
6711
6780
|
*/
|
|
6712
6781
|
(function (ConsensusProtocolVersion) {
|
|
6713
6782
|
ConsensusProtocolVersion[ConsensusProtocolVersion["Iris"] = 5] = "Iris";
|
|
6783
|
+
ConsensusProtocolVersion[ConsensusProtocolVersion["Ceres"] = 6] = "Ceres";
|
|
6714
6784
|
})(ConsensusProtocolVersion || (ConsensusProtocolVersion = {}));
|
|
6715
6785
|
let VmVersion;
|
|
6716
6786
|
|
|
@@ -6794,25 +6864,41 @@ let Tag; // KeyBlock = 100,
|
|
|
6794
6864
|
Tag[Tag["GaAttachTx"] = 80] = "GaAttachTx";
|
|
6795
6865
|
Tag[Tag["GaMetaTx"] = 81] = "GaMetaTx";
|
|
6796
6866
|
Tag[Tag["PayingForTx"] = 82] = "PayingForTx";
|
|
6867
|
+
Tag[Tag["GaMetaTxAuthData"] = 810] = "GaMetaTxAuthData";
|
|
6797
6868
|
})(Tag || (Tag = {}));
|
|
6798
6869
|
;// CONCATENATED MODULE: ./src/tx/builder/field-types/ct-version.ts
|
|
6799
6870
|
|
|
6800
|
-
|
|
6801
|
-
|
|
6871
|
+
/*
|
|
6872
|
+
* First abi/vm by default
|
|
6873
|
+
* @see {@link https://github.com/aeternity/protocol/blob/71cf111/contracts/contract_vms.md#virtual-machines-on-the-æternity-blockchain}
|
|
6874
|
+
*/
|
|
6802
6875
|
const ProtocolToVmAbi = {
|
|
6803
6876
|
[ConsensusProtocolVersion.Iris]: {
|
|
6804
6877
|
'contract-create': {
|
|
6805
6878
|
vmVersion: [VmVersion.Fate2],
|
|
6806
6879
|
abiVersion: [AbiVersion.Fate]
|
|
6807
6880
|
},
|
|
6808
|
-
// TODO: Ensure that AEVM (Sophia?) is still available here
|
|
6809
6881
|
'contract-call': {
|
|
6810
6882
|
vmVersion: [],
|
|
6811
6883
|
abiVersion: [AbiVersion.Fate, AbiVersion.Sophia]
|
|
6812
6884
|
},
|
|
6813
6885
|
'oracle-call': {
|
|
6814
6886
|
vmVersion: [],
|
|
6815
|
-
abiVersion: [AbiVersion.NoAbi, AbiVersion.
|
|
6887
|
+
abiVersion: [AbiVersion.NoAbi, AbiVersion.Fate]
|
|
6888
|
+
}
|
|
6889
|
+
},
|
|
6890
|
+
[ConsensusProtocolVersion.Ceres]: {
|
|
6891
|
+
'contract-create': {
|
|
6892
|
+
vmVersion: [VmVersion.Fate2],
|
|
6893
|
+
abiVersion: [AbiVersion.Fate]
|
|
6894
|
+
},
|
|
6895
|
+
'contract-call': {
|
|
6896
|
+
vmVersion: [],
|
|
6897
|
+
abiVersion: [AbiVersion.Fate]
|
|
6898
|
+
},
|
|
6899
|
+
'oracle-call': {
|
|
6900
|
+
vmVersion: [],
|
|
6901
|
+
abiVersion: [AbiVersion.NoAbi, AbiVersion.Fate]
|
|
6816
6902
|
}
|
|
6817
6903
|
}
|
|
6818
6904
|
};
|
|
@@ -6825,13 +6911,24 @@ function getProtocolDetails(protocolVersion, type) {
|
|
|
6825
6911
|
};
|
|
6826
6912
|
}
|
|
6827
6913
|
/* harmony default export */ const ct_version = ({
|
|
6828
|
-
serialize(value, {
|
|
6914
|
+
serialize(value, params, {
|
|
6829
6915
|
consensusProtocolVersion = ConsensusProtocolVersion.Iris
|
|
6830
6916
|
}) {
|
|
6831
6917
|
var _value;
|
|
6832
6918
|
(_value = value) !== null && _value !== void 0 ? _value : value = getProtocolDetails(consensusProtocolVersion, 'contract-create');
|
|
6833
6919
|
return Buffer.from([value.vmVersion, 0, value.abiVersion]);
|
|
6834
6920
|
},
|
|
6921
|
+
async prepare(value, params,
|
|
6922
|
+
// TODO: { consensusProtocolVersion: ConsensusProtocolVersion } | { onNode: Node } | {}
|
|
6923
|
+
options) {
|
|
6924
|
+
if (value != null) return value;
|
|
6925
|
+
if (options.consensusProtocolVersion != null) return undefined;
|
|
6926
|
+
if (Object.keys(ConsensusProtocolVersion).length === 2) return undefined;
|
|
6927
|
+
if (options.onNode != null) {
|
|
6928
|
+
return getProtocolDetails((await options.onNode.getNodeInfo()).consensusProtocolVersion, 'contract-create');
|
|
6929
|
+
}
|
|
6930
|
+
return undefined;
|
|
6931
|
+
},
|
|
6835
6932
|
deserialize(buffer) {
|
|
6836
6933
|
const [vm,, abi] = buffer;
|
|
6837
6934
|
return {
|
|
@@ -6846,34 +6943,36 @@ var external_rlp_ = __webpack_require__(3485);
|
|
|
6846
6943
|
|
|
6847
6944
|
|
|
6848
6945
|
/* harmony default export */ const abi_version = ({
|
|
6946
|
+
_getProtocolDetails(c, tag) {
|
|
6947
|
+
const kind = Tag.ContractCallTx === tag || Tag.GaMetaTx === tag ? 'contract-call' : 'oracle-call';
|
|
6948
|
+
return getProtocolDetails(c, kind).abiVersion;
|
|
6949
|
+
},
|
|
6849
6950
|
serialize(value, {
|
|
6850
|
-
tag
|
|
6951
|
+
tag
|
|
6952
|
+
}, {
|
|
6851
6953
|
consensusProtocolVersion = ConsensusProtocolVersion.Iris
|
|
6852
6954
|
}) {
|
|
6853
|
-
const result = value !== null && value !== void 0 ? value :
|
|
6955
|
+
const result = value !== null && value !== void 0 ? value : this._getProtocolDetails(consensusProtocolVersion, tag);
|
|
6854
6956
|
return Buffer.from([result]);
|
|
6855
6957
|
},
|
|
6958
|
+
async prepare(value, {
|
|
6959
|
+
tag
|
|
6960
|
+
},
|
|
6961
|
+
// TODO: { consensusProtocolVersion: ConsensusProtocolVersion } | { onNode: Node } | {}
|
|
6962
|
+
options) {
|
|
6963
|
+
if (value != null) return value;
|
|
6964
|
+
if (options.consensusProtocolVersion != null) return undefined;
|
|
6965
|
+
if (Object.keys(ConsensusProtocolVersion).length === 2) return undefined;
|
|
6966
|
+
if (options.onNode != null) {
|
|
6967
|
+
return this._getProtocolDetails((await options.onNode.getNodeInfo()).consensusProtocolVersion, tag);
|
|
6968
|
+
}
|
|
6969
|
+
return undefined;
|
|
6970
|
+
},
|
|
6856
6971
|
deserialize(buffer) {
|
|
6857
6972
|
return buffer[0];
|
|
6858
6973
|
}
|
|
6859
6974
|
});
|
|
6860
6975
|
;// CONCATENATED MODULE: ./src/utils/bytes.ts
|
|
6861
|
-
/*
|
|
6862
|
-
* ISC License (ISC)
|
|
6863
|
-
* Copyright 2018 aeternity developers
|
|
6864
|
-
*
|
|
6865
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
6866
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
6867
|
-
* copyright notice and this permission notice appear in all copies.
|
|
6868
|
-
*
|
|
6869
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
6870
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
6871
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
6872
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
6873
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
6874
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
6875
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
6876
|
-
*/
|
|
6877
6976
|
|
|
6878
6977
|
|
|
6879
6978
|
|
|
@@ -7142,13 +7241,12 @@ function isAuctionName(name) {
|
|
|
7142
7241
|
serializeAettos(value) {
|
|
7143
7242
|
return value !== null && value !== void 0 ? value : '0';
|
|
7144
7243
|
},
|
|
7145
|
-
serialize(value, {
|
|
7146
|
-
denomination
|
|
7147
|
-
...options
|
|
7244
|
+
serialize(value, params, {
|
|
7245
|
+
denomination = AE_AMOUNT_FORMATS.AETTOS
|
|
7148
7246
|
}) {
|
|
7149
7247
|
return u_int.serialize(this.serializeAettos(value != null ? formatAmount(value, {
|
|
7150
7248
|
denomination
|
|
7151
|
-
}) : value,
|
|
7249
|
+
}) : value, params));
|
|
7152
7250
|
}
|
|
7153
7251
|
});
|
|
7154
7252
|
;// CONCATENATED MODULE: ./src/tx/builder/field-types/deposit.ts
|
|
@@ -7159,13 +7257,14 @@ function isAuctionName(name) {
|
|
|
7159
7257
|
/**
|
|
7160
7258
|
* @param value - Deposit value in string format. Should be equal to '0'.
|
|
7161
7259
|
* @param options - Options
|
|
7260
|
+
* @param parameters - Parameters
|
|
7162
7261
|
* @returns Deposit value Buffer.
|
|
7163
7262
|
*/
|
|
7164
|
-
serialize(value, options) {
|
|
7263
|
+
serialize(value, options, parameters) {
|
|
7165
7264
|
var _value;
|
|
7166
7265
|
(_value = value) !== null && _value !== void 0 ? _value : value = 0;
|
|
7167
7266
|
if (+value !== 0) throw new IllegalArgumentError(`Contract deposit is not refundable, so it should be equal 0, got ${value.toString()} instead`);
|
|
7168
|
-
return coin_amount.serialize(value, options);
|
|
7267
|
+
return coin_amount.serialize(value, options, parameters);
|
|
7169
7268
|
}
|
|
7170
7269
|
});
|
|
7171
7270
|
;// CONCATENATED MODULE: ./src/tx/builder/field-types/encoded.ts
|
|
@@ -7194,6 +7293,9 @@ function genEntryField(tag) {
|
|
|
7194
7293
|
buildTx
|
|
7195
7294
|
}) {
|
|
7196
7295
|
if (ArrayBuffer.isView(txParams)) return Buffer.from(txParams);
|
|
7296
|
+
if (typeof txParams === 'string' && txParams.startsWith('tx_')) {
|
|
7297
|
+
return decode(txParams);
|
|
7298
|
+
}
|
|
7197
7299
|
return decode(buildTx({
|
|
7198
7300
|
...txParams,
|
|
7199
7301
|
...(tag != null && {
|
|
@@ -7331,9 +7433,13 @@ function buildFee(builtTx, unpackTx, buildTx) {
|
|
|
7331
7433
|
length
|
|
7332
7434
|
} = decode(builtTx);
|
|
7333
7435
|
const txObject = unpackTx(builtTx);
|
|
7436
|
+
let innerTxSize = 0;
|
|
7437
|
+
if (txObject.tag === Tag.GaMetaTx || txObject.tag === Tag.PayingForTx) {
|
|
7438
|
+
innerTxSize = decode(buildTx(txObject.tx.encodedTx)).length;
|
|
7439
|
+
}
|
|
7334
7440
|
return TX_FEE_BASE_GAS(txObject.tag).plus(TX_FEE_OTHER_GAS(txObject.tag, length, {
|
|
7335
7441
|
relativeTtl: getOracleRelativeTtl(txObject),
|
|
7336
|
-
innerTxSize
|
|
7442
|
+
innerTxSize
|
|
7337
7443
|
})).times(MIN_GAS_PRICE);
|
|
7338
7444
|
}
|
|
7339
7445
|
|
|
@@ -7397,8 +7503,9 @@ function calculateGasLimitMax(gasMax, rebuildTx, unpackTx, buildTx) {
|
|
|
7397
7503
|
rebuildTx,
|
|
7398
7504
|
unpackTx,
|
|
7399
7505
|
buildTx,
|
|
7400
|
-
gasMax = 6e6,
|
|
7401
7506
|
_computingGasLimit
|
|
7507
|
+
}, {
|
|
7508
|
+
gasMax = 6e6
|
|
7402
7509
|
}) {
|
|
7403
7510
|
if (_computingGasLimit != null) return short_u_int.serialize(_computingGasLimit);
|
|
7404
7511
|
const gasLimitMax = tag === Tag.GaMetaTx ? MAX_AUTH_FUN_GAS : calculateGasLimitMax(gasMax, gasLimit => rebuildTx({
|
|
@@ -7425,6 +7532,44 @@ function calculateGasLimitMax(gasMax, rebuildTx, unpackTx, buildTx) {
|
|
|
7425
7532
|
return value;
|
|
7426
7533
|
}
|
|
7427
7534
|
});
|
|
7535
|
+
;// CONCATENATED MODULE: ./src/tx/builder/field-types/map.ts
|
|
7536
|
+
|
|
7537
|
+
|
|
7538
|
+
function genMapField(encoding, tag) {
|
|
7539
|
+
return {
|
|
7540
|
+
serialize(object, {
|
|
7541
|
+
buildTx
|
|
7542
|
+
}) {
|
|
7543
|
+
return decode(buildTx({
|
|
7544
|
+
tag: Tag.Mtree,
|
|
7545
|
+
values: Object.entries(object).map(([key, value]) => ({
|
|
7546
|
+
tag: Tag.MtreeValue,
|
|
7547
|
+
key: decode(key),
|
|
7548
|
+
value: decode(buildTx({
|
|
7549
|
+
...value,
|
|
7550
|
+
tag
|
|
7551
|
+
}))
|
|
7552
|
+
}))
|
|
7553
|
+
}));
|
|
7554
|
+
},
|
|
7555
|
+
deserialize(buffer, {
|
|
7556
|
+
unpackTx
|
|
7557
|
+
}) {
|
|
7558
|
+
const {
|
|
7559
|
+
values
|
|
7560
|
+
} = unpackTx(encode(buffer, Encoding.Transaction), Tag.Mtree);
|
|
7561
|
+
return Object.fromEntries(values
|
|
7562
|
+
// TODO: remove after resolving https://github.com/aeternity/aeternity/issues/4066
|
|
7563
|
+
.filter(({
|
|
7564
|
+
key
|
|
7565
|
+
}) => encoding !== Encoding.ContractAddress || key.length === 32).map(({
|
|
7566
|
+
key,
|
|
7567
|
+
value
|
|
7568
|
+
}) => [encode(key, encoding), unpackTx(encode(value, Encoding.Transaction), tag)]));
|
|
7569
|
+
},
|
|
7570
|
+
recursiveType: true
|
|
7571
|
+
};
|
|
7572
|
+
}
|
|
7428
7573
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/helpers/classPrivateFieldSet.js
|
|
7429
7574
|
var classPrivateFieldSet = __webpack_require__(719);
|
|
7430
7575
|
var classPrivateFieldSet_default = /*#__PURE__*/__webpack_require__.n(classPrivateFieldSet);
|
|
@@ -7471,6 +7616,11 @@ class MPTree {
|
|
|
7471
7616
|
*/
|
|
7472
7617
|
constructor(binary, encoding, tag, unpTx) {
|
|
7473
7618
|
_classPrivateMethodInitSpec(this, _entriesRaw);
|
|
7619
|
+
/**
|
|
7620
|
+
* Retrieve value from Merkle Patricia Tree
|
|
7621
|
+
* @param _key - The key of the element to retrieve
|
|
7622
|
+
* @returns Value associated to the specified key
|
|
7623
|
+
*/
|
|
7474
7624
|
_classPrivateMethodInitSpec(this, _getRaw);
|
|
7475
7625
|
_classPrivateFieldInitSpec(this, _rootHash, {
|
|
7476
7626
|
writable: true,
|
|
@@ -7545,13 +7695,6 @@ class MPTree {
|
|
|
7545
7695
|
serialize() {
|
|
7546
7696
|
return [Buffer.from(classPrivateFieldGet_default()(this, _rootHash), 'hex'), Object.entries(classPrivateFieldGet_default()(this, _nodes)).map(([mptHash, value]) => [Buffer.from(mptHash, 'hex'), value])];
|
|
7547
7697
|
}
|
|
7548
|
-
|
|
7549
|
-
/**
|
|
7550
|
-
* Retrieve value from Merkle Patricia Tree
|
|
7551
|
-
* @param _key - The key of the element to retrieve
|
|
7552
|
-
* @returns Value associated to the specified key
|
|
7553
|
-
*/
|
|
7554
|
-
|
|
7555
7698
|
/**
|
|
7556
7699
|
* Retrieve value from Merkle Patricia Tree
|
|
7557
7700
|
* @param key - The key of the element to retrieve
|
|
@@ -7718,8 +7861,8 @@ function genMPTreeField(encoding, tag) {
|
|
|
7718
7861
|
* @param txFields - Transaction fields
|
|
7719
7862
|
* @param txFields.name - AENS Name in transaction
|
|
7720
7863
|
*/
|
|
7721
|
-
serialize(value, txFields) {
|
|
7722
|
-
return coin_amount.serialize.call(this, value, txFields);
|
|
7864
|
+
serialize(value, txFields, parameters) {
|
|
7865
|
+
return coin_amount.serialize.call(this, value, txFields, parameters);
|
|
7723
7866
|
}
|
|
7724
7867
|
});
|
|
7725
7868
|
;// CONCATENATED MODULE: ./src/tx/builder/field-types/name-id.ts
|
|
@@ -7736,6 +7879,35 @@ const addressName = genAddressField(Encoding.Name);
|
|
|
7736
7879
|
return addressName.serialize(isNameValid(value) ? produceNameId(value) : value);
|
|
7737
7880
|
}
|
|
7738
7881
|
});
|
|
7882
|
+
;// CONCATENATED MODULE: ./src/tx/builder/field-types/nonce.ts
|
|
7883
|
+
|
|
7884
|
+
|
|
7885
|
+
|
|
7886
|
+
function genNonceField(senderKey) {
|
|
7887
|
+
return {
|
|
7888
|
+
...short_u_int,
|
|
7889
|
+
async prepare(value, params, options) {
|
|
7890
|
+
if (value != null) return value;
|
|
7891
|
+
const {
|
|
7892
|
+
onNode,
|
|
7893
|
+
strategy
|
|
7894
|
+
} = options;
|
|
7895
|
+
const senderId = options[senderKey];
|
|
7896
|
+
const requirement = 'provided (or provide `nonce` instead)';
|
|
7897
|
+
if (onNode == null) throw new ArgumentError('onNode', requirement, onNode);
|
|
7898
|
+
if (senderId == null) throw new ArgumentError('senderId', requirement, senderId);
|
|
7899
|
+
return (await onNode.getAccountNextNonce(senderId.replace(/^ok_/, 'ak_'), {
|
|
7900
|
+
strategy
|
|
7901
|
+
}).catch(error => {
|
|
7902
|
+
if (!isAccountNotFoundError(error)) throw error;
|
|
7903
|
+
return {
|
|
7904
|
+
nextNonce: 1
|
|
7905
|
+
};
|
|
7906
|
+
})).nextNonce;
|
|
7907
|
+
},
|
|
7908
|
+
senderKey
|
|
7909
|
+
};
|
|
7910
|
+
}
|
|
7739
7911
|
;// CONCATENATED MODULE: ./src/tx/builder/field-types/pointers.ts
|
|
7740
7912
|
|
|
7741
7913
|
|
|
@@ -7781,17 +7953,21 @@ const addressAny = genAddressField(...idTagToEncoding);
|
|
|
7781
7953
|
;// CONCATENATED MODULE: ./src/tx/builder/field-types/short-u-int-const.ts
|
|
7782
7954
|
|
|
7783
7955
|
|
|
7784
|
-
function genShortUIntConstField(
|
|
7956
|
+
function genShortUIntConstField(constValue, optional) {
|
|
7785
7957
|
return {
|
|
7786
|
-
serialize(
|
|
7787
|
-
if (
|
|
7788
|
-
|
|
7958
|
+
serialize(value) {
|
|
7959
|
+
if ((optional !== true || value != null) && value !== constValue) {
|
|
7960
|
+
throw new ArgumentError('ShortUIntConst', constValue, value);
|
|
7961
|
+
}
|
|
7962
|
+
return short_u_int.serialize(constValue);
|
|
7789
7963
|
},
|
|
7790
7964
|
deserialize(buf) {
|
|
7791
|
-
const
|
|
7792
|
-
if (
|
|
7793
|
-
return
|
|
7794
|
-
}
|
|
7965
|
+
const value = short_u_int.deserialize(buf);
|
|
7966
|
+
if (value !== constValue) throw new ArgumentError('ShortUIntConst', constValue, value);
|
|
7967
|
+
return constValue;
|
|
7968
|
+
},
|
|
7969
|
+
constValue,
|
|
7970
|
+
constValueOptional: optional === true
|
|
7795
7971
|
};
|
|
7796
7972
|
}
|
|
7797
7973
|
;// CONCATENATED MODULE: ./src/tx/builder/field-types/string.ts
|
|
@@ -7804,6 +7980,47 @@ function genShortUIntConstField(value) {
|
|
|
7804
7980
|
return buffer.toString();
|
|
7805
7981
|
}
|
|
7806
7982
|
});
|
|
7983
|
+
;// CONCATENATED MODULE: ./src/tx/builder/field-types/ttl.ts
|
|
7984
|
+
|
|
7985
|
+
|
|
7986
|
+
/* harmony default export */ const ttl = ({
|
|
7987
|
+
...short_u_int,
|
|
7988
|
+
serialize(value) {
|
|
7989
|
+
return short_u_int.serialize(value !== null && value !== void 0 ? value : 0);
|
|
7990
|
+
},
|
|
7991
|
+
async prepare(value, params,
|
|
7992
|
+
// TODO: { absoluteTtl: true } | { absoluteTtl: false, onNode: Node }
|
|
7993
|
+
{
|
|
7994
|
+
onNode,
|
|
7995
|
+
absoluteTtl
|
|
7996
|
+
}) {
|
|
7997
|
+
if (absoluteTtl !== true && value !== 0 && value != null) {
|
|
7998
|
+
if (onNode == null) throw new ArgumentError('onNode', 'provided', onNode);
|
|
7999
|
+
value += (await onNode.getCurrentKeyBlock()).height;
|
|
8000
|
+
}
|
|
8001
|
+
return value;
|
|
8002
|
+
}
|
|
8003
|
+
});
|
|
8004
|
+
;// CONCATENATED MODULE: ./src/tx/builder/field-types/wrapped.ts
|
|
8005
|
+
|
|
8006
|
+
function genWrappedField(tag) {
|
|
8007
|
+
return {
|
|
8008
|
+
serialize(payload, {
|
|
8009
|
+
buildTx
|
|
8010
|
+
}) {
|
|
8011
|
+
return decode(buildTx({
|
|
8012
|
+
tag,
|
|
8013
|
+
payload
|
|
8014
|
+
}));
|
|
8015
|
+
},
|
|
8016
|
+
deserialize(buffer, {
|
|
8017
|
+
unpackTx
|
|
8018
|
+
}) {
|
|
8019
|
+
return unpackTx(encode(buffer, Encoding.Transaction), tag).payload;
|
|
8020
|
+
},
|
|
8021
|
+
recursiveType: true
|
|
8022
|
+
};
|
|
8023
|
+
}
|
|
7807
8024
|
;// CONCATENATED MODULE: ./src/tx/builder/field-types/index.ts
|
|
7808
8025
|
|
|
7809
8026
|
|
|
@@ -7825,6 +8042,10 @@ function genShortUIntConstField(value) {
|
|
|
7825
8042
|
|
|
7826
8043
|
|
|
7827
8044
|
|
|
8045
|
+
|
|
8046
|
+
|
|
8047
|
+
|
|
8048
|
+
|
|
7828
8049
|
|
|
7829
8050
|
|
|
7830
8051
|
|
|
@@ -7845,16 +8066,20 @@ const field_types_fee = fee;
|
|
|
7845
8066
|
const field_types_field = (/* unused pure expression or super */ null && (_field));
|
|
7846
8067
|
const gasLimit = gas_limit;
|
|
7847
8068
|
const gasPrice = gas_price;
|
|
8069
|
+
const map = genMapField;
|
|
7848
8070
|
const mptree = genMPTreeField;
|
|
7849
8071
|
const builder_field_types_name = field_types_name;
|
|
7850
8072
|
const nameFee = name_fee;
|
|
7851
8073
|
const nameId = name_id;
|
|
8074
|
+
const nonce = genNonceField;
|
|
7852
8075
|
const field_types_pointers = pointers;
|
|
7853
8076
|
const field_types_raw = raw;
|
|
7854
8077
|
const shortUInt = short_u_int;
|
|
7855
8078
|
const shortUIntConst = genShortUIntConstField;
|
|
7856
8079
|
const field_types_string = string;
|
|
8080
|
+
const field_types_ttl = ttl;
|
|
7857
8081
|
const uInt = u_int;
|
|
8082
|
+
const wrapped = genWrappedField;
|
|
7858
8083
|
|
|
7859
8084
|
;// CONCATENATED MODULE: ./src/tx/builder/schema.ts
|
|
7860
8085
|
/**
|
|
@@ -7869,14 +8094,11 @@ const uInt = u_int;
|
|
|
7869
8094
|
|
|
7870
8095
|
let ORACLE_TTL_TYPES;
|
|
7871
8096
|
|
|
7872
|
-
// #
|
|
8097
|
+
// # ORACLE
|
|
7873
8098
|
(function (ORACLE_TTL_TYPES) {
|
|
7874
8099
|
ORACLE_TTL_TYPES[ORACLE_TTL_TYPES["delta"] = 0] = "delta";
|
|
7875
8100
|
ORACLE_TTL_TYPES[ORACLE_TTL_TYPES["block"] = 1] = "block";
|
|
7876
8101
|
})(ORACLE_TTL_TYPES || (ORACLE_TTL_TYPES = {}));
|
|
7877
|
-
const TX_TTL = 0;
|
|
7878
|
-
// # ORACLE
|
|
7879
|
-
const QUERY_FEE = 30000;
|
|
7880
8102
|
const ORACLE_TTL = {
|
|
7881
8103
|
type: ORACLE_TTL_TYPES.delta,
|
|
7882
8104
|
value: 500
|
|
@@ -7895,164 +8117,471 @@ const DRY_RUN_ACCOUNT = {
|
|
|
7895
8117
|
amount: 100000000000000000000000000000000000n
|
|
7896
8118
|
};
|
|
7897
8119
|
let CallReturnType;
|
|
8120
|
+
|
|
8121
|
+
// TODO: figure out how to omit overriding types of recursive fields
|
|
7898
8122
|
(function (CallReturnType) {
|
|
7899
8123
|
CallReturnType[CallReturnType["Ok"] = 0] = "Ok";
|
|
7900
8124
|
CallReturnType[CallReturnType["Error"] = 1] = "Error";
|
|
7901
8125
|
CallReturnType[CallReturnType["Revert"] = 2] = "Revert";
|
|
7902
8126
|
})(CallReturnType || (CallReturnType = {}));
|
|
8127
|
+
const entryAny = entry();
|
|
8128
|
+
const entrySignedTx = entry(Tag.SignedTx);
|
|
8129
|
+
const entryMtreeValueArray = array(entry(Tag.MtreeValue));
|
|
8130
|
+
const entryTreesPoi = entry(Tag.TreesPoi);
|
|
8131
|
+
const mapContracts = map(Encoding.ContractAddress, Tag.Contract);
|
|
8132
|
+
const mapAccounts = map(Encoding.AccountAddress, Tag.Account);
|
|
8133
|
+
const mapCalls = map(Encoding.Bytearray, Tag.ContractCall);
|
|
8134
|
+
const mapChannels = map(Encoding.Channel, Tag.Channel);
|
|
8135
|
+
const mapNames = map(Encoding.Name, Tag.Name);
|
|
8136
|
+
const mapOracles = map(Encoding.OracleAddress, Tag.Oracle);
|
|
8137
|
+
|
|
7903
8138
|
/**
|
|
7904
8139
|
* @see {@link https://github.com/aeternity/protocol/blob/c007deeac4a01e401238412801ac7084ac72d60e/serializations.md#accounts-version-1-basic-accounts}
|
|
7905
8140
|
*/
|
|
7906
|
-
const
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8141
|
+
const txSchema = [{
|
|
8142
|
+
tag: shortUIntConst(Tag.Account),
|
|
8143
|
+
version: shortUIntConst(1),
|
|
8144
|
+
nonce: shortUInt,
|
|
8145
|
+
balance: uInt
|
|
8146
|
+
}, {
|
|
8147
|
+
tag: shortUIntConst(Tag.Account),
|
|
8148
|
+
version: shortUIntConst(2, true),
|
|
8149
|
+
flags: uInt,
|
|
8150
|
+
nonce: shortUInt,
|
|
8151
|
+
balance: uInt,
|
|
8152
|
+
gaContract: address(Encoding.ContractAddress, Encoding.Name),
|
|
8153
|
+
gaAuthFun: encoded(Encoding.ContractBytearray)
|
|
8154
|
+
}, {
|
|
8155
|
+
tag: shortUIntConst(Tag.SignedTx),
|
|
8156
|
+
version: shortUIntConst(1, true),
|
|
8157
|
+
signatures: array(field_types_raw),
|
|
8158
|
+
encodedTx: entryAny
|
|
8159
|
+
}, {
|
|
8160
|
+
tag: shortUIntConst(Tag.SpendTx),
|
|
8161
|
+
version: shortUIntConst(1, true),
|
|
8162
|
+
senderId: address(Encoding.AccountAddress),
|
|
8163
|
+
recipientId: address(Encoding.AccountAddress, Encoding.Name),
|
|
8164
|
+
amount: coinAmount,
|
|
8165
|
+
fee: field_types_fee,
|
|
8166
|
+
ttl: field_types_ttl,
|
|
8167
|
+
nonce: nonce('senderId'),
|
|
8168
|
+
payload: encoded(Encoding.Bytearray, true)
|
|
8169
|
+
}, {
|
|
8170
|
+
tag: shortUIntConst(Tag.Name),
|
|
8171
|
+
version: shortUIntConst(1, true),
|
|
8172
|
+
accountId: address(Encoding.AccountAddress),
|
|
8173
|
+
nameTtl: shortUInt,
|
|
8174
|
+
status: field_types_raw,
|
|
8175
|
+
clientTtl: shortUInt,
|
|
8176
|
+
pointers: field_types_pointers
|
|
8177
|
+
}, {
|
|
8178
|
+
tag: shortUIntConst(Tag.NamePreclaimTx),
|
|
8179
|
+
version: shortUIntConst(1, true),
|
|
8180
|
+
accountId: address(Encoding.AccountAddress),
|
|
8181
|
+
nonce: nonce('accountId'),
|
|
8182
|
+
commitmentId: address(Encoding.Commitment),
|
|
8183
|
+
fee: field_types_fee,
|
|
8184
|
+
ttl: field_types_ttl
|
|
8185
|
+
}, {
|
|
8186
|
+
tag: shortUIntConst(Tag.NameClaimTx),
|
|
8187
|
+
version: shortUIntConst(2, true),
|
|
8188
|
+
accountId: address(Encoding.AccountAddress),
|
|
8189
|
+
nonce: nonce('accountId'),
|
|
8190
|
+
name: builder_field_types_name,
|
|
8191
|
+
nameSalt: uInt,
|
|
8192
|
+
nameFee: nameFee,
|
|
8193
|
+
fee: field_types_fee,
|
|
8194
|
+
ttl: field_types_ttl
|
|
8195
|
+
}, {
|
|
8196
|
+
tag: shortUIntConst(Tag.NameUpdateTx),
|
|
8197
|
+
version: shortUIntConst(1, true),
|
|
8198
|
+
accountId: address(Encoding.AccountAddress),
|
|
8199
|
+
nonce: nonce('accountId'),
|
|
8200
|
+
nameId: nameId,
|
|
8201
|
+
nameTtl: shortUInt,
|
|
8202
|
+
pointers: field_types_pointers,
|
|
8203
|
+
clientTtl: shortUInt,
|
|
8204
|
+
fee: field_types_fee,
|
|
8205
|
+
ttl: field_types_ttl
|
|
8206
|
+
}, {
|
|
8207
|
+
tag: shortUIntConst(Tag.NameTransferTx),
|
|
8208
|
+
version: shortUIntConst(1, true),
|
|
8209
|
+
accountId: address(Encoding.AccountAddress),
|
|
8210
|
+
nonce: nonce('accountId'),
|
|
8211
|
+
nameId: nameId,
|
|
8212
|
+
recipientId: address(Encoding.AccountAddress, Encoding.Name),
|
|
8213
|
+
fee: field_types_fee,
|
|
8214
|
+
ttl: field_types_ttl
|
|
8215
|
+
}, {
|
|
8216
|
+
tag: shortUIntConst(Tag.NameRevokeTx),
|
|
8217
|
+
version: shortUIntConst(1, true),
|
|
8218
|
+
accountId: address(Encoding.AccountAddress),
|
|
8219
|
+
nonce: nonce('accountId'),
|
|
8220
|
+
nameId: nameId,
|
|
8221
|
+
fee: field_types_fee,
|
|
8222
|
+
ttl: field_types_ttl
|
|
8223
|
+
}, {
|
|
8224
|
+
tag: shortUIntConst(Tag.Contract),
|
|
8225
|
+
version: shortUIntConst(1, true),
|
|
8226
|
+
owner: address(Encoding.AccountAddress),
|
|
8227
|
+
ctVersion: ctVersion,
|
|
8228
|
+
code: encoded(Encoding.ContractBytearray),
|
|
8229
|
+
log: encoded(Encoding.ContractBytearray),
|
|
8230
|
+
active: builder_field_types_boolean,
|
|
8231
|
+
referers: array(address(Encoding.AccountAddress)),
|
|
8232
|
+
deposit: field_types_deposit
|
|
8233
|
+
}, {
|
|
8234
|
+
tag: shortUIntConst(Tag.ContractCreateTx),
|
|
8235
|
+
version: shortUIntConst(1, true),
|
|
8236
|
+
ownerId: address(Encoding.AccountAddress),
|
|
8237
|
+
nonce: nonce('ownerId'),
|
|
8238
|
+
code: encoded(Encoding.ContractBytearray),
|
|
8239
|
+
ctVersion: ctVersion,
|
|
8240
|
+
fee: field_types_fee,
|
|
8241
|
+
ttl: field_types_ttl,
|
|
8242
|
+
deposit: field_types_deposit,
|
|
8243
|
+
amount: coinAmount,
|
|
8244
|
+
gasLimit: gasLimit,
|
|
8245
|
+
gasPrice: gasPrice,
|
|
8246
|
+
callData: encoded(Encoding.ContractBytearray)
|
|
8247
|
+
}, {
|
|
8248
|
+
tag: shortUIntConst(Tag.ContractCallTx),
|
|
8249
|
+
version: shortUIntConst(1, true),
|
|
8250
|
+
callerId: address(Encoding.AccountAddress),
|
|
8251
|
+
nonce: nonce('callerId'),
|
|
8252
|
+
contractId: address(Encoding.ContractAddress, Encoding.Name),
|
|
8253
|
+
abiVersion: abiVersion,
|
|
8254
|
+
fee: field_types_fee,
|
|
8255
|
+
ttl: field_types_ttl,
|
|
8256
|
+
amount: coinAmount,
|
|
8257
|
+
gasLimit: gasLimit,
|
|
8258
|
+
gasPrice: gasPrice,
|
|
8259
|
+
callData: encoded(Encoding.ContractBytearray)
|
|
8260
|
+
}, {
|
|
8261
|
+
tag: shortUIntConst(Tag.ContractCall),
|
|
8262
|
+
version: shortUIntConst(2, true),
|
|
8263
|
+
callerId: address(Encoding.AccountAddress),
|
|
8264
|
+
callerNonce: shortUInt,
|
|
8265
|
+
height: shortUInt,
|
|
8266
|
+
contractId: address(Encoding.ContractAddress),
|
|
8267
|
+
// TODO: rename after resolving https://github.com/aeternity/protocol/issues/506
|
|
8268
|
+
gasPrice: uInt,
|
|
8269
|
+
gasUsed: shortUInt,
|
|
8270
|
+
returnValue: encoded(Encoding.ContractBytearray),
|
|
8271
|
+
returnType: enumeration(CallReturnType),
|
|
8272
|
+
// TODO: add serialization for
|
|
8273
|
+
// <log> :: [ { <address> :: id, [ <topics> :: binary() }, <data> :: binary() } ]
|
|
8274
|
+
log: array(field_types_raw)
|
|
8275
|
+
}, {
|
|
8276
|
+
tag: shortUIntConst(Tag.Oracle),
|
|
8277
|
+
version: shortUIntConst(1, true),
|
|
8278
|
+
accountId: address(Encoding.AccountAddress),
|
|
8279
|
+
queryFormat: field_types_string,
|
|
8280
|
+
responseFormat: field_types_string,
|
|
8281
|
+
queryFee: coinAmount,
|
|
8282
|
+
oracleTtlValue: shortUInt,
|
|
8283
|
+
abiVersion: abiVersion
|
|
8284
|
+
}, {
|
|
8285
|
+
tag: shortUIntConst(Tag.OracleRegisterTx),
|
|
8286
|
+
version: shortUIntConst(1, true),
|
|
8287
|
+
accountId: address(Encoding.AccountAddress),
|
|
8288
|
+
nonce: nonce('accountId'),
|
|
8289
|
+
queryFormat: field_types_string,
|
|
8290
|
+
responseFormat: field_types_string,
|
|
8291
|
+
queryFee: coinAmount,
|
|
8292
|
+
oracleTtlType: enumeration(ORACLE_TTL_TYPES),
|
|
8293
|
+
oracleTtlValue: shortUInt,
|
|
8294
|
+
fee: field_types_fee,
|
|
8295
|
+
ttl: field_types_ttl,
|
|
8296
|
+
abiVersion: abiVersion
|
|
8297
|
+
}, {
|
|
8298
|
+
tag: shortUIntConst(Tag.OracleExtendTx),
|
|
8299
|
+
version: shortUIntConst(1, true),
|
|
8300
|
+
oracleId: address(Encoding.OracleAddress, Encoding.Name),
|
|
8301
|
+
nonce: nonce('oracleId'),
|
|
8302
|
+
oracleTtlType: enumeration(ORACLE_TTL_TYPES),
|
|
8303
|
+
oracleTtlValue: shortUInt,
|
|
8304
|
+
fee: field_types_fee,
|
|
8305
|
+
ttl: field_types_ttl
|
|
8306
|
+
}, {
|
|
8307
|
+
tag: shortUIntConst(Tag.OracleQueryTx),
|
|
8308
|
+
version: shortUIntConst(1, true),
|
|
8309
|
+
senderId: address(Encoding.AccountAddress),
|
|
8310
|
+
nonce: nonce('senderId'),
|
|
8311
|
+
oracleId: address(Encoding.OracleAddress, Encoding.Name),
|
|
8312
|
+
query: field_types_string,
|
|
8313
|
+
queryFee: coinAmount,
|
|
8314
|
+
queryTtlType: enumeration(ORACLE_TTL_TYPES),
|
|
8315
|
+
queryTtlValue: shortUInt,
|
|
8316
|
+
responseTtlType: enumeration(ORACLE_TTL_TYPES),
|
|
8317
|
+
responseTtlValue: shortUInt,
|
|
8318
|
+
fee: field_types_fee,
|
|
8319
|
+
ttl: field_types_ttl
|
|
8320
|
+
}, {
|
|
8321
|
+
tag: shortUIntConst(Tag.OracleResponseTx),
|
|
8322
|
+
version: shortUIntConst(1, true),
|
|
8323
|
+
oracleId: address(Encoding.OracleAddress),
|
|
8324
|
+
nonce: nonce('oracleId'),
|
|
8325
|
+
queryId: encoded(Encoding.OracleQueryId),
|
|
8326
|
+
response: field_types_string,
|
|
8327
|
+
responseTtlType: enumeration(ORACLE_TTL_TYPES),
|
|
8328
|
+
responseTtlValue: shortUInt,
|
|
8329
|
+
fee: field_types_fee,
|
|
8330
|
+
ttl: field_types_ttl
|
|
8331
|
+
}, {
|
|
8332
|
+
tag: shortUIntConst(Tag.ChannelCreateTx),
|
|
8333
|
+
version: shortUIntConst(2, true),
|
|
8334
|
+
initiator: address(Encoding.AccountAddress),
|
|
8335
|
+
initiatorAmount: uInt,
|
|
8336
|
+
responder: address(Encoding.AccountAddress),
|
|
8337
|
+
responderAmount: uInt,
|
|
8338
|
+
channelReserve: uInt,
|
|
8339
|
+
lockPeriod: uInt,
|
|
8340
|
+
ttl: field_types_ttl,
|
|
8341
|
+
fee: field_types_fee,
|
|
8342
|
+
initiatorDelegateIds: array(address(...idTagToEncoding)),
|
|
8343
|
+
responderDelegateIds: array(address(...idTagToEncoding)),
|
|
8344
|
+
stateHash: encoded(Encoding.State),
|
|
8345
|
+
nonce: nonce('initiator')
|
|
8346
|
+
}, {
|
|
8347
|
+
tag: shortUIntConst(Tag.ChannelCloseMutualTx),
|
|
8348
|
+
version: shortUIntConst(1, true),
|
|
8349
|
+
channelId: address(Encoding.Channel),
|
|
8350
|
+
fromId: address(Encoding.AccountAddress),
|
|
8351
|
+
initiatorAmountFinal: uInt,
|
|
8352
|
+
responderAmountFinal: uInt,
|
|
8353
|
+
ttl: field_types_ttl,
|
|
8354
|
+
fee: field_types_fee,
|
|
8355
|
+
nonce: nonce('fromId')
|
|
8356
|
+
}, {
|
|
8357
|
+
tag: shortUIntConst(Tag.ChannelCloseSoloTx),
|
|
8358
|
+
version: shortUIntConst(1, true),
|
|
8359
|
+
channelId: address(Encoding.Channel),
|
|
8360
|
+
fromId: address(Encoding.AccountAddress),
|
|
8361
|
+
payload: encoded(Encoding.Transaction),
|
|
8362
|
+
poi: entryTreesPoi,
|
|
8363
|
+
ttl: field_types_ttl,
|
|
8364
|
+
fee: field_types_fee,
|
|
8365
|
+
nonce: nonce('fromId')
|
|
8366
|
+
}, {
|
|
8367
|
+
tag: shortUIntConst(Tag.ChannelSlashTx),
|
|
8368
|
+
version: shortUIntConst(1, true),
|
|
8369
|
+
channelId: address(Encoding.Channel),
|
|
8370
|
+
fromId: address(Encoding.AccountAddress),
|
|
8371
|
+
payload: encoded(Encoding.Transaction),
|
|
8372
|
+
poi: entryTreesPoi,
|
|
8373
|
+
ttl: field_types_ttl,
|
|
8374
|
+
fee: field_types_fee,
|
|
8375
|
+
nonce: nonce('fromId')
|
|
8376
|
+
}, {
|
|
8377
|
+
tag: shortUIntConst(Tag.ChannelDepositTx),
|
|
8378
|
+
version: shortUIntConst(1, true),
|
|
8379
|
+
channelId: address(Encoding.Channel),
|
|
8380
|
+
fromId: address(Encoding.AccountAddress),
|
|
8381
|
+
amount: uInt,
|
|
8382
|
+
ttl: field_types_ttl,
|
|
8383
|
+
fee: field_types_fee,
|
|
8384
|
+
stateHash: encoded(Encoding.State),
|
|
8385
|
+
round: shortUInt,
|
|
8386
|
+
nonce: nonce('fromId')
|
|
8387
|
+
}, {
|
|
8388
|
+
tag: shortUIntConst(Tag.ChannelWithdrawTx),
|
|
8389
|
+
version: shortUIntConst(1, true),
|
|
8390
|
+
channelId: address(Encoding.Channel),
|
|
8391
|
+
toId: address(Encoding.AccountAddress),
|
|
8392
|
+
amount: uInt,
|
|
8393
|
+
ttl: field_types_ttl,
|
|
8394
|
+
fee: field_types_fee,
|
|
8395
|
+
stateHash: encoded(Encoding.State),
|
|
8396
|
+
round: shortUInt,
|
|
8397
|
+
nonce: nonce('fromId')
|
|
8398
|
+
}, {
|
|
8399
|
+
tag: shortUIntConst(Tag.ChannelSettleTx),
|
|
8400
|
+
version: shortUIntConst(1, true),
|
|
8401
|
+
channelId: address(Encoding.Channel),
|
|
8402
|
+
fromId: address(Encoding.AccountAddress),
|
|
8403
|
+
initiatorAmountFinal: uInt,
|
|
8404
|
+
responderAmountFinal: uInt,
|
|
8405
|
+
ttl: field_types_ttl,
|
|
8406
|
+
fee: field_types_fee,
|
|
8407
|
+
nonce: nonce('fromId')
|
|
8408
|
+
}, {
|
|
8409
|
+
tag: shortUIntConst(Tag.ChannelForceProgressTx),
|
|
8410
|
+
version: shortUIntConst(1, true),
|
|
8411
|
+
channelId: address(Encoding.Channel),
|
|
8412
|
+
fromId: address(Encoding.AccountAddress),
|
|
8413
|
+
payload: encoded(Encoding.Transaction),
|
|
8414
|
+
round: shortUInt,
|
|
8415
|
+
update: encoded(Encoding.ContractBytearray),
|
|
8416
|
+
stateHash: encoded(Encoding.State),
|
|
8417
|
+
offChainTrees: encoded(Encoding.StateTrees),
|
|
8418
|
+
ttl: field_types_ttl,
|
|
8419
|
+
fee: field_types_fee,
|
|
8420
|
+
nonce: nonce('fromId')
|
|
8421
|
+
}, {
|
|
8422
|
+
tag: shortUIntConst(Tag.ChannelOffChainTx),
|
|
8423
|
+
version: shortUIntConst(2, true),
|
|
8424
|
+
channelId: address(Encoding.Channel),
|
|
8425
|
+
round: shortUInt,
|
|
8426
|
+
stateHash: encoded(Encoding.State)
|
|
8427
|
+
}, {
|
|
8428
|
+
tag: shortUIntConst(Tag.Channel),
|
|
8429
|
+
version: shortUIntConst(3, true),
|
|
8430
|
+
initiator: address(Encoding.AccountAddress),
|
|
8431
|
+
responder: address(Encoding.AccountAddress),
|
|
8432
|
+
channelAmount: uInt,
|
|
8433
|
+
initiatorAmount: uInt,
|
|
8434
|
+
responderAmount: uInt,
|
|
8435
|
+
channelReserve: uInt,
|
|
8436
|
+
initiatorDelegateIds: array(address(...idTagToEncoding)),
|
|
8437
|
+
responderDelegateIds: array(address(...idTagToEncoding)),
|
|
8438
|
+
stateHash: encoded(Encoding.State),
|
|
8439
|
+
round: shortUInt,
|
|
8440
|
+
soloRound: uInt,
|
|
8441
|
+
lockPeriod: uInt,
|
|
8442
|
+
lockedUntil: uInt,
|
|
8443
|
+
initiatorAuth: encoded(Encoding.ContractBytearray),
|
|
8444
|
+
responderAuth: encoded(Encoding.ContractBytearray)
|
|
8445
|
+
}, {
|
|
8446
|
+
tag: shortUIntConst(Tag.ChannelSnapshotSoloTx),
|
|
8447
|
+
version: shortUIntConst(1, true),
|
|
8448
|
+
channelId: address(Encoding.Channel),
|
|
8449
|
+
fromId: address(Encoding.AccountAddress),
|
|
8450
|
+
payload: encoded(Encoding.Transaction),
|
|
8451
|
+
ttl: field_types_ttl,
|
|
8452
|
+
fee: field_types_fee,
|
|
8453
|
+
nonce: nonce('fromId')
|
|
8454
|
+
}, {
|
|
8455
|
+
tag: shortUIntConst(Tag.ChannelOffChainUpdateTransfer),
|
|
8456
|
+
version: shortUIntConst(1, true),
|
|
8457
|
+
from: address(Encoding.AccountAddress),
|
|
8458
|
+
to: address(Encoding.AccountAddress),
|
|
8459
|
+
amount: uInt
|
|
8460
|
+
}, {
|
|
8461
|
+
tag: shortUIntConst(Tag.ChannelOffChainUpdateDeposit),
|
|
8462
|
+
version: shortUIntConst(1, true),
|
|
8463
|
+
from: address(Encoding.AccountAddress),
|
|
8464
|
+
amount: uInt
|
|
8465
|
+
}, {
|
|
8466
|
+
tag: shortUIntConst(Tag.ChannelOffChainUpdateWithdraw),
|
|
8467
|
+
version: shortUIntConst(1, true),
|
|
8468
|
+
from: address(Encoding.AccountAddress),
|
|
8469
|
+
amount: uInt
|
|
8470
|
+
}, {
|
|
8471
|
+
tag: shortUIntConst(Tag.ChannelOffChainUpdateCreateContract),
|
|
8472
|
+
version: shortUIntConst(1, true),
|
|
8473
|
+
owner: address(Encoding.AccountAddress),
|
|
8474
|
+
ctVersion: ctVersion,
|
|
8475
|
+
code: encoded(Encoding.ContractBytearray),
|
|
8476
|
+
deposit: uInt,
|
|
8477
|
+
callData: encoded(Encoding.ContractBytearray)
|
|
8478
|
+
}, {
|
|
8479
|
+
tag: shortUIntConst(Tag.ChannelOffChainUpdateCallContract),
|
|
8480
|
+
version: shortUIntConst(1, true),
|
|
8481
|
+
caller: address(Encoding.AccountAddress),
|
|
8482
|
+
contract: address(Encoding.ContractAddress),
|
|
8483
|
+
abiVersion: abiVersion,
|
|
8484
|
+
amount: uInt,
|
|
8485
|
+
callData: encoded(Encoding.ContractBytearray),
|
|
8486
|
+
callStack: field_types_raw,
|
|
8487
|
+
gasPrice: gasPrice,
|
|
8488
|
+
gasLimit: gasLimit
|
|
8489
|
+
}, {
|
|
8490
|
+
tag: shortUIntConst(Tag.ChannelClientReconnectTx),
|
|
8491
|
+
version: shortUIntConst(1, true),
|
|
8492
|
+
channelId: address(Encoding.Channel),
|
|
8493
|
+
round: shortUInt,
|
|
8494
|
+
role: field_types_string,
|
|
8495
|
+
pubkey: address(Encoding.AccountAddress)
|
|
8496
|
+
}, {
|
|
8497
|
+
tag: shortUIntConst(Tag.TreesPoi),
|
|
8498
|
+
version: shortUIntConst(1, true),
|
|
8499
|
+
// TODO: inline an extra wrapping array after resolving https://github.com/aeternity/protocol/issues/505
|
|
8500
|
+
accounts: array(mptree(Encoding.AccountAddress, Tag.Account)),
|
|
8501
|
+
calls: array(mptree(Encoding.Bytearray, Tag.ContractCall)),
|
|
8502
|
+
channels: array(mptree(Encoding.Channel, Tag.Channel)),
|
|
8503
|
+
contracts: array(mptree(Encoding.ContractAddress, Tag.Contract)),
|
|
8504
|
+
ns: array(mptree(Encoding.Name, Tag.Name)),
|
|
8505
|
+
oracles: array(mptree(Encoding.OracleAddress, Tag.Oracle))
|
|
8506
|
+
}, {
|
|
8507
|
+
tag: shortUIntConst(Tag.StateTrees),
|
|
8508
|
+
version: shortUIntConst(0, true),
|
|
8509
|
+
contracts: wrapped(Tag.ContractsMtree),
|
|
8510
|
+
calls: wrapped(Tag.CallsMtree),
|
|
8511
|
+
channels: wrapped(Tag.ChannelsMtree),
|
|
8512
|
+
ns: wrapped(Tag.NameserviceMtree),
|
|
8513
|
+
oracles: wrapped(Tag.OraclesMtree),
|
|
8514
|
+
accounts: wrapped(Tag.AccountsMtree)
|
|
8515
|
+
}, {
|
|
8516
|
+
tag: shortUIntConst(Tag.Mtree),
|
|
8517
|
+
version: shortUIntConst(1, true),
|
|
8518
|
+
values: entryMtreeValueArray
|
|
8519
|
+
}, {
|
|
8520
|
+
tag: shortUIntConst(Tag.MtreeValue),
|
|
8521
|
+
version: shortUIntConst(1, true),
|
|
8522
|
+
key: field_types_raw,
|
|
8523
|
+
value: field_types_raw
|
|
8524
|
+
}, {
|
|
8525
|
+
tag: shortUIntConst(Tag.ContractsMtree),
|
|
8526
|
+
version: shortUIntConst(1, true),
|
|
8527
|
+
payload: mapContracts
|
|
8528
|
+
}, {
|
|
8529
|
+
tag: shortUIntConst(Tag.CallsMtree),
|
|
8530
|
+
version: shortUIntConst(1, true),
|
|
8531
|
+
payload: mapCalls
|
|
8532
|
+
}, {
|
|
8533
|
+
tag: shortUIntConst(Tag.ChannelsMtree),
|
|
8534
|
+
version: shortUIntConst(1, true),
|
|
8535
|
+
payload: mapChannels
|
|
8536
|
+
}, {
|
|
8537
|
+
tag: shortUIntConst(Tag.NameserviceMtree),
|
|
8538
|
+
version: shortUIntConst(1, true),
|
|
8539
|
+
payload: mapNames
|
|
8540
|
+
}, {
|
|
8541
|
+
tag: shortUIntConst(Tag.OraclesMtree),
|
|
8542
|
+
version: shortUIntConst(1, true),
|
|
8543
|
+
payload: mapOracles
|
|
8544
|
+
}, {
|
|
8545
|
+
tag: shortUIntConst(Tag.AccountsMtree),
|
|
8546
|
+
version: shortUIntConst(1, true),
|
|
8547
|
+
payload: mapAccounts
|
|
8548
|
+
}, {
|
|
8549
|
+
tag: shortUIntConst(Tag.GaAttachTx),
|
|
8550
|
+
version: shortUIntConst(1, true),
|
|
8551
|
+
ownerId: address(Encoding.AccountAddress),
|
|
8552
|
+
nonce: nonce('ownerId'),
|
|
8553
|
+
code: encoded(Encoding.ContractBytearray),
|
|
8554
|
+
authFun: field_types_raw,
|
|
8555
|
+
ctVersion: ctVersion,
|
|
8556
|
+
fee: field_types_fee,
|
|
8557
|
+
ttl: field_types_ttl,
|
|
8558
|
+
gasLimit: gasLimit,
|
|
8559
|
+
gasPrice: gasPrice,
|
|
8560
|
+
callData: encoded(Encoding.ContractBytearray)
|
|
8561
|
+
}, {
|
|
8562
|
+
tag: shortUIntConst(Tag.GaMetaTx),
|
|
8563
|
+
version: shortUIntConst(2, true),
|
|
8564
|
+
gaId: address(Encoding.AccountAddress),
|
|
8565
|
+
authData: encoded(Encoding.ContractBytearray),
|
|
8566
|
+
abiVersion: abiVersion,
|
|
8567
|
+
fee: field_types_fee,
|
|
8568
|
+
gasLimit: gasLimit,
|
|
8569
|
+
gasPrice: gasPrice,
|
|
8570
|
+
tx: entrySignedTx
|
|
8571
|
+
}, {
|
|
8572
|
+
tag: shortUIntConst(Tag.PayingForTx),
|
|
8573
|
+
version: shortUIntConst(1, true),
|
|
8574
|
+
payerId: address(Encoding.AccountAddress),
|
|
8575
|
+
nonce: nonce('payerId'),
|
|
8576
|
+
fee: field_types_fee,
|
|
8577
|
+
tx: entrySignedTx
|
|
8578
|
+
}, {
|
|
8579
|
+
tag: shortUIntConst(Tag.GaMetaTxAuthData),
|
|
8580
|
+
version: shortUIntConst(1, true),
|
|
8581
|
+
fee: coinAmount,
|
|
8582
|
+
gasPrice: gasPrice,
|
|
8583
|
+
txHash: encoded(Encoding.TxHash)
|
|
8584
|
+
}];
|
|
8056
8585
|
;// CONCATENATED MODULE: ./src/tx/builder/index.ts
|
|
8057
8586
|
|
|
8058
8587
|
|
|
@@ -8062,33 +8591,18 @@ const TX_SCHEMA = {
|
|
|
8062
8591
|
|
|
8063
8592
|
|
|
8064
8593
|
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
8594
|
/**
|
|
8068
8595
|
* JavaScript-based Transaction builder
|
|
8069
8596
|
*/
|
|
8070
8597
|
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
if (binary.length !== schema.length) {
|
|
8080
|
-
throw new ArgumentError('Transaction RLP length', schema.length, binary.length);
|
|
8081
|
-
}
|
|
8082
|
-
return schema.reduce((acc, [name, field], index) => {
|
|
8083
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
8084
|
-
const deserialized = field.deserialize(binary[index], {
|
|
8085
|
-
unpackTx
|
|
8086
|
-
});
|
|
8087
|
-
return {
|
|
8088
|
-
...acc,
|
|
8089
|
-
[name]: deserialized
|
|
8090
|
-
};
|
|
8091
|
-
}, {});
|
|
8598
|
+
function getSchema(tag, version) {
|
|
8599
|
+
var _version;
|
|
8600
|
+
const schemas = txSchema.filter(s => s.tag.constValue === tag);
|
|
8601
|
+
if (schemas.length === 0) throw new SchemaNotFoundError(`${Tag[tag]} (${tag})`, 0);
|
|
8602
|
+
(_version = version) !== null && _version !== void 0 ? _version : version = Math.max(...schemas.map(schema => schema.version.constValue));
|
|
8603
|
+
const schema = schemas.find(s => s.version.constValue === version);
|
|
8604
|
+
if (schema == null) throw new SchemaNotFoundError(`${Tag[tag]} (${tag})`, version);
|
|
8605
|
+
return Object.entries(schema);
|
|
8092
8606
|
}
|
|
8093
8607
|
|
|
8094
8608
|
/**
|
|
@@ -8096,61 +8610,69 @@ function unpackRawTx(binary, schema) {
|
|
|
8096
8610
|
* @category transaction builder
|
|
8097
8611
|
* @param params - Object with tx params
|
|
8098
8612
|
* @param options - options
|
|
8099
|
-
* @param options.denomination - Denomination of amounts
|
|
8100
8613
|
* @param options.prefix - Prefix of transaction
|
|
8101
|
-
* @
|
|
8102
|
-
* @returns object
|
|
8103
|
-
* @returns object.tx Base64Check transaction hash with 'tx_' prefix
|
|
8104
|
-
* @returns object.rlpEncoded rlp encoded transaction
|
|
8105
|
-
* @returns object.binary binary transaction
|
|
8614
|
+
* @returns object Base64Check transaction hash with 'tx_' prefix
|
|
8106
8615
|
*/
|
|
8107
8616
|
function buildTx(params, {
|
|
8108
|
-
prefix
|
|
8109
|
-
denomination = AE_AMOUNT_FORMATS.AETTOS
|
|
8617
|
+
prefix
|
|
8110
8618
|
} = {}) {
|
|
8111
|
-
|
|
8112
|
-
const
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
throw new SchemaNotFoundError('serialization', Tag[params.tag], params.version);
|
|
8116
|
-
}
|
|
8117
|
-
const schema = schemas[params.version];
|
|
8118
|
-
const binary = schema.map(([key, field]) => field.serialize(params[key], {
|
|
8619
|
+
const schema = getSchema(params.tag, params.version);
|
|
8620
|
+
const binary = schema.map(([key, field]) => field.serialize(
|
|
8621
|
+
// @ts-expect-error the type of `params[key]` can't be determined accurately
|
|
8622
|
+
params[key], {
|
|
8119
8623
|
...params,
|
|
8120
8624
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
8121
8625
|
unpackTx,
|
|
8122
8626
|
buildTx,
|
|
8123
|
-
denomination,
|
|
8124
8627
|
rebuildTx: overrideParams => buildTx({
|
|
8125
8628
|
...params,
|
|
8126
8629
|
...overrideParams
|
|
8127
|
-
}, {
|
|
8128
|
-
denomination
|
|
8129
8630
|
})
|
|
8130
|
-
}));
|
|
8631
|
+
}, params));
|
|
8131
8632
|
|
|
8132
8633
|
// @ts-expect-error looks like a TypeScript edge case
|
|
8133
8634
|
return encode((0,external_rlp_.encode)(binary), prefix !== null && prefix !== void 0 ? prefix : Encoding.Transaction);
|
|
8134
8635
|
}
|
|
8636
|
+
/**
|
|
8637
|
+
* @category transaction builder
|
|
8638
|
+
*/
|
|
8639
|
+
async function buildTxAsync(params) {
|
|
8640
|
+
await Promise.all(getSchema(params.tag, params.version).map(async ([key, field]) => {
|
|
8641
|
+
if (field.prepare == null) return;
|
|
8642
|
+
// @ts-expect-error the type of `params[key]` can't be determined accurately
|
|
8643
|
+
params[key] = await field.prepare(params[key], params, params);
|
|
8644
|
+
}));
|
|
8645
|
+
|
|
8646
|
+
// @ts-expect-error after preparation properties should be compatible with sync tx builder
|
|
8647
|
+
return buildTx(params);
|
|
8648
|
+
}
|
|
8135
8649
|
|
|
8136
8650
|
/**
|
|
8137
|
-
* Unpack transaction
|
|
8651
|
+
* Unpack transaction encoded as string
|
|
8138
8652
|
* @category transaction builder
|
|
8139
8653
|
* @param encodedTx - Transaction to unpack
|
|
8140
8654
|
* @param txType - Expected transaction type
|
|
8141
|
-
* @returns
|
|
8142
|
-
* @returns object.tx Object with transaction param's
|
|
8143
|
-
* @returns object.txType Transaction type
|
|
8655
|
+
* @returns Object with transaction param's
|
|
8144
8656
|
*/
|
|
8145
8657
|
function unpackTx(encodedTx, txType) {
|
|
8146
8658
|
const binary = (0,external_rlp_.decode)(decode(encodedTx));
|
|
8147
8659
|
const tag = +readInt(binary[0]);
|
|
8148
|
-
if (!isKeyOfObject(tag, TX_SCHEMA)) throw new DecodeError(`Unknown transaction tag: ${tag}`);
|
|
8149
|
-
if (txType != null && txType !== tag) throw new DecodeError(`Expected transaction to have ${Tag[txType]} tag, got ${Tag[tag]} instead`);
|
|
8150
8660
|
const version = +readInt(binary[1]);
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8661
|
+
const schema = getSchema(tag, version);
|
|
8662
|
+
if (txType != null && txType !== tag) throw new DecodeError(`Expected transaction to have ${Tag[txType]} tag, got ${Tag[tag]} instead`);
|
|
8663
|
+
if (binary.length !== schema.length) {
|
|
8664
|
+
throw new ArgumentError('Transaction RLP length', schema.length, binary.length);
|
|
8665
|
+
}
|
|
8666
|
+
return schema.reduce((acc, [name, field], index) => {
|
|
8667
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
8668
|
+
const deserialized = field.deserialize(binary[index], {
|
|
8669
|
+
unpackTx
|
|
8670
|
+
});
|
|
8671
|
+
return {
|
|
8672
|
+
...acc,
|
|
8673
|
+
[name]: deserialized
|
|
8674
|
+
};
|
|
8675
|
+
}, {});
|
|
8154
8676
|
}
|
|
8155
8677
|
|
|
8156
8678
|
/**
|
|
@@ -8171,15 +8693,11 @@ function buildTxHash(rawTx) {
|
|
|
8171
8693
|
* @returns Contract public key
|
|
8172
8694
|
*/
|
|
8173
8695
|
function buildContractIdByContractTx(contractTx) {
|
|
8174
|
-
const
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
nonce
|
|
8178
|
-
} = unpackTx(contractTx);
|
|
8179
|
-
if (![Tag.ContractCreateTx, Tag.GaAttachTx].includes(tag)) {
|
|
8180
|
-
throw new ArgumentError('contractCreateTx', 'a contractCreateTx or gaAttach', tag);
|
|
8696
|
+
const params = unpackTx(contractTx);
|
|
8697
|
+
if (Tag.ContractCreateTx !== params.tag && Tag.GaAttachTx !== params.tag) {
|
|
8698
|
+
throw new ArgumentError('contractTx', 'a contractCreateTx or gaAttach', params.tag);
|
|
8181
8699
|
}
|
|
8182
|
-
return buildContractId(ownerId,
|
|
8700
|
+
return buildContractId(params.ownerId, params.nonce);
|
|
8183
8701
|
}
|
|
8184
8702
|
;// CONCATENATED MODULE: ./src/utils/semver-satisfies.ts
|
|
8185
8703
|
function semverSatisfies(version, geVersion, ltVersion) {
|
|
@@ -8244,15 +8762,18 @@ const genCombineGetRequestsPolicy = () => {
|
|
|
8244
8762
|
const genAggressiveCacheGetResponsesPolicy = () => {
|
|
8245
8763
|
const getRequests = new Map();
|
|
8246
8764
|
return {
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8765
|
+
policy: {
|
|
8766
|
+
name: 'aggressive-cache-get-responses',
|
|
8767
|
+
async sendRequest(request, next) {
|
|
8768
|
+
var _getRequests$get;
|
|
8769
|
+
if (request.method !== 'GET') return next(request);
|
|
8770
|
+
const key = JSON.stringify([request.url, request.body]);
|
|
8771
|
+
const response = (_getRequests$get = getRequests.get(key)) !== null && _getRequests$get !== void 0 ? _getRequests$get : next(request);
|
|
8772
|
+
getRequests.set(key, response);
|
|
8773
|
+
return response;
|
|
8774
|
+
}
|
|
8775
|
+
},
|
|
8776
|
+
position: 'perCall'
|
|
8256
8777
|
};
|
|
8257
8778
|
};
|
|
8258
8779
|
const genErrorFormatterPolicy = getMessage => ({
|
|
@@ -8284,11 +8805,40 @@ const genVersionCheckPolicy = (name, ignorePath, versionPromise, geVersion, ltVe
|
|
|
8284
8805
|
name: 'version-check',
|
|
8285
8806
|
async sendRequest(request, next) {
|
|
8286
8807
|
if (new URL(request.url).pathname === ignorePath) return next(request);
|
|
8287
|
-
const
|
|
8808
|
+
const version = await versionPromise;
|
|
8809
|
+
if (version instanceof Error) throw version;
|
|
8810
|
+
const args = [version, geVersion, ltVersion];
|
|
8288
8811
|
if (!semverSatisfies(...args)) throw new UnsupportedVersionError(name, ...args);
|
|
8289
8812
|
return next(request);
|
|
8290
8813
|
}
|
|
8291
8814
|
});
|
|
8815
|
+
const genRetryOnFailurePolicy = (retryCount, retryOverallDelay) => ({
|
|
8816
|
+
policy: {
|
|
8817
|
+
name: 'retry-on-failure',
|
|
8818
|
+
async sendRequest(request, next) {
|
|
8819
|
+
const statusesToNotRetry = [200, 400, 403];
|
|
8820
|
+
const intervals = new Array(retryCount).fill(0).map((_, idx) => ((idx + 1) / retryCount) ** 2);
|
|
8821
|
+
const intervalSum = intervals.reduce((a, b) => a + b);
|
|
8822
|
+
const intervalsInMs = intervals.map(el => el / intervalSum * retryOverallDelay);
|
|
8823
|
+
let error;
|
|
8824
|
+
for (let attempt = 0; attempt <= retryCount; attempt += 1) {
|
|
8825
|
+
if (error != null) {
|
|
8826
|
+
var _error$response$statu, _error$response2;
|
|
8827
|
+
if (!(error instanceof core_rest_pipeline_.RestError) || statusesToNotRetry.includes((_error$response$statu = (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status) !== null && _error$response$statu !== void 0 ? _error$response$statu : 0)) throw error;
|
|
8828
|
+
await pause(intervalsInMs[attempt - 1]);
|
|
8829
|
+
}
|
|
8830
|
+
try {
|
|
8831
|
+
return await next(request);
|
|
8832
|
+
} catch (e) {
|
|
8833
|
+
error = e;
|
|
8834
|
+
}
|
|
8835
|
+
}
|
|
8836
|
+
if (error == null) throw new UnexpectedTsError();
|
|
8837
|
+
throw error;
|
|
8838
|
+
}
|
|
8839
|
+
},
|
|
8840
|
+
position: 'perCall'
|
|
8841
|
+
});
|
|
8292
8842
|
// EXTERNAL MODULE: external "@azure/core-client"
|
|
8293
8843
|
var core_client_ = __webpack_require__(4711);
|
|
8294
8844
|
;// CONCATENATED MODULE: ./src/apis/node/models/mappers.ts
|
|
@@ -8711,6 +9261,7 @@ const SignedTx = {
|
|
|
8711
9261
|
}
|
|
8712
9262
|
};
|
|
8713
9263
|
const Tx = {
|
|
9264
|
+
serializedName: "Tx",
|
|
8714
9265
|
type: {
|
|
8715
9266
|
name: "Composite",
|
|
8716
9267
|
className: "Tx",
|
|
@@ -12455,7 +13006,7 @@ const CreateContractUnsignedTx = {
|
|
|
12455
13006
|
}
|
|
12456
13007
|
};
|
|
12457
13008
|
let discriminators = {
|
|
12458
|
-
"Tx.
|
|
13009
|
+
"Tx.Tx": Tx,
|
|
12459
13010
|
OffChainUpdate: OffChainUpdate,
|
|
12460
13011
|
"OffChainUpdate.OffChainTransfer": OffChainTransfer,
|
|
12461
13012
|
"OffChainUpdate.OffChainWithdrawal": OffChainWithdrawal,
|
|
@@ -12574,7 +13125,7 @@ const body1 = {
|
|
|
12574
13125
|
parameterPath: "body",
|
|
12575
13126
|
mapper: EncodedTx
|
|
12576
13127
|
};
|
|
12577
|
-
const
|
|
13128
|
+
const from = {
|
|
12578
13129
|
parameterPath: ["options", "from"],
|
|
12579
13130
|
mapper: {
|
|
12580
13131
|
serializedName: "from",
|
|
@@ -12597,7 +13148,7 @@ const limit = {
|
|
|
12597
13148
|
}
|
|
12598
13149
|
}
|
|
12599
13150
|
};
|
|
12600
|
-
const
|
|
13151
|
+
const type = {
|
|
12601
13152
|
parameterPath: ["options", "type"],
|
|
12602
13153
|
mapper: {
|
|
12603
13154
|
defaultValue: "all",
|
|
@@ -12632,7 +13183,6 @@ const parameters_name = {
|
|
|
12632
13183
|
|
|
12633
13184
|
|
|
12634
13185
|
|
|
12635
|
-
|
|
12636
13186
|
class Node extends core_client_.ServiceClient {
|
|
12637
13187
|
/**
|
|
12638
13188
|
* Initializes a new instance of the Node class.
|
|
@@ -12640,7 +13190,7 @@ class Node extends core_client_.ServiceClient {
|
|
|
12640
13190
|
* @param options The parameter options
|
|
12641
13191
|
*/
|
|
12642
13192
|
constructor($host, options) {
|
|
12643
|
-
var _ref, _options$endpoint
|
|
13193
|
+
var _ref, _options$endpoint;
|
|
12644
13194
|
if ($host === undefined) {
|
|
12645
13195
|
throw new Error("'$host' cannot be null");
|
|
12646
13196
|
}
|
|
@@ -12660,24 +13210,9 @@ class Node extends core_client_.ServiceClient {
|
|
|
12660
13210
|
userAgentOptions: {
|
|
12661
13211
|
userAgentPrefix
|
|
12662
13212
|
},
|
|
12663
|
-
|
|
13213
|
+
endpoint: (_ref = (_options$endpoint = options.endpoint) !== null && _options$endpoint !== void 0 ? _options$endpoint : options.baseUri) !== null && _ref !== void 0 ? _ref : "{$host}"
|
|
12664
13214
|
};
|
|
12665
13215
|
super(optionsWithDefaults);
|
|
12666
|
-
if ((_options = options) !== null && _options !== void 0 && _options.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
|
|
12667
|
-
const pipelinePolicies = options.pipeline.getOrderedPolicies();
|
|
12668
|
-
const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(pipelinePolicy => pipelinePolicy.name === core_rest_pipeline_.bearerTokenAuthenticationPolicyName);
|
|
12669
|
-
if (!bearerTokenAuthenticationPolicyFound) {
|
|
12670
|
-
this.pipeline.removePolicy({
|
|
12671
|
-
name: core_rest_pipeline_.bearerTokenAuthenticationPolicyName
|
|
12672
|
-
});
|
|
12673
|
-
this.pipeline.addPolicy(core_rest_pipeline_.bearerTokenAuthenticationPolicy({
|
|
12674
|
-
scopes: `${optionsWithDefaults.baseUri}/.default`,
|
|
12675
|
-
challengeCallbacks: {
|
|
12676
|
-
authorizeRequestOnChallenge: core_client_.authorizeRequestOnClaimChallenge
|
|
12677
|
-
}
|
|
12678
|
-
}));
|
|
12679
|
-
}
|
|
12680
|
-
}
|
|
12681
13216
|
// Parameter assignments
|
|
12682
13217
|
this.$host = $host;
|
|
12683
13218
|
}
|
|
@@ -13636,7 +14171,7 @@ const getOracleQueriesByPubkeyOperationSpec = {
|
|
|
13636
14171
|
isError: true
|
|
13637
14172
|
}
|
|
13638
14173
|
},
|
|
13639
|
-
queryParameters: [intAsString,
|
|
14174
|
+
queryParameters: [intAsString, from, limit, type],
|
|
13640
14175
|
urlParameters: [$host, pubkey],
|
|
13641
14176
|
headerParameters: [accept],
|
|
13642
14177
|
serializer
|
|
@@ -13814,15 +14349,19 @@ class Node_Node extends NodeTransformed {
|
|
|
13814
14349
|
* @param url - Url for node API
|
|
13815
14350
|
* @param options - Options
|
|
13816
14351
|
* @param options.ignoreVersion - Don't check node version
|
|
14352
|
+
* @param options.retryCount - Amount of extra requests to do in case of failure
|
|
14353
|
+
* @param options.retryOverallDelay - Time in ms to wait between all retries
|
|
13817
14354
|
*/
|
|
13818
14355
|
constructor(url, {
|
|
13819
14356
|
ignoreVersion = false,
|
|
14357
|
+
retryCount = 3,
|
|
14358
|
+
retryOverallDelay = 800,
|
|
13820
14359
|
...options
|
|
13821
14360
|
} = {}) {
|
|
13822
14361
|
// eslint-disable-next-line constructor-super
|
|
13823
14362
|
super(url, {
|
|
13824
14363
|
allowInsecureConnection: true,
|
|
13825
|
-
additionalPolicies: [genRequestQueuesPolicy(), genCombineGetRequestsPolicy(), genErrorFormatterPolicy(body => ` ${body.reason}`)],
|
|
14364
|
+
additionalPolicies: [genRequestQueuesPolicy(), genCombineGetRequestsPolicy(), genRetryOnFailurePolicy(retryCount, retryOverallDelay), genErrorFormatterPolicy(body => ` ${body.reason}`)],
|
|
13826
14365
|
...options
|
|
13827
14366
|
});
|
|
13828
14367
|
Node_classPrivateFieldInitSpec(this, _networkIdPromise, {
|
|
@@ -13833,10 +14372,10 @@ class Node_Node extends NodeTransformed {
|
|
|
13833
14372
|
const statusPromise = this.getStatus();
|
|
13834
14373
|
const versionPromise = statusPromise.then(({
|
|
13835
14374
|
nodeVersion
|
|
13836
|
-
}) => nodeVersion);
|
|
14375
|
+
}) => nodeVersion, error => error);
|
|
13837
14376
|
classPrivateFieldSet_default()(this, _networkIdPromise, statusPromise.then(({
|
|
13838
14377
|
networkId
|
|
13839
|
-
}) => networkId));
|
|
14378
|
+
}) => networkId, error => error));
|
|
13840
14379
|
this.pipeline.addPolicy(genVersionCheckPolicy('node', '/v3/status', versionPromise, '6.2.0', '7.0.0'));
|
|
13841
14380
|
}
|
|
13842
14381
|
this.intAsString = true;
|
|
@@ -13846,7 +14385,9 @@ class Node_Node extends NodeTransformed {
|
|
|
13846
14385
|
(_classPrivateFieldGet2 = classPrivateFieldGet_default()(this, _networkIdPromise)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : classPrivateFieldSet_default()(this, _networkIdPromise, this.getStatus().then(({
|
|
13847
14386
|
networkId
|
|
13848
14387
|
}) => networkId));
|
|
13849
|
-
|
|
14388
|
+
const networkId = await classPrivateFieldGet_default()(this, _networkIdPromise);
|
|
14389
|
+
if (networkId instanceof Error) throw networkId;
|
|
14390
|
+
return networkId;
|
|
13850
14391
|
}
|
|
13851
14392
|
async getNodeInfo() {
|
|
13852
14393
|
const {
|
|
@@ -13869,143 +14410,347 @@ class Node_Node extends NodeTransformed {
|
|
|
13869
14410
|
};
|
|
13870
14411
|
}
|
|
13871
14412
|
}
|
|
13872
|
-
;// CONCATENATED MODULE: ./src/tx/
|
|
14413
|
+
;// CONCATENATED MODULE: ./src/tx/transaction-signer.ts
|
|
13873
14414
|
|
|
13874
14415
|
|
|
13875
14416
|
|
|
13876
14417
|
|
|
14418
|
+
/**
|
|
14419
|
+
* Returns account address that signed a transaction
|
|
14420
|
+
* @param transaction - transaction to get a signer of
|
|
14421
|
+
*/
|
|
14422
|
+
function getTransactionSignerAddress(transaction) {
|
|
14423
|
+
var _getSchema$find;
|
|
14424
|
+
const params = unpackTx(transaction);
|
|
14425
|
+
switch (params.tag) {
|
|
14426
|
+
case Tag.SignedTx:
|
|
14427
|
+
return getTransactionSignerAddress(buildTx(params.encodedTx));
|
|
14428
|
+
case Tag.GaMetaTx:
|
|
14429
|
+
return params.gaId;
|
|
14430
|
+
default:
|
|
14431
|
+
}
|
|
14432
|
+
const nonce = (_getSchema$find = getSchema(params.tag, params.version).find(([name]) => name === 'nonce')) === null || _getSchema$find === void 0 ? void 0 : _getSchema$find[1];
|
|
14433
|
+
if (nonce == null) throw new TransactionError(`Transaction doesn't have nonce: ${Tag[params.tag]}`);
|
|
14434
|
+
if (!('senderKey' in nonce)) throw new UnexpectedTsError();
|
|
14435
|
+
const address = params[nonce.senderKey];
|
|
14436
|
+
return address.replace(/^ok_/, 'ak_');
|
|
14437
|
+
}
|
|
14438
|
+
;// CONCATENATED MODULE: ./src/account/Base.ts
|
|
14439
|
+
/**
|
|
14440
|
+
* Account is one of the three basic building blocks of an
|
|
14441
|
+
* {@link AeSdk} and provides access to a signing key pair.
|
|
14442
|
+
*/
|
|
14443
|
+
class AccountBase {}
|
|
14444
|
+
;// CONCATENATED MODULE: ./src/account/Memory.ts
|
|
13877
14445
|
|
|
13878
14446
|
|
|
13879
14447
|
|
|
13880
14448
|
|
|
13881
14449
|
|
|
13882
|
-
|
|
13883
|
-
|
|
13884
|
-
|
|
13885
|
-
|
|
13886
|
-
const
|
|
13887
|
-
|
|
13888
|
-
|
|
13889
|
-
|
|
13890
|
-
consensusProtocolVersion,
|
|
13891
|
-
nodeNetworkId
|
|
13892
|
-
}] = await Promise.all([address == null ? undefined : node.getAccountByPubkey(address).catch(error => {
|
|
13893
|
-
if (!isAccountNotFoundError(error)) throw error;
|
|
13894
|
-
return {
|
|
13895
|
-
id: address,
|
|
13896
|
-
balance: 0n,
|
|
13897
|
-
nonce: 0
|
|
13898
|
-
};
|
|
13899
|
-
})
|
|
13900
|
-
// TODO: remove after fixing https://github.com/aeternity/aepp-sdk-js/issues/1537
|
|
13901
|
-
.then(acc => ({
|
|
13902
|
-
...acc,
|
|
13903
|
-
id: acc.id
|
|
13904
|
-
})), node.getCurrentKeyBlockHeight(), node.getNodeInfo()]);
|
|
13905
|
-
return (await Promise.all(validators.map(v => v(tx, {
|
|
13906
|
-
node,
|
|
13907
|
-
account,
|
|
13908
|
-
height,
|
|
13909
|
-
consensusProtocolVersion,
|
|
13910
|
-
nodeNetworkId,
|
|
13911
|
-
parentTxTypes
|
|
13912
|
-
})))).flat();
|
|
14450
|
+
|
|
14451
|
+
|
|
14452
|
+
const secretKeys = new WeakMap();
|
|
14453
|
+
function getBufferToSign(transaction, networkId, innerTx) {
|
|
14454
|
+
const prefixes = [networkId];
|
|
14455
|
+
if (innerTx) prefixes.push('inner_tx');
|
|
14456
|
+
const rlpBinaryTx = decode(transaction);
|
|
14457
|
+
return concatBuffers([Buffer.from(prefixes.join('-')), hash(rlpBinaryTx)]);
|
|
13913
14458
|
}
|
|
13914
14459
|
|
|
13915
14460
|
/**
|
|
13916
|
-
*
|
|
13917
|
-
* This function validates some transaction properties,
|
|
13918
|
-
* to make sure it can be posted it to the chain
|
|
13919
|
-
* @category transaction builder
|
|
13920
|
-
* @param transaction - Base64Check-encoded transaction
|
|
13921
|
-
* @param nodeNotCached - Node to validate transaction against
|
|
13922
|
-
* @returns Array with verification errors
|
|
13923
|
-
* @example const errors = await verifyTransaction(transaction, node)
|
|
14461
|
+
* In-memory account class
|
|
13924
14462
|
*/
|
|
13925
|
-
|
|
13926
|
-
|
|
13927
|
-
|
|
13928
|
-
|
|
13929
|
-
|
|
13930
|
-
|
|
13931
|
-
|
|
13932
|
-
|
|
13933
|
-
|
|
13934
|
-
|
|
13935
|
-
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
|
|
13940
|
-
|
|
13941
|
-
|
|
13942
|
-
|
|
13943
|
-
|
|
13944
|
-
|
|
13945
|
-
|
|
13946
|
-
|
|
13947
|
-
|
|
13948
|
-
|
|
13949
|
-
|
|
13950
|
-
|
|
13951
|
-
|
|
13952
|
-
|
|
13953
|
-
|
|
13954
|
-
|
|
13955
|
-
|
|
13956
|
-
|
|
13957
|
-
}
|
|
13958
|
-
|
|
13959
|
-
|
|
13960
|
-
|
|
13961
|
-
|
|
13962
|
-
|
|
13963
|
-
|
|
13964
|
-
|
|
13965
|
-
}
|
|
13966
|
-
|
|
13967
|
-
|
|
13968
|
-
|
|
13969
|
-
|
|
13970
|
-
|
|
13971
|
-
|
|
13972
|
-
|
|
13973
|
-
|
|
13974
|
-
|
|
13975
|
-
|
|
13976
|
-
|
|
13977
|
-
|
|
13978
|
-
|
|
13979
|
-
|
|
13980
|
-
|
|
13981
|
-
|
|
13982
|
-
|
|
13983
|
-
|
|
13984
|
-
|
|
13985
|
-
|
|
13986
|
-
|
|
13987
|
-
|
|
13988
|
-
|
|
13989
|
-
|
|
13990
|
-
|
|
13991
|
-
|
|
13992
|
-
|
|
13993
|
-
|
|
14463
|
+
class AccountMemory extends AccountBase {
|
|
14464
|
+
/**
|
|
14465
|
+
* @param secretKey - Secret key
|
|
14466
|
+
*/
|
|
14467
|
+
constructor(secretKey) {
|
|
14468
|
+
super();
|
|
14469
|
+
secretKey = typeof secretKey === 'string' ? Buffer.from(secretKey, 'hex') : secretKey;
|
|
14470
|
+
if (secretKey.length !== 64) {
|
|
14471
|
+
throw new ArgumentError('secretKey', '64 bytes', secretKey.length);
|
|
14472
|
+
}
|
|
14473
|
+
secretKeys.set(this, secretKey);
|
|
14474
|
+
this.address = encode(generateKeyPairFromSecret(secretKeys.get(this)).publicKey, Encoding.AccountAddress);
|
|
14475
|
+
}
|
|
14476
|
+
|
|
14477
|
+
/**
|
|
14478
|
+
* Generates a new AccountMemory using a random secret key
|
|
14479
|
+
*/
|
|
14480
|
+
static generate() {
|
|
14481
|
+
return new AccountMemory(generateKeyPair().secretKey);
|
|
14482
|
+
}
|
|
14483
|
+
|
|
14484
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14485
|
+
async sign(data, options) {
|
|
14486
|
+
return sign(data, secretKeys.get(this));
|
|
14487
|
+
}
|
|
14488
|
+
async signTransaction(transaction, {
|
|
14489
|
+
innerTx,
|
|
14490
|
+
networkId,
|
|
14491
|
+
...options
|
|
14492
|
+
} = {}) {
|
|
14493
|
+
if (networkId == null) {
|
|
14494
|
+
throw new ArgumentError('networkId', 'provided', networkId);
|
|
14495
|
+
}
|
|
14496
|
+
const rlpBinaryTx = decode(transaction);
|
|
14497
|
+
const txWithNetworkId = getBufferToSign(transaction, networkId, innerTx === true);
|
|
14498
|
+
const signatures = [await this.sign(txWithNetworkId, options)];
|
|
14499
|
+
return buildTx({
|
|
14500
|
+
tag: Tag.SignedTx,
|
|
14501
|
+
encodedTx: rlpBinaryTx,
|
|
14502
|
+
signatures
|
|
14503
|
+
});
|
|
14504
|
+
}
|
|
14505
|
+
async signMessage(message, options) {
|
|
14506
|
+
return this.sign(messageToHash(message), options);
|
|
14507
|
+
}
|
|
14508
|
+
}
|
|
14509
|
+
;// CONCATENATED MODULE: ./src/tx/execution-cost.ts
|
|
14510
|
+
|
|
14511
|
+
|
|
14512
|
+
|
|
14513
|
+
|
|
14514
|
+
|
|
14515
|
+
|
|
14516
|
+
|
|
14517
|
+
/**
|
|
14518
|
+
* Calculates the cost of transaction execution
|
|
14519
|
+
* Provides an upper cost of contract-call-related transactions because of `gasLimit`.
|
|
14520
|
+
* Also assumes that oracle query fee is 0 unless it is provided in options.
|
|
14521
|
+
* @param transaction - Transaction to calculate the cost of
|
|
14522
|
+
* @param innerTx - Should be provided if transaction wrapped with Tag.PayingForTx
|
|
14523
|
+
* @param gasUsed - Amount of gas actually used to make calculation more accurate
|
|
14524
|
+
* @param queryFee - Oracle query fee
|
|
14525
|
+
* @param isInitiator - Is transaction signer an initiator of state channel
|
|
14526
|
+
*/
|
|
14527
|
+
function getExecutionCost(transaction, {
|
|
14528
|
+
innerTx,
|
|
14529
|
+
gasUsed,
|
|
14530
|
+
queryFee,
|
|
14531
|
+
isInitiator
|
|
14532
|
+
} = {}) {
|
|
14533
|
+
const params = unpackTx(transaction);
|
|
14534
|
+
if (params.tag === Tag.SignedTx) {
|
|
14535
|
+
throw new IllegalArgumentError('Transaction shouldn\'t be a SignedTx, use `getExecutionCostBySignedTx` instead');
|
|
14536
|
+
}
|
|
14537
|
+
let res = 0n;
|
|
14538
|
+
if ('fee' in params && innerTx !== 'freeloader') {
|
|
14539
|
+
res += BigInt(params.fee);
|
|
14540
|
+
}
|
|
14541
|
+
if (params.tag === Tag.NameClaimTx) {
|
|
14542
|
+
res += BigInt(params.nameFee);
|
|
14543
|
+
}
|
|
14544
|
+
if (params.tag === Tag.OracleQueryTx) {
|
|
14545
|
+
res += BigInt(params.queryFee);
|
|
14546
|
+
}
|
|
14547
|
+
if (params.tag === Tag.OracleResponseTx) {
|
|
14548
|
+
res -= BigInt(queryFee !== null && queryFee !== void 0 ? queryFee : 0);
|
|
14549
|
+
}
|
|
14550
|
+
if (params.tag === Tag.ChannelSettleTx) {
|
|
14551
|
+
if (isInitiator === true) res -= BigInt(params.initiatorAmountFinal);
|
|
14552
|
+
if (isInitiator === false) res -= BigInt(params.responderAmountFinal);
|
|
14553
|
+
}
|
|
14554
|
+
if ((params.tag === Tag.SpendTx && params.senderId !== params.recipientId || params.tag === Tag.ContractCreateTx || params.tag === Tag.ContractCallTx || params.tag === Tag.ChannelDepositTx) && innerTx !== 'fee-payer') {
|
|
14555
|
+
res += BigInt(params.amount);
|
|
14556
|
+
}
|
|
14557
|
+
if (params.tag === Tag.ContractCreateTx) res += BigInt(params.deposit);
|
|
14558
|
+
if ((params.tag === Tag.ContractCreateTx || params.tag === Tag.ContractCallTx || params.tag === Tag.GaAttachTx || params.tag === Tag.GaMetaTx) && innerTx !== 'freeloader') {
|
|
14559
|
+
res += BigInt(params.gasPrice) * BigInt(gasUsed !== null && gasUsed !== void 0 ? gasUsed : params.gasLimit);
|
|
14560
|
+
}
|
|
14561
|
+
if (params.tag === Tag.GaMetaTx || params.tag === Tag.PayingForTx) {
|
|
14562
|
+
res += getExecutionCost(buildTx(params.tx.encodedTx), params.tag === Tag.PayingForTx ? {
|
|
14563
|
+
innerTx: 'fee-payer'
|
|
14564
|
+
} : {});
|
|
14565
|
+
}
|
|
14566
|
+
return res;
|
|
14567
|
+
}
|
|
14568
|
+
|
|
14569
|
+
/**
|
|
14570
|
+
* Calculates the cost of signed transaction execution
|
|
14571
|
+
* @param transaction - Transaction to calculate the cost of
|
|
14572
|
+
* @param networkId - Network id used to sign the transaction
|
|
14573
|
+
* @param options - Options
|
|
14574
|
+
*/
|
|
14575
|
+
function getExecutionCostBySignedTx(transaction, networkId, options) {
|
|
14576
|
+
const params = unpackTx(transaction, Tag.SignedTx);
|
|
14577
|
+
if (params.encodedTx.tag === Tag.GaMetaTx) {
|
|
14578
|
+
return getExecutionCost(buildTx(params.encodedTx), options);
|
|
14579
|
+
}
|
|
14580
|
+
const tx = buildTx(params.encodedTx);
|
|
14581
|
+
const address = getTransactionSignerAddress(tx);
|
|
14582
|
+
const [isInnerTx, isNotInnerTx] = [true, false].map(f => verify(getBufferToSign(tx, networkId, f), params.signatures[0], address));
|
|
14583
|
+
if (!isInnerTx && !isNotInnerTx) throw new TransactionError('Can\'t verify signature');
|
|
14584
|
+
return getExecutionCost(buildTx(params.encodedTx), {
|
|
14585
|
+
...(isInnerTx && {
|
|
14586
|
+
innerTx: 'freeloader'
|
|
14587
|
+
}),
|
|
14588
|
+
...options
|
|
14589
|
+
});
|
|
14590
|
+
}
|
|
14591
|
+
|
|
14592
|
+
/**
|
|
14593
|
+
* Calculates the cost of signed and not signed transaction execution using node
|
|
14594
|
+
* @param transaction - Transaction to calculate the cost of
|
|
14595
|
+
* @param node - Node to use
|
|
14596
|
+
* @param isMined - Is transaction already mined or not
|
|
14597
|
+
* @param options - Options
|
|
14598
|
+
*/
|
|
14599
|
+
async function getExecutionCostUsingNode(transaction, node, {
|
|
14600
|
+
isMined,
|
|
14601
|
+
...options
|
|
14602
|
+
} = {}) {
|
|
14603
|
+
let params = unpackTx(transaction);
|
|
14604
|
+
const isSignedTx = params.tag === Tag.SignedTx;
|
|
14605
|
+
const txHash = isSignedTx && isMined === true && buildTxHash(transaction);
|
|
14606
|
+
if (params.tag === Tag.SignedTx) params = params.encodedTx;
|
|
14607
|
+
|
|
14608
|
+
// TODO: set gasUsed for PayingForTx after solving https://github.com/aeternity/aeternity/issues/4087
|
|
14609
|
+
if (options.gasUsed == null && txHash !== false && [Tag.ContractCreateTx, Tag.ContractCallTx, Tag.GaAttachTx, Tag.GaMetaTx].includes(params.tag)) {
|
|
14610
|
+
const {
|
|
14611
|
+
callInfo,
|
|
14612
|
+
gaInfo
|
|
14613
|
+
} = await node.getTransactionInfoByHash(txHash);
|
|
14614
|
+
const combinedInfo = callInfo !== null && callInfo !== void 0 ? callInfo : gaInfo;
|
|
14615
|
+
if (combinedInfo == null) {
|
|
14616
|
+
throw new InternalError(`callInfo and gaInfo is not available for transaction ${txHash}`);
|
|
14617
|
+
}
|
|
14618
|
+
options.gasUsed = combinedInfo.gasUsed;
|
|
14619
|
+
}
|
|
14620
|
+
if (options.queryFee == null && Tag.OracleResponseTx === params.tag) {
|
|
14621
|
+
options.queryFee = (await node.getOracleByPubkey(params.oracleId)).queryFee.toString();
|
|
14622
|
+
}
|
|
14623
|
+
if (options.isInitiator == null && Tag.ChannelSettleTx === params.tag && isMined !== true) {
|
|
14624
|
+
const {
|
|
14625
|
+
initiatorId
|
|
14626
|
+
} = await node.getChannelByPubkey(params.channelId);
|
|
14627
|
+
options.isInitiator = params.fromId === initiatorId;
|
|
14628
|
+
}
|
|
14629
|
+
return isSignedTx ? getExecutionCostBySignedTx(transaction, await node.getNetworkId(), options) : getExecutionCost(transaction, options);
|
|
14630
|
+
}
|
|
14631
|
+
;// CONCATENATED MODULE: ./src/tx/validator.ts
|
|
14632
|
+
|
|
14633
|
+
|
|
14634
|
+
|
|
14635
|
+
|
|
14636
|
+
|
|
14637
|
+
|
|
14638
|
+
|
|
14639
|
+
|
|
14640
|
+
|
|
14641
|
+
|
|
14642
|
+
|
|
14643
|
+
const validators = [];
|
|
14644
|
+
async function verifyTransactionInternal(tx, node, parentTxTypes) {
|
|
14645
|
+
const address = getTransactionSignerAddress(buildTx(tx));
|
|
14646
|
+
const [account, {
|
|
14647
|
+
height
|
|
14648
|
+
}, {
|
|
14649
|
+
consensusProtocolVersion,
|
|
14650
|
+
nodeNetworkId
|
|
14651
|
+
}] = await Promise.all([node.getAccountByPubkey(address).catch(error => {
|
|
14652
|
+
if (!isAccountNotFoundError(error)) throw error;
|
|
14653
|
+
return {
|
|
14654
|
+
id: address,
|
|
14655
|
+
balance: 0n,
|
|
14656
|
+
nonce: 0
|
|
14657
|
+
};
|
|
14658
|
+
})
|
|
14659
|
+
// TODO: remove after fixing https://github.com/aeternity/aepp-sdk-js/issues/1537
|
|
14660
|
+
.then(acc => ({
|
|
14661
|
+
...acc,
|
|
14662
|
+
id: acc.id
|
|
14663
|
+
})), node.getCurrentKeyBlockHeight(), node.getNodeInfo()]);
|
|
14664
|
+
return (await Promise.all(validators.map(async v => v(tx, {
|
|
14665
|
+
node,
|
|
14666
|
+
account,
|
|
14667
|
+
height,
|
|
14668
|
+
consensusProtocolVersion,
|
|
14669
|
+
nodeNetworkId,
|
|
14670
|
+
parentTxTypes
|
|
14671
|
+
})))).flat();
|
|
14672
|
+
}
|
|
14673
|
+
|
|
14674
|
+
/**
|
|
14675
|
+
* Transaction Validator
|
|
14676
|
+
* This function validates some transaction properties,
|
|
14677
|
+
* to make sure it can be posted it to the chain
|
|
14678
|
+
* @category transaction builder
|
|
14679
|
+
* @param transaction - Base64Check-encoded transaction
|
|
14680
|
+
* @param nodeNotCached - Node to validate transaction against
|
|
14681
|
+
* @returns Array with verification errors
|
|
14682
|
+
* @example const errors = await verifyTransaction(transaction, node)
|
|
14683
|
+
*/
|
|
14684
|
+
async function verifyTransaction(transaction, nodeNotCached) {
|
|
14685
|
+
const node = new Node_Node(nodeNotCached.$host, {
|
|
14686
|
+
ignoreVersion: true,
|
|
14687
|
+
pipeline: nodeNotCached.pipeline.clone(),
|
|
14688
|
+
additionalPolicies: [genAggressiveCacheGetResponsesPolicy()]
|
|
14689
|
+
});
|
|
14690
|
+
return verifyTransactionInternal(unpackTx(transaction), node, []);
|
|
14691
|
+
}
|
|
14692
|
+
validators.push((tx, {
|
|
14693
|
+
account,
|
|
14694
|
+
nodeNetworkId,
|
|
14695
|
+
parentTxTypes
|
|
14696
|
+
}) => {
|
|
14697
|
+
if (tx.tag !== Tag.SignedTx) return [];
|
|
14698
|
+
const {
|
|
14699
|
+
encodedTx,
|
|
14700
|
+
signatures
|
|
14701
|
+
} = tx;
|
|
14702
|
+
if ((encodedTx !== null && encodedTx !== void 0 ? encodedTx : signatures) == null) return [];
|
|
14703
|
+
if (signatures.length !== 1) return []; // TODO: Support multisignature like in state channels
|
|
14704
|
+
const prefix = Buffer.from([nodeNetworkId, ...(parentTxTypes.includes(Tag.PayingForTx) ? ['inner_tx'] : [])].join('-'));
|
|
14705
|
+
const txBinary = decode(buildTx(encodedTx));
|
|
14706
|
+
const txWithNetworkId = concatBuffers([prefix, txBinary]);
|
|
14707
|
+
const txHashWithNetworkId = concatBuffers([prefix, hash(txBinary)]);
|
|
14708
|
+
if (verify(txWithNetworkId, signatures[0], account.id) || verify(txHashWithNetworkId, signatures[0], account.id)) return [];
|
|
14709
|
+
return [{
|
|
14710
|
+
message: 'Signature cannot be verified, please ensure that you transaction have' + ' the correct prefix and the correct private key for the sender address',
|
|
14711
|
+
key: 'InvalidSignature',
|
|
14712
|
+
checkedKeys: ['encodedTx', 'signatures']
|
|
14713
|
+
}];
|
|
14714
|
+
}, async (tx, {
|
|
14715
|
+
node,
|
|
14716
|
+
parentTxTypes
|
|
14717
|
+
}) => {
|
|
14718
|
+
let nestedTx;
|
|
14719
|
+
if ('encodedTx' in tx) nestedTx = tx.encodedTx;
|
|
14720
|
+
if ('tx' in tx) nestedTx = tx.tx;
|
|
14721
|
+
if (nestedTx == null) return [];
|
|
14722
|
+
return verifyTransactionInternal(nestedTx, node, [...parentTxTypes, tx.tag]);
|
|
14723
|
+
}, (tx, {
|
|
14724
|
+
height
|
|
14725
|
+
}) => {
|
|
14726
|
+
if (!('ttl' in tx)) return [];
|
|
14727
|
+
if (tx.ttl === 0 || tx.ttl >= height) return [];
|
|
14728
|
+
return [{
|
|
14729
|
+
message: `TTL ${tx.ttl} is already expired, current height is ${height}`,
|
|
14730
|
+
key: 'ExpiredTTL',
|
|
14731
|
+
checkedKeys: ['ttl']
|
|
14732
|
+
}];
|
|
14733
|
+
}, async (tx, {
|
|
14734
|
+
account,
|
|
14735
|
+
parentTxTypes,
|
|
14736
|
+
node
|
|
14737
|
+
}) => {
|
|
14738
|
+
if (parentTxTypes.length !== 0) return [];
|
|
14739
|
+
const cost = await getExecutionCostUsingNode(buildTx(tx), node).catch(() => 0n);
|
|
14740
|
+
if (cost <= account.balance) return [];
|
|
14741
|
+
return [{
|
|
14742
|
+
message: `Account balance ${account.balance} is not enough to execute the transaction that costs ${cost}`,
|
|
13994
14743
|
key: 'InsufficientBalance',
|
|
13995
|
-
checkedKeys: ['amount', 'fee', 'nameFee']
|
|
14744
|
+
checkedKeys: ['amount', 'fee', 'nameFee', 'gasLimit', 'gasPrice']
|
|
13996
14745
|
}];
|
|
13997
|
-
}, ({
|
|
13998
|
-
signatures,
|
|
13999
|
-
tag
|
|
14000
|
-
}, {
|
|
14746
|
+
}, (tx, {
|
|
14001
14747
|
account
|
|
14002
14748
|
}) => {
|
|
14003
|
-
if (account == null) return [];
|
|
14004
14749
|
let message;
|
|
14005
|
-
if (tag === Tag.SignedTx && account.kind === 'generalized' && signatures.length !== 0) {
|
|
14750
|
+
if (tx.tag === Tag.SignedTx && account.kind === 'generalized' && tx.signatures.length !== 0) {
|
|
14006
14751
|
message = 'Generalized account can\'t be used to generate SignedTx with signatures';
|
|
14007
14752
|
}
|
|
14008
|
-
if (tag === Tag.GaMetaTx && account.kind === 'basic') {
|
|
14753
|
+
if (tx.tag === Tag.GaMetaTx && account.kind === 'basic') {
|
|
14009
14754
|
message = 'Basic account can\'t be used to generate GaMetaTx';
|
|
14010
14755
|
}
|
|
14011
14756
|
if (message == null) return [];
|
|
@@ -14014,46 +14759,24 @@ validators.push(({
|
|
|
14014
14759
|
key: 'InvalidAccountType',
|
|
14015
14760
|
checkedKeys: ['tag']
|
|
14016
14761
|
}];
|
|
14017
|
-
},
|
|
14018
|
-
|
|
14019
|
-
|
|
14020
|
-
account,
|
|
14021
|
-
parentTxTypes
|
|
14022
|
-
}) => {
|
|
14023
|
-
if (nonce == null || account == null || parentTxTypes.includes(Tag.GaMetaTx)) return [];
|
|
14024
|
-
nonce = +nonce;
|
|
14025
|
-
const validNonce = account.nonce + 1;
|
|
14026
|
-
if (nonce === validNonce) return [];
|
|
14027
|
-
return [{
|
|
14028
|
-
...(nonce < validNonce ? {
|
|
14029
|
-
message: `Nonce ${nonce} is already used, valid nonce is ${validNonce}`,
|
|
14030
|
-
key: 'NonceAlreadyUsed'
|
|
14031
|
-
} : {
|
|
14032
|
-
message: `Nonce ${nonce} is too high, valid nonce is ${validNonce}`,
|
|
14033
|
-
key: 'NonceHigh'
|
|
14034
|
-
}),
|
|
14035
|
-
checkedKeys: ['nonce']
|
|
14036
|
-
}];
|
|
14037
|
-
}, ({
|
|
14038
|
-
ctVersion,
|
|
14039
|
-
abiVersion,
|
|
14040
|
-
tag
|
|
14041
|
-
}, {
|
|
14762
|
+
},
|
|
14763
|
+
// TODO: revert nonce check
|
|
14764
|
+
(tx, {
|
|
14042
14765
|
consensusProtocolVersion
|
|
14043
14766
|
}) => {
|
|
14044
|
-
var
|
|
14045
|
-
const oracleCall = Tag.Oracle === tag || Tag.OracleRegisterTx === tag;
|
|
14046
|
-
const contractCreate = Tag.ContractCreateTx === tag || Tag.GaAttachTx === tag;
|
|
14047
|
-
const contractCall = Tag.ContractCallTx === tag || Tag.GaMetaTx === tag;
|
|
14048
|
-
const type = (
|
|
14767
|
+
var _ref, _ref2;
|
|
14768
|
+
const oracleCall = Tag.Oracle === tx.tag || Tag.OracleRegisterTx === tx.tag;
|
|
14769
|
+
const contractCreate = Tag.ContractCreateTx === tx.tag || Tag.GaAttachTx === tx.tag;
|
|
14770
|
+
const contractCall = Tag.ContractCallTx === tx.tag || Tag.GaMetaTx === tx.tag;
|
|
14771
|
+
const type = (_ref = (_ref2 = oracleCall ? 'oracle-call' : null) !== null && _ref2 !== void 0 ? _ref2 : contractCreate ? 'contract-create' : null) !== null && _ref !== void 0 ? _ref : contractCall ? 'contract-call' : null;
|
|
14049
14772
|
if (type == null) return [];
|
|
14050
|
-
// TODO: remove assertion after fixing buildTx types
|
|
14051
14773
|
const protocol = ProtocolToVmAbi[consensusProtocolVersion][type];
|
|
14052
|
-
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
abiVersion
|
|
14774
|
+
let ctVersion;
|
|
14775
|
+
if ('abiVersion' in tx) ctVersion = {
|
|
14776
|
+
abiVersion: tx.abiVersion
|
|
14056
14777
|
};
|
|
14778
|
+
if ('ctVersion' in tx) ctVersion = tx.ctVersion;
|
|
14779
|
+
if (ctVersion == null) throw new UnexpectedTsError();
|
|
14057
14780
|
if (!protocol.abiVersion.includes(ctVersion.abiVersion) || contractCreate && !protocol.vmVersion.includes(ctVersion.vmVersion)) {
|
|
14058
14781
|
return [{
|
|
14059
14782
|
message: `ABI/VM version ${JSON.stringify(ctVersion)} is wrong, supported is: ${JSON.stringify(protocol)}`,
|
|
@@ -14062,21 +14785,17 @@ validators.push(({
|
|
|
14062
14785
|
}];
|
|
14063
14786
|
}
|
|
14064
14787
|
return [];
|
|
14065
|
-
}, async ({
|
|
14066
|
-
contractId,
|
|
14067
|
-
tag
|
|
14068
|
-
}, {
|
|
14788
|
+
}, async (tx, {
|
|
14069
14789
|
node
|
|
14070
14790
|
}) => {
|
|
14071
|
-
if (Tag.ContractCallTx !== tag) return [];
|
|
14072
|
-
contractId = contractId;
|
|
14791
|
+
if (Tag.ContractCallTx !== tx.tag) return [];
|
|
14073
14792
|
try {
|
|
14074
14793
|
const {
|
|
14075
14794
|
active
|
|
14076
|
-
} = await node.getContract(contractId);
|
|
14795
|
+
} = await node.getContract(tx.contractId);
|
|
14077
14796
|
if (active) return [];
|
|
14078
14797
|
return [{
|
|
14079
|
-
message: `Contract ${contractId} is not active`,
|
|
14798
|
+
message: `Contract ${tx.contractId} is not active`,
|
|
14080
14799
|
key: 'ContractNotActive',
|
|
14081
14800
|
checkedKeys: ['contractId']
|
|
14082
14801
|
}];
|
|
@@ -14091,22 +14810,8 @@ validators.push(({
|
|
|
14091
14810
|
}
|
|
14092
14811
|
});
|
|
14093
14812
|
;// CONCATENATED MODULE: ./src/chain.ts
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
* Copyright (c) 2022 aeternity developers
|
|
14097
|
-
*
|
|
14098
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
14099
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
14100
|
-
* copyright notice and this permission notice appear in all copies.
|
|
14101
|
-
*
|
|
14102
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
14103
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
14104
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14105
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
14106
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14107
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14108
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
14109
|
-
*/
|
|
14813
|
+
|
|
14814
|
+
|
|
14110
14815
|
|
|
14111
14816
|
|
|
14112
14817
|
|
|
@@ -14163,7 +14868,7 @@ async function getHeight({
|
|
|
14163
14868
|
* @returns The transaction as it was mined
|
|
14164
14869
|
*/
|
|
14165
14870
|
async function poll(th, {
|
|
14166
|
-
blocks =
|
|
14871
|
+
blocks = 5,
|
|
14167
14872
|
interval,
|
|
14168
14873
|
onNode,
|
|
14169
14874
|
...options
|
|
@@ -14246,25 +14951,36 @@ async function waitForTxConfirm(txHash, {
|
|
|
14246
14951
|
}
|
|
14247
14952
|
|
|
14248
14953
|
/**
|
|
14249
|
-
*
|
|
14954
|
+
* Signs and submits transaction for mining
|
|
14250
14955
|
* @category chain
|
|
14251
|
-
* @param
|
|
14956
|
+
* @param txUnsigned - Transaction to sign and submit
|
|
14252
14957
|
* @param options - Options
|
|
14253
14958
|
* @param options.onNode - Node to use
|
|
14254
14959
|
* @param options.onAccount - Account to use
|
|
14255
|
-
* @param options.verify - Verify transaction before
|
|
14960
|
+
* @param options.verify - Verify transaction before broadcast, throw error if not
|
|
14256
14961
|
* @param options.waitMined - Ensure that transaction get into block
|
|
14257
14962
|
* @param options.confirm - Number of micro blocks that should be mined after tx get included
|
|
14258
14963
|
* @returns Transaction details
|
|
14259
14964
|
*/
|
|
14260
|
-
async function sendTransaction(
|
|
14965
|
+
async function sendTransaction(txUnsigned, {
|
|
14261
14966
|
onNode,
|
|
14262
14967
|
onAccount,
|
|
14263
14968
|
verify = true,
|
|
14264
14969
|
waitMined = true,
|
|
14265
14970
|
confirm,
|
|
14971
|
+
innerTx,
|
|
14266
14972
|
...options
|
|
14267
14973
|
}) {
|
|
14974
|
+
const tx = await onAccount.signTransaction(txUnsigned, {
|
|
14975
|
+
...options,
|
|
14976
|
+
onNode,
|
|
14977
|
+
innerTx,
|
|
14978
|
+
networkId: await onNode.getNetworkId()
|
|
14979
|
+
});
|
|
14980
|
+
if (innerTx === true) return {
|
|
14981
|
+
hash: buildTxHash(tx),
|
|
14982
|
+
rawTx: tx
|
|
14983
|
+
};
|
|
14268
14984
|
if (verify) {
|
|
14269
14985
|
const validation = await verifyTransaction(tx, onNode);
|
|
14270
14986
|
if (validation.length > 0) {
|
|
@@ -14358,9 +15074,10 @@ async function getBalance(address, {
|
|
|
14358
15074
|
format = AE_AMOUNT_FORMATS.AETTOS,
|
|
14359
15075
|
...options
|
|
14360
15076
|
}) {
|
|
15077
|
+
const addr = address.startsWith('ok_') ? encode(decode(address), Encoding.AccountAddress) : address;
|
|
14361
15078
|
const {
|
|
14362
15079
|
balance
|
|
14363
|
-
} = await getAccount(
|
|
15080
|
+
} = await getAccount(addr, options).catch(error => {
|
|
14364
15081
|
if (!isAccountNotFoundError(error)) throw error;
|
|
14365
15082
|
return {
|
|
14366
15083
|
balance: 0n
|
|
@@ -14744,121 +15461,6 @@ async function dump(name, password, privateKey, nonce = external_tweetnacl_defau
|
|
|
14744
15461
|
}
|
|
14745
15462
|
};
|
|
14746
15463
|
}
|
|
14747
|
-
;// CONCATENATED MODULE: ./src/tx/index.ts
|
|
14748
|
-
/*
|
|
14749
|
-
* ISC License (ISC)
|
|
14750
|
-
* Copyright (c) 2022 aeternity developers
|
|
14751
|
-
*
|
|
14752
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
14753
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
14754
|
-
* copyright notice and this permission notice appear in all copies.
|
|
14755
|
-
*
|
|
14756
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
14757
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
14758
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14759
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
14760
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14761
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14762
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
14763
|
-
*/
|
|
14764
|
-
|
|
14765
|
-
/**
|
|
14766
|
-
* Transaction methods
|
|
14767
|
-
*
|
|
14768
|
-
* This is implementation of [Tx](api/tx.md) relays
|
|
14769
|
-
* the creation of transactions to {@link Node}.
|
|
14770
|
-
* These methods provide ability to create native transactions.
|
|
14771
|
-
*/
|
|
14772
|
-
|
|
14773
|
-
|
|
14774
|
-
|
|
14775
|
-
|
|
14776
|
-
|
|
14777
|
-
// TODO: find a better name or rearrange methods
|
|
14778
|
-
/**
|
|
14779
|
-
* @category transaction builder
|
|
14780
|
-
*/
|
|
14781
|
-
async function _buildTx(txType, {
|
|
14782
|
-
denomination,
|
|
14783
|
-
absoluteTtl,
|
|
14784
|
-
strategy,
|
|
14785
|
-
onNode,
|
|
14786
|
-
..._params
|
|
14787
|
-
}) {
|
|
14788
|
-
var _params$nonce, _params$ttl;
|
|
14789
|
-
// TODO: avoid this assertion
|
|
14790
|
-
const params = _params;
|
|
14791
|
-
let senderKey;
|
|
14792
|
-
switch (txType) {
|
|
14793
|
-
case Tag.SpendTx:
|
|
14794
|
-
case Tag.OracleQueryTx:
|
|
14795
|
-
senderKey = 'senderId';
|
|
14796
|
-
break;
|
|
14797
|
-
case Tag.NameClaimTx:
|
|
14798
|
-
case Tag.NameUpdateTx:
|
|
14799
|
-
case Tag.NameRevokeTx:
|
|
14800
|
-
case Tag.NameTransferTx:
|
|
14801
|
-
case Tag.NamePreclaimTx:
|
|
14802
|
-
case Tag.OracleRegisterTx:
|
|
14803
|
-
senderKey = 'accountId';
|
|
14804
|
-
break;
|
|
14805
|
-
case Tag.ContractCreateTx:
|
|
14806
|
-
case Tag.GaAttachTx:
|
|
14807
|
-
senderKey = 'ownerId';
|
|
14808
|
-
break;
|
|
14809
|
-
case Tag.GaMetaTx:
|
|
14810
|
-
senderKey = 'gaId';
|
|
14811
|
-
break;
|
|
14812
|
-
case Tag.ContractCallTx:
|
|
14813
|
-
case Tag.OracleExtendTx:
|
|
14814
|
-
case Tag.OracleResponseTx:
|
|
14815
|
-
senderKey = 'callerId';
|
|
14816
|
-
break;
|
|
14817
|
-
case Tag.ChannelCloseSoloTx:
|
|
14818
|
-
case Tag.ChannelSlashTx:
|
|
14819
|
-
case Tag.ChannelSettleTx:
|
|
14820
|
-
case Tag.ChannelSnapshotSoloTx:
|
|
14821
|
-
senderKey = 'fromId';
|
|
14822
|
-
break;
|
|
14823
|
-
case Tag.PayingForTx:
|
|
14824
|
-
senderKey = 'payerId';
|
|
14825
|
-
break;
|
|
14826
|
-
default:
|
|
14827
|
-
throw new ArgumentError('txType', 'valid transaction type', txType);
|
|
14828
|
-
}
|
|
14829
|
-
if (Object.keys(ConsensusProtocolVersion).length !== 2 && ((Tag.ContractCreateTx === txType || Tag.GaAttachTx === txType) && params.ctVersion == null || (Tag.ContractCallTx === txType || Tag.GaMetaTx === txType) && params.abiVersion == null)) {
|
|
14830
|
-
const {
|
|
14831
|
-
consensusProtocolVersion
|
|
14832
|
-
} = await onNode.getNodeInfo();
|
|
14833
|
-
// @ts-expect-error remove after fixing buildTx types
|
|
14834
|
-
params.consensusProtocolVersion = consensusProtocolVersion;
|
|
14835
|
-
}
|
|
14836
|
-
if (txType === Tag.PayingForTx) {
|
|
14837
|
-
params.tx = unpackTx(params.tx);
|
|
14838
|
-
}
|
|
14839
|
-
const senderId = params[senderKey];
|
|
14840
|
-
// TODO: do this check on TypeScript level
|
|
14841
|
-
if (senderId == null) throw new InvalidTxParamsError(`Transaction field ${senderKey} is missed`);
|
|
14842
|
-
(_params$nonce = params.nonce) !== null && _params$nonce !== void 0 ? _params$nonce : params.nonce = (await onNode.getAccountNextNonce(senderId, {
|
|
14843
|
-
strategy
|
|
14844
|
-
}).catch(error => {
|
|
14845
|
-
if (!isAccountNotFoundError(error)) throw error;
|
|
14846
|
-
return {
|
|
14847
|
-
nextNonce: 1
|
|
14848
|
-
};
|
|
14849
|
-
})).nextNonce;
|
|
14850
|
-
(_params$ttl = params.ttl) !== null && _params$ttl !== void 0 ? _params$ttl : params.ttl = TX_TTL;
|
|
14851
|
-
if (params.ttl !== 0) {
|
|
14852
|
-
if (params.ttl < 0) throw new ArgumentError('ttl', 'greater or equal to 0', params.ttl);
|
|
14853
|
-
params.ttl += absoluteTtl === true ? 0 : (await onNode.getCurrentKeyBlock()).height;
|
|
14854
|
-
}
|
|
14855
|
-
return buildTx({
|
|
14856
|
-
...params,
|
|
14857
|
-
tag: txType
|
|
14858
|
-
}, {
|
|
14859
|
-
denomination
|
|
14860
|
-
});
|
|
14861
|
-
}
|
|
14862
15464
|
// EXTERNAL MODULE: external "tweetnacl-auth"
|
|
14863
15465
|
var external_tweetnacl_auth_ = __webpack_require__(9882);
|
|
14864
15466
|
// EXTERNAL MODULE: external "bip32-path"
|
|
@@ -15023,130 +15625,7 @@ const getHdWalletAccountFromSeed = (seed, accountIdx) => {
|
|
|
15023
15625
|
idx: accountIdx
|
|
15024
15626
|
};
|
|
15025
15627
|
};
|
|
15026
|
-
;// CONCATENATED MODULE: ./src/spend.ts
|
|
15027
|
-
/*
|
|
15028
|
-
* ISC License (ISC)
|
|
15029
|
-
* Copyright (c) 2022 aeternity developers
|
|
15030
|
-
*
|
|
15031
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
15032
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
15033
|
-
* copyright notice and this permission notice appear in all copies.
|
|
15034
|
-
*
|
|
15035
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
15036
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
15037
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
15038
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15039
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
15040
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15041
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
15042
|
-
*/
|
|
15043
|
-
|
|
15044
|
-
|
|
15045
|
-
|
|
15046
|
-
|
|
15047
|
-
|
|
15048
|
-
|
|
15049
|
-
/**
|
|
15050
|
-
* Sign and post a transaction to the chain
|
|
15051
|
-
* @category chain
|
|
15052
|
-
* @param tx - Transaction
|
|
15053
|
-
* @param options - Options
|
|
15054
|
-
* @param options.verify - Verify transaction before broadcast, throw error if not
|
|
15055
|
-
* valid
|
|
15056
|
-
* @returns Transaction
|
|
15057
|
-
*/
|
|
15058
|
-
async function send(tx, options) {
|
|
15059
|
-
const signed = await options.onAccount.signTransaction(tx, {
|
|
15060
|
-
...options,
|
|
15061
|
-
networkId: await options.onNode.getNetworkId()
|
|
15062
|
-
});
|
|
15063
|
-
return options.innerTx === true ? {
|
|
15064
|
-
hash: buildTxHash(signed),
|
|
15065
|
-
rawTx: signed
|
|
15066
|
-
} : sendTransaction(signed, options);
|
|
15067
|
-
}
|
|
15068
|
-
/**
|
|
15069
|
-
* Send coins to another account
|
|
15070
|
-
* @category chain
|
|
15071
|
-
* @param amount - Amount to spend
|
|
15072
|
-
* @param recipientIdOrName - Address or name of recipient account
|
|
15073
|
-
* @param options - Options
|
|
15074
|
-
* @returns Transaction
|
|
15075
|
-
*/
|
|
15076
|
-
async function spend(amount, recipientIdOrName, options) {
|
|
15077
|
-
return send(await _buildTx(Tag.SpendTx, {
|
|
15078
|
-
...options,
|
|
15079
|
-
senderId: options.onAccount.address,
|
|
15080
|
-
recipientId: await resolveName(recipientIdOrName, 'account_pubkey', options),
|
|
15081
|
-
amount
|
|
15082
|
-
}), options);
|
|
15083
|
-
}
|
|
15084
|
-
// TODO: Rename to spendFraction
|
|
15085
|
-
/**
|
|
15086
|
-
* Send a fraction of coin balance to another account
|
|
15087
|
-
* @category chain
|
|
15088
|
-
* @param fraction - Fraction of balance to spend (between 0 and 1)
|
|
15089
|
-
* @param recipientIdOrName - Address or name of recipient account
|
|
15090
|
-
* @param options - Options
|
|
15091
|
-
* @returns Transaction
|
|
15092
|
-
*/
|
|
15093
|
-
async function transferFunds(fraction, recipientIdOrName, options) {
|
|
15094
|
-
if (fraction < 0 || fraction > 1) {
|
|
15095
|
-
throw new ArgumentError('fraction', 'a number between 0 and 1', fraction);
|
|
15096
|
-
}
|
|
15097
|
-
const recipientId = await resolveName(recipientIdOrName, 'account_pubkey', options);
|
|
15098
|
-
const senderId = options.onAccount.address;
|
|
15099
|
-
const balance = new (external_bignumber_js_default())(await getBalance.bind(options.onAccount)(senderId, options));
|
|
15100
|
-
const desiredAmount = balance.times(fraction).integerValue((external_bignumber_js_default()).ROUND_HALF_UP);
|
|
15101
|
-
const {
|
|
15102
|
-
fee
|
|
15103
|
-
} = unpackTx(await _buildTx(Tag.SpendTx, {
|
|
15104
|
-
...options,
|
|
15105
|
-
senderId,
|
|
15106
|
-
recipientId,
|
|
15107
|
-
amount: desiredAmount
|
|
15108
|
-
}), Tag.SpendTx);
|
|
15109
|
-
// Reducing of the amount may reduce transaction fee, so this is not completely accurate
|
|
15110
|
-
const amount = desiredAmount.plus(fee).gt(balance) ? balance.minus(fee) : desiredAmount;
|
|
15111
|
-
return send(await _buildTx(Tag.SpendTx, {
|
|
15112
|
-
...options,
|
|
15113
|
-
senderId,
|
|
15114
|
-
recipientId,
|
|
15115
|
-
amount
|
|
15116
|
-
}), options);
|
|
15117
|
-
}
|
|
15118
|
-
/**
|
|
15119
|
-
* Submit transaction of another account paying for it (fee and gas)
|
|
15120
|
-
* @category chain
|
|
15121
|
-
* @param transaction - tx_<base64>-encoded transaction
|
|
15122
|
-
* @param options - Options
|
|
15123
|
-
* @returns Object Transaction
|
|
15124
|
-
*/
|
|
15125
|
-
async function payForTransaction(transaction, options) {
|
|
15126
|
-
return send(await _buildTx(Tag.PayingForTx, {
|
|
15127
|
-
...options,
|
|
15128
|
-
payerId: options.onAccount.address,
|
|
15129
|
-
tx: transaction
|
|
15130
|
-
}), options);
|
|
15131
|
-
}
|
|
15132
15628
|
;// CONCATENATED MODULE: ./src/aens.ts
|
|
15133
|
-
/*
|
|
15134
|
-
* ISC License (ISC)
|
|
15135
|
-
* Copyright (c) 2022 aeternity developers
|
|
15136
|
-
*
|
|
15137
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
15138
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
15139
|
-
* copyright notice and this permission notice appear in all copies.
|
|
15140
|
-
*
|
|
15141
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
15142
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
15143
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
15144
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15145
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
15146
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15147
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
15148
|
-
*/
|
|
15149
|
-
|
|
15150
15629
|
/**
|
|
15151
15630
|
* Aens methods - routines to interact with the æternity naming system
|
|
15152
15631
|
*
|
|
@@ -15161,7 +15640,6 @@ async function payForTransaction(transaction, options) {
|
|
|
15161
15640
|
|
|
15162
15641
|
|
|
15163
15642
|
|
|
15164
|
-
|
|
15165
15643
|
/**
|
|
15166
15644
|
* Revoke a name
|
|
15167
15645
|
* @category AENS
|
|
@@ -15184,12 +15662,13 @@ async function payForTransaction(transaction, options) {
|
|
|
15184
15662
|
* ```
|
|
15185
15663
|
*/
|
|
15186
15664
|
async function aensRevoke(name, options) {
|
|
15187
|
-
const nameRevokeTx = await
|
|
15665
|
+
const nameRevokeTx = await buildTxAsync({
|
|
15188
15666
|
...options,
|
|
15667
|
+
tag: Tag.NameRevokeTx,
|
|
15189
15668
|
nameId: name,
|
|
15190
15669
|
accountId: options.onAccount.address
|
|
15191
15670
|
});
|
|
15192
|
-
return
|
|
15671
|
+
return sendTransaction(nameRevokeTx, options);
|
|
15193
15672
|
}
|
|
15194
15673
|
/**
|
|
15195
15674
|
* Update a name
|
|
@@ -15231,10 +15710,11 @@ async function aensUpdate(name, pointers, {
|
|
|
15231
15710
|
}) => [key, id]))),
|
|
15232
15711
|
...pointers
|
|
15233
15712
|
};
|
|
15234
|
-
const nameUpdateTx = await
|
|
15713
|
+
const nameUpdateTx = await buildTxAsync({
|
|
15235
15714
|
clientTtl: CLIENT_TTL,
|
|
15236
15715
|
nameTtl: NAME_TTL,
|
|
15237
15716
|
...options,
|
|
15717
|
+
tag: Tag.NameUpdateTx,
|
|
15238
15718
|
nameId: name,
|
|
15239
15719
|
accountId: options.onAccount.address,
|
|
15240
15720
|
pointers: Object.entries(allPointers).map(([key, id]) => ({
|
|
@@ -15242,7 +15722,7 @@ async function aensUpdate(name, pointers, {
|
|
|
15242
15722
|
id
|
|
15243
15723
|
}))
|
|
15244
15724
|
});
|
|
15245
|
-
return
|
|
15725
|
+
return sendTransaction(nameUpdateTx, options);
|
|
15246
15726
|
}
|
|
15247
15727
|
/**
|
|
15248
15728
|
* Transfer a domain to another account
|
|
@@ -15268,13 +15748,14 @@ async function aensUpdate(name, pointers, {
|
|
|
15268
15748
|
* ```
|
|
15269
15749
|
*/
|
|
15270
15750
|
async function aensTransfer(name, account, options) {
|
|
15271
|
-
const nameTransferTx = await
|
|
15751
|
+
const nameTransferTx = await buildTxAsync({
|
|
15272
15752
|
...options,
|
|
15753
|
+
tag: Tag.NameTransferTx,
|
|
15273
15754
|
nameId: name,
|
|
15274
15755
|
accountId: options.onAccount.address,
|
|
15275
15756
|
recipientId: account
|
|
15276
15757
|
});
|
|
15277
|
-
return
|
|
15758
|
+
return sendTransaction(nameTransferTx, options);
|
|
15278
15759
|
}
|
|
15279
15760
|
/**
|
|
15280
15761
|
* Query the AENS name info from the node
|
|
@@ -15376,13 +15857,14 @@ async function aensQuery(name, opt) {
|
|
|
15376
15857
|
* ```
|
|
15377
15858
|
*/
|
|
15378
15859
|
async function aensClaim(name, salt, options) {
|
|
15379
|
-
const claimTx = await
|
|
15860
|
+
const claimTx = await buildTxAsync({
|
|
15380
15861
|
...options,
|
|
15862
|
+
tag: Tag.NameClaimTx,
|
|
15381
15863
|
accountId: options.onAccount.address,
|
|
15382
15864
|
nameSalt: salt,
|
|
15383
15865
|
name
|
|
15384
15866
|
});
|
|
15385
|
-
const result = await
|
|
15867
|
+
const result = await sendTransaction(claimTx, options);
|
|
15386
15868
|
if (!isAuctionName(name)) {
|
|
15387
15869
|
const nameInter = result.blockHeight != null && result.blockHeight > 0 ? await aensQuery(name, options) : {};
|
|
15388
15870
|
return Object.assign(result, nameInter);
|
|
@@ -15415,16 +15897,15 @@ async function aensClaim(name, salt, options) {
|
|
|
15415
15897
|
*/
|
|
15416
15898
|
async function aensPreclaim(name, options) {
|
|
15417
15899
|
const salt = genSalt();
|
|
15418
|
-
const height = await getHeight(options);
|
|
15419
15900
|
const commitmentId = commitmentHash(name, salt);
|
|
15420
|
-
const preclaimTx = await
|
|
15901
|
+
const preclaimTx = await buildTxAsync({
|
|
15421
15902
|
...options,
|
|
15903
|
+
tag: Tag.NamePreclaimTx,
|
|
15422
15904
|
accountId: options.onAccount.address,
|
|
15423
15905
|
commitmentId
|
|
15424
15906
|
});
|
|
15425
15907
|
return Object.freeze({
|
|
15426
|
-
...(await
|
|
15427
|
-
height,
|
|
15908
|
+
...(await sendTransaction(preclaimTx, options)),
|
|
15428
15909
|
salt,
|
|
15429
15910
|
commitmentId,
|
|
15430
15911
|
async claim(opts) {
|
|
@@ -15468,23 +15949,12 @@ async function aensBid(name, nameFee, options) {
|
|
|
15468
15949
|
// EXTERNAL MODULE: external "@aeternity/aepp-calldata"
|
|
15469
15950
|
var aepp_calldata_ = __webpack_require__(7946);
|
|
15470
15951
|
;// CONCATENATED MODULE: ./src/contract/Contract.ts
|
|
15471
|
-
/*
|
|
15472
|
-
* ISC License (ISC)
|
|
15473
|
-
* Copyright (c) 2022 aeternity developers
|
|
15474
|
-
*
|
|
15475
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
15476
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
15477
|
-
* copyright notice and this permission notice appear in all copies.
|
|
15478
|
-
*
|
|
15479
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
15480
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
15481
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
15482
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15483
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
15484
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15485
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
15486
|
-
*/
|
|
15487
15952
|
|
|
15953
|
+
|
|
15954
|
+
function Contract_classPrivateFieldInitSpec(obj, privateMap, value) { Contract_checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
15955
|
+
function Contract_classPrivateMethodInitSpec(obj, privateSet) { Contract_checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
|
15956
|
+
function Contract_checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
15957
|
+
function Contract_classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
|
15488
15958
|
/**
|
|
15489
15959
|
* Contract module - routines to interact with the æternity contract
|
|
15490
15960
|
*
|
|
@@ -15500,10 +15970,11 @@ var aepp_calldata_ = __webpack_require__(7946);
|
|
|
15500
15970
|
|
|
15501
15971
|
|
|
15502
15972
|
|
|
15503
|
-
|
|
15504
|
-
|
|
15505
|
-
|
|
15506
|
-
|
|
15973
|
+
var _getCallResult = /*#__PURE__*/new WeakSet();
|
|
15974
|
+
var _sendAndProcess = /*#__PURE__*/new WeakSet();
|
|
15975
|
+
var _getFunctionAci = /*#__PURE__*/new WeakSet();
|
|
15976
|
+
var _getContractNameByEvent = /*#__PURE__*/new WeakSet();
|
|
15977
|
+
var _aciContract = /*#__PURE__*/new WeakMap();
|
|
15507
15978
|
/**
|
|
15508
15979
|
* Generate contract ACI object with predefined js methods for contract usage - can be used for
|
|
15509
15980
|
* creating a reference to already deployed contracts
|
|
@@ -15522,103 +15993,41 @@ var aepp_calldata_ = __webpack_require__(7946);
|
|
|
15522
15993
|
* stateful or not
|
|
15523
15994
|
*/
|
|
15524
15995
|
class Contract {
|
|
15525
|
-
/**
|
|
15526
|
-
* Helper to generate a signature to delegate
|
|
15527
|
-
* - pre-claim/claim/transfer/revoke of a name to a contract.
|
|
15528
|
-
* - register/extend/respond of an Oracle to a contract.
|
|
15529
|
-
* @category contract
|
|
15530
|
-
* @param ids - The list of id's to prepend
|
|
15531
|
-
* @param _options - Options
|
|
15532
|
-
* @param _options.omitAddress - Prepend delegation signature with an account address
|
|
15533
|
-
* @param _options.onAccount - Account to use
|
|
15534
|
-
* @returns Signature
|
|
15535
|
-
* @example
|
|
15536
|
-
* ```js
|
|
15537
|
-
* const aeSdk = new AeSdk({ ... })
|
|
15538
|
-
* const contract = await aeSdk.initializeContract({ address: 'ct_asd2ks...' })
|
|
15539
|
-
* const aensName = 'example.chain'
|
|
15540
|
-
* const onAccount = new MemoryAccount(...) // Sign with a specific account
|
|
15541
|
-
* // Preclaim signature
|
|
15542
|
-
* const preclaimSig = await contract.$createDelegationSignature([], { onAccount })
|
|
15543
|
-
* // Claim, transfer and revoke signature
|
|
15544
|
-
* const aensDelegationSig = await contract
|
|
15545
|
-
* .$createDelegationSignature([aensName], { onAccount })
|
|
15546
|
-
* ```
|
|
15547
|
-
* @example
|
|
15548
|
-
* ```js
|
|
15549
|
-
* const aeSdk = new AeSdk({ ... })
|
|
15550
|
-
* const contract = await aeSdk.initializeContract({ address: 'ct_asd2ks...' })
|
|
15551
|
-
* const oracleQueryId = 'oq_...'
|
|
15552
|
-
* const onAccount = new MemoryAccount(...) // Sign with a specific account
|
|
15553
|
-
* // Oracle register and extend signature
|
|
15554
|
-
* const oracleDelegationSig = await contract.$createDelegationSignature([], { onAccount })
|
|
15555
|
-
* // Oracle respond signature
|
|
15556
|
-
* const respondSig = await contract
|
|
15557
|
-
* .$createDelegationSignature([oracleQueryId], { onAccount, omitAddress: true })
|
|
15558
|
-
* ```
|
|
15559
|
-
*/
|
|
15560
|
-
async $createDelegationSignature(ids = [], _options) {
|
|
15561
|
-
const options = {
|
|
15562
|
-
...this.$options,
|
|
15563
|
-
..._options
|
|
15564
|
-
};
|
|
15565
|
-
const contractId = this.$options.address;
|
|
15566
|
-
if (options.onAccount == null) throw new IllegalArgumentError('Can\'t create delegation signature without account');
|
|
15567
|
-
if (contractId == null) throw new MissingContractAddressError('Can\'t create delegation signature without address');
|
|
15568
|
-
return options.onAccount.sign(concatBuffers([Buffer.from(await options.onNode.getNetworkId()), ...(options.omitAddress === true ? [] : [decode(options.onAccount.address)]), ...ids.map(e => isNameValid(e) ? produceNameId(e) : e).map(e => decode(e)), decode(contractId)]), options);
|
|
15569
|
-
}
|
|
15570
|
-
|
|
15571
15996
|
/**
|
|
15572
15997
|
* Compile contract
|
|
15573
15998
|
* @returns bytecode
|
|
15574
15999
|
*/
|
|
15575
16000
|
async $compile() {
|
|
15576
16001
|
if (this.$options.bytecode != null) return this.$options.bytecode;
|
|
15577
|
-
if (this.$options.sourceCode == null) throw new IllegalArgumentError('Can\'t compile without source code');
|
|
15578
16002
|
if (this.$options.onCompiler == null) throw new IllegalArgumentError('Can\'t compile without compiler');
|
|
15579
|
-
|
|
15580
|
-
|
|
15581
|
-
|
|
15582
|
-
|
|
15583
|
-
|
|
15584
|
-
|
|
15585
|
-
|
|
15586
|
-
|
|
15587
|
-
|
|
15588
|
-
|
|
15589
|
-
|
|
15590
|
-
|
|
15591
|
-
|
|
15592
|
-
|
|
15593
|
-
case 'error':
|
|
15594
|
-
message = decode(returnValue).toString();
|
|
15595
|
-
break;
|
|
15596
|
-
default:
|
|
15597
|
-
throw new InternalError(`Unknown return type: ${returnType}`);
|
|
16003
|
+
if (this.$options.sourceCode != null) {
|
|
16004
|
+
const {
|
|
16005
|
+
bytecode
|
|
16006
|
+
} = await this.$options.onCompiler.compileBySourceCode(this.$options.sourceCode, this.$options.fileSystem);
|
|
16007
|
+
this.$options.bytecode = bytecode;
|
|
16008
|
+
}
|
|
16009
|
+
if (this.$options.sourceCodePath != null) {
|
|
16010
|
+
const {
|
|
16011
|
+
bytecode
|
|
16012
|
+
} = await this.$options.onCompiler.compile(this.$options.sourceCodePath);
|
|
16013
|
+
this.$options.bytecode = bytecode;
|
|
16014
|
+
}
|
|
16015
|
+
if (this.$options.bytecode == null) {
|
|
16016
|
+
throw new IllegalArgumentError('Can\'t compile without sourceCode and sourceCodePath');
|
|
15598
16017
|
}
|
|
15599
|
-
|
|
16018
|
+
return this.$options.bytecode;
|
|
15600
16019
|
}
|
|
15601
|
-
async
|
|
15602
|
-
const txData = await send(tx, {
|
|
15603
|
-
...this.$options,
|
|
15604
|
-
...options
|
|
15605
|
-
});
|
|
15606
|
-
const result = {
|
|
15607
|
-
hash: txData.hash,
|
|
15608
|
-
tx: unpackTx(txData.rawTx),
|
|
15609
|
-
txData,
|
|
15610
|
-
rawTx: txData.rawTx
|
|
15611
|
-
};
|
|
15612
|
-
if (txData.blockHeight == null) return result;
|
|
16020
|
+
async $getCallResultByTxHash(hash, fnName, options) {
|
|
15613
16021
|
const {
|
|
15614
16022
|
callInfo
|
|
15615
|
-
} = await this.$options.onNode.getTransactionInfoByHash(
|
|
15616
|
-
|
|
15617
|
-
|
|
15618
|
-
|
|
16023
|
+
} = await this.$options.onNode.getTransactionInfoByHash(hash);
|
|
16024
|
+
if (callInfo == null) {
|
|
16025
|
+
throw new ContractError(`callInfo is not available for transaction ${hash}`);
|
|
16026
|
+
}
|
|
16027
|
+
const callInfoTyped = callInfo;
|
|
15619
16028
|
return {
|
|
15620
|
-
...
|
|
15621
|
-
result:
|
|
16029
|
+
...Contract_classPrivateMethodGet(this, _getCallResult, _getCallResult2).call(this, callInfoTyped, fnName, undefined, options),
|
|
16030
|
+
result: callInfoTyped
|
|
15622
16031
|
};
|
|
15623
16032
|
}
|
|
15624
16033
|
async _estimateGas(name, params, options = {}) {
|
|
@@ -15660,8 +16069,9 @@ class Contract {
|
|
|
15660
16069
|
if (opt.onAccount == null) throw new IllegalArgumentError('Can\'t deploy without account');
|
|
15661
16070
|
const ownerId = opt.onAccount.address;
|
|
15662
16071
|
if (this.$options.bytecode == null) throw new IllegalArgumentError('Can\'t deploy without bytecode');
|
|
15663
|
-
const tx = await
|
|
16072
|
+
const tx = await buildTxAsync({
|
|
15664
16073
|
...opt,
|
|
16074
|
+
tag: Tag.ContractCreateTx,
|
|
15665
16075
|
gasLimit: (_opt$gasLimit = opt.gasLimit) !== null && _opt$gasLimit !== void 0 ? _opt$gasLimit : await this._estimateGas('init', params, opt),
|
|
15666
16076
|
callData: this._calldata.encode(this._name, 'init', params),
|
|
15667
16077
|
code: this.$options.bytecode,
|
|
@@ -15671,7 +16081,7 @@ class Contract {
|
|
|
15671
16081
|
const {
|
|
15672
16082
|
hash,
|
|
15673
16083
|
...other
|
|
15674
|
-
} = await this.
|
|
16084
|
+
} = await Contract_classPrivateMethodGet(this, _sendAndProcess, _sendAndProcess2).call(this, tx, 'init', {
|
|
15675
16085
|
...opt,
|
|
15676
16086
|
onAccount: opt.onAccount
|
|
15677
16087
|
});
|
|
@@ -15691,16 +16101,6 @@ class Contract {
|
|
|
15691
16101
|
* @param name - Function name
|
|
15692
16102
|
* @returns function ACI
|
|
15693
16103
|
*/
|
|
15694
|
-
_getFunctionACI(name) {
|
|
15695
|
-
const fn = this._aci.encodedAci.contract.functions.find(f => f.name === name);
|
|
15696
|
-
if (fn != null) {
|
|
15697
|
-
return fn;
|
|
15698
|
-
}
|
|
15699
|
-
if (name === 'init') return {
|
|
15700
|
-
payable: false
|
|
15701
|
-
};
|
|
15702
|
-
throw new NoSuchContractFunctionError(`Function ${name} doesn't exist in contract`);
|
|
15703
|
-
}
|
|
15704
16104
|
|
|
15705
16105
|
/**
|
|
15706
16106
|
* Call contract function
|
|
@@ -15710,6 +16110,7 @@ class Contract {
|
|
|
15710
16110
|
* @returns CallResult
|
|
15711
16111
|
*/
|
|
15712
16112
|
async $call(fn, params, options = {}) {
|
|
16113
|
+
var _opt$gasLimit2;
|
|
15713
16114
|
const {
|
|
15714
16115
|
callStatic,
|
|
15715
16116
|
top,
|
|
@@ -15718,14 +16119,14 @@ class Contract {
|
|
|
15718
16119
|
...this.$options,
|
|
15719
16120
|
...options
|
|
15720
16121
|
};
|
|
15721
|
-
const
|
|
16122
|
+
const fnAci = Contract_classPrivateMethodGet(this, _getFunctionAci, _getFunctionAci2).call(this, fn);
|
|
15722
16123
|
const contractId = this.$options.address;
|
|
15723
16124
|
const {
|
|
15724
16125
|
onNode
|
|
15725
16126
|
} = opt;
|
|
15726
16127
|
if (fn == null) throw new MissingFunctionNameError();
|
|
15727
16128
|
if (fn === 'init' && callStatic !== true) throw new InvalidMethodInvocationError('"init" can be called only via dryRun');
|
|
15728
|
-
if (fn !== 'init' && opt.amount != null && opt.amount > 0 &&
|
|
16129
|
+
if (fn !== 'init' && opt.amount != null && opt.amount > 0 && !fnAci.payable) {
|
|
15729
16130
|
throw new NotPayableFunctionError(opt.amount, fn);
|
|
15730
16131
|
}
|
|
15731
16132
|
let callerId;
|
|
@@ -15738,7 +16139,6 @@ class Contract {
|
|
|
15738
16139
|
callerId = DRY_RUN_ACCOUNT.pub;
|
|
15739
16140
|
}
|
|
15740
16141
|
const callData = this._calldata.encode(this._name, fn, params);
|
|
15741
|
-
let res;
|
|
15742
16142
|
if (callStatic === true) {
|
|
15743
16143
|
if (opt.nonce == null && top != null) {
|
|
15744
16144
|
const topKey = typeof top === 'number' ? 'height' : 'hash';
|
|
@@ -15755,15 +16155,17 @@ class Contract {
|
|
|
15755
16155
|
let tx;
|
|
15756
16156
|
if (fn === 'init') {
|
|
15757
16157
|
if (this.$options.bytecode == null) throw new IllegalArgumentError('Can\'t dry-run "init" without bytecode');
|
|
15758
|
-
tx = await
|
|
16158
|
+
tx = await buildTxAsync({
|
|
15759
16159
|
...txOpt,
|
|
16160
|
+
tag: Tag.ContractCreateTx,
|
|
15760
16161
|
code: this.$options.bytecode,
|
|
15761
16162
|
ownerId: callerId
|
|
15762
16163
|
});
|
|
15763
16164
|
} else {
|
|
15764
16165
|
if (contractId == null) throw new MissingContractAddressError('Can\'t dry-run contract without address');
|
|
15765
|
-
tx = await
|
|
16166
|
+
tx = await buildTxAsync({
|
|
15766
16167
|
...txOpt,
|
|
16168
|
+
tag: Tag.ContractCallTx,
|
|
15767
16169
|
callerId,
|
|
15768
16170
|
contractId
|
|
15769
16171
|
});
|
|
@@ -15775,38 +16177,35 @@ class Contract {
|
|
|
15775
16177
|
...opt,
|
|
15776
16178
|
top
|
|
15777
16179
|
});
|
|
15778
|
-
if (callObj == null)
|
|
15779
|
-
|
|
15780
|
-
|
|
15781
|
-
|
|
15782
|
-
|
|
15783
|
-
res = {
|
|
16180
|
+
if (callObj == null) {
|
|
16181
|
+
throw new InternalError(`callObj is not available for transaction ${tx}`);
|
|
16182
|
+
}
|
|
16183
|
+
const callInfoTyped = callObj;
|
|
16184
|
+
return {
|
|
15784
16185
|
...dryRunOther,
|
|
16186
|
+
...Contract_classPrivateMethodGet(this, _getCallResult, _getCallResult2).call(this, callInfoTyped, fn, tx, opt),
|
|
15785
16187
|
tx: unpackTx(tx),
|
|
15786
|
-
result:
|
|
16188
|
+
result: callInfoTyped,
|
|
16189
|
+
rawTx: tx,
|
|
16190
|
+
hash: buildTxHash(tx),
|
|
16191
|
+
txData: undefined
|
|
15787
16192
|
};
|
|
15788
|
-
} else {
|
|
15789
|
-
var _opt$gasLimit2;
|
|
15790
|
-
if (top != null) throw new IllegalArgumentError('Can\'t handle `top` option in on-chain contract call');
|
|
15791
|
-
if (contractId == null) throw new MissingContractAddressError('Can\'t call contract without address');
|
|
15792
|
-
const tx = await _buildTx(Tag.ContractCallTx, {
|
|
15793
|
-
...opt,
|
|
15794
|
-
gasLimit: (_opt$gasLimit2 = opt.gasLimit) !== null && _opt$gasLimit2 !== void 0 ? _opt$gasLimit2 : await this._estimateGas(fn, params, opt),
|
|
15795
|
-
callerId,
|
|
15796
|
-
contractId,
|
|
15797
|
-
callData
|
|
15798
|
-
});
|
|
15799
|
-
if (opt.onAccount == null) throw new IllegalArgumentError('Can\'t call contract on chain without account');
|
|
15800
|
-
res = await this._sendAndProcess(tx, {
|
|
15801
|
-
...opt,
|
|
15802
|
-
onAccount: opt.onAccount
|
|
15803
|
-
});
|
|
15804
|
-
}
|
|
15805
|
-
if (callStatic === true || res.txData.blockHeight != null) {
|
|
15806
|
-
res.decodedResult = fnACI.returns != null && fnACI.returns !== 'unit' && fn !== 'init' && this._calldata.decode(this._name, fn, res.result.returnValue);
|
|
15807
|
-
res.decodedEvents = this.$decodeEvents(res.result.log, opt);
|
|
15808
16193
|
}
|
|
15809
|
-
|
|
16194
|
+
if (top != null) throw new IllegalArgumentError('Can\'t handle `top` option in on-chain contract call');
|
|
16195
|
+
if (contractId == null) throw new MissingContractAddressError('Can\'t call contract without address');
|
|
16196
|
+
const tx = await buildTxAsync({
|
|
16197
|
+
...opt,
|
|
16198
|
+
tag: Tag.ContractCallTx,
|
|
16199
|
+
gasLimit: (_opt$gasLimit2 = opt.gasLimit) !== null && _opt$gasLimit2 !== void 0 ? _opt$gasLimit2 : await this._estimateGas(fn, params, opt),
|
|
16200
|
+
callerId,
|
|
16201
|
+
contractId,
|
|
16202
|
+
callData
|
|
16203
|
+
});
|
|
16204
|
+
if (opt.onAccount == null) throw new IllegalArgumentError('Can\'t call contract on chain without account');
|
|
16205
|
+
return Contract_classPrivateMethodGet(this, _sendAndProcess, _sendAndProcess2).call(this, tx, fn, {
|
|
16206
|
+
...opt,
|
|
16207
|
+
onAccount: opt.onAccount
|
|
16208
|
+
});
|
|
15810
16209
|
}
|
|
15811
16210
|
|
|
15812
16211
|
/**
|
|
@@ -15817,31 +16216,6 @@ class Contract {
|
|
|
15817
16216
|
* @throws {@link MissingEventDefinitionError}
|
|
15818
16217
|
* @throws {@link AmbiguousEventDefinitionError}
|
|
15819
16218
|
*/
|
|
15820
|
-
_getContractNameByEvent(ctAddress, nameHash, {
|
|
15821
|
-
contractAddressToName
|
|
15822
|
-
}) {
|
|
15823
|
-
const addressToName = {
|
|
15824
|
-
...this.$options.contractAddressToName,
|
|
15825
|
-
...contractAddressToName
|
|
15826
|
-
};
|
|
15827
|
-
if (addressToName[ctAddress] != null) return addressToName[ctAddress];
|
|
15828
|
-
|
|
15829
|
-
// TODO: consider using a third-party library
|
|
15830
|
-
const isEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
15831
|
-
const matchedEvents = [this._aci.encodedAci, ...this._aci.externalEncodedAci].filter(({
|
|
15832
|
-
contract
|
|
15833
|
-
}) => contract === null || contract === void 0 ? void 0 : contract.event).map(({
|
|
15834
|
-
contract
|
|
15835
|
-
}) => [contract.name, contract.event.variant]).map(([name, events]) => events.map(event => [name, Object.keys(event)[0], Object.values(event)[0]])).flat().filter(([, eventName]) => BigInt(`0x${hash(eventName).toString('hex')}`) === nameHash).filter(([,, type], idx, arr) => !arr.slice(0, idx).some(el => isEqual(el[2], type)));
|
|
15836
|
-
switch (matchedEvents.length) {
|
|
15837
|
-
case 0:
|
|
15838
|
-
throw new MissingEventDefinitionError(nameHash.toString(), ctAddress);
|
|
15839
|
-
case 1:
|
|
15840
|
-
return matchedEvents[0][0];
|
|
15841
|
-
default:
|
|
15842
|
-
throw new AmbiguousEventDefinitionError(ctAddress, matchedEvents);
|
|
15843
|
-
}
|
|
15844
|
-
}
|
|
15845
16219
|
|
|
15846
16220
|
/**
|
|
15847
16221
|
* Decode Events
|
|
@@ -15857,7 +16231,7 @@ class Contract {
|
|
|
15857
16231
|
const topics = event.topics.map(t => BigInt(t));
|
|
15858
16232
|
let contractName;
|
|
15859
16233
|
try {
|
|
15860
|
-
contractName = this.
|
|
16234
|
+
contractName = Contract_classPrivateMethodGet(this, _getContractNameByEvent, _getContractNameByEvent2).call(this, event.address, topics[0], opt);
|
|
15861
16235
|
} catch (error) {
|
|
15862
16236
|
if ((omitUnknown !== null && omitUnknown !== void 0 ? omitUnknown : false) && error instanceof MissingEventDefinitionError) return null;
|
|
15863
16237
|
throw error;
|
|
@@ -15903,7 +16277,7 @@ class Contract {
|
|
|
15903
16277
|
onNode
|
|
15904
16278
|
});
|
|
15905
16279
|
}
|
|
15906
|
-
if (address == null && sourceCode == null && bytecode == null) {
|
|
16280
|
+
if (address == null && sourceCode == null && sourceCodePath == null && bytecode == null) {
|
|
15907
16281
|
throw new MissingContractAddressError('Can\'t create instance by ACI without address');
|
|
15908
16282
|
}
|
|
15909
16283
|
if (address != null) {
|
|
@@ -15921,13 +16295,19 @@ class Contract {
|
|
|
15921
16295
|
if (bytecode != null) isValid = bytecode === onChanBytecode;else if (sourceCode != null) {
|
|
15922
16296
|
if (onCompiler == null) throw new IllegalArgumentError('Can\'t validate bytecode without compiler');
|
|
15923
16297
|
isValid = await onCompiler.validateBySourceCode(onChanBytecode, sourceCode, fileSystem);
|
|
16298
|
+
} else if (sourceCodePath != null) {
|
|
16299
|
+
if (onCompiler == null) throw new IllegalArgumentError('Can\'t validate bytecode without compiler');
|
|
16300
|
+
isValid = await onCompiler.validate(onChanBytecode, sourceCodePath);
|
|
16301
|
+
}
|
|
16302
|
+
if (!isValid) {
|
|
16303
|
+
throw new BytecodeMismatchError((sourceCode !== null && sourceCode !== void 0 ? sourceCode : sourceCodePath) != null ? 'source code' : 'bytecode');
|
|
15924
16304
|
}
|
|
15925
|
-
if (!isValid) throw new BytecodeMismatchError(sourceCode != null ? 'source code' : 'bytecode');
|
|
15926
16305
|
}
|
|
15927
16306
|
return new ContractWithMethods({
|
|
15928
16307
|
onCompiler,
|
|
15929
16308
|
onNode,
|
|
15930
16309
|
sourceCode,
|
|
16310
|
+
sourceCodePath,
|
|
15931
16311
|
bytecode,
|
|
15932
16312
|
aci,
|
|
15933
16313
|
address,
|
|
@@ -15939,9 +16319,22 @@ class Contract {
|
|
|
15939
16319
|
aci,
|
|
15940
16320
|
...otherOptions
|
|
15941
16321
|
}) {
|
|
16322
|
+
Contract_classPrivateMethodInitSpec(this, _getContractNameByEvent);
|
|
16323
|
+
Contract_classPrivateMethodInitSpec(this, _getFunctionAci);
|
|
16324
|
+
Contract_classPrivateMethodInitSpec(this, _sendAndProcess);
|
|
16325
|
+
Contract_classPrivateMethodInitSpec(this, _getCallResult);
|
|
16326
|
+
Contract_classPrivateFieldInitSpec(this, _aciContract, {
|
|
16327
|
+
writable: true,
|
|
16328
|
+
value: void 0
|
|
16329
|
+
});
|
|
15942
16330
|
this._aci = aci;
|
|
15943
|
-
|
|
15944
|
-
|
|
16331
|
+
const aciLast = aci[aci.length - 1];
|
|
16332
|
+
if (aciLast.contract == null) {
|
|
16333
|
+
throw new IllegalArgumentError(`The last 'aci' item should have 'contract' key, got ${Object.keys(aciLast)} keys instead`);
|
|
16334
|
+
}
|
|
16335
|
+
classPrivateFieldSet_default()(this, _aciContract, aciLast.contract);
|
|
16336
|
+
this._name = classPrivateFieldGet_default()(this, _aciContract).name;
|
|
16337
|
+
this._calldata = new aepp_calldata_.Encoder(aci);
|
|
15945
16338
|
this.$options = otherOptions;
|
|
15946
16339
|
|
|
15947
16340
|
/**
|
|
@@ -15958,7 +16351,7 @@ class Contract {
|
|
|
15958
16351
|
* await contract.testFunction({ callStatic: false }) // send tx on-chain
|
|
15959
16352
|
* ```
|
|
15960
16353
|
*/
|
|
15961
|
-
Object.assign(this, Object.fromEntries(this.
|
|
16354
|
+
Object.assign(this, Object.fromEntries(classPrivateFieldGet_default()(this, _aciContract).functions.map(({
|
|
15962
16355
|
name,
|
|
15963
16356
|
arguments: aciArgs,
|
|
15964
16357
|
stateful
|
|
@@ -15979,27 +16372,89 @@ class Contract {
|
|
|
15979
16372
|
})));
|
|
15980
16373
|
}
|
|
15981
16374
|
}
|
|
16375
|
+
function _getCallResult2({
|
|
16376
|
+
returnType,
|
|
16377
|
+
returnValue,
|
|
16378
|
+
log
|
|
16379
|
+
}, fnName, transaction, options) {
|
|
16380
|
+
let message;
|
|
16381
|
+
switch (returnType) {
|
|
16382
|
+
case 'ok':
|
|
16383
|
+
{
|
|
16384
|
+
const fnAci = Contract_classPrivateMethodGet(this, _getFunctionAci, _getFunctionAci2).call(this, fnName);
|
|
16385
|
+
return {
|
|
16386
|
+
decodedResult: this._calldata.decode(this._name, fnAci.name, returnValue),
|
|
16387
|
+
decodedEvents: this.$decodeEvents(log, options)
|
|
16388
|
+
};
|
|
16389
|
+
}
|
|
16390
|
+
case 'revert':
|
|
16391
|
+
message = this._calldata.decodeFateString(returnValue);
|
|
16392
|
+
break;
|
|
16393
|
+
case 'error':
|
|
16394
|
+
message = decode(returnValue).toString();
|
|
16395
|
+
break;
|
|
16396
|
+
default:
|
|
16397
|
+
throw new InternalError(`Unknown return type: ${returnType}`);
|
|
16398
|
+
}
|
|
16399
|
+
throw new NodeInvocationError(message, transaction);
|
|
16400
|
+
}
|
|
16401
|
+
async function _sendAndProcess2(tx, fnName, options) {
|
|
16402
|
+
const txData = await sendTransaction(tx, {
|
|
16403
|
+
...this.$options,
|
|
16404
|
+
...options
|
|
16405
|
+
});
|
|
16406
|
+
return {
|
|
16407
|
+
hash: txData.hash,
|
|
16408
|
+
tx: unpackTx(txData.rawTx),
|
|
16409
|
+
txData,
|
|
16410
|
+
rawTx: txData.rawTx,
|
|
16411
|
+
...(txData.blockHeight != null && (await this.$getCallResultByTxHash(txData.hash, fnName, options)))
|
|
16412
|
+
};
|
|
16413
|
+
}
|
|
16414
|
+
function _getFunctionAci2(name) {
|
|
16415
|
+
const fn = classPrivateFieldGet_default()(this, _aciContract).functions.find(f => f.name === name);
|
|
16416
|
+
if (fn != null) {
|
|
16417
|
+
return fn;
|
|
16418
|
+
}
|
|
16419
|
+
if (name === 'init') {
|
|
16420
|
+
return {
|
|
16421
|
+
arguments: [],
|
|
16422
|
+
name: 'init',
|
|
16423
|
+
payable: false,
|
|
16424
|
+
returns: 'unit',
|
|
16425
|
+
stateful: true
|
|
16426
|
+
};
|
|
16427
|
+
}
|
|
16428
|
+
throw new NoSuchContractFunctionError(`Function ${name} doesn't exist in contract`);
|
|
16429
|
+
}
|
|
16430
|
+
function _getContractNameByEvent2(ctAddress, nameHash, {
|
|
16431
|
+
contractAddressToName
|
|
16432
|
+
}) {
|
|
16433
|
+
const addressToName = {
|
|
16434
|
+
...this.$options.contractAddressToName,
|
|
16435
|
+
...contractAddressToName
|
|
16436
|
+
};
|
|
16437
|
+
if (addressToName[ctAddress] != null) return addressToName[ctAddress];
|
|
16438
|
+
|
|
16439
|
+
// TODO: consider using a third-party library
|
|
16440
|
+
const isEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
16441
|
+
const contracts = this._aci.map(({
|
|
16442
|
+
contract
|
|
16443
|
+
}) => contract).filter(contract => contract === null || contract === void 0 ? void 0 : contract.event);
|
|
16444
|
+
const matchedEvents = contracts.map(contract => [contract.name, contract.event.variant]).map(([name, events]) => events.map(event => [name, Object.keys(event)[0], Object.values(event)[0]])).flat().filter(([, eventName]) => BigInt(`0x${hash(eventName).toString('hex')}`) === nameHash).filter(([,, type], idx, arr) => !arr.slice(0, idx).some(el => isEqual(el[2], type)));
|
|
16445
|
+
switch (matchedEvents.length) {
|
|
16446
|
+
case 0:
|
|
16447
|
+
throw new MissingEventDefinitionError(nameHash.toString(), ctAddress);
|
|
16448
|
+
case 1:
|
|
16449
|
+
return matchedEvents[0][0];
|
|
16450
|
+
default:
|
|
16451
|
+
throw new AmbiguousEventDefinitionError(ctAddress, matchedEvents);
|
|
16452
|
+
}
|
|
16453
|
+
}
|
|
15982
16454
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
15983
16455
|
const ContractWithMethods = Contract;
|
|
15984
16456
|
/* harmony default export */ const contract_Contract = (ContractWithMethods);
|
|
15985
16457
|
;// CONCATENATED MODULE: ./src/oracle.ts
|
|
15986
|
-
/*
|
|
15987
|
-
* ISC License (ISC)
|
|
15988
|
-
* Copyright (c) 2022 aeternity developers
|
|
15989
|
-
*
|
|
15990
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
15991
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
15992
|
-
* copyright notice and this permission notice appear in all copies.
|
|
15993
|
-
*
|
|
15994
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
15995
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
15996
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
15997
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15998
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
15999
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
16000
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
16001
|
-
*/
|
|
16002
|
-
|
|
16003
16458
|
/**
|
|
16004
16459
|
* Oracle methods - routines to interact with the æternity oracle system
|
|
16005
16460
|
*
|
|
@@ -16016,8 +16471,6 @@ const ContractWithMethods = Contract;
|
|
|
16016
16471
|
|
|
16017
16472
|
|
|
16018
16473
|
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
16474
|
/**
|
|
16022
16475
|
* Poll for oracle queries
|
|
16023
16476
|
* @category oracle
|
|
@@ -16041,10 +16494,10 @@ function pollForQueries(oracleId, onQuery, {
|
|
|
16041
16494
|
const queries = ((_await$onNode$getOrac = (await onNode.getOracleQueriesByPubkey(oracleId)).oracleQueries) !== null && _await$onNode$getOrac !== void 0 ? _await$onNode$getOrac : []).filter(({
|
|
16042
16495
|
id
|
|
16043
16496
|
}) => !knownQueryIds.has(id));
|
|
16044
|
-
queries.forEach(
|
|
16045
|
-
id
|
|
16046
|
-
|
|
16047
|
-
|
|
16497
|
+
queries.forEach(query => {
|
|
16498
|
+
knownQueryIds.add(query.id);
|
|
16499
|
+
onQuery(query);
|
|
16500
|
+
});
|
|
16048
16501
|
};
|
|
16049
16502
|
let stopped = false;
|
|
16050
16503
|
|
|
@@ -16113,7 +16566,7 @@ async function getQueryObject(oracleId, queryId, options) {
|
|
|
16113
16566
|
decodedResponse: decode(record.response).toString(),
|
|
16114
16567
|
respond: async (response, opt) =>
|
|
16115
16568
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
16116
|
-
respondToQuery(
|
|
16569
|
+
respondToQuery(queryId, response, {
|
|
16117
16570
|
...options,
|
|
16118
16571
|
...opt
|
|
16119
16572
|
}),
|
|
@@ -16140,12 +16593,13 @@ async function postQueryToOracle(oracleId, query, options) {
|
|
|
16140
16593
|
var _options$queryFee;
|
|
16141
16594
|
(_options$queryFee = options.queryFee) !== null && _options$queryFee !== void 0 ? _options$queryFee : options.queryFee = (await options.onNode.getOracleByPubkey(oracleId)).queryFee.toString();
|
|
16142
16595
|
const senderId = options.onAccount.address;
|
|
16143
|
-
const oracleQueryTx = await
|
|
16596
|
+
const oracleQueryTx = await buildTxAsync({
|
|
16144
16597
|
queryTtlType: QUERY_TTL.type,
|
|
16145
16598
|
queryTtlValue: QUERY_TTL.value,
|
|
16146
16599
|
responseTtlType: RESPONSE_TTL.type,
|
|
16147
16600
|
responseTtlValue: RESPONSE_TTL.value,
|
|
16148
16601
|
...options,
|
|
16602
|
+
tag: Tag.OracleQueryTx,
|
|
16149
16603
|
oracleId,
|
|
16150
16604
|
senderId,
|
|
16151
16605
|
query
|
|
@@ -16155,14 +16609,13 @@ async function postQueryToOracle(oracleId, query, options) {
|
|
|
16155
16609
|
} = unpackTx(oracleQueryTx, Tag.OracleQueryTx);
|
|
16156
16610
|
const queryId = oracleQueryId(senderId, nonce, oracleId);
|
|
16157
16611
|
return {
|
|
16158
|
-
...(await
|
|
16612
|
+
...(await sendTransaction(oracleQueryTx, options)),
|
|
16159
16613
|
...(await getQueryObject(oracleId, queryId, options))
|
|
16160
16614
|
};
|
|
16161
16615
|
}
|
|
16162
16616
|
/**
|
|
16163
16617
|
* Extend oracle ttl
|
|
16164
16618
|
* @category oracle
|
|
16165
|
-
* @param oracleId - Oracle public key
|
|
16166
16619
|
* @param options - Options object
|
|
16167
16620
|
* @param options.fee - fee Transaction fee
|
|
16168
16621
|
* @param options.ttl - Transaction time to leave
|
|
@@ -16170,16 +16623,17 @@ async function postQueryToOracle(oracleId, query, options) {
|
|
|
16170
16623
|
* @param options.oracleTtlValue - Oracle time to leave for extend
|
|
16171
16624
|
* @returns Oracle object
|
|
16172
16625
|
*/
|
|
16173
|
-
async function extendOracleTtl(
|
|
16174
|
-
const
|
|
16626
|
+
async function extendOracleTtl(options) {
|
|
16627
|
+
const oracleId = encode(decode(options.onAccount.address), Encoding.OracleAddress);
|
|
16628
|
+
const oracleExtendTx = await buildTxAsync({
|
|
16175
16629
|
oracleTtlType: ORACLE_TTL.type,
|
|
16176
16630
|
oracleTtlValue: ORACLE_TTL.value,
|
|
16177
16631
|
...options,
|
|
16178
|
-
|
|
16632
|
+
tag: Tag.OracleExtendTx,
|
|
16179
16633
|
oracleId
|
|
16180
16634
|
});
|
|
16181
16635
|
return {
|
|
16182
|
-
...(await
|
|
16636
|
+
...(await sendTransaction(oracleExtendTx, options)),
|
|
16183
16637
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
16184
16638
|
...(await getOracleObject(oracleId, options))
|
|
16185
16639
|
};
|
|
@@ -16187,7 +16641,6 @@ async function extendOracleTtl(oracleId, options) {
|
|
|
16187
16641
|
/**
|
|
16188
16642
|
* Extend oracle ttl
|
|
16189
16643
|
* @category oracle
|
|
16190
|
-
* @param oracleId - Oracle public key
|
|
16191
16644
|
* @param queryId - Oracle query id
|
|
16192
16645
|
* @param response - Oracle query response
|
|
16193
16646
|
* @param options - Options object
|
|
@@ -16196,18 +16649,19 @@ async function extendOracleTtl(oracleId, options) {
|
|
|
16196
16649
|
* @param options.ttl - Transaction time to leave
|
|
16197
16650
|
* @returns Oracle object
|
|
16198
16651
|
*/
|
|
16199
|
-
async function respondToQuery(
|
|
16200
|
-
const
|
|
16652
|
+
async function respondToQuery(queryId, response, options) {
|
|
16653
|
+
const oracleId = encode(decode(options.onAccount.address), Encoding.OracleAddress);
|
|
16654
|
+
const oracleRespondTx = await buildTxAsync({
|
|
16201
16655
|
responseTtlType: RESPONSE_TTL.type,
|
|
16202
16656
|
responseTtlValue: RESPONSE_TTL.value,
|
|
16203
16657
|
...options,
|
|
16204
|
-
|
|
16658
|
+
tag: Tag.OracleResponseTx,
|
|
16205
16659
|
oracleId,
|
|
16206
16660
|
queryId,
|
|
16207
16661
|
response
|
|
16208
16662
|
});
|
|
16209
16663
|
return {
|
|
16210
|
-
...(await
|
|
16664
|
+
...(await sendTransaction(oracleRespondTx, options)),
|
|
16211
16665
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
16212
16666
|
...(await getOracleObject(oracleId, options))
|
|
16213
16667
|
};
|
|
@@ -16237,7 +16691,7 @@ async function getOracleObject(oracleId, options) {
|
|
|
16237
16691
|
...lastArg
|
|
16238
16692
|
});
|
|
16239
16693
|
} else args.push(options);
|
|
16240
|
-
return handler(oracleId, ...args);
|
|
16694
|
+
return handler(...(['extendOracle', 'respondToQuery'].includes(name) ? [] : [oracleId]), ...args);
|
|
16241
16695
|
}])
|
|
16242
16696
|
};
|
|
16243
16697
|
}
|
|
@@ -16256,38 +16710,104 @@ async function getOracleObject(oracleId, options) {
|
|
|
16256
16710
|
*/
|
|
16257
16711
|
async function registerOracle(queryFormat, responseFormat, options) {
|
|
16258
16712
|
const accountId = options.onAccount.address;
|
|
16259
|
-
const oracleRegisterTx = await
|
|
16260
|
-
queryFee: QUERY_FEE,
|
|
16713
|
+
const oracleRegisterTx = await buildTxAsync({
|
|
16261
16714
|
oracleTtlValue: ORACLE_TTL.value,
|
|
16262
16715
|
oracleTtlType: ORACLE_TTL.type,
|
|
16263
16716
|
...options,
|
|
16264
|
-
|
|
16265
|
-
|
|
16266
|
-
|
|
16267
|
-
|
|
16268
|
-
|
|
16269
|
-
|
|
16270
|
-
...(await
|
|
16271
|
-
|
|
16717
|
+
tag: Tag.OracleRegisterTx,
|
|
16718
|
+
accountId,
|
|
16719
|
+
queryFormat,
|
|
16720
|
+
responseFormat
|
|
16721
|
+
});
|
|
16722
|
+
return {
|
|
16723
|
+
...(await sendTransaction(oracleRegisterTx, options)),
|
|
16724
|
+
...(await getOracleObject(encode(decode(accountId), Encoding.OracleAddress), options))
|
|
16725
|
+
};
|
|
16726
|
+
}
|
|
16727
|
+
;// CONCATENATED MODULE: ./src/spend.ts
|
|
16728
|
+
|
|
16729
|
+
|
|
16730
|
+
|
|
16731
|
+
|
|
16732
|
+
|
|
16733
|
+
/**
|
|
16734
|
+
* Send coins to another account
|
|
16735
|
+
* @category chain
|
|
16736
|
+
* @param amount - Amount to spend
|
|
16737
|
+
* @param recipientIdOrName - Address or name of recipient account
|
|
16738
|
+
* @param options - Options
|
|
16739
|
+
* @returns Transaction
|
|
16740
|
+
*/
|
|
16741
|
+
async function spend(amount, recipientIdOrName, options) {
|
|
16742
|
+
return sendTransaction(await buildTxAsync({
|
|
16743
|
+
...options,
|
|
16744
|
+
tag: Tag.SpendTx,
|
|
16745
|
+
senderId: options.onAccount.address,
|
|
16746
|
+
recipientId: await resolveName(recipientIdOrName, 'account_pubkey', options),
|
|
16747
|
+
amount
|
|
16748
|
+
}), options);
|
|
16749
|
+
}
|
|
16750
|
+
// TODO: Rename to spendFraction
|
|
16751
|
+
/**
|
|
16752
|
+
* Spend a fraction of coin balance to another account. Useful if needed to drain account balance
|
|
16753
|
+
* completely, sending funds to another account (with fraction set to 1).
|
|
16754
|
+
* @category chain
|
|
16755
|
+
* @param fraction - Fraction of balance to spend (between 0 and 1)
|
|
16756
|
+
* @param recipientIdOrName - Address or name of recipient account
|
|
16757
|
+
* @param options - Options
|
|
16758
|
+
* @example
|
|
16759
|
+
* ```js
|
|
16760
|
+
* // `fraction` * 100 = % of AE to be transferred (e.g. `0.42` for 42% or `1` for 100%)
|
|
16761
|
+
* const { blockHeight } = await aeSdk.transferFunds(
|
|
16762
|
+
* 0.42,
|
|
16763
|
+
* 'ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E',
|
|
16764
|
+
* );
|
|
16765
|
+
* console.log('Transaction mined at', blockHeight);
|
|
16766
|
+
* ```
|
|
16767
|
+
*/
|
|
16768
|
+
async function transferFunds(fraction, recipientIdOrName, options) {
|
|
16769
|
+
if (fraction < 0 || fraction > 1) {
|
|
16770
|
+
throw new ArgumentError('fraction', 'a number between 0 and 1', fraction);
|
|
16771
|
+
}
|
|
16772
|
+
const recipientId = await resolveName(recipientIdOrName, 'account_pubkey', options);
|
|
16773
|
+
const senderId = options.onAccount.address;
|
|
16774
|
+
const balance = new (external_bignumber_js_default())(await getBalance.bind(options.onAccount)(senderId, options));
|
|
16775
|
+
const desiredAmount = balance.times(fraction).integerValue((external_bignumber_js_default()).ROUND_HALF_UP);
|
|
16776
|
+
const {
|
|
16777
|
+
fee
|
|
16778
|
+
} = unpackTx(await buildTxAsync({
|
|
16779
|
+
...options,
|
|
16780
|
+
tag: Tag.SpendTx,
|
|
16781
|
+
senderId,
|
|
16782
|
+
recipientId,
|
|
16783
|
+
amount: desiredAmount
|
|
16784
|
+
}), Tag.SpendTx);
|
|
16785
|
+
// Reducing of the amount may reduce transaction fee, so this is not completely accurate
|
|
16786
|
+
const amount = desiredAmount.plus(fee).gt(balance) ? balance.minus(fee) : desiredAmount;
|
|
16787
|
+
return sendTransaction(await buildTxAsync({
|
|
16788
|
+
...options,
|
|
16789
|
+
tag: Tag.SpendTx,
|
|
16790
|
+
senderId,
|
|
16791
|
+
recipientId,
|
|
16792
|
+
amount
|
|
16793
|
+
}), options);
|
|
16794
|
+
}
|
|
16795
|
+
/**
|
|
16796
|
+
* Submit transaction of another account paying for it (fee and gas)
|
|
16797
|
+
* @category chain
|
|
16798
|
+
* @param transaction - tx_<base64>-encoded transaction
|
|
16799
|
+
* @param options - Options
|
|
16800
|
+
* @returns Object Transaction
|
|
16801
|
+
*/
|
|
16802
|
+
async function payForTransaction(transaction, options) {
|
|
16803
|
+
return sendTransaction(await buildTxAsync({
|
|
16804
|
+
...options,
|
|
16805
|
+
tag: Tag.PayingForTx,
|
|
16806
|
+
payerId: options.onAccount.address,
|
|
16807
|
+
tx: transaction
|
|
16808
|
+
}), options);
|
|
16272
16809
|
}
|
|
16273
16810
|
;// CONCATENATED MODULE: ./src/contract/ga.ts
|
|
16274
|
-
/*
|
|
16275
|
-
* ISC License (ISC)
|
|
16276
|
-
* Copyright (c) 2022 aeternity developers
|
|
16277
|
-
*
|
|
16278
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
16279
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
16280
|
-
* copyright notice and this permission notice appear in all copies.
|
|
16281
|
-
*
|
|
16282
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
16283
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
16284
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
16285
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
16286
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16287
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
16288
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
16289
|
-
*/
|
|
16290
|
-
|
|
16291
16811
|
/**
|
|
16292
16812
|
* Generalized Account module - routines to use generalized account
|
|
16293
16813
|
*/
|
|
@@ -16300,8 +16820,6 @@ async function registerOracle(queryFormat, responseFormat, options) {
|
|
|
16300
16820
|
|
|
16301
16821
|
|
|
16302
16822
|
|
|
16303
|
-
|
|
16304
|
-
|
|
16305
16823
|
/**
|
|
16306
16824
|
* Convert current account to GA
|
|
16307
16825
|
* @category contract
|
|
@@ -16339,8 +16857,9 @@ async function createGeneralizedAccount(authFnName, args, {
|
|
|
16339
16857
|
sourceCode,
|
|
16340
16858
|
fileSystem
|
|
16341
16859
|
});
|
|
16342
|
-
const tx = await
|
|
16860
|
+
const tx = await buildTxAsync({
|
|
16343
16861
|
...options,
|
|
16862
|
+
tag: Tag.GaAttachTx,
|
|
16344
16863
|
onNode,
|
|
16345
16864
|
code: await contract.$compile(),
|
|
16346
16865
|
gasLimit: (_options$gasLimit = options.gasLimit) !== null && _options$gasLimit !== void 0 ? _options$gasLimit : await contract._estimateGas('init', args, options),
|
|
@@ -16352,7 +16871,7 @@ async function createGeneralizedAccount(authFnName, args, {
|
|
|
16352
16871
|
const {
|
|
16353
16872
|
hash: transaction,
|
|
16354
16873
|
rawTx
|
|
16355
|
-
} = await
|
|
16874
|
+
} = await sendTransaction(tx, {
|
|
16356
16875
|
onNode,
|
|
16357
16876
|
onAccount,
|
|
16358
16877
|
onCompiler,
|
|
@@ -16366,21 +16885,103 @@ async function createGeneralizedAccount(authFnName, args, {
|
|
|
16366
16885
|
});
|
|
16367
16886
|
}
|
|
16368
16887
|
/**
|
|
16369
|
-
* Build a transaction hash the same as `Auth.tx_hash`
|
|
16888
|
+
* Build a transaction hash the same as `Auth.tx_hash` by GaMetaTx payload
|
|
16370
16889
|
* @category contract
|
|
16371
16890
|
* @param transaction - tx-encoded transaction
|
|
16372
16891
|
* @param options - Options
|
|
16892
|
+
* @param options.fee - GaMetaTx fee, required in Ceres
|
|
16893
|
+
* @param options.gasPrice - GaMetaTx gasPrice, required in Ceres
|
|
16373
16894
|
* @param options.onNode - Node to use
|
|
16374
16895
|
* @returns Transaction hash
|
|
16375
16896
|
*/
|
|
16376
16897
|
async function buildAuthTxHash(transaction, {
|
|
16898
|
+
fee,
|
|
16899
|
+
gasPrice,
|
|
16900
|
+
onNode
|
|
16901
|
+
}) {
|
|
16902
|
+
const {
|
|
16903
|
+
nodeNetworkId,
|
|
16904
|
+
consensusProtocolVersion
|
|
16905
|
+
} = await onNode.getNodeInfo();
|
|
16906
|
+
let payload = hash(concatBuffers([Buffer.from(nodeNetworkId), decode(transaction)]));
|
|
16907
|
+
if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
|
|
16908
|
+
if (fee == null) throw new ArgumentError('fee', 'provided (in Ceres)', fee);
|
|
16909
|
+
if (gasPrice == null) throw new ArgumentError('gasPrice', 'provided (in Ceres)', gasPrice);
|
|
16910
|
+
payload = hash(decode(buildTx({
|
|
16911
|
+
tag: Tag.GaMetaTxAuthData,
|
|
16912
|
+
fee,
|
|
16913
|
+
gasPrice,
|
|
16914
|
+
txHash: encode(payload, Encoding.TxHash)
|
|
16915
|
+
})));
|
|
16916
|
+
}
|
|
16917
|
+
return payload;
|
|
16918
|
+
}
|
|
16919
|
+
|
|
16920
|
+
/**
|
|
16921
|
+
* Build a transaction hash the same as `Auth.tx_hash` by GaMetaTx
|
|
16922
|
+
* @category contract
|
|
16923
|
+
* @param transaction - tx-encoded signed GaMeta transaction
|
|
16924
|
+
* @param options - Options
|
|
16925
|
+
* @param options.onNode - Node to use
|
|
16926
|
+
* @returns Transaction hash
|
|
16927
|
+
*/
|
|
16928
|
+
async function buildAuthTxHashByGaMetaTx(transaction, {
|
|
16377
16929
|
onNode
|
|
16378
16930
|
}) {
|
|
16379
|
-
|
|
16931
|
+
const txParams = unpackTx(transaction, Tag.SignedTx);
|
|
16932
|
+
if (txParams.encodedTx.tag !== Tag.GaMetaTx) {
|
|
16933
|
+
throw new ArgumentError('transaction', 'to include GaMetaTx', Tag[txParams.encodedTx.tag]);
|
|
16934
|
+
}
|
|
16935
|
+
return buildAuthTxHash(buildTx(txParams.encodedTx.tx.encodedTx), {
|
|
16936
|
+
fee: txParams.encodedTx.fee,
|
|
16937
|
+
gasPrice: txParams.encodedTx.gasPrice,
|
|
16938
|
+
onNode
|
|
16939
|
+
});
|
|
16380
16940
|
}
|
|
16381
16941
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/helpers/defineProperty.js
|
|
16382
16942
|
var defineProperty = __webpack_require__(1125);
|
|
16383
16943
|
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
|
|
16944
|
+
;// CONCATENATED MODULE: ./src/contract/delegation-signature.ts
|
|
16945
|
+
|
|
16946
|
+
|
|
16947
|
+
|
|
16948
|
+
/**
|
|
16949
|
+
* Helper to generate a signature to delegate
|
|
16950
|
+
* - pre-claim/claim/transfer/revoke of a name to a contract.
|
|
16951
|
+
* - register/extend/respond of an Oracle to a contract.
|
|
16952
|
+
* @category contract
|
|
16953
|
+
* @param contractAddress - Address of contract to delegate access
|
|
16954
|
+
* @param ids - The list of id's to prepend
|
|
16955
|
+
* @param options - Options
|
|
16956
|
+
* @param options.omitAddress - Prepend delegation signature with an account address
|
|
16957
|
+
* @param options.onAccount - Account to use
|
|
16958
|
+
* @param options.onNode - Node to use
|
|
16959
|
+
* @returns Signature
|
|
16960
|
+
* @example
|
|
16961
|
+
* ```js
|
|
16962
|
+
* const aeSdk = new AeSdk({ ... })
|
|
16963
|
+
* const contractAddress = 'ct_asd2ks...'
|
|
16964
|
+
* const aensName = 'example.chain'
|
|
16965
|
+
* const onAccount = new MemoryAccount(...) // Sign with a specific account
|
|
16966
|
+
* // Preclaim signature
|
|
16967
|
+
* const preclaimSig = await aeSdk.createDelegationSignature(contractAddress, [], { onAccount })
|
|
16968
|
+
* // Claim, transfer and revoke signature
|
|
16969
|
+
* const aensDelegationSig = await aeSdk
|
|
16970
|
+
* .createDelegationSignature(contractAddress, [aensName], { onAccount })
|
|
16971
|
+
*
|
|
16972
|
+
* const oracleQueryId = 'oq_...'
|
|
16973
|
+
* const onAccount = new MemoryAccount(...) // Sign with a specific account
|
|
16974
|
+
* // Oracle register and extend signature
|
|
16975
|
+
* const oracleDelegationSig = await aeSdk
|
|
16976
|
+
* .createDelegationSignature(contractAddress, [], { onAccount })
|
|
16977
|
+
* // Oracle respond signature
|
|
16978
|
+
* const respondSig = await aeSdk
|
|
16979
|
+
* .createDelegationSignature(contractAddress, [oracleQueryId], { onAccount, omitAddress: true })
|
|
16980
|
+
* ```
|
|
16981
|
+
*/
|
|
16982
|
+
async function createDelegationSignature(contractAddress, ids, options) {
|
|
16983
|
+
return options.onAccount.sign(concatBuffers([Buffer.from(await options.onNode.getNetworkId()), ...(options.omitAddress === true ? [] : [decode(options.onAccount.address)]), ...ids.map(e => isNameValid(e) ? produceNameId(e) : e).map(e => decode(e)), decode(contractAddress)]), options);
|
|
16984
|
+
}
|
|
16384
16985
|
;// CONCATENATED MODULE: ./src/AeSdkMethods.ts
|
|
16385
16986
|
|
|
16386
16987
|
|
|
@@ -16417,6 +17018,7 @@ const methods = {
|
|
|
16417
17018
|
...aens_namespaceObject,
|
|
16418
17019
|
...spend_namespaceObject,
|
|
16419
17020
|
...oracle_namespaceObject,
|
|
17021
|
+
createDelegationSignature: createDelegationSignature,
|
|
16420
17022
|
...ga_namespaceObject
|
|
16421
17023
|
};
|
|
16422
17024
|
/**
|
|
@@ -16437,9 +17039,7 @@ class AeSdkMethods {
|
|
|
16437
17039
|
* @param options - Options
|
|
16438
17040
|
*/
|
|
16439
17041
|
constructor(options = {}) {
|
|
16440
|
-
defineProperty_default()(this, "_options", {
|
|
16441
|
-
denomination: AE_AMOUNT_FORMATS.AETTOS
|
|
16442
|
-
});
|
|
17042
|
+
defineProperty_default()(this, "_options", {});
|
|
16443
17043
|
Object.assign(this._options, options);
|
|
16444
17044
|
}
|
|
16445
17045
|
|
|
@@ -16459,9 +17059,8 @@ class AeSdkMethods {
|
|
|
16459
17059
|
onAccount: getValueOrErrorProxy(() => this._resolveAccount())
|
|
16460
17060
|
};
|
|
16461
17061
|
}
|
|
16462
|
-
async buildTx(
|
|
16463
|
-
|
|
16464
|
-
return _buildTx(txType, {
|
|
17062
|
+
async buildTx(options) {
|
|
17063
|
+
return buildTxAsync({
|
|
16465
17064
|
...this._getOptions(),
|
|
16466
17065
|
...options
|
|
16467
17066
|
});
|
|
@@ -16718,29 +17317,6 @@ class AeSdk extends AeSdkBase {
|
|
|
16718
17317
|
this.selectedAddress = address;
|
|
16719
17318
|
}
|
|
16720
17319
|
}
|
|
16721
|
-
;// CONCATENATED MODULE: ./src/account/Base.ts
|
|
16722
|
-
/*
|
|
16723
|
-
* ISC License (ISC)
|
|
16724
|
-
* Copyright (c) 2022 aeternity developers
|
|
16725
|
-
*
|
|
16726
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
16727
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
16728
|
-
* copyright notice and this permission notice appear in all copies.
|
|
16729
|
-
*
|
|
16730
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
16731
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
16732
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
16733
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
16734
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16735
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
16736
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
16737
|
-
*/
|
|
16738
|
-
|
|
16739
|
-
/**
|
|
16740
|
-
* Account is one of the three basic building blocks of an
|
|
16741
|
-
* {@link AeSdk} and provides access to a signing key pair.
|
|
16742
|
-
*/
|
|
16743
|
-
class AccountBase {}
|
|
16744
17320
|
;// CONCATENATED MODULE: ./src/aepp-wallet-communication/schema.ts
|
|
16745
17321
|
|
|
16746
17322
|
// eslint-disable-next-line max-classes-per-file
|
|
@@ -17025,6 +17601,10 @@ var _processResponse = /*#__PURE__*/new WeakSet();
|
|
|
17025
17601
|
*/
|
|
17026
17602
|
class RpcClient {
|
|
17027
17603
|
constructor(connection, onDisconnect, methods) {
|
|
17604
|
+
/**
|
|
17605
|
+
* Process response message
|
|
17606
|
+
* @param msg - Message object
|
|
17607
|
+
*/
|
|
17028
17608
|
RpcClient_classPrivateMethodInitSpec(this, _processResponse);
|
|
17029
17609
|
RpcClient_classPrivateMethodInitSpec(this, _sendResponse);
|
|
17030
17610
|
RpcClient_classPrivateMethodInitSpec(this, _sendRequest);
|
|
@@ -17069,11 +17649,6 @@ class RpcClient {
|
|
|
17069
17649
|
notify(name, params) {
|
|
17070
17650
|
RpcClient_classPrivateMethodGet(this, _sendRequest, _sendRequest2).call(this, undefined, name, params);
|
|
17071
17651
|
}
|
|
17072
|
-
|
|
17073
|
-
/**
|
|
17074
|
-
* Process response message
|
|
17075
|
-
* @param msg - Message object
|
|
17076
|
-
*/
|
|
17077
17652
|
}
|
|
17078
17653
|
async function _handleMessage2(msg, origin) {
|
|
17079
17654
|
if ((msg === null || msg === void 0 ? void 0 : msg.jsonrpc) !== '2.0') throw new InvalidRpcMessageError(JSON.stringify(msg));
|
|
@@ -17193,11 +17768,19 @@ class AeSdkAepp extends AeSdkBase {
|
|
|
17193
17768
|
*/
|
|
17194
17769
|
async connectToWallet(connection, {
|
|
17195
17770
|
connectNode = false,
|
|
17196
|
-
name = 'wallet-node'
|
|
17197
|
-
select = false
|
|
17771
|
+
name = 'wallet-node'
|
|
17198
17772
|
} = {}) {
|
|
17199
17773
|
if (this.rpcClient != null) throw new AlreadyConnectedError('You are already connected to wallet');
|
|
17200
17774
|
let disconnectParams;
|
|
17775
|
+
const updateNetwork = params => {
|
|
17776
|
+
if (connectNode) {
|
|
17777
|
+
var _params$node;
|
|
17778
|
+
if (((_params$node = params.node) === null || _params$node === void 0 ? void 0 : _params$node.url) == null) throw new RpcConnectionError('Missing URLs of the Node');
|
|
17779
|
+
this.pool.delete(name);
|
|
17780
|
+
this.addNode(name, new Node_Node(params.node.url), true);
|
|
17781
|
+
}
|
|
17782
|
+
this.onNetworkChange(params);
|
|
17783
|
+
};
|
|
17201
17784
|
const client = new RpcClient(connection, () => {
|
|
17202
17785
|
delete this.rpcClient;
|
|
17203
17786
|
delete this._accounts;
|
|
@@ -17207,31 +17790,19 @@ class AeSdkAepp extends AeSdkBase {
|
|
|
17207
17790
|
this._accounts = params;
|
|
17208
17791
|
this.onAddressChange(params);
|
|
17209
17792
|
},
|
|
17210
|
-
[METHODS.updateNetwork]:
|
|
17211
|
-
const {
|
|
17212
|
-
node
|
|
17213
|
-
} = params;
|
|
17214
|
-
if (node != null) this.addNode(node.name, new Node_Node(node.url), true);
|
|
17215
|
-
this.onNetworkChange(params);
|
|
17216
|
-
},
|
|
17793
|
+
[METHODS.updateNetwork]: updateNetwork,
|
|
17217
17794
|
[METHODS.closeConnection]: params => {
|
|
17218
17795
|
disconnectParams = params;
|
|
17219
17796
|
client.connection.disconnect();
|
|
17220
17797
|
},
|
|
17221
17798
|
[METHODS.readyToConnect]: () => {}
|
|
17222
17799
|
});
|
|
17223
|
-
const {
|
|
17224
|
-
node,
|
|
17225
|
-
...walletInfo
|
|
17226
|
-
} = await client.request(METHODS.connect, {
|
|
17800
|
+
const walletInfo = await client.request(METHODS.connect, {
|
|
17227
17801
|
name: this.name,
|
|
17228
17802
|
version: RPC_VERSION,
|
|
17229
17803
|
connectNode
|
|
17230
17804
|
});
|
|
17231
|
-
|
|
17232
|
-
if (node == null) throw new RpcConnectionError('Missing URLs of the Node');
|
|
17233
|
-
this.addNode(name, new Node_Node(node.url), select);
|
|
17234
|
-
}
|
|
17805
|
+
updateNetwork(walletInfo);
|
|
17235
17806
|
this.rpcClient = client;
|
|
17236
17807
|
return walletInfo;
|
|
17237
17808
|
}
|
|
@@ -17506,7 +18077,7 @@ class AeSdkWallet extends AeSdk {
|
|
|
17506
18077
|
}
|
|
17507
18078
|
try {
|
|
17508
18079
|
return json_big.parse(json_big.stringify({
|
|
17509
|
-
transactionHash: await this.
|
|
18080
|
+
transactionHash: await this.sendTransaction(tx, {
|
|
17510
18081
|
...parameters,
|
|
17511
18082
|
verify: false
|
|
17512
18083
|
})
|
|
@@ -17578,105 +18149,11 @@ class AeSdkWallet extends AeSdk {
|
|
|
17578
18149
|
};
|
|
17579
18150
|
}
|
|
17580
18151
|
}
|
|
17581
|
-
;// CONCATENATED MODULE: ./src/account/Memory.ts
|
|
17582
|
-
/*
|
|
17583
|
-
* ISC License (ISC)
|
|
17584
|
-
* Copyright (c) 2022 aeternity developers
|
|
17585
|
-
*
|
|
17586
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
17587
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
17588
|
-
* copyright notice and this permission notice appear in all copies.
|
|
17589
|
-
*
|
|
17590
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
17591
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
17592
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
17593
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
17594
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
17595
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17596
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
17597
|
-
*/
|
|
17598
|
-
|
|
17599
|
-
|
|
17600
|
-
|
|
17601
|
-
|
|
17602
|
-
|
|
17603
|
-
|
|
17604
|
-
|
|
17605
|
-
const secretKeys = new WeakMap();
|
|
17606
|
-
|
|
17607
|
-
/**
|
|
17608
|
-
* In-memory account class
|
|
17609
|
-
*/
|
|
17610
|
-
class AccountMemory extends AccountBase {
|
|
17611
|
-
/**
|
|
17612
|
-
* @param secretKey - Secret key
|
|
17613
|
-
*/
|
|
17614
|
-
constructor(secretKey) {
|
|
17615
|
-
super();
|
|
17616
|
-
secretKey = typeof secretKey === 'string' ? Buffer.from(secretKey, 'hex') : secretKey;
|
|
17617
|
-
if (secretKey.length !== 64) {
|
|
17618
|
-
throw new ArgumentError('secretKey', '64 bytes', secretKey.length);
|
|
17619
|
-
}
|
|
17620
|
-
secretKeys.set(this, secretKey);
|
|
17621
|
-
this.address = encode(generateKeyPairFromSecret(secretKeys.get(this)).publicKey, Encoding.AccountAddress);
|
|
17622
|
-
}
|
|
17623
|
-
|
|
17624
|
-
/**
|
|
17625
|
-
* Generates a new AccountMemory using a random secret key
|
|
17626
|
-
*/
|
|
17627
|
-
static generate() {
|
|
17628
|
-
return new AccountMemory(generateKeyPair().secretKey);
|
|
17629
|
-
}
|
|
17630
|
-
|
|
17631
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17632
|
-
async sign(data, options) {
|
|
17633
|
-
return sign(data, secretKeys.get(this));
|
|
17634
|
-
}
|
|
17635
|
-
async signTransaction(tx, {
|
|
17636
|
-
innerTx,
|
|
17637
|
-
networkId,
|
|
17638
|
-
...options
|
|
17639
|
-
} = {}) {
|
|
17640
|
-
if (networkId == null) {
|
|
17641
|
-
throw new ArgumentError('networkId', 'provided', networkId);
|
|
17642
|
-
}
|
|
17643
|
-
const prefixes = [networkId];
|
|
17644
|
-
if (innerTx === true) prefixes.push('inner_tx');
|
|
17645
|
-
const rlpBinaryTx = decode(tx);
|
|
17646
|
-
const txWithNetworkId = concatBuffers([Buffer.from(prefixes.join('-')), hash(rlpBinaryTx)]);
|
|
17647
|
-
const signatures = [await this.sign(txWithNetworkId, options)];
|
|
17648
|
-
return buildTx({
|
|
17649
|
-
tag: Tag.SignedTx,
|
|
17650
|
-
encodedTx: rlpBinaryTx,
|
|
17651
|
-
signatures
|
|
17652
|
-
});
|
|
17653
|
-
}
|
|
17654
|
-
async signMessage(message, options) {
|
|
17655
|
-
return this.sign(messageToHash(message), options);
|
|
17656
|
-
}
|
|
17657
|
-
}
|
|
17658
18152
|
;// CONCATENATED MODULE: ./src/account/Generalized.ts
|
|
17659
18153
|
|
|
17660
18154
|
|
|
17661
18155
|
function Generalized_classPrivateFieldInitSpec(obj, privateMap, value) { Generalized_checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
17662
18156
|
function Generalized_checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
17663
|
-
/*
|
|
17664
|
-
* ISC License (ISC)
|
|
17665
|
-
* Copyright (c) 2022 aeternity developers
|
|
17666
|
-
*
|
|
17667
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
17668
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
17669
|
-
* copyright notice and this permission notice appear in all copies.
|
|
17670
|
-
*
|
|
17671
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
17672
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
17673
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
17674
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
17675
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
17676
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17677
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
17678
|
-
*/
|
|
17679
|
-
|
|
17680
18157
|
|
|
17681
18158
|
|
|
17682
18159
|
|
|
@@ -17724,8 +18201,10 @@ class AccountGeneralized extends AccountBase {
|
|
|
17724
18201
|
callData,
|
|
17725
18202
|
sourceCode,
|
|
17726
18203
|
args,
|
|
17727
|
-
|
|
17728
|
-
|
|
18204
|
+
fee,
|
|
18205
|
+
gasLimit,
|
|
18206
|
+
gasPrice
|
|
18207
|
+
} = typeof authData === 'function' ? await authData(tx) : authData;
|
|
17729
18208
|
const authCallData = callData !== null && callData !== void 0 ? callData : await (async () => {
|
|
17730
18209
|
if (classPrivateFieldGet_default()(this, _authFun) == null) {
|
|
17731
18210
|
const account = await getAccount(this.address, {
|
|
@@ -17740,7 +18219,7 @@ class AccountGeneralized extends AccountBase {
|
|
|
17740
18219
|
throw new InternalError('Account in generalised, but authFun not provided');
|
|
17741
18220
|
}
|
|
17742
18221
|
if (sourceCode == null || args == null) {
|
|
17743
|
-
throw new InvalidAuthDataError('Auth data must contain
|
|
18222
|
+
throw new InvalidAuthDataError('Auth data must contain sourceCode and args or callData.');
|
|
17744
18223
|
}
|
|
17745
18224
|
const contract = await contract_Contract.initialize({
|
|
17746
18225
|
onCompiler,
|
|
@@ -17749,16 +18228,18 @@ class AccountGeneralized extends AccountBase {
|
|
|
17749
18228
|
});
|
|
17750
18229
|
return contract._calldata.encode(contract._name, classPrivateFieldGet_default()(this, _authFun), args);
|
|
17751
18230
|
})();
|
|
17752
|
-
const gaMetaTx = await
|
|
17753
|
-
|
|
18231
|
+
const gaMetaTx = await buildTxAsync({
|
|
18232
|
+
tag: Tag.GaMetaTx,
|
|
18233
|
+
tx: {
|
|
17754
18234
|
tag: Tag.SignedTx,
|
|
17755
18235
|
encodedTx: decode(tx),
|
|
17756
18236
|
signatures: []
|
|
17757
|
-
}
|
|
18237
|
+
},
|
|
17758
18238
|
gaId: this.address,
|
|
17759
18239
|
authData: authCallData,
|
|
18240
|
+
fee,
|
|
17760
18241
|
gasLimit,
|
|
17761
|
-
|
|
18242
|
+
gasPrice,
|
|
17762
18243
|
onNode
|
|
17763
18244
|
});
|
|
17764
18245
|
return buildTx({
|
|
@@ -18099,10 +18580,10 @@ const ErrorPos = {
|
|
|
18099
18580
|
}
|
|
18100
18581
|
}
|
|
18101
18582
|
};
|
|
18102
|
-
const
|
|
18583
|
+
const CompileResult = {
|
|
18103
18584
|
type: {
|
|
18104
18585
|
name: "Composite",
|
|
18105
|
-
className: "
|
|
18586
|
+
className: "CompileResult",
|
|
18106
18587
|
modelProperties: {
|
|
18107
18588
|
bytecode: {
|
|
18108
18589
|
serializedName: "bytecode",
|
|
@@ -18110,6 +18591,23 @@ const mappers_ByteCode = {
|
|
|
18110
18591
|
type: {
|
|
18111
18592
|
name: "String"
|
|
18112
18593
|
}
|
|
18594
|
+
},
|
|
18595
|
+
aci: {
|
|
18596
|
+
serializedName: "aci",
|
|
18597
|
+
required: true,
|
|
18598
|
+
type: {
|
|
18599
|
+
name: "Sequence",
|
|
18600
|
+
element: {
|
|
18601
|
+
type: {
|
|
18602
|
+
name: "Dictionary",
|
|
18603
|
+
value: {
|
|
18604
|
+
type: {
|
|
18605
|
+
name: "any"
|
|
18606
|
+
}
|
|
18607
|
+
}
|
|
18608
|
+
}
|
|
18609
|
+
}
|
|
18610
|
+
}
|
|
18113
18611
|
}
|
|
18114
18612
|
}
|
|
18115
18613
|
}
|
|
@@ -18583,7 +19081,6 @@ const body7 = {
|
|
|
18583
19081
|
|
|
18584
19082
|
|
|
18585
19083
|
|
|
18586
|
-
|
|
18587
19084
|
class Compiler extends core_client_.ServiceClient {
|
|
18588
19085
|
/**
|
|
18589
19086
|
* Initializes a new instance of the Compiler class.
|
|
@@ -18591,7 +19088,7 @@ class Compiler extends core_client_.ServiceClient {
|
|
|
18591
19088
|
* @param options The parameter options
|
|
18592
19089
|
*/
|
|
18593
19090
|
constructor($host, options) {
|
|
18594
|
-
var _ref, _options$endpoint
|
|
19091
|
+
var _ref, _options$endpoint;
|
|
18595
19092
|
if ($host === undefined) {
|
|
18596
19093
|
throw new Error("'$host' cannot be null");
|
|
18597
19094
|
}
|
|
@@ -18611,24 +19108,9 @@ class Compiler extends core_client_.ServiceClient {
|
|
|
18611
19108
|
userAgentOptions: {
|
|
18612
19109
|
userAgentPrefix
|
|
18613
19110
|
},
|
|
18614
|
-
|
|
19111
|
+
endpoint: (_ref = (_options$endpoint = options.endpoint) !== null && _options$endpoint !== void 0 ? _options$endpoint : options.baseUri) !== null && _ref !== void 0 ? _ref : "{$host}"
|
|
18615
19112
|
};
|
|
18616
19113
|
super(optionsWithDefaults);
|
|
18617
|
-
if ((_options = options) !== null && _options !== void 0 && _options.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
|
|
18618
|
-
const pipelinePolicies = options.pipeline.getOrderedPolicies();
|
|
18619
|
-
const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(pipelinePolicy => pipelinePolicy.name === core_rest_pipeline_.bearerTokenAuthenticationPolicyName);
|
|
18620
|
-
if (!bearerTokenAuthenticationPolicyFound) {
|
|
18621
|
-
this.pipeline.removePolicy({
|
|
18622
|
-
name: core_rest_pipeline_.bearerTokenAuthenticationPolicyName
|
|
18623
|
-
});
|
|
18624
|
-
this.pipeline.addPolicy(core_rest_pipeline_.bearerTokenAuthenticationPolicy({
|
|
18625
|
-
scopes: `${optionsWithDefaults.baseUri}/.default`,
|
|
18626
|
-
challengeCallbacks: {
|
|
18627
|
-
authorizeRequestOnChallenge: core_client_.authorizeRequestOnClaimChallenge
|
|
18628
|
-
}
|
|
18629
|
-
}));
|
|
18630
|
-
}
|
|
18631
|
-
}
|
|
18632
19114
|
// Parameter assignments
|
|
18633
19115
|
this.$host = $host;
|
|
18634
19116
|
}
|
|
@@ -18646,7 +19128,7 @@ class Compiler extends core_client_.ServiceClient {
|
|
|
18646
19128
|
}
|
|
18647
19129
|
|
|
18648
19130
|
/**
|
|
18649
|
-
* Compile a sophia contract from source and return byte code
|
|
19131
|
+
* Compile a sophia contract from source and return byte code and ACI
|
|
18650
19132
|
* @param body contract code
|
|
18651
19133
|
* @param options The options parameters.
|
|
18652
19134
|
*/
|
|
@@ -18818,7 +19300,7 @@ const compileContractOperationSpec = {
|
|
|
18818
19300
|
httpMethod: "POST",
|
|
18819
19301
|
responses: {
|
|
18820
19302
|
200: {
|
|
18821
|
-
bodyMapper:
|
|
19303
|
+
bodyMapper: CompileResult
|
|
18822
19304
|
},
|
|
18823
19305
|
400: {
|
|
18824
19306
|
bodyMapper: {
|
|
@@ -19095,22 +19577,6 @@ const apiOperationSpec = {
|
|
|
19095
19577
|
serializer: compiler_serializer
|
|
19096
19578
|
};
|
|
19097
19579
|
;// CONCATENATED MODULE: ./src/contract/compiler/Http.ts
|
|
19098
|
-
/*
|
|
19099
|
-
* ISC License (ISC)
|
|
19100
|
-
* Copyright (c) 2022 aeternity developers
|
|
19101
|
-
*
|
|
19102
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
19103
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
19104
|
-
* copyright notice and this permission notice appear in all copies.
|
|
19105
|
-
*
|
|
19106
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
19107
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
19108
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
19109
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
19110
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
19111
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19112
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
19113
|
-
*/
|
|
19114
19580
|
|
|
19115
19581
|
|
|
19116
19582
|
|
|
@@ -19143,7 +19609,7 @@ class CompilerHttp extends CompilerBase {
|
|
|
19143
19609
|
}${body.info != null ? ` (${JSON.stringify(body.info)})` : ''}`;
|
|
19144
19610
|
}
|
|
19145
19611
|
if (Array.isArray(body)) {
|
|
19146
|
-
message += `\n${body.map(e => `${e.type}:${e.pos.line}:${e.pos.col}: ${e.message}${e.context != null ? `(${e.context})` : ''}`).join('\n')}`;
|
|
19612
|
+
message += `\n${body.map(e => `${e.type}:${e.pos.line}:${e.pos.col}: ${e.message}${e.context != null ? ` (${e.context})` : ''}`).join('\n')}`;
|
|
19147
19613
|
}
|
|
19148
19614
|
return message;
|
|
19149
19615
|
})]
|
|
@@ -19151,28 +19617,20 @@ class CompilerHttp extends CompilerBase {
|
|
|
19151
19617
|
if (ignoreVersion !== true) {
|
|
19152
19618
|
const versionPromise = this.api.apiVersion().then(({
|
|
19153
19619
|
apiVersion
|
|
19154
|
-
}) => apiVersion);
|
|
19155
|
-
this.api.pipeline.addPolicy(genVersionCheckPolicy('compiler', '/api-version', versionPromise, '7.
|
|
19620
|
+
}) => apiVersion, error => error);
|
|
19621
|
+
this.api.pipeline.addPolicy(genVersionCheckPolicy('compiler', '/api-version', versionPromise, '7.1.1', '8.0.0'));
|
|
19156
19622
|
}
|
|
19157
19623
|
}
|
|
19158
19624
|
async compileBySourceCode(sourceCode, fileSystem) {
|
|
19159
19625
|
try {
|
|
19160
|
-
const
|
|
19161
|
-
code: sourceCode,
|
|
19162
|
-
options: {
|
|
19163
|
-
fileSystem
|
|
19164
|
-
}
|
|
19165
|
-
}).then(res => res.bytecode), this.api.generateACI({
|
|
19626
|
+
const res = await this.api.compileContract({
|
|
19166
19627
|
code: sourceCode,
|
|
19167
19628
|
options: {
|
|
19168
19629
|
fileSystem
|
|
19169
19630
|
}
|
|
19170
|
-
})
|
|
19631
|
+
});
|
|
19171
19632
|
// TODO: should be fixed when the compiledAci interface gets updated
|
|
19172
|
-
return
|
|
19173
|
-
bytecode,
|
|
19174
|
-
aci: aci
|
|
19175
|
-
};
|
|
19633
|
+
return res;
|
|
19176
19634
|
} catch (error) {
|
|
19177
19635
|
if (error instanceof core_rest_pipeline_.RestError && error.statusCode === 400) {
|
|
19178
19636
|
throw new CompilerError(error.message.replace(/^aci error:/, 'compile error:'));
|
|
@@ -19209,23 +19667,6 @@ class CompilerHttp extends CompilerBase {
|
|
|
19209
19667
|
}
|
|
19210
19668
|
}
|
|
19211
19669
|
;// CONCATENATED MODULE: ./src/utils/string.ts
|
|
19212
|
-
/*
|
|
19213
|
-
* ISC License (ISC)
|
|
19214
|
-
* Copyright 2018 aeternity developers
|
|
19215
|
-
*
|
|
19216
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
19217
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
19218
|
-
* copyright notice and this permission notice appear in all copies.
|
|
19219
|
-
*
|
|
19220
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
19221
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
19222
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
19223
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
19224
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
19225
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19226
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
19227
|
-
*/
|
|
19228
|
-
|
|
19229
19670
|
/**
|
|
19230
19671
|
* Convert string from snake_case to PascalCase
|
|
19231
19672
|
* @param s - String to convert
|
|
@@ -19246,22 +19687,7 @@ function pascalToSnake(s) {
|
|
|
19246
19687
|
// EXTERNAL MODULE: external "websocket"
|
|
19247
19688
|
var external_websocket_ = __webpack_require__(8079);
|
|
19248
19689
|
;// CONCATENATED MODULE: ./src/channel/internal.ts
|
|
19249
|
-
|
|
19250
|
-
* ISC License (ISC)
|
|
19251
|
-
* Copyright (c) 2018 aeternity developers
|
|
19252
|
-
*
|
|
19253
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
19254
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
19255
|
-
* copyright notice and this permission notice appear in all copies.
|
|
19256
|
-
*
|
|
19257
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
19258
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
19259
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
19260
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
19261
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
19262
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19263
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
19264
|
-
*/
|
|
19690
|
+
|
|
19265
19691
|
|
|
19266
19692
|
|
|
19267
19693
|
|
|
@@ -19299,7 +19725,7 @@ function changeState(channel, newState) {
|
|
|
19299
19725
|
channel._state = newState;
|
|
19300
19726
|
emit(channel, 'stateChanged', newState);
|
|
19301
19727
|
}
|
|
19302
|
-
function
|
|
19728
|
+
function send(channel, message) {
|
|
19303
19729
|
if (channel._options.debug) console.log('Send message: ', message);
|
|
19304
19730
|
channel._websocket.send(json_big.stringify({
|
|
19305
19731
|
jsonrpc: '2.0',
|
|
@@ -19307,7 +19733,7 @@ function internal_send(channel, message) {
|
|
|
19307
19733
|
}));
|
|
19308
19734
|
}
|
|
19309
19735
|
function notify(channel, method, params = {}) {
|
|
19310
|
-
|
|
19736
|
+
send(channel, {
|
|
19311
19737
|
method,
|
|
19312
19738
|
params
|
|
19313
19739
|
});
|
|
@@ -19345,11 +19771,23 @@ async function enqueueAction(channel, guard, action) {
|
|
|
19345
19771
|
return promise;
|
|
19346
19772
|
}
|
|
19347
19773
|
async function handleMessage(channel, message) {
|
|
19774
|
+
var _message$params, _message$params$data, _message$params$data$, _message$params$data$2;
|
|
19348
19775
|
const {
|
|
19349
19776
|
handler,
|
|
19350
19777
|
state: st
|
|
19351
19778
|
} = channel._fsm;
|
|
19352
|
-
|
|
19779
|
+
const nextState = await Promise.resolve(handler(channel, message, st));
|
|
19780
|
+
enterState(channel, nextState);
|
|
19781
|
+
// TODO: emit message and handler name (?) to move this code to Contract constructor
|
|
19782
|
+
if ((message === null || message === void 0 ? void 0 : (_message$params = message.params) === null || _message$params === void 0 ? void 0 : (_message$params$data = _message$params.data) === null || _message$params$data === void 0 ? void 0 : (_message$params$data$ = _message$params$data.updates) === null || _message$params$data$ === void 0 ? void 0 : (_message$params$data$2 = _message$params$data$[0]) === null || _message$params$data$2 === void 0 ? void 0 : _message$params$data$2.op) === 'OffChainNewContract'
|
|
19783
|
+
// if name is channelOpen, the contract was created by other participant
|
|
19784
|
+
&& (nextState === null || nextState === void 0 ? void 0 : nextState.handler.name) === 'channelOpen') {
|
|
19785
|
+
var _message$params2, _message$params2$data, _message$params2$data2, _message$params2$data3;
|
|
19786
|
+
const round = channel.round();
|
|
19787
|
+
if (round == null) throw new UnexpectedTsError('Round is null');
|
|
19788
|
+
const owner = message === null || message === void 0 ? void 0 : (_message$params2 = message.params) === null || _message$params2 === void 0 ? void 0 : (_message$params2$data = _message$params2.data) === null || _message$params2$data === void 0 ? void 0 : (_message$params2$data2 = _message$params2$data.updates) === null || _message$params2$data2 === void 0 ? void 0 : (_message$params2$data3 = _message$params2$data2[0]) === null || _message$params2$data3 === void 0 ? void 0 : _message$params2$data3.owner;
|
|
19789
|
+
emit(channel, 'newContract', encodeContractAddress(owner, round + 1));
|
|
19790
|
+
}
|
|
19353
19791
|
}
|
|
19354
19792
|
async function dequeueMessage(channel) {
|
|
19355
19793
|
if (channel._isMessageQueueLocked) return;
|
|
@@ -19421,7 +19859,7 @@ async function call(channel, method, params) {
|
|
|
19421
19859
|
reject(new ChannelCallError(message.error.message + details));
|
|
19422
19860
|
} else resolve(message.result);
|
|
19423
19861
|
});
|
|
19424
|
-
|
|
19862
|
+
send(channel, {
|
|
19425
19863
|
method,
|
|
19426
19864
|
id,
|
|
19427
19865
|
params
|
|
@@ -19457,7 +19895,10 @@ async function initialize(channel, connectionHandler, openHandler, {
|
|
|
19457
19895
|
const {
|
|
19458
19896
|
signedTx
|
|
19459
19897
|
} = await channel.state();
|
|
19460
|
-
|
|
19898
|
+
if (signedTx == null) {
|
|
19899
|
+
throw new ChannelError('`signedTx` missed in state while reconnection');
|
|
19900
|
+
}
|
|
19901
|
+
changeState(channel, buildTx(signedTx));
|
|
19461
19902
|
}
|
|
19462
19903
|
ping(channel);
|
|
19463
19904
|
},
|
|
@@ -19472,22 +19913,6 @@ async function initialize(channel, connectionHandler, openHandler, {
|
|
|
19472
19913
|
});
|
|
19473
19914
|
}
|
|
19474
19915
|
;// CONCATENATED MODULE: ./src/channel/handlers.ts
|
|
19475
|
-
/*
|
|
19476
|
-
* ISC License (ISC)
|
|
19477
|
-
* Copyright (c) 2018 aeternity developers
|
|
19478
|
-
*
|
|
19479
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
19480
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
19481
|
-
* copyright notice and this permission notice appear in all copies.
|
|
19482
|
-
*
|
|
19483
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
19484
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
19485
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
19486
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
19487
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
19488
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19489
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
19490
|
-
*/
|
|
19491
19916
|
/* eslint-disable consistent-return */
|
|
19492
19917
|
/* eslint-disable default-case */
|
|
19493
19918
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
@@ -19496,6 +19921,7 @@ async function initialize(channel, connectionHandler, openHandler, {
|
|
|
19496
19921
|
|
|
19497
19922
|
|
|
19498
19923
|
|
|
19924
|
+
|
|
19499
19925
|
async function appendSignature(tx, signFn) {
|
|
19500
19926
|
const {
|
|
19501
19927
|
signatures,
|
|
@@ -19615,7 +20041,10 @@ async function awaitingReconnection(channel, message, state) {
|
|
|
19615
20041
|
if (message.method === 'channels.info') {
|
|
19616
20042
|
if (message.params.data.event === 'fsm_up') {
|
|
19617
20043
|
channel._fsmId = message.params.data.fsm_id;
|
|
19618
|
-
|
|
20044
|
+
const {
|
|
20045
|
+
signedTx
|
|
20046
|
+
} = await channel.state();
|
|
20047
|
+
changeState(channel, signedTx == null ? '' : buildTx(signedTx));
|
|
19619
20048
|
return {
|
|
19620
20049
|
handler: channelOpen
|
|
19621
20050
|
};
|
|
@@ -19714,7 +20143,7 @@ async function channelOpen(channel, message, state) {
|
|
|
19714
20143
|
//
|
|
19715
20144
|
// We should enter intermediate state where offchain transactions
|
|
19716
20145
|
// are blocked until channel is reestablished.
|
|
19717
|
-
emit(channel, message.params.data.event);
|
|
20146
|
+
emit(channel, snakeToPascal(message.params.data.event));
|
|
19718
20147
|
return {
|
|
19719
20148
|
handler: channelOpen
|
|
19720
20149
|
};
|
|
@@ -19870,22 +20299,6 @@ function channelClosed(_channel, message, state) {
|
|
|
19870
20299
|
var external_events_ = __webpack_require__(3735);
|
|
19871
20300
|
;// CONCATENATED MODULE: ./src/channel/Base.ts
|
|
19872
20301
|
|
|
19873
|
-
/*
|
|
19874
|
-
* ISC License (ISC)
|
|
19875
|
-
* Copyright (c) 2022 aeternity developers
|
|
19876
|
-
*
|
|
19877
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
19878
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
19879
|
-
* copyright notice and this permission notice appear in all copies.
|
|
19880
|
-
*
|
|
19881
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
19882
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
19883
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
19884
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
19885
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
19886
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19887
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
19888
|
-
*/
|
|
19889
20302
|
|
|
19890
20303
|
|
|
19891
20304
|
|
|
@@ -19899,6 +20312,7 @@ function snakeToPascalObjKeys(obj) {
|
|
|
19899
20312
|
[snakeToPascal(key)]: val
|
|
19900
20313
|
}), {});
|
|
19901
20314
|
}
|
|
20315
|
+
|
|
19902
20316
|
/**
|
|
19903
20317
|
* Channel
|
|
19904
20318
|
* @example
|
|
@@ -19930,6 +20344,7 @@ class Base_Channel {
|
|
|
19930
20344
|
defineProperty_default()(this, "_actionQueue", []);
|
|
19931
20345
|
defineProperty_default()(this, "_isActionQueueLocked", false);
|
|
19932
20346
|
defineProperty_default()(this, "_status", 'disconnected');
|
|
20347
|
+
defineProperty_default()(this, "_state", '');
|
|
19933
20348
|
}
|
|
19934
20349
|
/**
|
|
19935
20350
|
* @param options - Channel params
|
|
@@ -19995,18 +20410,22 @@ class Base_Channel {
|
|
|
19995
20410
|
* Possible events:
|
|
19996
20411
|
*
|
|
19997
20412
|
* - "error"
|
|
20413
|
+
* - "stateChanged"
|
|
20414
|
+
* - "statusChanged"
|
|
20415
|
+
* - "message"
|
|
20416
|
+
* - "peerDisconnected"
|
|
19998
20417
|
* - "onChainTx"
|
|
19999
20418
|
* - "ownWithdrawLocked"
|
|
20000
20419
|
* - "withdrawLocked"
|
|
20001
20420
|
* - "ownDepositLocked"
|
|
20002
20421
|
* - "depositLocked"
|
|
20422
|
+
* - "channelReestablished"
|
|
20423
|
+
* - "newContract"
|
|
20003
20424
|
*
|
|
20004
|
-
* TODO: the event list looks outdated
|
|
20005
20425
|
*
|
|
20006
20426
|
* @param eventName - Event name
|
|
20007
20427
|
* @param callback - Callback function
|
|
20008
20428
|
*/
|
|
20009
|
-
// TODO define specific callback type depending on the event name
|
|
20010
20429
|
on(eventName, callback) {
|
|
20011
20430
|
this._eventEmitter.on(eventName, callback);
|
|
20012
20431
|
}
|
|
@@ -20038,7 +20457,17 @@ class Base_Channel {
|
|
|
20038
20457
|
* Get current state
|
|
20039
20458
|
*/
|
|
20040
20459
|
async state() {
|
|
20041
|
-
|
|
20460
|
+
const res = snakeToPascalObjKeys(await call(this, 'channels.get.offchain_state', {}));
|
|
20461
|
+
return {
|
|
20462
|
+
calls: unpackTx(res.calls, Tag.CallsMtree),
|
|
20463
|
+
...(res.halfSignedTx !== '' && {
|
|
20464
|
+
halfSignedTx: unpackTx(res.halfSignedTx, Tag.SignedTx)
|
|
20465
|
+
}),
|
|
20466
|
+
...(res.signedTx !== '' && {
|
|
20467
|
+
signedTx: unpackTx(res.signedTx, Tag.SignedTx)
|
|
20468
|
+
}),
|
|
20469
|
+
trees: unpackTx(res.trees, Tag.StateTrees)
|
|
20470
|
+
};
|
|
20042
20471
|
}
|
|
20043
20472
|
|
|
20044
20473
|
/**
|
|
@@ -20048,20 +20477,17 @@ class Base_Channel {
|
|
|
20048
20477
|
* it will return `null`.
|
|
20049
20478
|
*/
|
|
20050
20479
|
round() {
|
|
20051
|
-
if (this._state
|
|
20480
|
+
if (this._state === '') {
|
|
20052
20481
|
return null;
|
|
20053
20482
|
}
|
|
20054
|
-
const
|
|
20055
|
-
|
|
20056
|
-
round
|
|
20057
|
-
} = unpackTx(this._state, Tag.SignedTx).encodedTx;
|
|
20058
|
-
switch (tag) {
|
|
20483
|
+
const params = unpackTx(this._state, Tag.SignedTx).encodedTx;
|
|
20484
|
+
switch (params.tag) {
|
|
20059
20485
|
case Tag.ChannelCreateTx:
|
|
20060
20486
|
return 1;
|
|
20061
20487
|
case Tag.ChannelOffChainTx:
|
|
20062
20488
|
case Tag.ChannelWithdrawTx:
|
|
20063
20489
|
case Tag.ChannelDepositTx:
|
|
20064
|
-
return round;
|
|
20490
|
+
return params.round;
|
|
20065
20491
|
default:
|
|
20066
20492
|
return null;
|
|
20067
20493
|
}
|
|
@@ -20156,23 +20582,6 @@ class Base_Channel {
|
|
|
20156
20582
|
}
|
|
20157
20583
|
}
|
|
20158
20584
|
;// CONCATENATED MODULE: ./src/channel/Spend.ts
|
|
20159
|
-
/*
|
|
20160
|
-
* ISC License (ISC)
|
|
20161
|
-
* Copyright (c) 2022 aeternity developers
|
|
20162
|
-
*
|
|
20163
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
20164
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
20165
|
-
* copyright notice and this permission notice appear in all copies.
|
|
20166
|
-
*
|
|
20167
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
20168
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
20169
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
20170
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
20171
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
20172
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
20173
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
20174
|
-
*/
|
|
20175
|
-
|
|
20176
20585
|
|
|
20177
20586
|
|
|
20178
20587
|
|
|
@@ -20538,23 +20947,6 @@ class ChannelSpend extends Base_Channel {
|
|
|
20538
20947
|
}
|
|
20539
20948
|
}
|
|
20540
20949
|
;// CONCATENATED MODULE: ./src/channel/Contract.ts
|
|
20541
|
-
/*
|
|
20542
|
-
* ISC License (ISC)
|
|
20543
|
-
* Copyright (c) 2022 aeternity developers
|
|
20544
|
-
*
|
|
20545
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
20546
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
20547
|
-
* copyright notice and this permission notice appear in all copies.
|
|
20548
|
-
*
|
|
20549
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
20550
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
20551
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
20552
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
20553
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
20554
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
20555
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
20556
|
-
*/
|
|
20557
|
-
|
|
20558
20950
|
|
|
20559
20951
|
|
|
20560
20952
|
|
|
@@ -20632,15 +21024,18 @@ class ChannelContract extends ChannelSpend {
|
|
|
20632
21024
|
await signAndNotify(this, 'channels.update', message.params.data, async tx => state.sign(tx));
|
|
20633
21025
|
return {
|
|
20634
21026
|
handler: (_2, message2, state2) => awaitingCompletion(this, message2, state2, () => {
|
|
20635
|
-
const
|
|
20636
|
-
|
|
20637
|
-
|
|
21027
|
+
const params = unpackTx(message2.params.data.state, Tag.SignedTx).encodedTx;
|
|
21028
|
+
if (params.tag !== Tag.ChannelOffChainTx) {
|
|
21029
|
+
throw new ChannelError(`Tag should be ${Tag[Tag.ChannelOffChainTx]}, got ${Tag[params.tag]} instead`);
|
|
21030
|
+
}
|
|
20638
21031
|
const addressKey = this._options.role === 'initiator' ? 'initiatorId' : 'responderId';
|
|
20639
21032
|
const owner = this._options[addressKey];
|
|
20640
21033
|
changeState(this, message2.params.data.state);
|
|
21034
|
+
const address = encodeContractAddress(owner, params.round);
|
|
21035
|
+
emit(this, 'newContract', address);
|
|
20641
21036
|
state2.resolve({
|
|
20642
21037
|
accepted: true,
|
|
20643
|
-
address
|
|
21038
|
+
address,
|
|
20644
21039
|
signedTx: message2.params.data.state
|
|
20645
21040
|
});
|
|
20646
21041
|
return {
|
|
@@ -20950,23 +21345,6 @@ class ChannelContract extends ChannelSpend {
|
|
|
20950
21345
|
}
|
|
20951
21346
|
}
|
|
20952
21347
|
;// CONCATENATED MODULE: ./src/aepp-wallet-communication/connection-proxy.ts
|
|
20953
|
-
/*
|
|
20954
|
-
* ISC License (ISC)
|
|
20955
|
-
* Copyright (c) 2022 aeternity developers
|
|
20956
|
-
*
|
|
20957
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
20958
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
20959
|
-
* copyright notice and this permission notice appear in all copies.
|
|
20960
|
-
*
|
|
20961
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
20962
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
20963
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
20964
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
20965
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
20966
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
20967
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
20968
|
-
*/
|
|
20969
|
-
|
|
20970
21348
|
/**
|
|
20971
21349
|
* Browser connection proxy
|
|
20972
21350
|
* Provide functionality to easily forward messages from one connection to another and back
|
|
@@ -20984,23 +21362,6 @@ class ChannelContract extends ChannelSpend {
|
|
|
20984
21362
|
};
|
|
20985
21363
|
});
|
|
20986
21364
|
;// CONCATENATED MODULE: ./src/aepp-wallet-communication/connection/Browser.ts
|
|
20987
|
-
/*
|
|
20988
|
-
* ISC License (ISC)
|
|
20989
|
-
* Copyright (c) 2022 aeternity developers
|
|
20990
|
-
*
|
|
20991
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
20992
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
20993
|
-
* copyright notice and this permission notice appear in all copies.
|
|
20994
|
-
*
|
|
20995
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
20996
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
20997
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
20998
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
20999
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
21000
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
21001
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
21002
|
-
*/
|
|
21003
|
-
|
|
21004
21365
|
|
|
21005
21366
|
|
|
21006
21367
|
/**
|
|
@@ -21058,23 +21419,6 @@ class BrowserConnection {
|
|
|
21058
21419
|
|
|
21059
21420
|
function BrowserWindowMessage_classPrivateFieldInitSpec(obj, privateMap, value) { BrowserWindowMessage_checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
21060
21421
|
function BrowserWindowMessage_checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
21061
|
-
/*
|
|
21062
|
-
* ISC License (ISC)
|
|
21063
|
-
* Copyright (c) 2022 aeternity developers
|
|
21064
|
-
*
|
|
21065
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
21066
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
21067
|
-
* copyright notice and this permission notice appear in all copies.
|
|
21068
|
-
*
|
|
21069
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
21070
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
21071
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
21072
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
21073
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
21074
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
21075
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
21076
|
-
*/
|
|
21077
|
-
|
|
21078
21422
|
|
|
21079
21423
|
|
|
21080
21424
|
|
|
@@ -21169,23 +21513,6 @@ class BrowserWindowMessageConnection extends BrowserConnection {
|
|
|
21169
21513
|
}
|
|
21170
21514
|
}
|
|
21171
21515
|
;// CONCATENATED MODULE: ./src/aepp-wallet-communication/wallet-detector.ts
|
|
21172
|
-
/*
|
|
21173
|
-
* ISC License (ISC)
|
|
21174
|
-
* Copyright (c) 2022 aeternity developers
|
|
21175
|
-
*
|
|
21176
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
21177
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
21178
|
-
* copyright notice and this permission notice appear in all copies.
|
|
21179
|
-
*
|
|
21180
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
21181
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
21182
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
21183
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
21184
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
21185
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
21186
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
21187
|
-
*/
|
|
21188
|
-
|
|
21189
21516
|
|
|
21190
21517
|
|
|
21191
21518
|
|
|
@@ -21232,23 +21559,6 @@ class BrowserWindowMessageConnection extends BrowserConnection {
|
|
|
21232
21559
|
|
|
21233
21560
|
function BrowserRuntime_classPrivateFieldInitSpec(obj, privateMap, value) { BrowserRuntime_checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
21234
21561
|
function BrowserRuntime_checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
21235
|
-
/*
|
|
21236
|
-
* ISC License (ISC)
|
|
21237
|
-
* Copyright (c) 2022 aeternity developers
|
|
21238
|
-
*
|
|
21239
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
21240
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
21241
|
-
* copyright notice and this permission notice appear in all copies.
|
|
21242
|
-
*
|
|
21243
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
21244
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
21245
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
21246
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
21247
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
21248
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
21249
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
21250
|
-
*/
|
|
21251
|
-
|
|
21252
21562
|
|
|
21253
21563
|
|
|
21254
21564
|
|
|
@@ -21298,22 +21608,7 @@ class BrowserRuntimeConnection extends BrowserConnection {
|
|
|
21298
21608
|
}
|
|
21299
21609
|
}
|
|
21300
21610
|
;// CONCATENATED MODULE: ./src/index-browser.ts
|
|
21301
|
-
|
|
21302
|
-
* ISC License (ISC)
|
|
21303
|
-
* Copyright (c) 2022 aeternity developers
|
|
21304
|
-
*
|
|
21305
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
21306
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
21307
|
-
* copyright notice and this permission notice appear in all copies.
|
|
21308
|
-
*
|
|
21309
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
21310
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
21311
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
21312
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
21313
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
21314
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
21315
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
21316
|
-
*/
|
|
21611
|
+
// TODO: avoid `export * from`
|
|
21317
21612
|
|
|
21318
21613
|
|
|
21319
21614
|
|
|
@@ -21321,6 +21616,7 @@ class BrowserRuntimeConnection extends BrowserConnection {
|
|
|
21321
21616
|
|
|
21322
21617
|
|
|
21323
21618
|
|
|
21619
|
+
// TODO: move to constants
|
|
21324
21620
|
|
|
21325
21621
|
|
|
21326
21622
|
|
|
@@ -21418,21 +21714,15 @@ class CompilerCli extends CompilerBase {
|
|
|
21418
21714
|
}
|
|
21419
21715
|
async compile(path) {
|
|
21420
21716
|
await classPrivateFieldGet_default()(this, _ensureCompatibleVersion);
|
|
21421
|
-
let bytecode;
|
|
21422
|
-
let aciCli;
|
|
21423
21717
|
try {
|
|
21424
|
-
[bytecode,
|
|
21718
|
+
const [bytecode, aci] = await Promise.all([Cli_classPrivateMethodGet(this, _run, _run2).call(this, path), Cli_classPrivateMethodGet(this, _run, _run2).call(this, '--create_json_aci', path).then(res => JSON.parse(res))]);
|
|
21719
|
+
return {
|
|
21720
|
+
bytecode: bytecode.trimEnd(),
|
|
21721
|
+
aci: aci
|
|
21722
|
+
};
|
|
21425
21723
|
} catch (error) {
|
|
21426
21724
|
throw new CompilerError(error.message);
|
|
21427
21725
|
}
|
|
21428
|
-
const aci = {
|
|
21429
|
-
encodedAci: aciCli[0],
|
|
21430
|
-
externalEncodedAci: aciCli.slice(1)
|
|
21431
|
-
};
|
|
21432
|
-
return {
|
|
21433
|
-
bytecode: bytecode.trimEnd(),
|
|
21434
|
-
aci: aci
|
|
21435
|
-
};
|
|
21436
21726
|
}
|
|
21437
21727
|
async compileBySourceCode(sourceCode, fileSystem) {
|
|
21438
21728
|
const tmp = await Cli_classStaticPrivateMethodGet(CompilerCli, CompilerCli, _saveContractToTmpDir).call(CompilerCli, sourceCode, fileSystem);
|