@aeternity/aepp-sdk 13.0.0-alpha.1 → 13.0.0-beta.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/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 +1792 -1525
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdk.mjs.map +1 -1
- 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 +11 -24
- 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 +19 -22
- 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 +174 -211
- package/es/contract/Contract.mjs.map +1 -1
- package/es/contract/compiler/Base.d.ts +7 -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 +4 -3
- package/es/index-browser.mjs +6 -20
- 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 +2 -32
- 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/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 +8 -23
- 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 +6 -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 +28 -27
- 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 +133 -163
- package/src/contract/compiler/Base.ts +7 -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 +12 -20
- 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 +15 -44
- package/src/utils/string.ts +0 -17
- 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 +7 -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 +4 -3
- 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/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 +7 -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 +4 -3
- 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:
|
|
@@ -4999,7 +5124,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
4999
5124
|
"InvalidRpcMessageError": () => (/* reexport */ InvalidRpcMessageError),
|
|
5000
5125
|
"InvalidSignatureError": () => (/* reexport */ InvalidSignatureError),
|
|
5001
5126
|
"InvalidTxError": () => (/* reexport */ InvalidTxError),
|
|
5002
|
-
"InvalidTxParamsError": () => (/* reexport */ InvalidTxParamsError),
|
|
5003
5127
|
"MAX_AUTH_FUN_GAS": () => (/* reexport */ MAX_AUTH_FUN_GAS),
|
|
5004
5128
|
"MESSAGE_DIRECTION": () => (/* reexport */ MESSAGE_DIRECTION),
|
|
5005
5129
|
"METHODS": () => (/* reexport */ METHODS),
|
|
@@ -5035,7 +5159,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5035
5159
|
"ORACLE_TTL_TYPES": () => (/* reexport */ ORACLE_TTL_TYPES),
|
|
5036
5160
|
"PayloadLengthError": () => (/* reexport */ PayloadLengthError),
|
|
5037
5161
|
"PrefixNotFoundError": () => (/* reexport */ PrefixNotFoundError),
|
|
5038
|
-
"QUERY_FEE": () => (/* reexport */ QUERY_FEE),
|
|
5039
5162
|
"QUERY_TTL": () => (/* reexport */ QUERY_TTL),
|
|
5040
5163
|
"RESPONSE_TTL": () => (/* reexport */ RESPONSE_TTL),
|
|
5041
5164
|
"RPC_STATUS": () => (/* reexport */ RPC_STATUS),
|
|
@@ -5053,8 +5176,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5053
5176
|
"RpcUnsupportedProtocolError": () => (/* reexport */ RpcUnsupportedProtocolError),
|
|
5054
5177
|
"SUBSCRIPTION_TYPES": () => (/* reexport */ SUBSCRIPTION_TYPES),
|
|
5055
5178
|
"SchemaNotFoundError": () => (/* reexport */ SchemaNotFoundError),
|
|
5056
|
-
"TX_SCHEMA": () => (/* reexport */ TX_SCHEMA),
|
|
5057
|
-
"TX_TTL": () => (/* reexport */ TX_TTL),
|
|
5058
5179
|
"Tag": () => (/* reexport */ Tag),
|
|
5059
5180
|
"TagNotFoundError": () => (/* reexport */ TagNotFoundError),
|
|
5060
5181
|
"TransactionError": () => (/* reexport */ TransactionError),
|
|
@@ -5070,15 +5191,12 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5070
5191
|
"UnknownPathNibbleError": () => (/* reexport */ UnknownPathNibbleError),
|
|
5071
5192
|
"UnknownRpcClientError": () => (/* reexport */ UnknownRpcClientError),
|
|
5072
5193
|
"UnsubscribedAccountError": () => (/* reexport */ UnsubscribedAccountError),
|
|
5073
|
-
"UnsupportedABIversionError": () => (/* reexport */ UnsupportedABIversionError),
|
|
5074
5194
|
"UnsupportedPlatformError": () => (/* reexport */ UnsupportedPlatformError),
|
|
5075
5195
|
"UnsupportedProtocolError": () => (/* reexport */ UnsupportedProtocolError),
|
|
5076
|
-
"UnsupportedVMversionError": () => (/* reexport */ UnsupportedVMversionError),
|
|
5077
5196
|
"UnsupportedVersionError": () => (/* reexport */ UnsupportedVersionError),
|
|
5078
5197
|
"VmVersion": () => (/* reexport */ VmVersion),
|
|
5079
5198
|
"WALLET_TYPE": () => (/* reexport */ WALLET_TYPE),
|
|
5080
5199
|
"WalletError": () => (/* reexport */ WalletError),
|
|
5081
|
-
"_buildTx": () => (/* reexport */ _buildTx),
|
|
5082
5200
|
"_getPollInterval": () => (/* reexport */ _getPollInterval),
|
|
5083
5201
|
"aensBid": () => (/* reexport */ aensBid),
|
|
5084
5202
|
"aensClaim": () => (/* reexport */ aensClaim),
|
|
@@ -5089,9 +5207,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5089
5207
|
"aensUpdate": () => (/* reexport */ aensUpdate),
|
|
5090
5208
|
"awaitHeight": () => (/* reexport */ awaitHeight),
|
|
5091
5209
|
"buildAuthTxHash": () => (/* reexport */ buildAuthTxHash),
|
|
5210
|
+
"buildAuthTxHashByGaMetaTx": () => (/* reexport */ buildAuthTxHashByGaMetaTx),
|
|
5092
5211
|
"buildContractId": () => (/* reexport */ buildContractId),
|
|
5093
5212
|
"buildContractIdByContractTx": () => (/* reexport */ buildContractIdByContractTx),
|
|
5094
5213
|
"buildTx": () => (/* reexport */ buildTx),
|
|
5214
|
+
"buildTxAsync": () => (/* reexport */ buildTxAsync),
|
|
5095
5215
|
"buildTxHash": () => (/* reexport */ buildTxHash),
|
|
5096
5216
|
"commitmentHash": () => (/* reexport */ commitmentHash),
|
|
5097
5217
|
"computeAuctionEndBlock": () => (/* reexport */ computeAuctionEndBlock),
|
|
@@ -5119,6 +5239,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5119
5239
|
"getContractByteCode": () => (/* reexport */ getContractByteCode),
|
|
5120
5240
|
"getCurrentGeneration": () => (/* reexport */ getCurrentGeneration),
|
|
5121
5241
|
"getDefaultPointerKey": () => (/* reexport */ getDefaultPointerKey),
|
|
5242
|
+
"getExecutionCost": () => (/* reexport */ getExecutionCost),
|
|
5243
|
+
"getExecutionCostBySignedTx": () => (/* reexport */ getExecutionCostBySignedTx),
|
|
5244
|
+
"getExecutionCostUsingNode": () => (/* reexport */ getExecutionCostUsingNode),
|
|
5122
5245
|
"getFileSystem": () => (/* reexport */ getFileSystem),
|
|
5123
5246
|
"getGeneration": () => (/* reexport */ getGeneration),
|
|
5124
5247
|
"getHdWalletAccountFromSeed": () => (/* reexport */ getHdWalletAccountFromSeed),
|
|
@@ -5133,6 +5256,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5133
5256
|
"getOracleObject": () => (/* reexport */ getOracleObject),
|
|
5134
5257
|
"getQueryObject": () => (/* reexport */ getQueryObject),
|
|
5135
5258
|
"getSaveHDWalletAccounts": () => (/* reexport */ getSaveHDWalletAccounts),
|
|
5259
|
+
"getTransactionSignerAddress": () => (/* reexport */ getTransactionSignerAddress),
|
|
5136
5260
|
"hash": () => (/* reexport */ hash),
|
|
5137
5261
|
"isAddressValid": () => (/* reexport */ isAddressValid),
|
|
5138
5262
|
"isAuctionName": () => (/* reexport */ isAuctionName),
|
|
@@ -5151,7 +5275,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5151
5275
|
"registerOracle": () => (/* reexport */ registerOracle),
|
|
5152
5276
|
"resolveName": () => (/* reexport */ resolveName),
|
|
5153
5277
|
"respondToQuery": () => (/* reexport */ respondToQuery),
|
|
5154
|
-
"send": () => (/* reexport */ send),
|
|
5155
5278
|
"sendTransaction": () => (/* reexport */ sendTransaction),
|
|
5156
5279
|
"sign": () => (/* reexport */ sign),
|
|
5157
5280
|
"signMessage": () => (/* reexport */ signMessage),
|
|
@@ -5286,16 +5409,6 @@ __webpack_require__.d(chain_namespaceObject, {
|
|
|
5286
5409
|
"waitForTxConfirm": () => (waitForTxConfirm)
|
|
5287
5410
|
});
|
|
5288
5411
|
|
|
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
5412
|
// NAMESPACE OBJECT: ./src/aens.ts
|
|
5300
5413
|
var aens_namespaceObject = {};
|
|
5301
5414
|
__webpack_require__.r(aens_namespaceObject);
|
|
@@ -5323,11 +5436,21 @@ __webpack_require__.d(oracle_namespaceObject, {
|
|
|
5323
5436
|
"respondToQuery": () => (respondToQuery)
|
|
5324
5437
|
});
|
|
5325
5438
|
|
|
5439
|
+
// NAMESPACE OBJECT: ./src/spend.ts
|
|
5440
|
+
var spend_namespaceObject = {};
|
|
5441
|
+
__webpack_require__.r(spend_namespaceObject);
|
|
5442
|
+
__webpack_require__.d(spend_namespaceObject, {
|
|
5443
|
+
"payForTransaction": () => (payForTransaction),
|
|
5444
|
+
"spend": () => (spend),
|
|
5445
|
+
"transferFunds": () => (transferFunds)
|
|
5446
|
+
});
|
|
5447
|
+
|
|
5326
5448
|
// NAMESPACE OBJECT: ./src/contract/ga.ts
|
|
5327
5449
|
var ga_namespaceObject = {};
|
|
5328
5450
|
__webpack_require__.r(ga_namespaceObject);
|
|
5329
5451
|
__webpack_require__.d(ga_namespaceObject, {
|
|
5330
5452
|
"buildAuthTxHash": () => (buildAuthTxHash),
|
|
5453
|
+
"buildAuthTxHashByGaMetaTx": () => (buildAuthTxHashByGaMetaTx),
|
|
5331
5454
|
"createGeneralizedAccount": () => (createGeneralizedAccount)
|
|
5332
5455
|
});
|
|
5333
5456
|
|
|
@@ -5337,11 +5460,11 @@ __webpack_require__.r(models_mappers_namespaceObject);
|
|
|
5337
5460
|
__webpack_require__.d(models_mappers_namespaceObject, {
|
|
5338
5461
|
"Aci": () => (Aci),
|
|
5339
5462
|
"ApiVersion": () => (ApiVersion),
|
|
5340
|
-
"ByteCode": () => (mappers_ByteCode),
|
|
5341
5463
|
"ByteCodeInput": () => (ByteCodeInput),
|
|
5342
5464
|
"BytecodeCallResultInput": () => (BytecodeCallResultInput),
|
|
5343
5465
|
"Calldata": () => (Calldata),
|
|
5344
5466
|
"CompileOpts": () => (CompileOpts),
|
|
5467
|
+
"CompileResult": () => (CompileResult),
|
|
5345
5468
|
"CompilerError": () => (mappers_CompilerError),
|
|
5346
5469
|
"CompilerVersion": () => (CompilerVersion),
|
|
5347
5470
|
"Contract": () => (mappers_Contract),
|
|
@@ -6060,16 +6183,6 @@ class InvalidSignatureError extends TransactionError {
|
|
|
6060
6183
|
}
|
|
6061
6184
|
}
|
|
6062
6185
|
|
|
6063
|
-
/**
|
|
6064
|
-
* @category exception
|
|
6065
|
-
*/
|
|
6066
|
-
class InvalidTxParamsError extends TransactionError {
|
|
6067
|
-
constructor(message) {
|
|
6068
|
-
super(message);
|
|
6069
|
-
this.name = 'InvalidTxParamsError';
|
|
6070
|
-
}
|
|
6071
|
-
}
|
|
6072
|
-
|
|
6073
6186
|
/**
|
|
6074
6187
|
* @category exception
|
|
6075
6188
|
*/
|
|
@@ -6084,8 +6197,8 @@ class PrefixNotFoundError extends TransactionError {
|
|
|
6084
6197
|
* @category exception
|
|
6085
6198
|
*/
|
|
6086
6199
|
class SchemaNotFoundError extends TransactionError {
|
|
6087
|
-
constructor(
|
|
6088
|
-
super(`Transaction
|
|
6200
|
+
constructor(key, version) {
|
|
6201
|
+
super(`Transaction schema not implemented for tag ${key} version ${version}`);
|
|
6089
6202
|
this.name = 'SchemaNotFoundError';
|
|
6090
6203
|
}
|
|
6091
6204
|
}
|
|
@@ -6110,26 +6223,6 @@ class TxNotInChainError extends TransactionError {
|
|
|
6110
6223
|
}
|
|
6111
6224
|
}
|
|
6112
6225
|
|
|
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
6226
|
/**
|
|
6134
6227
|
* @category exception
|
|
6135
6228
|
*/
|
|
@@ -6160,22 +6253,6 @@ class RpcConnectionError extends WalletError {
|
|
|
6160
6253
|
}
|
|
6161
6254
|
}
|
|
6162
6255
|
;// 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
6256
|
|
|
6180
6257
|
|
|
6181
6258
|
|
|
@@ -6464,22 +6541,6 @@ function encode(data, type) {
|
|
|
6464
6541
|
return `${type}_${encoder.encode(data)}`;
|
|
6465
6542
|
}
|
|
6466
6543
|
;// 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
6544
|
|
|
6484
6545
|
// js extension is required for mjs build, not importing the whole package to reduce bundle size
|
|
6485
6546
|
// eslint-disable-next-line import/extensions
|
|
@@ -6711,6 +6772,7 @@ let ConsensusProtocolVersion;
|
|
|
6711
6772
|
*/
|
|
6712
6773
|
(function (ConsensusProtocolVersion) {
|
|
6713
6774
|
ConsensusProtocolVersion[ConsensusProtocolVersion["Iris"] = 5] = "Iris";
|
|
6775
|
+
ConsensusProtocolVersion[ConsensusProtocolVersion["Ceres"] = 6] = "Ceres";
|
|
6714
6776
|
})(ConsensusProtocolVersion || (ConsensusProtocolVersion = {}));
|
|
6715
6777
|
let VmVersion;
|
|
6716
6778
|
|
|
@@ -6794,25 +6856,41 @@ let Tag; // KeyBlock = 100,
|
|
|
6794
6856
|
Tag[Tag["GaAttachTx"] = 80] = "GaAttachTx";
|
|
6795
6857
|
Tag[Tag["GaMetaTx"] = 81] = "GaMetaTx";
|
|
6796
6858
|
Tag[Tag["PayingForTx"] = 82] = "PayingForTx";
|
|
6859
|
+
Tag[Tag["GaMetaTxAuthData"] = 810] = "GaMetaTxAuthData";
|
|
6797
6860
|
})(Tag || (Tag = {}));
|
|
6798
6861
|
;// CONCATENATED MODULE: ./src/tx/builder/field-types/ct-version.ts
|
|
6799
6862
|
|
|
6800
|
-
|
|
6801
|
-
|
|
6863
|
+
/*
|
|
6864
|
+
* First abi/vm by default
|
|
6865
|
+
* @see {@link https://github.com/aeternity/protocol/blob/71cf111/contracts/contract_vms.md#virtual-machines-on-the-æternity-blockchain}
|
|
6866
|
+
*/
|
|
6802
6867
|
const ProtocolToVmAbi = {
|
|
6803
6868
|
[ConsensusProtocolVersion.Iris]: {
|
|
6804
6869
|
'contract-create': {
|
|
6805
6870
|
vmVersion: [VmVersion.Fate2],
|
|
6806
6871
|
abiVersion: [AbiVersion.Fate]
|
|
6807
6872
|
},
|
|
6808
|
-
// TODO: Ensure that AEVM (Sophia?) is still available here
|
|
6809
6873
|
'contract-call': {
|
|
6810
6874
|
vmVersion: [],
|
|
6811
6875
|
abiVersion: [AbiVersion.Fate, AbiVersion.Sophia]
|
|
6812
6876
|
},
|
|
6813
6877
|
'oracle-call': {
|
|
6814
6878
|
vmVersion: [],
|
|
6815
|
-
abiVersion: [AbiVersion.NoAbi, AbiVersion.
|
|
6879
|
+
abiVersion: [AbiVersion.NoAbi, AbiVersion.Fate]
|
|
6880
|
+
}
|
|
6881
|
+
},
|
|
6882
|
+
[ConsensusProtocolVersion.Ceres]: {
|
|
6883
|
+
'contract-create': {
|
|
6884
|
+
vmVersion: [VmVersion.Fate2],
|
|
6885
|
+
abiVersion: [AbiVersion.Fate]
|
|
6886
|
+
},
|
|
6887
|
+
'contract-call': {
|
|
6888
|
+
vmVersion: [],
|
|
6889
|
+
abiVersion: [AbiVersion.Fate]
|
|
6890
|
+
},
|
|
6891
|
+
'oracle-call': {
|
|
6892
|
+
vmVersion: [],
|
|
6893
|
+
abiVersion: [AbiVersion.NoAbi, AbiVersion.Fate]
|
|
6816
6894
|
}
|
|
6817
6895
|
}
|
|
6818
6896
|
};
|
|
@@ -6825,13 +6903,24 @@ function getProtocolDetails(protocolVersion, type) {
|
|
|
6825
6903
|
};
|
|
6826
6904
|
}
|
|
6827
6905
|
/* harmony default export */ const ct_version = ({
|
|
6828
|
-
serialize(value, {
|
|
6906
|
+
serialize(value, params, {
|
|
6829
6907
|
consensusProtocolVersion = ConsensusProtocolVersion.Iris
|
|
6830
6908
|
}) {
|
|
6831
6909
|
var _value;
|
|
6832
6910
|
(_value = value) !== null && _value !== void 0 ? _value : value = getProtocolDetails(consensusProtocolVersion, 'contract-create');
|
|
6833
6911
|
return Buffer.from([value.vmVersion, 0, value.abiVersion]);
|
|
6834
6912
|
},
|
|
6913
|
+
async prepare(value, params,
|
|
6914
|
+
// TODO: { consensusProtocolVersion: ConsensusProtocolVersion } | { onNode: Node } | {}
|
|
6915
|
+
options) {
|
|
6916
|
+
if (value != null) return value;
|
|
6917
|
+
if (options.consensusProtocolVersion != null) return undefined;
|
|
6918
|
+
if (Object.keys(ConsensusProtocolVersion).length === 2) return undefined;
|
|
6919
|
+
if (options.onNode != null) {
|
|
6920
|
+
return getProtocolDetails((await options.onNode.getNodeInfo()).consensusProtocolVersion, 'contract-create');
|
|
6921
|
+
}
|
|
6922
|
+
return undefined;
|
|
6923
|
+
},
|
|
6835
6924
|
deserialize(buffer) {
|
|
6836
6925
|
const [vm,, abi] = buffer;
|
|
6837
6926
|
return {
|
|
@@ -6846,34 +6935,36 @@ var external_rlp_ = __webpack_require__(3485);
|
|
|
6846
6935
|
|
|
6847
6936
|
|
|
6848
6937
|
/* harmony default export */ const abi_version = ({
|
|
6938
|
+
_getProtocolDetails(c, tag) {
|
|
6939
|
+
const kind = Tag.ContractCallTx === tag || Tag.GaMetaTx === tag ? 'contract-call' : 'oracle-call';
|
|
6940
|
+
return getProtocolDetails(c, kind).abiVersion;
|
|
6941
|
+
},
|
|
6849
6942
|
serialize(value, {
|
|
6850
|
-
tag
|
|
6943
|
+
tag
|
|
6944
|
+
}, {
|
|
6851
6945
|
consensusProtocolVersion = ConsensusProtocolVersion.Iris
|
|
6852
6946
|
}) {
|
|
6853
|
-
const result = value !== null && value !== void 0 ? value :
|
|
6947
|
+
const result = value !== null && value !== void 0 ? value : this._getProtocolDetails(consensusProtocolVersion, tag);
|
|
6854
6948
|
return Buffer.from([result]);
|
|
6855
6949
|
},
|
|
6950
|
+
async prepare(value, {
|
|
6951
|
+
tag
|
|
6952
|
+
},
|
|
6953
|
+
// TODO: { consensusProtocolVersion: ConsensusProtocolVersion } | { onNode: Node } | {}
|
|
6954
|
+
options) {
|
|
6955
|
+
if (value != null) return value;
|
|
6956
|
+
if (options.consensusProtocolVersion != null) return undefined;
|
|
6957
|
+
if (Object.keys(ConsensusProtocolVersion).length === 2) return undefined;
|
|
6958
|
+
if (options.onNode != null) {
|
|
6959
|
+
return this._getProtocolDetails((await options.onNode.getNodeInfo()).consensusProtocolVersion, tag);
|
|
6960
|
+
}
|
|
6961
|
+
return undefined;
|
|
6962
|
+
},
|
|
6856
6963
|
deserialize(buffer) {
|
|
6857
6964
|
return buffer[0];
|
|
6858
6965
|
}
|
|
6859
6966
|
});
|
|
6860
6967
|
;// 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
6968
|
|
|
6878
6969
|
|
|
6879
6970
|
|
|
@@ -7142,13 +7233,12 @@ function isAuctionName(name) {
|
|
|
7142
7233
|
serializeAettos(value) {
|
|
7143
7234
|
return value !== null && value !== void 0 ? value : '0';
|
|
7144
7235
|
},
|
|
7145
|
-
serialize(value, {
|
|
7146
|
-
denomination
|
|
7147
|
-
...options
|
|
7236
|
+
serialize(value, params, {
|
|
7237
|
+
denomination = AE_AMOUNT_FORMATS.AETTOS
|
|
7148
7238
|
}) {
|
|
7149
7239
|
return u_int.serialize(this.serializeAettos(value != null ? formatAmount(value, {
|
|
7150
7240
|
denomination
|
|
7151
|
-
}) : value,
|
|
7241
|
+
}) : value, params));
|
|
7152
7242
|
}
|
|
7153
7243
|
});
|
|
7154
7244
|
;// CONCATENATED MODULE: ./src/tx/builder/field-types/deposit.ts
|
|
@@ -7159,13 +7249,14 @@ function isAuctionName(name) {
|
|
|
7159
7249
|
/**
|
|
7160
7250
|
* @param value - Deposit value in string format. Should be equal to '0'.
|
|
7161
7251
|
* @param options - Options
|
|
7252
|
+
* @param parameters - Parameters
|
|
7162
7253
|
* @returns Deposit value Buffer.
|
|
7163
7254
|
*/
|
|
7164
|
-
serialize(value, options) {
|
|
7255
|
+
serialize(value, options, parameters) {
|
|
7165
7256
|
var _value;
|
|
7166
7257
|
(_value = value) !== null && _value !== void 0 ? _value : value = 0;
|
|
7167
7258
|
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);
|
|
7259
|
+
return coin_amount.serialize(value, options, parameters);
|
|
7169
7260
|
}
|
|
7170
7261
|
});
|
|
7171
7262
|
;// CONCATENATED MODULE: ./src/tx/builder/field-types/encoded.ts
|
|
@@ -7194,6 +7285,9 @@ function genEntryField(tag) {
|
|
|
7194
7285
|
buildTx
|
|
7195
7286
|
}) {
|
|
7196
7287
|
if (ArrayBuffer.isView(txParams)) return Buffer.from(txParams);
|
|
7288
|
+
if (typeof txParams === 'string' && txParams.startsWith('tx_')) {
|
|
7289
|
+
return decode(txParams);
|
|
7290
|
+
}
|
|
7197
7291
|
return decode(buildTx({
|
|
7198
7292
|
...txParams,
|
|
7199
7293
|
...(tag != null && {
|
|
@@ -7331,9 +7425,13 @@ function buildFee(builtTx, unpackTx, buildTx) {
|
|
|
7331
7425
|
length
|
|
7332
7426
|
} = decode(builtTx);
|
|
7333
7427
|
const txObject = unpackTx(builtTx);
|
|
7428
|
+
let innerTxSize = 0;
|
|
7429
|
+
if (txObject.tag === Tag.GaMetaTx || txObject.tag === Tag.PayingForTx) {
|
|
7430
|
+
innerTxSize = decode(buildTx(txObject.tx.encodedTx)).length;
|
|
7431
|
+
}
|
|
7334
7432
|
return TX_FEE_BASE_GAS(txObject.tag).plus(TX_FEE_OTHER_GAS(txObject.tag, length, {
|
|
7335
7433
|
relativeTtl: getOracleRelativeTtl(txObject),
|
|
7336
|
-
innerTxSize
|
|
7434
|
+
innerTxSize
|
|
7337
7435
|
})).times(MIN_GAS_PRICE);
|
|
7338
7436
|
}
|
|
7339
7437
|
|
|
@@ -7397,8 +7495,9 @@ function calculateGasLimitMax(gasMax, rebuildTx, unpackTx, buildTx) {
|
|
|
7397
7495
|
rebuildTx,
|
|
7398
7496
|
unpackTx,
|
|
7399
7497
|
buildTx,
|
|
7400
|
-
gasMax = 6e6,
|
|
7401
7498
|
_computingGasLimit
|
|
7499
|
+
}, {
|
|
7500
|
+
gasMax = 6e6
|
|
7402
7501
|
}) {
|
|
7403
7502
|
if (_computingGasLimit != null) return short_u_int.serialize(_computingGasLimit);
|
|
7404
7503
|
const gasLimitMax = tag === Tag.GaMetaTx ? MAX_AUTH_FUN_GAS : calculateGasLimitMax(gasMax, gasLimit => rebuildTx({
|
|
@@ -7425,6 +7524,44 @@ function calculateGasLimitMax(gasMax, rebuildTx, unpackTx, buildTx) {
|
|
|
7425
7524
|
return value;
|
|
7426
7525
|
}
|
|
7427
7526
|
});
|
|
7527
|
+
;// CONCATENATED MODULE: ./src/tx/builder/field-types/map.ts
|
|
7528
|
+
|
|
7529
|
+
|
|
7530
|
+
function genMapField(encoding, tag) {
|
|
7531
|
+
return {
|
|
7532
|
+
serialize(object, {
|
|
7533
|
+
buildTx
|
|
7534
|
+
}) {
|
|
7535
|
+
return decode(buildTx({
|
|
7536
|
+
tag: Tag.Mtree,
|
|
7537
|
+
values: Object.entries(object).map(([key, value]) => ({
|
|
7538
|
+
tag: Tag.MtreeValue,
|
|
7539
|
+
key: decode(key),
|
|
7540
|
+
value: decode(buildTx({
|
|
7541
|
+
...value,
|
|
7542
|
+
tag
|
|
7543
|
+
}))
|
|
7544
|
+
}))
|
|
7545
|
+
}));
|
|
7546
|
+
},
|
|
7547
|
+
deserialize(buffer, {
|
|
7548
|
+
unpackTx
|
|
7549
|
+
}) {
|
|
7550
|
+
const {
|
|
7551
|
+
values
|
|
7552
|
+
} = unpackTx(encode(buffer, Encoding.Transaction), Tag.Mtree);
|
|
7553
|
+
return Object.fromEntries(values
|
|
7554
|
+
// TODO: remove after resolving https://github.com/aeternity/aeternity/issues/4066
|
|
7555
|
+
.filter(({
|
|
7556
|
+
key
|
|
7557
|
+
}) => encoding !== Encoding.ContractAddress || key.length === 32).map(({
|
|
7558
|
+
key,
|
|
7559
|
+
value
|
|
7560
|
+
}) => [encode(key, encoding), unpackTx(encode(value, Encoding.Transaction), tag)]));
|
|
7561
|
+
},
|
|
7562
|
+
recursiveType: true
|
|
7563
|
+
};
|
|
7564
|
+
}
|
|
7428
7565
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/helpers/classPrivateFieldSet.js
|
|
7429
7566
|
var classPrivateFieldSet = __webpack_require__(719);
|
|
7430
7567
|
var classPrivateFieldSet_default = /*#__PURE__*/__webpack_require__.n(classPrivateFieldSet);
|
|
@@ -7471,6 +7608,11 @@ class MPTree {
|
|
|
7471
7608
|
*/
|
|
7472
7609
|
constructor(binary, encoding, tag, unpTx) {
|
|
7473
7610
|
_classPrivateMethodInitSpec(this, _entriesRaw);
|
|
7611
|
+
/**
|
|
7612
|
+
* Retrieve value from Merkle Patricia Tree
|
|
7613
|
+
* @param _key - The key of the element to retrieve
|
|
7614
|
+
* @returns Value associated to the specified key
|
|
7615
|
+
*/
|
|
7474
7616
|
_classPrivateMethodInitSpec(this, _getRaw);
|
|
7475
7617
|
_classPrivateFieldInitSpec(this, _rootHash, {
|
|
7476
7618
|
writable: true,
|
|
@@ -7545,13 +7687,6 @@ class MPTree {
|
|
|
7545
7687
|
serialize() {
|
|
7546
7688
|
return [Buffer.from(classPrivateFieldGet_default()(this, _rootHash), 'hex'), Object.entries(classPrivateFieldGet_default()(this, _nodes)).map(([mptHash, value]) => [Buffer.from(mptHash, 'hex'), value])];
|
|
7547
7689
|
}
|
|
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
7690
|
/**
|
|
7556
7691
|
* Retrieve value from Merkle Patricia Tree
|
|
7557
7692
|
* @param key - The key of the element to retrieve
|
|
@@ -7718,8 +7853,8 @@ function genMPTreeField(encoding, tag) {
|
|
|
7718
7853
|
* @param txFields - Transaction fields
|
|
7719
7854
|
* @param txFields.name - AENS Name in transaction
|
|
7720
7855
|
*/
|
|
7721
|
-
serialize(value, txFields) {
|
|
7722
|
-
return coin_amount.serialize.call(this, value, txFields);
|
|
7856
|
+
serialize(value, txFields, parameters) {
|
|
7857
|
+
return coin_amount.serialize.call(this, value, txFields, parameters);
|
|
7723
7858
|
}
|
|
7724
7859
|
});
|
|
7725
7860
|
;// CONCATENATED MODULE: ./src/tx/builder/field-types/name-id.ts
|
|
@@ -7736,6 +7871,35 @@ const addressName = genAddressField(Encoding.Name);
|
|
|
7736
7871
|
return addressName.serialize(isNameValid(value) ? produceNameId(value) : value);
|
|
7737
7872
|
}
|
|
7738
7873
|
});
|
|
7874
|
+
;// CONCATENATED MODULE: ./src/tx/builder/field-types/nonce.ts
|
|
7875
|
+
|
|
7876
|
+
|
|
7877
|
+
|
|
7878
|
+
function genNonceField(senderKey) {
|
|
7879
|
+
return {
|
|
7880
|
+
...short_u_int,
|
|
7881
|
+
async prepare(value, params, options) {
|
|
7882
|
+
if (value != null) return value;
|
|
7883
|
+
const {
|
|
7884
|
+
onNode,
|
|
7885
|
+
strategy
|
|
7886
|
+
} = options;
|
|
7887
|
+
const senderId = options[senderKey];
|
|
7888
|
+
const requirement = 'provided (or provide `nonce` instead)';
|
|
7889
|
+
if (onNode == null) throw new ArgumentError('onNode', requirement, onNode);
|
|
7890
|
+
if (senderId == null) throw new ArgumentError('senderId', requirement, senderId);
|
|
7891
|
+
return (await onNode.getAccountNextNonce(senderId.replace(/^ok_/, 'ak_'), {
|
|
7892
|
+
strategy
|
|
7893
|
+
}).catch(error => {
|
|
7894
|
+
if (!isAccountNotFoundError(error)) throw error;
|
|
7895
|
+
return {
|
|
7896
|
+
nextNonce: 1
|
|
7897
|
+
};
|
|
7898
|
+
})).nextNonce;
|
|
7899
|
+
},
|
|
7900
|
+
senderKey
|
|
7901
|
+
};
|
|
7902
|
+
}
|
|
7739
7903
|
;// CONCATENATED MODULE: ./src/tx/builder/field-types/pointers.ts
|
|
7740
7904
|
|
|
7741
7905
|
|
|
@@ -7781,17 +7945,21 @@ const addressAny = genAddressField(...idTagToEncoding);
|
|
|
7781
7945
|
;// CONCATENATED MODULE: ./src/tx/builder/field-types/short-u-int-const.ts
|
|
7782
7946
|
|
|
7783
7947
|
|
|
7784
|
-
function genShortUIntConstField(
|
|
7948
|
+
function genShortUIntConstField(constValue, optional) {
|
|
7785
7949
|
return {
|
|
7786
|
-
serialize(
|
|
7787
|
-
if (
|
|
7788
|
-
|
|
7950
|
+
serialize(value) {
|
|
7951
|
+
if ((optional !== true || value != null) && value !== constValue) {
|
|
7952
|
+
throw new ArgumentError('ShortUIntConst', constValue, value);
|
|
7953
|
+
}
|
|
7954
|
+
return short_u_int.serialize(constValue);
|
|
7789
7955
|
},
|
|
7790
7956
|
deserialize(buf) {
|
|
7791
|
-
const
|
|
7792
|
-
if (
|
|
7793
|
-
return
|
|
7794
|
-
}
|
|
7957
|
+
const value = short_u_int.deserialize(buf);
|
|
7958
|
+
if (value !== constValue) throw new ArgumentError('ShortUIntConst', constValue, value);
|
|
7959
|
+
return constValue;
|
|
7960
|
+
},
|
|
7961
|
+
constValue,
|
|
7962
|
+
constValueOptional: optional === true
|
|
7795
7963
|
};
|
|
7796
7964
|
}
|
|
7797
7965
|
;// CONCATENATED MODULE: ./src/tx/builder/field-types/string.ts
|
|
@@ -7804,6 +7972,47 @@ function genShortUIntConstField(value) {
|
|
|
7804
7972
|
return buffer.toString();
|
|
7805
7973
|
}
|
|
7806
7974
|
});
|
|
7975
|
+
;// CONCATENATED MODULE: ./src/tx/builder/field-types/ttl.ts
|
|
7976
|
+
|
|
7977
|
+
|
|
7978
|
+
/* harmony default export */ const ttl = ({
|
|
7979
|
+
...short_u_int,
|
|
7980
|
+
serialize(value) {
|
|
7981
|
+
return short_u_int.serialize(value !== null && value !== void 0 ? value : 0);
|
|
7982
|
+
},
|
|
7983
|
+
async prepare(value, params,
|
|
7984
|
+
// TODO: { absoluteTtl: true } | { absoluteTtl: false, onNode: Node }
|
|
7985
|
+
{
|
|
7986
|
+
onNode,
|
|
7987
|
+
absoluteTtl
|
|
7988
|
+
}) {
|
|
7989
|
+
if (absoluteTtl !== true && value !== 0 && value != null) {
|
|
7990
|
+
if (onNode == null) throw new ArgumentError('onNode', 'provided', onNode);
|
|
7991
|
+
value += (await onNode.getCurrentKeyBlock()).height;
|
|
7992
|
+
}
|
|
7993
|
+
return value;
|
|
7994
|
+
}
|
|
7995
|
+
});
|
|
7996
|
+
;// CONCATENATED MODULE: ./src/tx/builder/field-types/wrapped.ts
|
|
7997
|
+
|
|
7998
|
+
function genWrappedField(tag) {
|
|
7999
|
+
return {
|
|
8000
|
+
serialize(payload, {
|
|
8001
|
+
buildTx
|
|
8002
|
+
}) {
|
|
8003
|
+
return decode(buildTx({
|
|
8004
|
+
tag,
|
|
8005
|
+
payload
|
|
8006
|
+
}));
|
|
8007
|
+
},
|
|
8008
|
+
deserialize(buffer, {
|
|
8009
|
+
unpackTx
|
|
8010
|
+
}) {
|
|
8011
|
+
return unpackTx(encode(buffer, Encoding.Transaction), tag).payload;
|
|
8012
|
+
},
|
|
8013
|
+
recursiveType: true
|
|
8014
|
+
};
|
|
8015
|
+
}
|
|
7807
8016
|
;// CONCATENATED MODULE: ./src/tx/builder/field-types/index.ts
|
|
7808
8017
|
|
|
7809
8018
|
|
|
@@ -7825,6 +8034,10 @@ function genShortUIntConstField(value) {
|
|
|
7825
8034
|
|
|
7826
8035
|
|
|
7827
8036
|
|
|
8037
|
+
|
|
8038
|
+
|
|
8039
|
+
|
|
8040
|
+
|
|
7828
8041
|
|
|
7829
8042
|
|
|
7830
8043
|
|
|
@@ -7845,16 +8058,20 @@ const field_types_fee = fee;
|
|
|
7845
8058
|
const field_types_field = (/* unused pure expression or super */ null && (_field));
|
|
7846
8059
|
const gasLimit = gas_limit;
|
|
7847
8060
|
const gasPrice = gas_price;
|
|
8061
|
+
const map = genMapField;
|
|
7848
8062
|
const mptree = genMPTreeField;
|
|
7849
8063
|
const builder_field_types_name = field_types_name;
|
|
7850
8064
|
const nameFee = name_fee;
|
|
7851
8065
|
const nameId = name_id;
|
|
8066
|
+
const nonce = genNonceField;
|
|
7852
8067
|
const field_types_pointers = pointers;
|
|
7853
8068
|
const field_types_raw = raw;
|
|
7854
8069
|
const shortUInt = short_u_int;
|
|
7855
8070
|
const shortUIntConst = genShortUIntConstField;
|
|
7856
8071
|
const field_types_string = string;
|
|
8072
|
+
const field_types_ttl = ttl;
|
|
7857
8073
|
const uInt = u_int;
|
|
8074
|
+
const wrapped = genWrappedField;
|
|
7858
8075
|
|
|
7859
8076
|
;// CONCATENATED MODULE: ./src/tx/builder/schema.ts
|
|
7860
8077
|
/**
|
|
@@ -7869,14 +8086,11 @@ const uInt = u_int;
|
|
|
7869
8086
|
|
|
7870
8087
|
let ORACLE_TTL_TYPES;
|
|
7871
8088
|
|
|
7872
|
-
// #
|
|
8089
|
+
// # ORACLE
|
|
7873
8090
|
(function (ORACLE_TTL_TYPES) {
|
|
7874
8091
|
ORACLE_TTL_TYPES[ORACLE_TTL_TYPES["delta"] = 0] = "delta";
|
|
7875
8092
|
ORACLE_TTL_TYPES[ORACLE_TTL_TYPES["block"] = 1] = "block";
|
|
7876
8093
|
})(ORACLE_TTL_TYPES || (ORACLE_TTL_TYPES = {}));
|
|
7877
|
-
const TX_TTL = 0;
|
|
7878
|
-
// # ORACLE
|
|
7879
|
-
const QUERY_FEE = 30000;
|
|
7880
8094
|
const ORACLE_TTL = {
|
|
7881
8095
|
type: ORACLE_TTL_TYPES.delta,
|
|
7882
8096
|
value: 500
|
|
@@ -7895,164 +8109,471 @@ const DRY_RUN_ACCOUNT = {
|
|
|
7895
8109
|
amount: 100000000000000000000000000000000000n
|
|
7896
8110
|
};
|
|
7897
8111
|
let CallReturnType;
|
|
8112
|
+
|
|
8113
|
+
// TODO: figure out how to omit overriding types of recursive fields
|
|
7898
8114
|
(function (CallReturnType) {
|
|
7899
8115
|
CallReturnType[CallReturnType["Ok"] = 0] = "Ok";
|
|
7900
8116
|
CallReturnType[CallReturnType["Error"] = 1] = "Error";
|
|
7901
8117
|
CallReturnType[CallReturnType["Revert"] = 2] = "Revert";
|
|
7902
8118
|
})(CallReturnType || (CallReturnType = {}));
|
|
8119
|
+
const entryAny = entry();
|
|
8120
|
+
const entrySignedTx = entry(Tag.SignedTx);
|
|
8121
|
+
const entryMtreeValueArray = array(entry(Tag.MtreeValue));
|
|
8122
|
+
const entryTreesPoi = entry(Tag.TreesPoi);
|
|
8123
|
+
const mapContracts = map(Encoding.ContractAddress, Tag.Contract);
|
|
8124
|
+
const mapAccounts = map(Encoding.AccountAddress, Tag.Account);
|
|
8125
|
+
const mapCalls = map(Encoding.Bytearray, Tag.ContractCall);
|
|
8126
|
+
const mapChannels = map(Encoding.Channel, Tag.Channel);
|
|
8127
|
+
const mapNames = map(Encoding.Name, Tag.Name);
|
|
8128
|
+
const mapOracles = map(Encoding.OracleAddress, Tag.Oracle);
|
|
8129
|
+
|
|
7903
8130
|
/**
|
|
7904
8131
|
* @see {@link https://github.com/aeternity/protocol/blob/c007deeac4a01e401238412801ac7084ac72d60e/serializations.md#accounts-version-1-basic-accounts}
|
|
7905
8132
|
*/
|
|
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
|
-
|
|
8133
|
+
const txSchema = [{
|
|
8134
|
+
tag: shortUIntConst(Tag.Account),
|
|
8135
|
+
version: shortUIntConst(1),
|
|
8136
|
+
nonce: shortUInt,
|
|
8137
|
+
balance: uInt
|
|
8138
|
+
}, {
|
|
8139
|
+
tag: shortUIntConst(Tag.Account),
|
|
8140
|
+
version: shortUIntConst(2, true),
|
|
8141
|
+
flags: uInt,
|
|
8142
|
+
nonce: shortUInt,
|
|
8143
|
+
balance: uInt,
|
|
8144
|
+
gaContract: address(Encoding.ContractAddress, Encoding.Name),
|
|
8145
|
+
gaAuthFun: encoded(Encoding.ContractBytearray)
|
|
8146
|
+
}, {
|
|
8147
|
+
tag: shortUIntConst(Tag.SignedTx),
|
|
8148
|
+
version: shortUIntConst(1, true),
|
|
8149
|
+
signatures: array(field_types_raw),
|
|
8150
|
+
encodedTx: entryAny
|
|
8151
|
+
}, {
|
|
8152
|
+
tag: shortUIntConst(Tag.SpendTx),
|
|
8153
|
+
version: shortUIntConst(1, true),
|
|
8154
|
+
senderId: address(Encoding.AccountAddress),
|
|
8155
|
+
recipientId: address(Encoding.AccountAddress, Encoding.Name),
|
|
8156
|
+
amount: coinAmount,
|
|
8157
|
+
fee: field_types_fee,
|
|
8158
|
+
ttl: field_types_ttl,
|
|
8159
|
+
nonce: nonce('senderId'),
|
|
8160
|
+
payload: encoded(Encoding.Bytearray, true)
|
|
8161
|
+
}, {
|
|
8162
|
+
tag: shortUIntConst(Tag.Name),
|
|
8163
|
+
version: shortUIntConst(1, true),
|
|
8164
|
+
accountId: address(Encoding.AccountAddress),
|
|
8165
|
+
nameTtl: shortUInt,
|
|
8166
|
+
status: field_types_raw,
|
|
8167
|
+
clientTtl: shortUInt,
|
|
8168
|
+
pointers: field_types_pointers
|
|
8169
|
+
}, {
|
|
8170
|
+
tag: shortUIntConst(Tag.NamePreclaimTx),
|
|
8171
|
+
version: shortUIntConst(1, true),
|
|
8172
|
+
accountId: address(Encoding.AccountAddress),
|
|
8173
|
+
nonce: nonce('accountId'),
|
|
8174
|
+
commitmentId: address(Encoding.Commitment),
|
|
8175
|
+
fee: field_types_fee,
|
|
8176
|
+
ttl: field_types_ttl
|
|
8177
|
+
}, {
|
|
8178
|
+
tag: shortUIntConst(Tag.NameClaimTx),
|
|
8179
|
+
version: shortUIntConst(2, true),
|
|
8180
|
+
accountId: address(Encoding.AccountAddress),
|
|
8181
|
+
nonce: nonce('accountId'),
|
|
8182
|
+
name: builder_field_types_name,
|
|
8183
|
+
nameSalt: uInt,
|
|
8184
|
+
nameFee: nameFee,
|
|
8185
|
+
fee: field_types_fee,
|
|
8186
|
+
ttl: field_types_ttl
|
|
8187
|
+
}, {
|
|
8188
|
+
tag: shortUIntConst(Tag.NameUpdateTx),
|
|
8189
|
+
version: shortUIntConst(1, true),
|
|
8190
|
+
accountId: address(Encoding.AccountAddress),
|
|
8191
|
+
nonce: nonce('accountId'),
|
|
8192
|
+
nameId: nameId,
|
|
8193
|
+
nameTtl: shortUInt,
|
|
8194
|
+
pointers: field_types_pointers,
|
|
8195
|
+
clientTtl: shortUInt,
|
|
8196
|
+
fee: field_types_fee,
|
|
8197
|
+
ttl: field_types_ttl
|
|
8198
|
+
}, {
|
|
8199
|
+
tag: shortUIntConst(Tag.NameTransferTx),
|
|
8200
|
+
version: shortUIntConst(1, true),
|
|
8201
|
+
accountId: address(Encoding.AccountAddress),
|
|
8202
|
+
nonce: nonce('accountId'),
|
|
8203
|
+
nameId: nameId,
|
|
8204
|
+
recipientId: address(Encoding.AccountAddress, Encoding.Name),
|
|
8205
|
+
fee: field_types_fee,
|
|
8206
|
+
ttl: field_types_ttl
|
|
8207
|
+
}, {
|
|
8208
|
+
tag: shortUIntConst(Tag.NameRevokeTx),
|
|
8209
|
+
version: shortUIntConst(1, true),
|
|
8210
|
+
accountId: address(Encoding.AccountAddress),
|
|
8211
|
+
nonce: nonce('accountId'),
|
|
8212
|
+
nameId: nameId,
|
|
8213
|
+
fee: field_types_fee,
|
|
8214
|
+
ttl: field_types_ttl
|
|
8215
|
+
}, {
|
|
8216
|
+
tag: shortUIntConst(Tag.Contract),
|
|
8217
|
+
version: shortUIntConst(1, true),
|
|
8218
|
+
owner: address(Encoding.AccountAddress),
|
|
8219
|
+
ctVersion: ctVersion,
|
|
8220
|
+
code: encoded(Encoding.ContractBytearray),
|
|
8221
|
+
log: encoded(Encoding.ContractBytearray),
|
|
8222
|
+
active: builder_field_types_boolean,
|
|
8223
|
+
referers: array(address(Encoding.AccountAddress)),
|
|
8224
|
+
deposit: field_types_deposit
|
|
8225
|
+
}, {
|
|
8226
|
+
tag: shortUIntConst(Tag.ContractCreateTx),
|
|
8227
|
+
version: shortUIntConst(1, true),
|
|
8228
|
+
ownerId: address(Encoding.AccountAddress),
|
|
8229
|
+
nonce: nonce('ownerId'),
|
|
8230
|
+
code: encoded(Encoding.ContractBytearray),
|
|
8231
|
+
ctVersion: ctVersion,
|
|
8232
|
+
fee: field_types_fee,
|
|
8233
|
+
ttl: field_types_ttl,
|
|
8234
|
+
deposit: field_types_deposit,
|
|
8235
|
+
amount: coinAmount,
|
|
8236
|
+
gasLimit: gasLimit,
|
|
8237
|
+
gasPrice: gasPrice,
|
|
8238
|
+
callData: encoded(Encoding.ContractBytearray)
|
|
8239
|
+
}, {
|
|
8240
|
+
tag: shortUIntConst(Tag.ContractCallTx),
|
|
8241
|
+
version: shortUIntConst(1, true),
|
|
8242
|
+
callerId: address(Encoding.AccountAddress),
|
|
8243
|
+
nonce: nonce('callerId'),
|
|
8244
|
+
contractId: address(Encoding.ContractAddress, Encoding.Name),
|
|
8245
|
+
abiVersion: abiVersion,
|
|
8246
|
+
fee: field_types_fee,
|
|
8247
|
+
ttl: field_types_ttl,
|
|
8248
|
+
amount: coinAmount,
|
|
8249
|
+
gasLimit: gasLimit,
|
|
8250
|
+
gasPrice: gasPrice,
|
|
8251
|
+
callData: encoded(Encoding.ContractBytearray)
|
|
8252
|
+
}, {
|
|
8253
|
+
tag: shortUIntConst(Tag.ContractCall),
|
|
8254
|
+
version: shortUIntConst(2, true),
|
|
8255
|
+
callerId: address(Encoding.AccountAddress),
|
|
8256
|
+
callerNonce: shortUInt,
|
|
8257
|
+
height: shortUInt,
|
|
8258
|
+
contractId: address(Encoding.ContractAddress),
|
|
8259
|
+
// TODO: rename after resolving https://github.com/aeternity/protocol/issues/506
|
|
8260
|
+
gasPrice: uInt,
|
|
8261
|
+
gasUsed: shortUInt,
|
|
8262
|
+
returnValue: encoded(Encoding.ContractBytearray),
|
|
8263
|
+
returnType: enumeration(CallReturnType),
|
|
8264
|
+
// TODO: add serialization for
|
|
8265
|
+
// <log> :: [ { <address> :: id, [ <topics> :: binary() }, <data> :: binary() } ]
|
|
8266
|
+
log: array(field_types_raw)
|
|
8267
|
+
}, {
|
|
8268
|
+
tag: shortUIntConst(Tag.Oracle),
|
|
8269
|
+
version: shortUIntConst(1, true),
|
|
8270
|
+
accountId: address(Encoding.AccountAddress),
|
|
8271
|
+
queryFormat: field_types_string,
|
|
8272
|
+
responseFormat: field_types_string,
|
|
8273
|
+
queryFee: coinAmount,
|
|
8274
|
+
oracleTtlValue: shortUInt,
|
|
8275
|
+
abiVersion: abiVersion
|
|
8276
|
+
}, {
|
|
8277
|
+
tag: shortUIntConst(Tag.OracleRegisterTx),
|
|
8278
|
+
version: shortUIntConst(1, true),
|
|
8279
|
+
accountId: address(Encoding.AccountAddress),
|
|
8280
|
+
nonce: nonce('accountId'),
|
|
8281
|
+
queryFormat: field_types_string,
|
|
8282
|
+
responseFormat: field_types_string,
|
|
8283
|
+
queryFee: coinAmount,
|
|
8284
|
+
oracleTtlType: enumeration(ORACLE_TTL_TYPES),
|
|
8285
|
+
oracleTtlValue: shortUInt,
|
|
8286
|
+
fee: field_types_fee,
|
|
8287
|
+
ttl: field_types_ttl,
|
|
8288
|
+
abiVersion: abiVersion
|
|
8289
|
+
}, {
|
|
8290
|
+
tag: shortUIntConst(Tag.OracleExtendTx),
|
|
8291
|
+
version: shortUIntConst(1, true),
|
|
8292
|
+
oracleId: address(Encoding.OracleAddress, Encoding.Name),
|
|
8293
|
+
nonce: nonce('oracleId'),
|
|
8294
|
+
oracleTtlType: enumeration(ORACLE_TTL_TYPES),
|
|
8295
|
+
oracleTtlValue: shortUInt,
|
|
8296
|
+
fee: field_types_fee,
|
|
8297
|
+
ttl: field_types_ttl
|
|
8298
|
+
}, {
|
|
8299
|
+
tag: shortUIntConst(Tag.OracleQueryTx),
|
|
8300
|
+
version: shortUIntConst(1, true),
|
|
8301
|
+
senderId: address(Encoding.AccountAddress),
|
|
8302
|
+
nonce: nonce('senderId'),
|
|
8303
|
+
oracleId: address(Encoding.OracleAddress, Encoding.Name),
|
|
8304
|
+
query: field_types_string,
|
|
8305
|
+
queryFee: coinAmount,
|
|
8306
|
+
queryTtlType: enumeration(ORACLE_TTL_TYPES),
|
|
8307
|
+
queryTtlValue: shortUInt,
|
|
8308
|
+
responseTtlType: enumeration(ORACLE_TTL_TYPES),
|
|
8309
|
+
responseTtlValue: shortUInt,
|
|
8310
|
+
fee: field_types_fee,
|
|
8311
|
+
ttl: field_types_ttl
|
|
8312
|
+
}, {
|
|
8313
|
+
tag: shortUIntConst(Tag.OracleResponseTx),
|
|
8314
|
+
version: shortUIntConst(1, true),
|
|
8315
|
+
oracleId: address(Encoding.OracleAddress),
|
|
8316
|
+
nonce: nonce('oracleId'),
|
|
8317
|
+
queryId: encoded(Encoding.OracleQueryId),
|
|
8318
|
+
response: field_types_string,
|
|
8319
|
+
responseTtlType: enumeration(ORACLE_TTL_TYPES),
|
|
8320
|
+
responseTtlValue: shortUInt,
|
|
8321
|
+
fee: field_types_fee,
|
|
8322
|
+
ttl: field_types_ttl
|
|
8323
|
+
}, {
|
|
8324
|
+
tag: shortUIntConst(Tag.ChannelCreateTx),
|
|
8325
|
+
version: shortUIntConst(2, true),
|
|
8326
|
+
initiator: address(Encoding.AccountAddress),
|
|
8327
|
+
initiatorAmount: uInt,
|
|
8328
|
+
responder: address(Encoding.AccountAddress),
|
|
8329
|
+
responderAmount: uInt,
|
|
8330
|
+
channelReserve: uInt,
|
|
8331
|
+
lockPeriod: uInt,
|
|
8332
|
+
ttl: field_types_ttl,
|
|
8333
|
+
fee: field_types_fee,
|
|
8334
|
+
initiatorDelegateIds: array(address(...idTagToEncoding)),
|
|
8335
|
+
responderDelegateIds: array(address(...idTagToEncoding)),
|
|
8336
|
+
stateHash: encoded(Encoding.State),
|
|
8337
|
+
nonce: nonce('initiator')
|
|
8338
|
+
}, {
|
|
8339
|
+
tag: shortUIntConst(Tag.ChannelCloseMutualTx),
|
|
8340
|
+
version: shortUIntConst(1, true),
|
|
8341
|
+
channelId: address(Encoding.Channel),
|
|
8342
|
+
fromId: address(Encoding.AccountAddress),
|
|
8343
|
+
initiatorAmountFinal: uInt,
|
|
8344
|
+
responderAmountFinal: uInt,
|
|
8345
|
+
ttl: field_types_ttl,
|
|
8346
|
+
fee: field_types_fee,
|
|
8347
|
+
nonce: nonce('fromId')
|
|
8348
|
+
}, {
|
|
8349
|
+
tag: shortUIntConst(Tag.ChannelCloseSoloTx),
|
|
8350
|
+
version: shortUIntConst(1, true),
|
|
8351
|
+
channelId: address(Encoding.Channel),
|
|
8352
|
+
fromId: address(Encoding.AccountAddress),
|
|
8353
|
+
payload: encoded(Encoding.Transaction),
|
|
8354
|
+
poi: entryTreesPoi,
|
|
8355
|
+
ttl: field_types_ttl,
|
|
8356
|
+
fee: field_types_fee,
|
|
8357
|
+
nonce: nonce('fromId')
|
|
8358
|
+
}, {
|
|
8359
|
+
tag: shortUIntConst(Tag.ChannelSlashTx),
|
|
8360
|
+
version: shortUIntConst(1, true),
|
|
8361
|
+
channelId: address(Encoding.Channel),
|
|
8362
|
+
fromId: address(Encoding.AccountAddress),
|
|
8363
|
+
payload: encoded(Encoding.Transaction),
|
|
8364
|
+
poi: entryTreesPoi,
|
|
8365
|
+
ttl: field_types_ttl,
|
|
8366
|
+
fee: field_types_fee,
|
|
8367
|
+
nonce: nonce('fromId')
|
|
8368
|
+
}, {
|
|
8369
|
+
tag: shortUIntConst(Tag.ChannelDepositTx),
|
|
8370
|
+
version: shortUIntConst(1, true),
|
|
8371
|
+
channelId: address(Encoding.Channel),
|
|
8372
|
+
fromId: address(Encoding.AccountAddress),
|
|
8373
|
+
amount: uInt,
|
|
8374
|
+
ttl: field_types_ttl,
|
|
8375
|
+
fee: field_types_fee,
|
|
8376
|
+
stateHash: encoded(Encoding.State),
|
|
8377
|
+
round: shortUInt,
|
|
8378
|
+
nonce: nonce('fromId')
|
|
8379
|
+
}, {
|
|
8380
|
+
tag: shortUIntConst(Tag.ChannelWithdrawTx),
|
|
8381
|
+
version: shortUIntConst(1, true),
|
|
8382
|
+
channelId: address(Encoding.Channel),
|
|
8383
|
+
toId: address(Encoding.AccountAddress),
|
|
8384
|
+
amount: uInt,
|
|
8385
|
+
ttl: field_types_ttl,
|
|
8386
|
+
fee: field_types_fee,
|
|
8387
|
+
stateHash: encoded(Encoding.State),
|
|
8388
|
+
round: shortUInt,
|
|
8389
|
+
nonce: nonce('fromId')
|
|
8390
|
+
}, {
|
|
8391
|
+
tag: shortUIntConst(Tag.ChannelSettleTx),
|
|
8392
|
+
version: shortUIntConst(1, true),
|
|
8393
|
+
channelId: address(Encoding.Channel),
|
|
8394
|
+
fromId: address(Encoding.AccountAddress),
|
|
8395
|
+
initiatorAmountFinal: uInt,
|
|
8396
|
+
responderAmountFinal: uInt,
|
|
8397
|
+
ttl: field_types_ttl,
|
|
8398
|
+
fee: field_types_fee,
|
|
8399
|
+
nonce: nonce('fromId')
|
|
8400
|
+
}, {
|
|
8401
|
+
tag: shortUIntConst(Tag.ChannelForceProgressTx),
|
|
8402
|
+
version: shortUIntConst(1, true),
|
|
8403
|
+
channelId: address(Encoding.Channel),
|
|
8404
|
+
fromId: address(Encoding.AccountAddress),
|
|
8405
|
+
payload: encoded(Encoding.Transaction),
|
|
8406
|
+
round: shortUInt,
|
|
8407
|
+
update: encoded(Encoding.ContractBytearray),
|
|
8408
|
+
stateHash: encoded(Encoding.State),
|
|
8409
|
+
offChainTrees: encoded(Encoding.StateTrees),
|
|
8410
|
+
ttl: field_types_ttl,
|
|
8411
|
+
fee: field_types_fee,
|
|
8412
|
+
nonce: nonce('fromId')
|
|
8413
|
+
}, {
|
|
8414
|
+
tag: shortUIntConst(Tag.ChannelOffChainTx),
|
|
8415
|
+
version: shortUIntConst(2, true),
|
|
8416
|
+
channelId: address(Encoding.Channel),
|
|
8417
|
+
round: shortUInt,
|
|
8418
|
+
stateHash: encoded(Encoding.State)
|
|
8419
|
+
}, {
|
|
8420
|
+
tag: shortUIntConst(Tag.Channel),
|
|
8421
|
+
version: shortUIntConst(3, true),
|
|
8422
|
+
initiator: address(Encoding.AccountAddress),
|
|
8423
|
+
responder: address(Encoding.AccountAddress),
|
|
8424
|
+
channelAmount: uInt,
|
|
8425
|
+
initiatorAmount: uInt,
|
|
8426
|
+
responderAmount: uInt,
|
|
8427
|
+
channelReserve: uInt,
|
|
8428
|
+
initiatorDelegateIds: array(address(...idTagToEncoding)),
|
|
8429
|
+
responderDelegateIds: array(address(...idTagToEncoding)),
|
|
8430
|
+
stateHash: encoded(Encoding.State),
|
|
8431
|
+
round: shortUInt,
|
|
8432
|
+
soloRound: uInt,
|
|
8433
|
+
lockPeriod: uInt,
|
|
8434
|
+
lockedUntil: uInt,
|
|
8435
|
+
initiatorAuth: encoded(Encoding.ContractBytearray),
|
|
8436
|
+
responderAuth: encoded(Encoding.ContractBytearray)
|
|
8437
|
+
}, {
|
|
8438
|
+
tag: shortUIntConst(Tag.ChannelSnapshotSoloTx),
|
|
8439
|
+
version: shortUIntConst(1, true),
|
|
8440
|
+
channelId: address(Encoding.Channel),
|
|
8441
|
+
fromId: address(Encoding.AccountAddress),
|
|
8442
|
+
payload: encoded(Encoding.Transaction),
|
|
8443
|
+
ttl: field_types_ttl,
|
|
8444
|
+
fee: field_types_fee,
|
|
8445
|
+
nonce: nonce('fromId')
|
|
8446
|
+
}, {
|
|
8447
|
+
tag: shortUIntConst(Tag.ChannelOffChainUpdateTransfer),
|
|
8448
|
+
version: shortUIntConst(1, true),
|
|
8449
|
+
from: address(Encoding.AccountAddress),
|
|
8450
|
+
to: address(Encoding.AccountAddress),
|
|
8451
|
+
amount: uInt
|
|
8452
|
+
}, {
|
|
8453
|
+
tag: shortUIntConst(Tag.ChannelOffChainUpdateDeposit),
|
|
8454
|
+
version: shortUIntConst(1, true),
|
|
8455
|
+
from: address(Encoding.AccountAddress),
|
|
8456
|
+
amount: uInt
|
|
8457
|
+
}, {
|
|
8458
|
+
tag: shortUIntConst(Tag.ChannelOffChainUpdateWithdraw),
|
|
8459
|
+
version: shortUIntConst(1, true),
|
|
8460
|
+
from: address(Encoding.AccountAddress),
|
|
8461
|
+
amount: uInt
|
|
8462
|
+
}, {
|
|
8463
|
+
tag: shortUIntConst(Tag.ChannelOffChainUpdateCreateContract),
|
|
8464
|
+
version: shortUIntConst(1, true),
|
|
8465
|
+
owner: address(Encoding.AccountAddress),
|
|
8466
|
+
ctVersion: ctVersion,
|
|
8467
|
+
code: encoded(Encoding.ContractBytearray),
|
|
8468
|
+
deposit: uInt,
|
|
8469
|
+
callData: encoded(Encoding.ContractBytearray)
|
|
8470
|
+
}, {
|
|
8471
|
+
tag: shortUIntConst(Tag.ChannelOffChainUpdateCallContract),
|
|
8472
|
+
version: shortUIntConst(1, true),
|
|
8473
|
+
caller: address(Encoding.AccountAddress),
|
|
8474
|
+
contract: address(Encoding.ContractAddress),
|
|
8475
|
+
abiVersion: abiVersion,
|
|
8476
|
+
amount: uInt,
|
|
8477
|
+
callData: encoded(Encoding.ContractBytearray),
|
|
8478
|
+
callStack: field_types_raw,
|
|
8479
|
+
gasPrice: gasPrice,
|
|
8480
|
+
gasLimit: gasLimit
|
|
8481
|
+
}, {
|
|
8482
|
+
tag: shortUIntConst(Tag.ChannelClientReconnectTx),
|
|
8483
|
+
version: shortUIntConst(1, true),
|
|
8484
|
+
channelId: address(Encoding.Channel),
|
|
8485
|
+
round: shortUInt,
|
|
8486
|
+
role: field_types_string,
|
|
8487
|
+
pubkey: address(Encoding.AccountAddress)
|
|
8488
|
+
}, {
|
|
8489
|
+
tag: shortUIntConst(Tag.TreesPoi),
|
|
8490
|
+
version: shortUIntConst(1, true),
|
|
8491
|
+
// TODO: inline an extra wrapping array after resolving https://github.com/aeternity/protocol/issues/505
|
|
8492
|
+
accounts: array(mptree(Encoding.AccountAddress, Tag.Account)),
|
|
8493
|
+
calls: array(mptree(Encoding.Bytearray, Tag.ContractCall)),
|
|
8494
|
+
channels: array(mptree(Encoding.Channel, Tag.Channel)),
|
|
8495
|
+
contracts: array(mptree(Encoding.ContractAddress, Tag.Contract)),
|
|
8496
|
+
ns: array(mptree(Encoding.Name, Tag.Name)),
|
|
8497
|
+
oracles: array(mptree(Encoding.OracleAddress, Tag.Oracle))
|
|
8498
|
+
}, {
|
|
8499
|
+
tag: shortUIntConst(Tag.StateTrees),
|
|
8500
|
+
version: shortUIntConst(0, true),
|
|
8501
|
+
contracts: wrapped(Tag.ContractsMtree),
|
|
8502
|
+
calls: wrapped(Tag.CallsMtree),
|
|
8503
|
+
channels: wrapped(Tag.ChannelsMtree),
|
|
8504
|
+
ns: wrapped(Tag.NameserviceMtree),
|
|
8505
|
+
oracles: wrapped(Tag.OraclesMtree),
|
|
8506
|
+
accounts: wrapped(Tag.AccountsMtree)
|
|
8507
|
+
}, {
|
|
8508
|
+
tag: shortUIntConst(Tag.Mtree),
|
|
8509
|
+
version: shortUIntConst(1, true),
|
|
8510
|
+
values: entryMtreeValueArray
|
|
8511
|
+
}, {
|
|
8512
|
+
tag: shortUIntConst(Tag.MtreeValue),
|
|
8513
|
+
version: shortUIntConst(1, true),
|
|
8514
|
+
key: field_types_raw,
|
|
8515
|
+
value: field_types_raw
|
|
8516
|
+
}, {
|
|
8517
|
+
tag: shortUIntConst(Tag.ContractsMtree),
|
|
8518
|
+
version: shortUIntConst(1, true),
|
|
8519
|
+
payload: mapContracts
|
|
8520
|
+
}, {
|
|
8521
|
+
tag: shortUIntConst(Tag.CallsMtree),
|
|
8522
|
+
version: shortUIntConst(1, true),
|
|
8523
|
+
payload: mapCalls
|
|
8524
|
+
}, {
|
|
8525
|
+
tag: shortUIntConst(Tag.ChannelsMtree),
|
|
8526
|
+
version: shortUIntConst(1, true),
|
|
8527
|
+
payload: mapChannels
|
|
8528
|
+
}, {
|
|
8529
|
+
tag: shortUIntConst(Tag.NameserviceMtree),
|
|
8530
|
+
version: shortUIntConst(1, true),
|
|
8531
|
+
payload: mapNames
|
|
8532
|
+
}, {
|
|
8533
|
+
tag: shortUIntConst(Tag.OraclesMtree),
|
|
8534
|
+
version: shortUIntConst(1, true),
|
|
8535
|
+
payload: mapOracles
|
|
8536
|
+
}, {
|
|
8537
|
+
tag: shortUIntConst(Tag.AccountsMtree),
|
|
8538
|
+
version: shortUIntConst(1, true),
|
|
8539
|
+
payload: mapAccounts
|
|
8540
|
+
}, {
|
|
8541
|
+
tag: shortUIntConst(Tag.GaAttachTx),
|
|
8542
|
+
version: shortUIntConst(1, true),
|
|
8543
|
+
ownerId: address(Encoding.AccountAddress),
|
|
8544
|
+
nonce: nonce('ownerId'),
|
|
8545
|
+
code: encoded(Encoding.ContractBytearray),
|
|
8546
|
+
authFun: field_types_raw,
|
|
8547
|
+
ctVersion: ctVersion,
|
|
8548
|
+
fee: field_types_fee,
|
|
8549
|
+
ttl: field_types_ttl,
|
|
8550
|
+
gasLimit: gasLimit,
|
|
8551
|
+
gasPrice: gasPrice,
|
|
8552
|
+
callData: encoded(Encoding.ContractBytearray)
|
|
8553
|
+
}, {
|
|
8554
|
+
tag: shortUIntConst(Tag.GaMetaTx),
|
|
8555
|
+
version: shortUIntConst(2, true),
|
|
8556
|
+
gaId: address(Encoding.AccountAddress),
|
|
8557
|
+
authData: encoded(Encoding.ContractBytearray),
|
|
8558
|
+
abiVersion: abiVersion,
|
|
8559
|
+
fee: field_types_fee,
|
|
8560
|
+
gasLimit: gasLimit,
|
|
8561
|
+
gasPrice: gasPrice,
|
|
8562
|
+
tx: entrySignedTx
|
|
8563
|
+
}, {
|
|
8564
|
+
tag: shortUIntConst(Tag.PayingForTx),
|
|
8565
|
+
version: shortUIntConst(1, true),
|
|
8566
|
+
payerId: address(Encoding.AccountAddress),
|
|
8567
|
+
nonce: nonce('payerId'),
|
|
8568
|
+
fee: field_types_fee,
|
|
8569
|
+
tx: entrySignedTx
|
|
8570
|
+
}, {
|
|
8571
|
+
tag: shortUIntConst(Tag.GaMetaTxAuthData),
|
|
8572
|
+
version: shortUIntConst(1, true),
|
|
8573
|
+
fee: coinAmount,
|
|
8574
|
+
gasPrice: gasPrice,
|
|
8575
|
+
txHash: encoded(Encoding.TxHash)
|
|
8576
|
+
}];
|
|
8056
8577
|
;// CONCATENATED MODULE: ./src/tx/builder/index.ts
|
|
8057
8578
|
|
|
8058
8579
|
|
|
@@ -8062,33 +8583,18 @@ const TX_SCHEMA = {
|
|
|
8062
8583
|
|
|
8063
8584
|
|
|
8064
8585
|
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
8586
|
/**
|
|
8068
8587
|
* JavaScript-based Transaction builder
|
|
8069
8588
|
*/
|
|
8070
8589
|
|
|
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
|
-
}, {});
|
|
8590
|
+
function getSchema(tag, version) {
|
|
8591
|
+
var _version;
|
|
8592
|
+
const schemas = txSchema.filter(s => s.tag.constValue === tag);
|
|
8593
|
+
if (schemas.length === 0) throw new SchemaNotFoundError(`${Tag[tag]} (${tag})`, 0);
|
|
8594
|
+
(_version = version) !== null && _version !== void 0 ? _version : version = Math.max(...schemas.map(schema => schema.version.constValue));
|
|
8595
|
+
const schema = schemas.find(s => s.version.constValue === version);
|
|
8596
|
+
if (schema == null) throw new SchemaNotFoundError(`${Tag[tag]} (${tag})`, version);
|
|
8597
|
+
return Object.entries(schema);
|
|
8092
8598
|
}
|
|
8093
8599
|
|
|
8094
8600
|
/**
|
|
@@ -8096,61 +8602,69 @@ function unpackRawTx(binary, schema) {
|
|
|
8096
8602
|
* @category transaction builder
|
|
8097
8603
|
* @param params - Object with tx params
|
|
8098
8604
|
* @param options - options
|
|
8099
|
-
* @param options.denomination - Denomination of amounts
|
|
8100
8605
|
* @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
|
|
8606
|
+
* @returns object Base64Check transaction hash with 'tx_' prefix
|
|
8106
8607
|
*/
|
|
8107
8608
|
function buildTx(params, {
|
|
8108
|
-
prefix
|
|
8109
|
-
denomination = AE_AMOUNT_FORMATS.AETTOS
|
|
8609
|
+
prefix
|
|
8110
8610
|
} = {}) {
|
|
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], {
|
|
8611
|
+
const schema = getSchema(params.tag, params.version);
|
|
8612
|
+
const binary = schema.map(([key, field]) => field.serialize(
|
|
8613
|
+
// @ts-expect-error the type of `params[key]` can't be determined accurately
|
|
8614
|
+
params[key], {
|
|
8119
8615
|
...params,
|
|
8120
8616
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
8121
8617
|
unpackTx,
|
|
8122
8618
|
buildTx,
|
|
8123
|
-
denomination,
|
|
8124
8619
|
rebuildTx: overrideParams => buildTx({
|
|
8125
8620
|
...params,
|
|
8126
8621
|
...overrideParams
|
|
8127
|
-
}, {
|
|
8128
|
-
denomination
|
|
8129
8622
|
})
|
|
8130
|
-
}));
|
|
8623
|
+
}, params));
|
|
8131
8624
|
|
|
8132
8625
|
// @ts-expect-error looks like a TypeScript edge case
|
|
8133
8626
|
return encode((0,external_rlp_.encode)(binary), prefix !== null && prefix !== void 0 ? prefix : Encoding.Transaction);
|
|
8134
8627
|
}
|
|
8628
|
+
/**
|
|
8629
|
+
* @category transaction builder
|
|
8630
|
+
*/
|
|
8631
|
+
async function buildTxAsync(params) {
|
|
8632
|
+
await Promise.all(getSchema(params.tag, params.version).map(async ([key, field]) => {
|
|
8633
|
+
if (field.prepare == null) return;
|
|
8634
|
+
// @ts-expect-error the type of `params[key]` can't be determined accurately
|
|
8635
|
+
params[key] = await field.prepare(params[key], params, params);
|
|
8636
|
+
}));
|
|
8637
|
+
|
|
8638
|
+
// @ts-expect-error after preparation properties should be compatible with sync tx builder
|
|
8639
|
+
return buildTx(params);
|
|
8640
|
+
}
|
|
8135
8641
|
|
|
8136
8642
|
/**
|
|
8137
|
-
* Unpack transaction
|
|
8643
|
+
* Unpack transaction encoded as string
|
|
8138
8644
|
* @category transaction builder
|
|
8139
8645
|
* @param encodedTx - Transaction to unpack
|
|
8140
8646
|
* @param txType - Expected transaction type
|
|
8141
|
-
* @returns
|
|
8142
|
-
* @returns object.tx Object with transaction param's
|
|
8143
|
-
* @returns object.txType Transaction type
|
|
8647
|
+
* @returns Object with transaction param's
|
|
8144
8648
|
*/
|
|
8145
8649
|
function unpackTx(encodedTx, txType) {
|
|
8146
8650
|
const binary = (0,external_rlp_.decode)(decode(encodedTx));
|
|
8147
8651
|
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
8652
|
const version = +readInt(binary[1]);
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8653
|
+
const schema = getSchema(tag, version);
|
|
8654
|
+
if (txType != null && txType !== tag) throw new DecodeError(`Expected transaction to have ${Tag[txType]} tag, got ${Tag[tag]} instead`);
|
|
8655
|
+
if (binary.length !== schema.length) {
|
|
8656
|
+
throw new ArgumentError('Transaction RLP length', schema.length, binary.length);
|
|
8657
|
+
}
|
|
8658
|
+
return schema.reduce((acc, [name, field], index) => {
|
|
8659
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
8660
|
+
const deserialized = field.deserialize(binary[index], {
|
|
8661
|
+
unpackTx
|
|
8662
|
+
});
|
|
8663
|
+
return {
|
|
8664
|
+
...acc,
|
|
8665
|
+
[name]: deserialized
|
|
8666
|
+
};
|
|
8667
|
+
}, {});
|
|
8154
8668
|
}
|
|
8155
8669
|
|
|
8156
8670
|
/**
|
|
@@ -8171,15 +8685,11 @@ function buildTxHash(rawTx) {
|
|
|
8171
8685
|
* @returns Contract public key
|
|
8172
8686
|
*/
|
|
8173
8687
|
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);
|
|
8688
|
+
const params = unpackTx(contractTx);
|
|
8689
|
+
if (Tag.ContractCreateTx !== params.tag && Tag.GaAttachTx !== params.tag) {
|
|
8690
|
+
throw new ArgumentError('contractTx', 'a contractCreateTx or gaAttach', params.tag);
|
|
8181
8691
|
}
|
|
8182
|
-
return buildContractId(ownerId,
|
|
8692
|
+
return buildContractId(params.ownerId, params.nonce);
|
|
8183
8693
|
}
|
|
8184
8694
|
;// CONCATENATED MODULE: ./src/utils/semver-satisfies.ts
|
|
8185
8695
|
function semverSatisfies(version, geVersion, ltVersion) {
|
|
@@ -8244,15 +8754,18 @@ const genCombineGetRequestsPolicy = () => {
|
|
|
8244
8754
|
const genAggressiveCacheGetResponsesPolicy = () => {
|
|
8245
8755
|
const getRequests = new Map();
|
|
8246
8756
|
return {
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8757
|
+
policy: {
|
|
8758
|
+
name: 'aggressive-cache-get-responses',
|
|
8759
|
+
async sendRequest(request, next) {
|
|
8760
|
+
var _getRequests$get;
|
|
8761
|
+
if (request.method !== 'GET') return next(request);
|
|
8762
|
+
const key = JSON.stringify([request.url, request.body]);
|
|
8763
|
+
const response = (_getRequests$get = getRequests.get(key)) !== null && _getRequests$get !== void 0 ? _getRequests$get : next(request);
|
|
8764
|
+
getRequests.set(key, response);
|
|
8765
|
+
return response;
|
|
8766
|
+
}
|
|
8767
|
+
},
|
|
8768
|
+
position: 'perCall'
|
|
8256
8769
|
};
|
|
8257
8770
|
};
|
|
8258
8771
|
const genErrorFormatterPolicy = getMessage => ({
|
|
@@ -8284,11 +8797,40 @@ const genVersionCheckPolicy = (name, ignorePath, versionPromise, geVersion, ltVe
|
|
|
8284
8797
|
name: 'version-check',
|
|
8285
8798
|
async sendRequest(request, next) {
|
|
8286
8799
|
if (new URL(request.url).pathname === ignorePath) return next(request);
|
|
8287
|
-
const
|
|
8800
|
+
const version = await versionPromise;
|
|
8801
|
+
if (version instanceof Error) throw version;
|
|
8802
|
+
const args = [version, geVersion, ltVersion];
|
|
8288
8803
|
if (!semverSatisfies(...args)) throw new UnsupportedVersionError(name, ...args);
|
|
8289
8804
|
return next(request);
|
|
8290
8805
|
}
|
|
8291
8806
|
});
|
|
8807
|
+
const genRetryOnFailurePolicy = (retryCount, retryOverallDelay) => ({
|
|
8808
|
+
policy: {
|
|
8809
|
+
name: 'retry-on-failure',
|
|
8810
|
+
async sendRequest(request, next) {
|
|
8811
|
+
const statusesToNotRetry = [200, 400, 403];
|
|
8812
|
+
const intervals = new Array(retryCount).fill(0).map((_, idx) => ((idx + 1) / retryCount) ** 2);
|
|
8813
|
+
const intervalSum = intervals.reduce((a, b) => a + b);
|
|
8814
|
+
const intervalsInMs = intervals.map(el => el / intervalSum * retryOverallDelay);
|
|
8815
|
+
let error;
|
|
8816
|
+
for (let attempt = 0; attempt <= retryCount; attempt += 1) {
|
|
8817
|
+
if (error != null) {
|
|
8818
|
+
var _error$response$statu, _error$response2;
|
|
8819
|
+
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;
|
|
8820
|
+
await pause(intervalsInMs[attempt - 1]);
|
|
8821
|
+
}
|
|
8822
|
+
try {
|
|
8823
|
+
return await next(request);
|
|
8824
|
+
} catch (e) {
|
|
8825
|
+
error = e;
|
|
8826
|
+
}
|
|
8827
|
+
}
|
|
8828
|
+
if (error == null) throw new UnexpectedTsError();
|
|
8829
|
+
throw error;
|
|
8830
|
+
}
|
|
8831
|
+
},
|
|
8832
|
+
position: 'perCall'
|
|
8833
|
+
});
|
|
8292
8834
|
// EXTERNAL MODULE: external "@azure/core-client"
|
|
8293
8835
|
var core_client_ = __webpack_require__(4711);
|
|
8294
8836
|
;// CONCATENATED MODULE: ./src/apis/node/models/mappers.ts
|
|
@@ -8711,6 +9253,7 @@ const SignedTx = {
|
|
|
8711
9253
|
}
|
|
8712
9254
|
};
|
|
8713
9255
|
const Tx = {
|
|
9256
|
+
serializedName: "Tx",
|
|
8714
9257
|
type: {
|
|
8715
9258
|
name: "Composite",
|
|
8716
9259
|
className: "Tx",
|
|
@@ -12455,7 +12998,7 @@ const CreateContractUnsignedTx = {
|
|
|
12455
12998
|
}
|
|
12456
12999
|
};
|
|
12457
13000
|
let discriminators = {
|
|
12458
|
-
"Tx.
|
|
13001
|
+
"Tx.Tx": Tx,
|
|
12459
13002
|
OffChainUpdate: OffChainUpdate,
|
|
12460
13003
|
"OffChainUpdate.OffChainTransfer": OffChainTransfer,
|
|
12461
13004
|
"OffChainUpdate.OffChainWithdrawal": OffChainWithdrawal,
|
|
@@ -12574,7 +13117,7 @@ const body1 = {
|
|
|
12574
13117
|
parameterPath: "body",
|
|
12575
13118
|
mapper: EncodedTx
|
|
12576
13119
|
};
|
|
12577
|
-
const
|
|
13120
|
+
const from = {
|
|
12578
13121
|
parameterPath: ["options", "from"],
|
|
12579
13122
|
mapper: {
|
|
12580
13123
|
serializedName: "from",
|
|
@@ -12597,7 +13140,7 @@ const limit = {
|
|
|
12597
13140
|
}
|
|
12598
13141
|
}
|
|
12599
13142
|
};
|
|
12600
|
-
const
|
|
13143
|
+
const type = {
|
|
12601
13144
|
parameterPath: ["options", "type"],
|
|
12602
13145
|
mapper: {
|
|
12603
13146
|
defaultValue: "all",
|
|
@@ -12632,7 +13175,6 @@ const parameters_name = {
|
|
|
12632
13175
|
|
|
12633
13176
|
|
|
12634
13177
|
|
|
12635
|
-
|
|
12636
13178
|
class Node extends core_client_.ServiceClient {
|
|
12637
13179
|
/**
|
|
12638
13180
|
* Initializes a new instance of the Node class.
|
|
@@ -12640,7 +13182,7 @@ class Node extends core_client_.ServiceClient {
|
|
|
12640
13182
|
* @param options The parameter options
|
|
12641
13183
|
*/
|
|
12642
13184
|
constructor($host, options) {
|
|
12643
|
-
var _ref, _options$endpoint
|
|
13185
|
+
var _ref, _options$endpoint;
|
|
12644
13186
|
if ($host === undefined) {
|
|
12645
13187
|
throw new Error("'$host' cannot be null");
|
|
12646
13188
|
}
|
|
@@ -12660,24 +13202,9 @@ class Node extends core_client_.ServiceClient {
|
|
|
12660
13202
|
userAgentOptions: {
|
|
12661
13203
|
userAgentPrefix
|
|
12662
13204
|
},
|
|
12663
|
-
|
|
13205
|
+
endpoint: (_ref = (_options$endpoint = options.endpoint) !== null && _options$endpoint !== void 0 ? _options$endpoint : options.baseUri) !== null && _ref !== void 0 ? _ref : "{$host}"
|
|
12664
13206
|
};
|
|
12665
13207
|
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
13208
|
// Parameter assignments
|
|
12682
13209
|
this.$host = $host;
|
|
12683
13210
|
}
|
|
@@ -13636,7 +14163,7 @@ const getOracleQueriesByPubkeyOperationSpec = {
|
|
|
13636
14163
|
isError: true
|
|
13637
14164
|
}
|
|
13638
14165
|
},
|
|
13639
|
-
queryParameters: [intAsString,
|
|
14166
|
+
queryParameters: [intAsString, from, limit, type],
|
|
13640
14167
|
urlParameters: [$host, pubkey],
|
|
13641
14168
|
headerParameters: [accept],
|
|
13642
14169
|
serializer
|
|
@@ -13814,15 +14341,19 @@ class Node_Node extends NodeTransformed {
|
|
|
13814
14341
|
* @param url - Url for node API
|
|
13815
14342
|
* @param options - Options
|
|
13816
14343
|
* @param options.ignoreVersion - Don't check node version
|
|
14344
|
+
* @param options.retryCount - Amount of extra requests to do in case of failure
|
|
14345
|
+
* @param options.retryOverallDelay - Time in ms to wait between all retries
|
|
13817
14346
|
*/
|
|
13818
14347
|
constructor(url, {
|
|
13819
14348
|
ignoreVersion = false,
|
|
14349
|
+
retryCount = 3,
|
|
14350
|
+
retryOverallDelay = 800,
|
|
13820
14351
|
...options
|
|
13821
14352
|
} = {}) {
|
|
13822
14353
|
// eslint-disable-next-line constructor-super
|
|
13823
14354
|
super(url, {
|
|
13824
14355
|
allowInsecureConnection: true,
|
|
13825
|
-
additionalPolicies: [genRequestQueuesPolicy(), genCombineGetRequestsPolicy(), genErrorFormatterPolicy(body => ` ${body.reason}`)],
|
|
14356
|
+
additionalPolicies: [genRequestQueuesPolicy(), genCombineGetRequestsPolicy(), genRetryOnFailurePolicy(retryCount, retryOverallDelay), genErrorFormatterPolicy(body => ` ${body.reason}`)],
|
|
13826
14357
|
...options
|
|
13827
14358
|
});
|
|
13828
14359
|
Node_classPrivateFieldInitSpec(this, _networkIdPromise, {
|
|
@@ -13833,10 +14364,10 @@ class Node_Node extends NodeTransformed {
|
|
|
13833
14364
|
const statusPromise = this.getStatus();
|
|
13834
14365
|
const versionPromise = statusPromise.then(({
|
|
13835
14366
|
nodeVersion
|
|
13836
|
-
}) => nodeVersion);
|
|
14367
|
+
}) => nodeVersion, error => error);
|
|
13837
14368
|
classPrivateFieldSet_default()(this, _networkIdPromise, statusPromise.then(({
|
|
13838
14369
|
networkId
|
|
13839
|
-
}) => networkId));
|
|
14370
|
+
}) => networkId, error => error));
|
|
13840
14371
|
this.pipeline.addPolicy(genVersionCheckPolicy('node', '/v3/status', versionPromise, '6.2.0', '7.0.0'));
|
|
13841
14372
|
}
|
|
13842
14373
|
this.intAsString = true;
|
|
@@ -13846,7 +14377,9 @@ class Node_Node extends NodeTransformed {
|
|
|
13846
14377
|
(_classPrivateFieldGet2 = classPrivateFieldGet_default()(this, _networkIdPromise)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : classPrivateFieldSet_default()(this, _networkIdPromise, this.getStatus().then(({
|
|
13847
14378
|
networkId
|
|
13848
14379
|
}) => networkId));
|
|
13849
|
-
|
|
14380
|
+
const networkId = await classPrivateFieldGet_default()(this, _networkIdPromise);
|
|
14381
|
+
if (networkId instanceof Error) throw networkId;
|
|
14382
|
+
return networkId;
|
|
13850
14383
|
}
|
|
13851
14384
|
async getNodeInfo() {
|
|
13852
14385
|
const {
|
|
@@ -13869,143 +14402,347 @@ class Node_Node extends NodeTransformed {
|
|
|
13869
14402
|
};
|
|
13870
14403
|
}
|
|
13871
14404
|
}
|
|
13872
|
-
;// CONCATENATED MODULE: ./src/tx/
|
|
14405
|
+
;// CONCATENATED MODULE: ./src/tx/transaction-signer.ts
|
|
13873
14406
|
|
|
13874
14407
|
|
|
13875
14408
|
|
|
13876
14409
|
|
|
14410
|
+
/**
|
|
14411
|
+
* Returns account address that signed a transaction
|
|
14412
|
+
* @param transaction - transaction to get a signer of
|
|
14413
|
+
*/
|
|
14414
|
+
function getTransactionSignerAddress(transaction) {
|
|
14415
|
+
var _getSchema$find;
|
|
14416
|
+
const params = unpackTx(transaction);
|
|
14417
|
+
switch (params.tag) {
|
|
14418
|
+
case Tag.SignedTx:
|
|
14419
|
+
return getTransactionSignerAddress(buildTx(params.encodedTx));
|
|
14420
|
+
case Tag.GaMetaTx:
|
|
14421
|
+
return params.gaId;
|
|
14422
|
+
default:
|
|
14423
|
+
}
|
|
14424
|
+
const nonce = (_getSchema$find = getSchema(params.tag, params.version).find(([name]) => name === 'nonce')) === null || _getSchema$find === void 0 ? void 0 : _getSchema$find[1];
|
|
14425
|
+
if (nonce == null) throw new TransactionError(`Transaction doesn't have nonce: ${Tag[params.tag]}`);
|
|
14426
|
+
if (!('senderKey' in nonce)) throw new UnexpectedTsError();
|
|
14427
|
+
const address = params[nonce.senderKey];
|
|
14428
|
+
return address.replace(/^ok_/, 'ak_');
|
|
14429
|
+
}
|
|
14430
|
+
;// CONCATENATED MODULE: ./src/account/Base.ts
|
|
14431
|
+
/**
|
|
14432
|
+
* Account is one of the three basic building blocks of an
|
|
14433
|
+
* {@link AeSdk} and provides access to a signing key pair.
|
|
14434
|
+
*/
|
|
14435
|
+
class AccountBase {}
|
|
14436
|
+
;// CONCATENATED MODULE: ./src/account/Memory.ts
|
|
13877
14437
|
|
|
13878
14438
|
|
|
13879
14439
|
|
|
13880
14440
|
|
|
13881
14441
|
|
|
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();
|
|
14442
|
+
|
|
14443
|
+
|
|
14444
|
+
const secretKeys = new WeakMap();
|
|
14445
|
+
function getBufferToSign(transaction, networkId, innerTx) {
|
|
14446
|
+
const prefixes = [networkId];
|
|
14447
|
+
if (innerTx) prefixes.push('inner_tx');
|
|
14448
|
+
const rlpBinaryTx = decode(transaction);
|
|
14449
|
+
return concatBuffers([Buffer.from(prefixes.join('-')), hash(rlpBinaryTx)]);
|
|
13913
14450
|
}
|
|
13914
14451
|
|
|
13915
14452
|
/**
|
|
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)
|
|
14453
|
+
* In-memory account class
|
|
13924
14454
|
*/
|
|
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
|
-
|
|
13994
|
-
|
|
13995
|
-
|
|
13996
|
-
|
|
13997
|
-
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14455
|
+
class AccountMemory extends AccountBase {
|
|
14456
|
+
/**
|
|
14457
|
+
* @param secretKey - Secret key
|
|
14458
|
+
*/
|
|
14459
|
+
constructor(secretKey) {
|
|
14460
|
+
super();
|
|
14461
|
+
secretKey = typeof secretKey === 'string' ? Buffer.from(secretKey, 'hex') : secretKey;
|
|
14462
|
+
if (secretKey.length !== 64) {
|
|
14463
|
+
throw new ArgumentError('secretKey', '64 bytes', secretKey.length);
|
|
14464
|
+
}
|
|
14465
|
+
secretKeys.set(this, secretKey);
|
|
14466
|
+
this.address = encode(generateKeyPairFromSecret(secretKeys.get(this)).publicKey, Encoding.AccountAddress);
|
|
14467
|
+
}
|
|
14468
|
+
|
|
14469
|
+
/**
|
|
14470
|
+
* Generates a new AccountMemory using a random secret key
|
|
14471
|
+
*/
|
|
14472
|
+
static generate() {
|
|
14473
|
+
return new AccountMemory(generateKeyPair().secretKey);
|
|
14474
|
+
}
|
|
14475
|
+
|
|
14476
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14477
|
+
async sign(data, options) {
|
|
14478
|
+
return sign(data, secretKeys.get(this));
|
|
14479
|
+
}
|
|
14480
|
+
async signTransaction(transaction, {
|
|
14481
|
+
innerTx,
|
|
14482
|
+
networkId,
|
|
14483
|
+
...options
|
|
14484
|
+
} = {}) {
|
|
14485
|
+
if (networkId == null) {
|
|
14486
|
+
throw new ArgumentError('networkId', 'provided', networkId);
|
|
14487
|
+
}
|
|
14488
|
+
const rlpBinaryTx = decode(transaction);
|
|
14489
|
+
const txWithNetworkId = getBufferToSign(transaction, networkId, innerTx === true);
|
|
14490
|
+
const signatures = [await this.sign(txWithNetworkId, options)];
|
|
14491
|
+
return buildTx({
|
|
14492
|
+
tag: Tag.SignedTx,
|
|
14493
|
+
encodedTx: rlpBinaryTx,
|
|
14494
|
+
signatures
|
|
14495
|
+
});
|
|
14496
|
+
}
|
|
14497
|
+
async signMessage(message, options) {
|
|
14498
|
+
return this.sign(messageToHash(message), options);
|
|
14499
|
+
}
|
|
14500
|
+
}
|
|
14501
|
+
;// CONCATENATED MODULE: ./src/tx/execution-cost.ts
|
|
14502
|
+
|
|
14503
|
+
|
|
14504
|
+
|
|
14505
|
+
|
|
14506
|
+
|
|
14507
|
+
|
|
14508
|
+
|
|
14509
|
+
/**
|
|
14510
|
+
* Calculates the cost of transaction execution
|
|
14511
|
+
* Provides an upper cost of contract-call-related transactions because of `gasLimit`.
|
|
14512
|
+
* Also assumes that oracle query fee is 0 unless it is provided in options.
|
|
14513
|
+
* @param transaction - Transaction to calculate the cost of
|
|
14514
|
+
* @param innerTx - Should be provided if transaction wrapped with Tag.PayingForTx
|
|
14515
|
+
* @param gasUsed - Amount of gas actually used to make calculation more accurate
|
|
14516
|
+
* @param queryFee - Oracle query fee
|
|
14517
|
+
* @param isInitiator - Is transaction signer an initiator of state channel
|
|
14518
|
+
*/
|
|
14519
|
+
function getExecutionCost(transaction, {
|
|
14520
|
+
innerTx,
|
|
14521
|
+
gasUsed,
|
|
14522
|
+
queryFee,
|
|
14523
|
+
isInitiator
|
|
14524
|
+
} = {}) {
|
|
14525
|
+
const params = unpackTx(transaction);
|
|
14526
|
+
if (params.tag === Tag.SignedTx) {
|
|
14527
|
+
throw new IllegalArgumentError('Transaction shouldn\'t be a SignedTx, use `getExecutionCostBySignedTx` instead');
|
|
14528
|
+
}
|
|
14529
|
+
let res = 0n;
|
|
14530
|
+
if ('fee' in params && innerTx !== 'freeloader') {
|
|
14531
|
+
res += BigInt(params.fee);
|
|
14532
|
+
}
|
|
14533
|
+
if (params.tag === Tag.NameClaimTx) {
|
|
14534
|
+
res += BigInt(params.nameFee);
|
|
14535
|
+
}
|
|
14536
|
+
if (params.tag === Tag.OracleQueryTx) {
|
|
14537
|
+
res += BigInt(params.queryFee);
|
|
14538
|
+
}
|
|
14539
|
+
if (params.tag === Tag.OracleResponseTx) {
|
|
14540
|
+
res -= BigInt(queryFee !== null && queryFee !== void 0 ? queryFee : 0);
|
|
14541
|
+
}
|
|
14542
|
+
if (params.tag === Tag.ChannelSettleTx) {
|
|
14543
|
+
if (isInitiator === true) res -= BigInt(params.initiatorAmountFinal);
|
|
14544
|
+
if (isInitiator === false) res -= BigInt(params.responderAmountFinal);
|
|
14545
|
+
}
|
|
14546
|
+
if ((params.tag === Tag.SpendTx && params.senderId !== params.recipientId || params.tag === Tag.ContractCreateTx || params.tag === Tag.ContractCallTx || params.tag === Tag.ChannelDepositTx) && innerTx !== 'fee-payer') {
|
|
14547
|
+
res += BigInt(params.amount);
|
|
14548
|
+
}
|
|
14549
|
+
if (params.tag === Tag.ContractCreateTx) res += BigInt(params.deposit);
|
|
14550
|
+
if ((params.tag === Tag.ContractCreateTx || params.tag === Tag.ContractCallTx || params.tag === Tag.GaAttachTx || params.tag === Tag.GaMetaTx) && innerTx !== 'freeloader') {
|
|
14551
|
+
res += BigInt(params.gasPrice) * BigInt(gasUsed !== null && gasUsed !== void 0 ? gasUsed : params.gasLimit);
|
|
14552
|
+
}
|
|
14553
|
+
if (params.tag === Tag.GaMetaTx || params.tag === Tag.PayingForTx) {
|
|
14554
|
+
res += getExecutionCost(buildTx(params.tx.encodedTx), params.tag === Tag.PayingForTx ? {
|
|
14555
|
+
innerTx: 'fee-payer'
|
|
14556
|
+
} : {});
|
|
14557
|
+
}
|
|
14558
|
+
return res;
|
|
14559
|
+
}
|
|
14560
|
+
|
|
14561
|
+
/**
|
|
14562
|
+
* Calculates the cost of signed transaction execution
|
|
14563
|
+
* @param transaction - Transaction to calculate the cost of
|
|
14564
|
+
* @param networkId - Network id used to sign the transaction
|
|
14565
|
+
* @param options - Options
|
|
14566
|
+
*/
|
|
14567
|
+
function getExecutionCostBySignedTx(transaction, networkId, options) {
|
|
14568
|
+
const params = unpackTx(transaction, Tag.SignedTx);
|
|
14569
|
+
if (params.encodedTx.tag === Tag.GaMetaTx) {
|
|
14570
|
+
return getExecutionCost(buildTx(params.encodedTx), options);
|
|
14571
|
+
}
|
|
14572
|
+
const tx = buildTx(params.encodedTx);
|
|
14573
|
+
const address = getTransactionSignerAddress(tx);
|
|
14574
|
+
const [isInnerTx, isNotInnerTx] = [true, false].map(f => verify(getBufferToSign(tx, networkId, f), params.signatures[0], address));
|
|
14575
|
+
if (!isInnerTx && !isNotInnerTx) throw new TransactionError('Can\'t verify signature');
|
|
14576
|
+
return getExecutionCost(buildTx(params.encodedTx), {
|
|
14577
|
+
...(isInnerTx && {
|
|
14578
|
+
innerTx: 'freeloader'
|
|
14579
|
+
}),
|
|
14580
|
+
...options
|
|
14581
|
+
});
|
|
14582
|
+
}
|
|
14583
|
+
|
|
14584
|
+
/**
|
|
14585
|
+
* Calculates the cost of signed and not signed transaction execution using node
|
|
14586
|
+
* @param transaction - Transaction to calculate the cost of
|
|
14587
|
+
* @param node - Node to use
|
|
14588
|
+
* @param isMined - Is transaction already mined or not
|
|
14589
|
+
* @param options - Options
|
|
14590
|
+
*/
|
|
14591
|
+
async function getExecutionCostUsingNode(transaction, node, {
|
|
14592
|
+
isMined,
|
|
14593
|
+
...options
|
|
14594
|
+
} = {}) {
|
|
14595
|
+
let params = unpackTx(transaction);
|
|
14596
|
+
const isSignedTx = params.tag === Tag.SignedTx;
|
|
14597
|
+
const txHash = isSignedTx && isMined === true && buildTxHash(transaction);
|
|
14598
|
+
if (params.tag === Tag.SignedTx) params = params.encodedTx;
|
|
14599
|
+
|
|
14600
|
+
// TODO: set gasUsed for PayingForTx after solving https://github.com/aeternity/aeternity/issues/4087
|
|
14601
|
+
if (options.gasUsed == null && txHash !== false && [Tag.ContractCreateTx, Tag.ContractCallTx, Tag.GaAttachTx, Tag.GaMetaTx].includes(params.tag)) {
|
|
14602
|
+
const {
|
|
14603
|
+
callInfo,
|
|
14604
|
+
gaInfo
|
|
14605
|
+
} = await node.getTransactionInfoByHash(txHash);
|
|
14606
|
+
const combinedInfo = callInfo !== null && callInfo !== void 0 ? callInfo : gaInfo;
|
|
14607
|
+
if (combinedInfo == null) {
|
|
14608
|
+
throw new InternalError(`callInfo and gaInfo is not available for transaction ${txHash}`);
|
|
14609
|
+
}
|
|
14610
|
+
options.gasUsed = combinedInfo.gasUsed;
|
|
14611
|
+
}
|
|
14612
|
+
if (options.queryFee == null && Tag.OracleResponseTx === params.tag) {
|
|
14613
|
+
options.queryFee = (await node.getOracleByPubkey(params.oracleId)).queryFee.toString();
|
|
14614
|
+
}
|
|
14615
|
+
if (options.isInitiator == null && Tag.ChannelSettleTx === params.tag && isMined !== true) {
|
|
14616
|
+
const {
|
|
14617
|
+
initiatorId
|
|
14618
|
+
} = await node.getChannelByPubkey(params.channelId);
|
|
14619
|
+
options.isInitiator = params.fromId === initiatorId;
|
|
14620
|
+
}
|
|
14621
|
+
return isSignedTx ? getExecutionCostBySignedTx(transaction, await node.getNetworkId(), options) : getExecutionCost(transaction, options);
|
|
14622
|
+
}
|
|
14623
|
+
;// CONCATENATED MODULE: ./src/tx/validator.ts
|
|
14624
|
+
|
|
14625
|
+
|
|
14626
|
+
|
|
14627
|
+
|
|
14628
|
+
|
|
14629
|
+
|
|
14630
|
+
|
|
14631
|
+
|
|
14632
|
+
|
|
14633
|
+
|
|
14634
|
+
|
|
14635
|
+
const validators = [];
|
|
14636
|
+
async function verifyTransactionInternal(tx, node, parentTxTypes) {
|
|
14637
|
+
const address = getTransactionSignerAddress(buildTx(tx));
|
|
14638
|
+
const [account, {
|
|
14639
|
+
height
|
|
14640
|
+
}, {
|
|
14641
|
+
consensusProtocolVersion,
|
|
14642
|
+
nodeNetworkId
|
|
14643
|
+
}] = await Promise.all([node.getAccountByPubkey(address).catch(error => {
|
|
14644
|
+
if (!isAccountNotFoundError(error)) throw error;
|
|
14645
|
+
return {
|
|
14646
|
+
id: address,
|
|
14647
|
+
balance: 0n,
|
|
14648
|
+
nonce: 0
|
|
14649
|
+
};
|
|
14650
|
+
})
|
|
14651
|
+
// TODO: remove after fixing https://github.com/aeternity/aepp-sdk-js/issues/1537
|
|
14652
|
+
.then(acc => ({
|
|
14653
|
+
...acc,
|
|
14654
|
+
id: acc.id
|
|
14655
|
+
})), node.getCurrentKeyBlockHeight(), node.getNodeInfo()]);
|
|
14656
|
+
return (await Promise.all(validators.map(async v => v(tx, {
|
|
14657
|
+
node,
|
|
14658
|
+
account,
|
|
14659
|
+
height,
|
|
14660
|
+
consensusProtocolVersion,
|
|
14661
|
+
nodeNetworkId,
|
|
14662
|
+
parentTxTypes
|
|
14663
|
+
})))).flat();
|
|
14664
|
+
}
|
|
14665
|
+
|
|
14666
|
+
/**
|
|
14667
|
+
* Transaction Validator
|
|
14668
|
+
* This function validates some transaction properties,
|
|
14669
|
+
* to make sure it can be posted it to the chain
|
|
14670
|
+
* @category transaction builder
|
|
14671
|
+
* @param transaction - Base64Check-encoded transaction
|
|
14672
|
+
* @param nodeNotCached - Node to validate transaction against
|
|
14673
|
+
* @returns Array with verification errors
|
|
14674
|
+
* @example const errors = await verifyTransaction(transaction, node)
|
|
14675
|
+
*/
|
|
14676
|
+
async function verifyTransaction(transaction, nodeNotCached) {
|
|
14677
|
+
const node = new Node_Node(nodeNotCached.$host, {
|
|
14678
|
+
ignoreVersion: true,
|
|
14679
|
+
pipeline: nodeNotCached.pipeline.clone(),
|
|
14680
|
+
additionalPolicies: [genAggressiveCacheGetResponsesPolicy()]
|
|
14681
|
+
});
|
|
14682
|
+
return verifyTransactionInternal(unpackTx(transaction), node, []);
|
|
14683
|
+
}
|
|
14684
|
+
validators.push((tx, {
|
|
14685
|
+
account,
|
|
14686
|
+
nodeNetworkId,
|
|
14687
|
+
parentTxTypes
|
|
14688
|
+
}) => {
|
|
14689
|
+
if (tx.tag !== Tag.SignedTx) return [];
|
|
14690
|
+
const {
|
|
14691
|
+
encodedTx,
|
|
14692
|
+
signatures
|
|
14693
|
+
} = tx;
|
|
14694
|
+
if ((encodedTx !== null && encodedTx !== void 0 ? encodedTx : signatures) == null) return [];
|
|
14695
|
+
if (signatures.length !== 1) return []; // TODO: Support multisignature like in state channels
|
|
14696
|
+
const prefix = Buffer.from([nodeNetworkId, ...(parentTxTypes.includes(Tag.PayingForTx) ? ['inner_tx'] : [])].join('-'));
|
|
14697
|
+
const txBinary = decode(buildTx(encodedTx));
|
|
14698
|
+
const txWithNetworkId = concatBuffers([prefix, txBinary]);
|
|
14699
|
+
const txHashWithNetworkId = concatBuffers([prefix, hash(txBinary)]);
|
|
14700
|
+
if (verify(txWithNetworkId, signatures[0], account.id) || verify(txHashWithNetworkId, signatures[0], account.id)) return [];
|
|
14701
|
+
return [{
|
|
14702
|
+
message: 'Signature cannot be verified, please ensure that you transaction have' + ' the correct prefix and the correct private key for the sender address',
|
|
14703
|
+
key: 'InvalidSignature',
|
|
14704
|
+
checkedKeys: ['encodedTx', 'signatures']
|
|
14705
|
+
}];
|
|
14706
|
+
}, async (tx, {
|
|
14707
|
+
node,
|
|
14708
|
+
parentTxTypes
|
|
14709
|
+
}) => {
|
|
14710
|
+
let nestedTx;
|
|
14711
|
+
if ('encodedTx' in tx) nestedTx = tx.encodedTx;
|
|
14712
|
+
if ('tx' in tx) nestedTx = tx.tx;
|
|
14713
|
+
if (nestedTx == null) return [];
|
|
14714
|
+
return verifyTransactionInternal(nestedTx, node, [...parentTxTypes, tx.tag]);
|
|
14715
|
+
}, (tx, {
|
|
14716
|
+
height
|
|
14717
|
+
}) => {
|
|
14718
|
+
if (!('ttl' in tx)) return [];
|
|
14719
|
+
if (tx.ttl === 0 || tx.ttl >= height) return [];
|
|
14720
|
+
return [{
|
|
14721
|
+
message: `TTL ${tx.ttl} is already expired, current height is ${height}`,
|
|
14722
|
+
key: 'ExpiredTTL',
|
|
14723
|
+
checkedKeys: ['ttl']
|
|
14724
|
+
}];
|
|
14725
|
+
}, async (tx, {
|
|
14726
|
+
account,
|
|
14727
|
+
parentTxTypes,
|
|
14728
|
+
node
|
|
14729
|
+
}) => {
|
|
14730
|
+
if (parentTxTypes.length !== 0) return [];
|
|
14731
|
+
const cost = await getExecutionCostUsingNode(buildTx(tx), node).catch(() => 0n);
|
|
14732
|
+
if (cost <= account.balance) return [];
|
|
14733
|
+
return [{
|
|
14734
|
+
message: `Account balance ${account.balance} is not enough to execute the transaction that costs ${cost}`,
|
|
14735
|
+
key: 'InsufficientBalance',
|
|
14736
|
+
checkedKeys: ['amount', 'fee', 'nameFee', 'gasLimit', 'gasPrice']
|
|
14737
|
+
}];
|
|
14738
|
+
}, (tx, {
|
|
14001
14739
|
account
|
|
14002
14740
|
}) => {
|
|
14003
|
-
if (account == null) return [];
|
|
14004
14741
|
let message;
|
|
14005
|
-
if (tag === Tag.SignedTx && account.kind === 'generalized' && signatures.length !== 0) {
|
|
14742
|
+
if (tx.tag === Tag.SignedTx && account.kind === 'generalized' && tx.signatures.length !== 0) {
|
|
14006
14743
|
message = 'Generalized account can\'t be used to generate SignedTx with signatures';
|
|
14007
14744
|
}
|
|
14008
|
-
if (tag === Tag.GaMetaTx && account.kind === 'basic') {
|
|
14745
|
+
if (tx.tag === Tag.GaMetaTx && account.kind === 'basic') {
|
|
14009
14746
|
message = 'Basic account can\'t be used to generate GaMetaTx';
|
|
14010
14747
|
}
|
|
14011
14748
|
if (message == null) return [];
|
|
@@ -14014,46 +14751,24 @@ validators.push(({
|
|
|
14014
14751
|
key: 'InvalidAccountType',
|
|
14015
14752
|
checkedKeys: ['tag']
|
|
14016
14753
|
}];
|
|
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
|
-
}, {
|
|
14754
|
+
},
|
|
14755
|
+
// TODO: revert nonce check
|
|
14756
|
+
(tx, {
|
|
14042
14757
|
consensusProtocolVersion
|
|
14043
14758
|
}) => {
|
|
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 = (
|
|
14759
|
+
var _ref, _ref2;
|
|
14760
|
+
const oracleCall = Tag.Oracle === tx.tag || Tag.OracleRegisterTx === tx.tag;
|
|
14761
|
+
const contractCreate = Tag.ContractCreateTx === tx.tag || Tag.GaAttachTx === tx.tag;
|
|
14762
|
+
const contractCall = Tag.ContractCallTx === tx.tag || Tag.GaMetaTx === tx.tag;
|
|
14763
|
+
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
14764
|
if (type == null) return [];
|
|
14050
|
-
// TODO: remove assertion after fixing buildTx types
|
|
14051
14765
|
const protocol = ProtocolToVmAbi[consensusProtocolVersion][type];
|
|
14052
|
-
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
abiVersion
|
|
14766
|
+
let ctVersion;
|
|
14767
|
+
if ('abiVersion' in tx) ctVersion = {
|
|
14768
|
+
abiVersion: tx.abiVersion
|
|
14056
14769
|
};
|
|
14770
|
+
if ('ctVersion' in tx) ctVersion = tx.ctVersion;
|
|
14771
|
+
if (ctVersion == null) throw new UnexpectedTsError();
|
|
14057
14772
|
if (!protocol.abiVersion.includes(ctVersion.abiVersion) || contractCreate && !protocol.vmVersion.includes(ctVersion.vmVersion)) {
|
|
14058
14773
|
return [{
|
|
14059
14774
|
message: `ABI/VM version ${JSON.stringify(ctVersion)} is wrong, supported is: ${JSON.stringify(protocol)}`,
|
|
@@ -14062,21 +14777,17 @@ validators.push(({
|
|
|
14062
14777
|
}];
|
|
14063
14778
|
}
|
|
14064
14779
|
return [];
|
|
14065
|
-
}, async ({
|
|
14066
|
-
contractId,
|
|
14067
|
-
tag
|
|
14068
|
-
}, {
|
|
14780
|
+
}, async (tx, {
|
|
14069
14781
|
node
|
|
14070
14782
|
}) => {
|
|
14071
|
-
if (Tag.ContractCallTx !== tag) return [];
|
|
14072
|
-
contractId = contractId;
|
|
14783
|
+
if (Tag.ContractCallTx !== tx.tag) return [];
|
|
14073
14784
|
try {
|
|
14074
14785
|
const {
|
|
14075
14786
|
active
|
|
14076
|
-
} = await node.getContract(contractId);
|
|
14787
|
+
} = await node.getContract(tx.contractId);
|
|
14077
14788
|
if (active) return [];
|
|
14078
14789
|
return [{
|
|
14079
|
-
message: `Contract ${contractId} is not active`,
|
|
14790
|
+
message: `Contract ${tx.contractId} is not active`,
|
|
14080
14791
|
key: 'ContractNotActive',
|
|
14081
14792
|
checkedKeys: ['contractId']
|
|
14082
14793
|
}];
|
|
@@ -14091,22 +14802,8 @@ validators.push(({
|
|
|
14091
14802
|
}
|
|
14092
14803
|
});
|
|
14093
14804
|
;// 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
|
-
*/
|
|
14805
|
+
|
|
14806
|
+
|
|
14110
14807
|
|
|
14111
14808
|
|
|
14112
14809
|
|
|
@@ -14246,25 +14943,36 @@ async function waitForTxConfirm(txHash, {
|
|
|
14246
14943
|
}
|
|
14247
14944
|
|
|
14248
14945
|
/**
|
|
14249
|
-
*
|
|
14946
|
+
* Signs and submits transaction for mining
|
|
14250
14947
|
* @category chain
|
|
14251
|
-
* @param
|
|
14948
|
+
* @param txUnsigned - Transaction to sign and submit
|
|
14252
14949
|
* @param options - Options
|
|
14253
14950
|
* @param options.onNode - Node to use
|
|
14254
14951
|
* @param options.onAccount - Account to use
|
|
14255
|
-
* @param options.verify - Verify transaction before
|
|
14952
|
+
* @param options.verify - Verify transaction before broadcast, throw error if not
|
|
14256
14953
|
* @param options.waitMined - Ensure that transaction get into block
|
|
14257
14954
|
* @param options.confirm - Number of micro blocks that should be mined after tx get included
|
|
14258
14955
|
* @returns Transaction details
|
|
14259
14956
|
*/
|
|
14260
|
-
async function sendTransaction(
|
|
14957
|
+
async function sendTransaction(txUnsigned, {
|
|
14261
14958
|
onNode,
|
|
14262
14959
|
onAccount,
|
|
14263
14960
|
verify = true,
|
|
14264
14961
|
waitMined = true,
|
|
14265
14962
|
confirm,
|
|
14963
|
+
innerTx,
|
|
14266
14964
|
...options
|
|
14267
14965
|
}) {
|
|
14966
|
+
const tx = await onAccount.signTransaction(txUnsigned, {
|
|
14967
|
+
...options,
|
|
14968
|
+
onNode,
|
|
14969
|
+
innerTx,
|
|
14970
|
+
networkId: await onNode.getNetworkId()
|
|
14971
|
+
});
|
|
14972
|
+
if (innerTx === true) return {
|
|
14973
|
+
hash: buildTxHash(tx),
|
|
14974
|
+
rawTx: tx
|
|
14975
|
+
};
|
|
14268
14976
|
if (verify) {
|
|
14269
14977
|
const validation = await verifyTransaction(tx, onNode);
|
|
14270
14978
|
if (validation.length > 0) {
|
|
@@ -14358,9 +15066,10 @@ async function getBalance(address, {
|
|
|
14358
15066
|
format = AE_AMOUNT_FORMATS.AETTOS,
|
|
14359
15067
|
...options
|
|
14360
15068
|
}) {
|
|
15069
|
+
const addr = address.startsWith('ok_') ? encode(decode(address), Encoding.AccountAddress) : address;
|
|
14361
15070
|
const {
|
|
14362
15071
|
balance
|
|
14363
|
-
} = await getAccount(
|
|
15072
|
+
} = await getAccount(addr, options).catch(error => {
|
|
14364
15073
|
if (!isAccountNotFoundError(error)) throw error;
|
|
14365
15074
|
return {
|
|
14366
15075
|
balance: 0n
|
|
@@ -14744,121 +15453,6 @@ async function dump(name, password, privateKey, nonce = external_tweetnacl_defau
|
|
|
14744
15453
|
}
|
|
14745
15454
|
};
|
|
14746
15455
|
}
|
|
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
15456
|
// EXTERNAL MODULE: external "tweetnacl-auth"
|
|
14863
15457
|
var external_tweetnacl_auth_ = __webpack_require__(9882);
|
|
14864
15458
|
// EXTERNAL MODULE: external "bip32-path"
|
|
@@ -15023,130 +15617,7 @@ const getHdWalletAccountFromSeed = (seed, accountIdx) => {
|
|
|
15023
15617
|
idx: accountIdx
|
|
15024
15618
|
};
|
|
15025
15619
|
};
|
|
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
15620
|
;// 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
15621
|
/**
|
|
15151
15622
|
* Aens methods - routines to interact with the æternity naming system
|
|
15152
15623
|
*
|
|
@@ -15161,7 +15632,6 @@ async function payForTransaction(transaction, options) {
|
|
|
15161
15632
|
|
|
15162
15633
|
|
|
15163
15634
|
|
|
15164
|
-
|
|
15165
15635
|
/**
|
|
15166
15636
|
* Revoke a name
|
|
15167
15637
|
* @category AENS
|
|
@@ -15184,12 +15654,13 @@ async function payForTransaction(transaction, options) {
|
|
|
15184
15654
|
* ```
|
|
15185
15655
|
*/
|
|
15186
15656
|
async function aensRevoke(name, options) {
|
|
15187
|
-
const nameRevokeTx = await
|
|
15657
|
+
const nameRevokeTx = await buildTxAsync({
|
|
15188
15658
|
...options,
|
|
15659
|
+
tag: Tag.NameRevokeTx,
|
|
15189
15660
|
nameId: name,
|
|
15190
15661
|
accountId: options.onAccount.address
|
|
15191
15662
|
});
|
|
15192
|
-
return
|
|
15663
|
+
return sendTransaction(nameRevokeTx, options);
|
|
15193
15664
|
}
|
|
15194
15665
|
/**
|
|
15195
15666
|
* Update a name
|
|
@@ -15231,10 +15702,11 @@ async function aensUpdate(name, pointers, {
|
|
|
15231
15702
|
}) => [key, id]))),
|
|
15232
15703
|
...pointers
|
|
15233
15704
|
};
|
|
15234
|
-
const nameUpdateTx = await
|
|
15705
|
+
const nameUpdateTx = await buildTxAsync({
|
|
15235
15706
|
clientTtl: CLIENT_TTL,
|
|
15236
15707
|
nameTtl: NAME_TTL,
|
|
15237
15708
|
...options,
|
|
15709
|
+
tag: Tag.NameUpdateTx,
|
|
15238
15710
|
nameId: name,
|
|
15239
15711
|
accountId: options.onAccount.address,
|
|
15240
15712
|
pointers: Object.entries(allPointers).map(([key, id]) => ({
|
|
@@ -15242,7 +15714,7 @@ async function aensUpdate(name, pointers, {
|
|
|
15242
15714
|
id
|
|
15243
15715
|
}))
|
|
15244
15716
|
});
|
|
15245
|
-
return
|
|
15717
|
+
return sendTransaction(nameUpdateTx, options);
|
|
15246
15718
|
}
|
|
15247
15719
|
/**
|
|
15248
15720
|
* Transfer a domain to another account
|
|
@@ -15268,13 +15740,14 @@ async function aensUpdate(name, pointers, {
|
|
|
15268
15740
|
* ```
|
|
15269
15741
|
*/
|
|
15270
15742
|
async function aensTransfer(name, account, options) {
|
|
15271
|
-
const nameTransferTx = await
|
|
15743
|
+
const nameTransferTx = await buildTxAsync({
|
|
15272
15744
|
...options,
|
|
15745
|
+
tag: Tag.NameTransferTx,
|
|
15273
15746
|
nameId: name,
|
|
15274
15747
|
accountId: options.onAccount.address,
|
|
15275
15748
|
recipientId: account
|
|
15276
15749
|
});
|
|
15277
|
-
return
|
|
15750
|
+
return sendTransaction(nameTransferTx, options);
|
|
15278
15751
|
}
|
|
15279
15752
|
/**
|
|
15280
15753
|
* Query the AENS name info from the node
|
|
@@ -15376,13 +15849,14 @@ async function aensQuery(name, opt) {
|
|
|
15376
15849
|
* ```
|
|
15377
15850
|
*/
|
|
15378
15851
|
async function aensClaim(name, salt, options) {
|
|
15379
|
-
const claimTx = await
|
|
15852
|
+
const claimTx = await buildTxAsync({
|
|
15380
15853
|
...options,
|
|
15854
|
+
tag: Tag.NameClaimTx,
|
|
15381
15855
|
accountId: options.onAccount.address,
|
|
15382
15856
|
nameSalt: salt,
|
|
15383
15857
|
name
|
|
15384
15858
|
});
|
|
15385
|
-
const result = await
|
|
15859
|
+
const result = await sendTransaction(claimTx, options);
|
|
15386
15860
|
if (!isAuctionName(name)) {
|
|
15387
15861
|
const nameInter = result.blockHeight != null && result.blockHeight > 0 ? await aensQuery(name, options) : {};
|
|
15388
15862
|
return Object.assign(result, nameInter);
|
|
@@ -15415,16 +15889,15 @@ async function aensClaim(name, salt, options) {
|
|
|
15415
15889
|
*/
|
|
15416
15890
|
async function aensPreclaim(name, options) {
|
|
15417
15891
|
const salt = genSalt();
|
|
15418
|
-
const height = await getHeight(options);
|
|
15419
15892
|
const commitmentId = commitmentHash(name, salt);
|
|
15420
|
-
const preclaimTx = await
|
|
15893
|
+
const preclaimTx = await buildTxAsync({
|
|
15421
15894
|
...options,
|
|
15895
|
+
tag: Tag.NamePreclaimTx,
|
|
15422
15896
|
accountId: options.onAccount.address,
|
|
15423
15897
|
commitmentId
|
|
15424
15898
|
});
|
|
15425
15899
|
return Object.freeze({
|
|
15426
|
-
...(await
|
|
15427
|
-
height,
|
|
15900
|
+
...(await sendTransaction(preclaimTx, options)),
|
|
15428
15901
|
salt,
|
|
15429
15902
|
commitmentId,
|
|
15430
15903
|
async claim(opts) {
|
|
@@ -15468,23 +15941,12 @@ async function aensBid(name, nameFee, options) {
|
|
|
15468
15941
|
// EXTERNAL MODULE: external "@aeternity/aepp-calldata"
|
|
15469
15942
|
var aepp_calldata_ = __webpack_require__(7946);
|
|
15470
15943
|
;// 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
15944
|
|
|
15945
|
+
|
|
15946
|
+
function Contract_classPrivateFieldInitSpec(obj, privateMap, value) { Contract_checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
15947
|
+
function Contract_classPrivateMethodInitSpec(obj, privateSet) { Contract_checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
|
15948
|
+
function Contract_checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
15949
|
+
function Contract_classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
|
15488
15950
|
/**
|
|
15489
15951
|
* Contract module - routines to interact with the æternity contract
|
|
15490
15952
|
*
|
|
@@ -15500,10 +15962,11 @@ var aepp_calldata_ = __webpack_require__(7946);
|
|
|
15500
15962
|
|
|
15501
15963
|
|
|
15502
15964
|
|
|
15503
|
-
|
|
15504
|
-
|
|
15505
|
-
|
|
15506
|
-
|
|
15965
|
+
var _getCallResult = /*#__PURE__*/new WeakSet();
|
|
15966
|
+
var _sendAndProcess = /*#__PURE__*/new WeakSet();
|
|
15967
|
+
var _getFunctionAci = /*#__PURE__*/new WeakSet();
|
|
15968
|
+
var _getContractNameByEvent = /*#__PURE__*/new WeakSet();
|
|
15969
|
+
var _aciContract = /*#__PURE__*/new WeakMap();
|
|
15507
15970
|
/**
|
|
15508
15971
|
* Generate contract ACI object with predefined js methods for contract usage - can be used for
|
|
15509
15972
|
* creating a reference to already deployed contracts
|
|
@@ -15522,52 +15985,6 @@ var aepp_calldata_ = __webpack_require__(7946);
|
|
|
15522
15985
|
* stateful or not
|
|
15523
15986
|
*/
|
|
15524
15987
|
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
15988
|
/**
|
|
15572
15989
|
* Compile contract
|
|
15573
15990
|
* @returns bytecode
|
|
@@ -15579,46 +15996,17 @@ class Contract {
|
|
|
15579
15996
|
this.$options.bytecode = (await this.$options.onCompiler.compileBySourceCode(this.$options.sourceCode, this.$options.fileSystem)).bytecode;
|
|
15580
15997
|
return this.$options.bytecode;
|
|
15581
15998
|
}
|
|
15582
|
-
|
|
15583
|
-
returnType,
|
|
15584
|
-
returnValue
|
|
15585
|
-
}, transaction) {
|
|
15586
|
-
let message;
|
|
15587
|
-
switch (returnType) {
|
|
15588
|
-
case 'ok':
|
|
15589
|
-
return;
|
|
15590
|
-
case 'revert':
|
|
15591
|
-
message = this._calldata.decodeFateString(returnValue);
|
|
15592
|
-
break;
|
|
15593
|
-
case 'error':
|
|
15594
|
-
message = decode(returnValue).toString();
|
|
15595
|
-
break;
|
|
15596
|
-
default:
|
|
15597
|
-
throw new InternalError(`Unknown return type: ${returnType}`);
|
|
15598
|
-
}
|
|
15599
|
-
throw new NodeInvocationError(message, transaction);
|
|
15600
|
-
}
|
|
15601
|
-
async _sendAndProcess(tx, options) {
|
|
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;
|
|
15999
|
+
async $getCallResultByTxHash(hash, fnName, options) {
|
|
15613
16000
|
const {
|
|
15614
16001
|
callInfo
|
|
15615
|
-
} = await this.$options.onNode.getTransactionInfoByHash(
|
|
15616
|
-
|
|
15617
|
-
|
|
15618
|
-
|
|
16002
|
+
} = await this.$options.onNode.getTransactionInfoByHash(hash);
|
|
16003
|
+
if (callInfo == null) {
|
|
16004
|
+
throw new ContractError(`callInfo is not available for transaction ${hash}`);
|
|
16005
|
+
}
|
|
16006
|
+
const callInfoTyped = callInfo;
|
|
15619
16007
|
return {
|
|
15620
|
-
...
|
|
15621
|
-
result:
|
|
16008
|
+
...Contract_classPrivateMethodGet(this, _getCallResult, _getCallResult2).call(this, callInfoTyped, fnName, undefined, options),
|
|
16009
|
+
result: callInfoTyped
|
|
15622
16010
|
};
|
|
15623
16011
|
}
|
|
15624
16012
|
async _estimateGas(name, params, options = {}) {
|
|
@@ -15660,8 +16048,9 @@ class Contract {
|
|
|
15660
16048
|
if (opt.onAccount == null) throw new IllegalArgumentError('Can\'t deploy without account');
|
|
15661
16049
|
const ownerId = opt.onAccount.address;
|
|
15662
16050
|
if (this.$options.bytecode == null) throw new IllegalArgumentError('Can\'t deploy without bytecode');
|
|
15663
|
-
const tx = await
|
|
16051
|
+
const tx = await buildTxAsync({
|
|
15664
16052
|
...opt,
|
|
16053
|
+
tag: Tag.ContractCreateTx,
|
|
15665
16054
|
gasLimit: (_opt$gasLimit = opt.gasLimit) !== null && _opt$gasLimit !== void 0 ? _opt$gasLimit : await this._estimateGas('init', params, opt),
|
|
15666
16055
|
callData: this._calldata.encode(this._name, 'init', params),
|
|
15667
16056
|
code: this.$options.bytecode,
|
|
@@ -15671,7 +16060,7 @@ class Contract {
|
|
|
15671
16060
|
const {
|
|
15672
16061
|
hash,
|
|
15673
16062
|
...other
|
|
15674
|
-
} = await this.
|
|
16063
|
+
} = await Contract_classPrivateMethodGet(this, _sendAndProcess, _sendAndProcess2).call(this, tx, 'init', {
|
|
15675
16064
|
...opt,
|
|
15676
16065
|
onAccount: opt.onAccount
|
|
15677
16066
|
});
|
|
@@ -15691,16 +16080,6 @@ class Contract {
|
|
|
15691
16080
|
* @param name - Function name
|
|
15692
16081
|
* @returns function ACI
|
|
15693
16082
|
*/
|
|
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
16083
|
|
|
15705
16084
|
/**
|
|
15706
16085
|
* Call contract function
|
|
@@ -15710,6 +16089,7 @@ class Contract {
|
|
|
15710
16089
|
* @returns CallResult
|
|
15711
16090
|
*/
|
|
15712
16091
|
async $call(fn, params, options = {}) {
|
|
16092
|
+
var _opt$gasLimit2;
|
|
15713
16093
|
const {
|
|
15714
16094
|
callStatic,
|
|
15715
16095
|
top,
|
|
@@ -15718,14 +16098,14 @@ class Contract {
|
|
|
15718
16098
|
...this.$options,
|
|
15719
16099
|
...options
|
|
15720
16100
|
};
|
|
15721
|
-
const
|
|
16101
|
+
const fnAci = Contract_classPrivateMethodGet(this, _getFunctionAci, _getFunctionAci2).call(this, fn);
|
|
15722
16102
|
const contractId = this.$options.address;
|
|
15723
16103
|
const {
|
|
15724
16104
|
onNode
|
|
15725
16105
|
} = opt;
|
|
15726
16106
|
if (fn == null) throw new MissingFunctionNameError();
|
|
15727
16107
|
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 &&
|
|
16108
|
+
if (fn !== 'init' && opt.amount != null && opt.amount > 0 && !fnAci.payable) {
|
|
15729
16109
|
throw new NotPayableFunctionError(opt.amount, fn);
|
|
15730
16110
|
}
|
|
15731
16111
|
let callerId;
|
|
@@ -15738,7 +16118,6 @@ class Contract {
|
|
|
15738
16118
|
callerId = DRY_RUN_ACCOUNT.pub;
|
|
15739
16119
|
}
|
|
15740
16120
|
const callData = this._calldata.encode(this._name, fn, params);
|
|
15741
|
-
let res;
|
|
15742
16121
|
if (callStatic === true) {
|
|
15743
16122
|
if (opt.nonce == null && top != null) {
|
|
15744
16123
|
const topKey = typeof top === 'number' ? 'height' : 'hash';
|
|
@@ -15755,15 +16134,17 @@ class Contract {
|
|
|
15755
16134
|
let tx;
|
|
15756
16135
|
if (fn === 'init') {
|
|
15757
16136
|
if (this.$options.bytecode == null) throw new IllegalArgumentError('Can\'t dry-run "init" without bytecode');
|
|
15758
|
-
tx = await
|
|
16137
|
+
tx = await buildTxAsync({
|
|
15759
16138
|
...txOpt,
|
|
16139
|
+
tag: Tag.ContractCreateTx,
|
|
15760
16140
|
code: this.$options.bytecode,
|
|
15761
16141
|
ownerId: callerId
|
|
15762
16142
|
});
|
|
15763
16143
|
} else {
|
|
15764
16144
|
if (contractId == null) throw new MissingContractAddressError('Can\'t dry-run contract without address');
|
|
15765
|
-
tx = await
|
|
16145
|
+
tx = await buildTxAsync({
|
|
15766
16146
|
...txOpt,
|
|
16147
|
+
tag: Tag.ContractCallTx,
|
|
15767
16148
|
callerId,
|
|
15768
16149
|
contractId
|
|
15769
16150
|
});
|
|
@@ -15775,38 +16156,35 @@ class Contract {
|
|
|
15775
16156
|
...opt,
|
|
15776
16157
|
top
|
|
15777
16158
|
});
|
|
15778
|
-
if (callObj == null)
|
|
15779
|
-
|
|
15780
|
-
|
|
15781
|
-
|
|
15782
|
-
|
|
15783
|
-
res = {
|
|
16159
|
+
if (callObj == null) {
|
|
16160
|
+
throw new InternalError(`callObj is not available for transaction ${tx}`);
|
|
16161
|
+
}
|
|
16162
|
+
const callInfoTyped = callObj;
|
|
16163
|
+
return {
|
|
15784
16164
|
...dryRunOther,
|
|
16165
|
+
...Contract_classPrivateMethodGet(this, _getCallResult, _getCallResult2).call(this, callInfoTyped, fn, tx, opt),
|
|
15785
16166
|
tx: unpackTx(tx),
|
|
15786
|
-
result:
|
|
16167
|
+
result: callInfoTyped,
|
|
16168
|
+
rawTx: tx,
|
|
16169
|
+
hash: buildTxHash(tx),
|
|
16170
|
+
txData: undefined
|
|
15787
16171
|
};
|
|
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
16172
|
}
|
|
15805
|
-
if (
|
|
15806
|
-
|
|
15807
|
-
|
|
15808
|
-
|
|
15809
|
-
|
|
16173
|
+
if (top != null) throw new IllegalArgumentError('Can\'t handle `top` option in on-chain contract call');
|
|
16174
|
+
if (contractId == null) throw new MissingContractAddressError('Can\'t call contract without address');
|
|
16175
|
+
const tx = await buildTxAsync({
|
|
16176
|
+
...opt,
|
|
16177
|
+
tag: Tag.ContractCallTx,
|
|
16178
|
+
gasLimit: (_opt$gasLimit2 = opt.gasLimit) !== null && _opt$gasLimit2 !== void 0 ? _opt$gasLimit2 : await this._estimateGas(fn, params, opt),
|
|
16179
|
+
callerId,
|
|
16180
|
+
contractId,
|
|
16181
|
+
callData
|
|
16182
|
+
});
|
|
16183
|
+
if (opt.onAccount == null) throw new IllegalArgumentError('Can\'t call contract on chain without account');
|
|
16184
|
+
return Contract_classPrivateMethodGet(this, _sendAndProcess, _sendAndProcess2).call(this, tx, fn, {
|
|
16185
|
+
...opt,
|
|
16186
|
+
onAccount: opt.onAccount
|
|
16187
|
+
});
|
|
15810
16188
|
}
|
|
15811
16189
|
|
|
15812
16190
|
/**
|
|
@@ -15817,31 +16195,6 @@ class Contract {
|
|
|
15817
16195
|
* @throws {@link MissingEventDefinitionError}
|
|
15818
16196
|
* @throws {@link AmbiguousEventDefinitionError}
|
|
15819
16197
|
*/
|
|
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
16198
|
|
|
15846
16199
|
/**
|
|
15847
16200
|
* Decode Events
|
|
@@ -15857,7 +16210,7 @@ class Contract {
|
|
|
15857
16210
|
const topics = event.topics.map(t => BigInt(t));
|
|
15858
16211
|
let contractName;
|
|
15859
16212
|
try {
|
|
15860
|
-
contractName = this.
|
|
16213
|
+
contractName = Contract_classPrivateMethodGet(this, _getContractNameByEvent, _getContractNameByEvent2).call(this, event.address, topics[0], opt);
|
|
15861
16214
|
} catch (error) {
|
|
15862
16215
|
if ((omitUnknown !== null && omitUnknown !== void 0 ? omitUnknown : false) && error instanceof MissingEventDefinitionError) return null;
|
|
15863
16216
|
throw error;
|
|
@@ -15939,9 +16292,22 @@ class Contract {
|
|
|
15939
16292
|
aci,
|
|
15940
16293
|
...otherOptions
|
|
15941
16294
|
}) {
|
|
16295
|
+
Contract_classPrivateMethodInitSpec(this, _getContractNameByEvent);
|
|
16296
|
+
Contract_classPrivateMethodInitSpec(this, _getFunctionAci);
|
|
16297
|
+
Contract_classPrivateMethodInitSpec(this, _sendAndProcess);
|
|
16298
|
+
Contract_classPrivateMethodInitSpec(this, _getCallResult);
|
|
16299
|
+
Contract_classPrivateFieldInitSpec(this, _aciContract, {
|
|
16300
|
+
writable: true,
|
|
16301
|
+
value: void 0
|
|
16302
|
+
});
|
|
15942
16303
|
this._aci = aci;
|
|
15943
|
-
|
|
15944
|
-
|
|
16304
|
+
const aciLast = aci[aci.length - 1];
|
|
16305
|
+
if (aciLast.contract == null) {
|
|
16306
|
+
throw new IllegalArgumentError(`The last 'aci' item should have 'contract' key, got ${Object.keys(aciLast)} keys instead`);
|
|
16307
|
+
}
|
|
16308
|
+
classPrivateFieldSet_default()(this, _aciContract, aciLast.contract);
|
|
16309
|
+
this._name = classPrivateFieldGet_default()(this, _aciContract).name;
|
|
16310
|
+
this._calldata = new aepp_calldata_.Encoder(aci);
|
|
15945
16311
|
this.$options = otherOptions;
|
|
15946
16312
|
|
|
15947
16313
|
/**
|
|
@@ -15958,7 +16324,7 @@ class Contract {
|
|
|
15958
16324
|
* await contract.testFunction({ callStatic: false }) // send tx on-chain
|
|
15959
16325
|
* ```
|
|
15960
16326
|
*/
|
|
15961
|
-
Object.assign(this, Object.fromEntries(this.
|
|
16327
|
+
Object.assign(this, Object.fromEntries(classPrivateFieldGet_default()(this, _aciContract).functions.map(({
|
|
15962
16328
|
name,
|
|
15963
16329
|
arguments: aciArgs,
|
|
15964
16330
|
stateful
|
|
@@ -15979,27 +16345,89 @@ class Contract {
|
|
|
15979
16345
|
})));
|
|
15980
16346
|
}
|
|
15981
16347
|
}
|
|
16348
|
+
function _getCallResult2({
|
|
16349
|
+
returnType,
|
|
16350
|
+
returnValue,
|
|
16351
|
+
log
|
|
16352
|
+
}, fnName, transaction, options) {
|
|
16353
|
+
let message;
|
|
16354
|
+
switch (returnType) {
|
|
16355
|
+
case 'ok':
|
|
16356
|
+
{
|
|
16357
|
+
const fnAci = Contract_classPrivateMethodGet(this, _getFunctionAci, _getFunctionAci2).call(this, fnName);
|
|
16358
|
+
return {
|
|
16359
|
+
decodedResult: this._calldata.decode(this._name, fnAci.name, returnValue),
|
|
16360
|
+
decodedEvents: this.$decodeEvents(log, options)
|
|
16361
|
+
};
|
|
16362
|
+
}
|
|
16363
|
+
case 'revert':
|
|
16364
|
+
message = this._calldata.decodeFateString(returnValue);
|
|
16365
|
+
break;
|
|
16366
|
+
case 'error':
|
|
16367
|
+
message = decode(returnValue).toString();
|
|
16368
|
+
break;
|
|
16369
|
+
default:
|
|
16370
|
+
throw new InternalError(`Unknown return type: ${returnType}`);
|
|
16371
|
+
}
|
|
16372
|
+
throw new NodeInvocationError(message, transaction);
|
|
16373
|
+
}
|
|
16374
|
+
async function _sendAndProcess2(tx, fnName, options) {
|
|
16375
|
+
const txData = await sendTransaction(tx, {
|
|
16376
|
+
...this.$options,
|
|
16377
|
+
...options
|
|
16378
|
+
});
|
|
16379
|
+
return {
|
|
16380
|
+
hash: txData.hash,
|
|
16381
|
+
tx: unpackTx(txData.rawTx),
|
|
16382
|
+
txData,
|
|
16383
|
+
rawTx: txData.rawTx,
|
|
16384
|
+
...(txData.blockHeight != null && (await this.$getCallResultByTxHash(txData.hash, fnName, options)))
|
|
16385
|
+
};
|
|
16386
|
+
}
|
|
16387
|
+
function _getFunctionAci2(name) {
|
|
16388
|
+
const fn = classPrivateFieldGet_default()(this, _aciContract).functions.find(f => f.name === name);
|
|
16389
|
+
if (fn != null) {
|
|
16390
|
+
return fn;
|
|
16391
|
+
}
|
|
16392
|
+
if (name === 'init') {
|
|
16393
|
+
return {
|
|
16394
|
+
arguments: [],
|
|
16395
|
+
name: 'init',
|
|
16396
|
+
payable: false,
|
|
16397
|
+
returns: 'unit',
|
|
16398
|
+
stateful: true
|
|
16399
|
+
};
|
|
16400
|
+
}
|
|
16401
|
+
throw new NoSuchContractFunctionError(`Function ${name} doesn't exist in contract`);
|
|
16402
|
+
}
|
|
16403
|
+
function _getContractNameByEvent2(ctAddress, nameHash, {
|
|
16404
|
+
contractAddressToName
|
|
16405
|
+
}) {
|
|
16406
|
+
const addressToName = {
|
|
16407
|
+
...this.$options.contractAddressToName,
|
|
16408
|
+
...contractAddressToName
|
|
16409
|
+
};
|
|
16410
|
+
if (addressToName[ctAddress] != null) return addressToName[ctAddress];
|
|
16411
|
+
|
|
16412
|
+
// TODO: consider using a third-party library
|
|
16413
|
+
const isEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
16414
|
+
const contracts = this._aci.map(({
|
|
16415
|
+
contract
|
|
16416
|
+
}) => contract).filter(contract => contract === null || contract === void 0 ? void 0 : contract.event);
|
|
16417
|
+
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)));
|
|
16418
|
+
switch (matchedEvents.length) {
|
|
16419
|
+
case 0:
|
|
16420
|
+
throw new MissingEventDefinitionError(nameHash.toString(), ctAddress);
|
|
16421
|
+
case 1:
|
|
16422
|
+
return matchedEvents[0][0];
|
|
16423
|
+
default:
|
|
16424
|
+
throw new AmbiguousEventDefinitionError(ctAddress, matchedEvents);
|
|
16425
|
+
}
|
|
16426
|
+
}
|
|
15982
16427
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
15983
16428
|
const ContractWithMethods = Contract;
|
|
15984
16429
|
/* harmony default export */ const contract_Contract = (ContractWithMethods);
|
|
15985
16430
|
;// 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
16431
|
/**
|
|
16004
16432
|
* Oracle methods - routines to interact with the æternity oracle system
|
|
16005
16433
|
*
|
|
@@ -16016,8 +16444,6 @@ const ContractWithMethods = Contract;
|
|
|
16016
16444
|
|
|
16017
16445
|
|
|
16018
16446
|
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
16447
|
/**
|
|
16022
16448
|
* Poll for oracle queries
|
|
16023
16449
|
* @category oracle
|
|
@@ -16041,10 +16467,10 @@ function pollForQueries(oracleId, onQuery, {
|
|
|
16041
16467
|
const queries = ((_await$onNode$getOrac = (await onNode.getOracleQueriesByPubkey(oracleId)).oracleQueries) !== null && _await$onNode$getOrac !== void 0 ? _await$onNode$getOrac : []).filter(({
|
|
16042
16468
|
id
|
|
16043
16469
|
}) => !knownQueryIds.has(id));
|
|
16044
|
-
queries.forEach(
|
|
16045
|
-
id
|
|
16046
|
-
|
|
16047
|
-
|
|
16470
|
+
queries.forEach(query => {
|
|
16471
|
+
knownQueryIds.add(query.id);
|
|
16472
|
+
onQuery(query);
|
|
16473
|
+
});
|
|
16048
16474
|
};
|
|
16049
16475
|
let stopped = false;
|
|
16050
16476
|
|
|
@@ -16113,7 +16539,7 @@ async function getQueryObject(oracleId, queryId, options) {
|
|
|
16113
16539
|
decodedResponse: decode(record.response).toString(),
|
|
16114
16540
|
respond: async (response, opt) =>
|
|
16115
16541
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
16116
|
-
respondToQuery(
|
|
16542
|
+
respondToQuery(queryId, response, {
|
|
16117
16543
|
...options,
|
|
16118
16544
|
...opt
|
|
16119
16545
|
}),
|
|
@@ -16140,12 +16566,13 @@ async function postQueryToOracle(oracleId, query, options) {
|
|
|
16140
16566
|
var _options$queryFee;
|
|
16141
16567
|
(_options$queryFee = options.queryFee) !== null && _options$queryFee !== void 0 ? _options$queryFee : options.queryFee = (await options.onNode.getOracleByPubkey(oracleId)).queryFee.toString();
|
|
16142
16568
|
const senderId = options.onAccount.address;
|
|
16143
|
-
const oracleQueryTx = await
|
|
16569
|
+
const oracleQueryTx = await buildTxAsync({
|
|
16144
16570
|
queryTtlType: QUERY_TTL.type,
|
|
16145
16571
|
queryTtlValue: QUERY_TTL.value,
|
|
16146
16572
|
responseTtlType: RESPONSE_TTL.type,
|
|
16147
16573
|
responseTtlValue: RESPONSE_TTL.value,
|
|
16148
16574
|
...options,
|
|
16575
|
+
tag: Tag.OracleQueryTx,
|
|
16149
16576
|
oracleId,
|
|
16150
16577
|
senderId,
|
|
16151
16578
|
query
|
|
@@ -16155,14 +16582,13 @@ async function postQueryToOracle(oracleId, query, options) {
|
|
|
16155
16582
|
} = unpackTx(oracleQueryTx, Tag.OracleQueryTx);
|
|
16156
16583
|
const queryId = oracleQueryId(senderId, nonce, oracleId);
|
|
16157
16584
|
return {
|
|
16158
|
-
...(await
|
|
16585
|
+
...(await sendTransaction(oracleQueryTx, options)),
|
|
16159
16586
|
...(await getQueryObject(oracleId, queryId, options))
|
|
16160
16587
|
};
|
|
16161
16588
|
}
|
|
16162
16589
|
/**
|
|
16163
16590
|
* Extend oracle ttl
|
|
16164
16591
|
* @category oracle
|
|
16165
|
-
* @param oracleId - Oracle public key
|
|
16166
16592
|
* @param options - Options object
|
|
16167
16593
|
* @param options.fee - fee Transaction fee
|
|
16168
16594
|
* @param options.ttl - Transaction time to leave
|
|
@@ -16170,16 +16596,17 @@ async function postQueryToOracle(oracleId, query, options) {
|
|
|
16170
16596
|
* @param options.oracleTtlValue - Oracle time to leave for extend
|
|
16171
16597
|
* @returns Oracle object
|
|
16172
16598
|
*/
|
|
16173
|
-
async function extendOracleTtl(
|
|
16174
|
-
const
|
|
16599
|
+
async function extendOracleTtl(options) {
|
|
16600
|
+
const oracleId = encode(decode(options.onAccount.address), Encoding.OracleAddress);
|
|
16601
|
+
const oracleExtendTx = await buildTxAsync({
|
|
16175
16602
|
oracleTtlType: ORACLE_TTL.type,
|
|
16176
16603
|
oracleTtlValue: ORACLE_TTL.value,
|
|
16177
16604
|
...options,
|
|
16178
|
-
|
|
16605
|
+
tag: Tag.OracleExtendTx,
|
|
16179
16606
|
oracleId
|
|
16180
16607
|
});
|
|
16181
16608
|
return {
|
|
16182
|
-
...(await
|
|
16609
|
+
...(await sendTransaction(oracleExtendTx, options)),
|
|
16183
16610
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
16184
16611
|
...(await getOracleObject(oracleId, options))
|
|
16185
16612
|
};
|
|
@@ -16187,7 +16614,6 @@ async function extendOracleTtl(oracleId, options) {
|
|
|
16187
16614
|
/**
|
|
16188
16615
|
* Extend oracle ttl
|
|
16189
16616
|
* @category oracle
|
|
16190
|
-
* @param oracleId - Oracle public key
|
|
16191
16617
|
* @param queryId - Oracle query id
|
|
16192
16618
|
* @param response - Oracle query response
|
|
16193
16619
|
* @param options - Options object
|
|
@@ -16196,18 +16622,19 @@ async function extendOracleTtl(oracleId, options) {
|
|
|
16196
16622
|
* @param options.ttl - Transaction time to leave
|
|
16197
16623
|
* @returns Oracle object
|
|
16198
16624
|
*/
|
|
16199
|
-
async function respondToQuery(
|
|
16200
|
-
const
|
|
16625
|
+
async function respondToQuery(queryId, response, options) {
|
|
16626
|
+
const oracleId = encode(decode(options.onAccount.address), Encoding.OracleAddress);
|
|
16627
|
+
const oracleRespondTx = await buildTxAsync({
|
|
16201
16628
|
responseTtlType: RESPONSE_TTL.type,
|
|
16202
16629
|
responseTtlValue: RESPONSE_TTL.value,
|
|
16203
16630
|
...options,
|
|
16204
|
-
|
|
16631
|
+
tag: Tag.OracleResponseTx,
|
|
16205
16632
|
oracleId,
|
|
16206
16633
|
queryId,
|
|
16207
16634
|
response
|
|
16208
16635
|
});
|
|
16209
16636
|
return {
|
|
16210
|
-
...(await
|
|
16637
|
+
...(await sendTransaction(oracleRespondTx, options)),
|
|
16211
16638
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
16212
16639
|
...(await getOracleObject(oracleId, options))
|
|
16213
16640
|
};
|
|
@@ -16237,7 +16664,7 @@ async function getOracleObject(oracleId, options) {
|
|
|
16237
16664
|
...lastArg
|
|
16238
16665
|
});
|
|
16239
16666
|
} else args.push(options);
|
|
16240
|
-
return handler(oracleId, ...args);
|
|
16667
|
+
return handler(...(['extendOracle', 'respondToQuery'].includes(name) ? [] : [oracleId]), ...args);
|
|
16241
16668
|
}])
|
|
16242
16669
|
};
|
|
16243
16670
|
}
|
|
@@ -16254,40 +16681,106 @@ async function getOracleObject(oracleId, options) {
|
|
|
16254
16681
|
* @param options.ttl - Transaction time to leave
|
|
16255
16682
|
* @returns Oracle object
|
|
16256
16683
|
*/
|
|
16257
|
-
async function registerOracle(queryFormat, responseFormat, options) {
|
|
16258
|
-
const accountId = options.onAccount.address;
|
|
16259
|
-
const oracleRegisterTx = await
|
|
16260
|
-
|
|
16261
|
-
|
|
16262
|
-
|
|
16684
|
+
async function registerOracle(queryFormat, responseFormat, options) {
|
|
16685
|
+
const accountId = options.onAccount.address;
|
|
16686
|
+
const oracleRegisterTx = await buildTxAsync({
|
|
16687
|
+
oracleTtlValue: ORACLE_TTL.value,
|
|
16688
|
+
oracleTtlType: ORACLE_TTL.type,
|
|
16689
|
+
...options,
|
|
16690
|
+
tag: Tag.OracleRegisterTx,
|
|
16691
|
+
accountId,
|
|
16692
|
+
queryFormat,
|
|
16693
|
+
responseFormat
|
|
16694
|
+
});
|
|
16695
|
+
return {
|
|
16696
|
+
...(await sendTransaction(oracleRegisterTx, options)),
|
|
16697
|
+
...(await getOracleObject(encode(decode(accountId), Encoding.OracleAddress), options))
|
|
16698
|
+
};
|
|
16699
|
+
}
|
|
16700
|
+
;// CONCATENATED MODULE: ./src/spend.ts
|
|
16701
|
+
|
|
16702
|
+
|
|
16703
|
+
|
|
16704
|
+
|
|
16705
|
+
|
|
16706
|
+
/**
|
|
16707
|
+
* Send coins to another account
|
|
16708
|
+
* @category chain
|
|
16709
|
+
* @param amount - Amount to spend
|
|
16710
|
+
* @param recipientIdOrName - Address or name of recipient account
|
|
16711
|
+
* @param options - Options
|
|
16712
|
+
* @returns Transaction
|
|
16713
|
+
*/
|
|
16714
|
+
async function spend(amount, recipientIdOrName, options) {
|
|
16715
|
+
return sendTransaction(await buildTxAsync({
|
|
16716
|
+
...options,
|
|
16717
|
+
tag: Tag.SpendTx,
|
|
16718
|
+
senderId: options.onAccount.address,
|
|
16719
|
+
recipientId: await resolveName(recipientIdOrName, 'account_pubkey', options),
|
|
16720
|
+
amount
|
|
16721
|
+
}), options);
|
|
16722
|
+
}
|
|
16723
|
+
// TODO: Rename to spendFraction
|
|
16724
|
+
/**
|
|
16725
|
+
* Spend a fraction of coin balance to another account. Useful if needed to drain account balance
|
|
16726
|
+
* completely, sending funds to another account (with fraction set to 1).
|
|
16727
|
+
* @category chain
|
|
16728
|
+
* @param fraction - Fraction of balance to spend (between 0 and 1)
|
|
16729
|
+
* @param recipientIdOrName - Address or name of recipient account
|
|
16730
|
+
* @param options - Options
|
|
16731
|
+
* @example
|
|
16732
|
+
* ```js
|
|
16733
|
+
* // `fraction` * 100 = % of AE to be transferred (e.g. `0.42` for 42% or `1` for 100%)
|
|
16734
|
+
* const { blockHeight } = await aeSdk.transferFunds(
|
|
16735
|
+
* 0.42,
|
|
16736
|
+
* 'ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E',
|
|
16737
|
+
* );
|
|
16738
|
+
* console.log('Transaction mined at', blockHeight);
|
|
16739
|
+
* ```
|
|
16740
|
+
*/
|
|
16741
|
+
async function transferFunds(fraction, recipientIdOrName, options) {
|
|
16742
|
+
if (fraction < 0 || fraction > 1) {
|
|
16743
|
+
throw new ArgumentError('fraction', 'a number between 0 and 1', fraction);
|
|
16744
|
+
}
|
|
16745
|
+
const recipientId = await resolveName(recipientIdOrName, 'account_pubkey', options);
|
|
16746
|
+
const senderId = options.onAccount.address;
|
|
16747
|
+
const balance = new (external_bignumber_js_default())(await getBalance.bind(options.onAccount)(senderId, options));
|
|
16748
|
+
const desiredAmount = balance.times(fraction).integerValue((external_bignumber_js_default()).ROUND_HALF_UP);
|
|
16749
|
+
const {
|
|
16750
|
+
fee
|
|
16751
|
+
} = unpackTx(await buildTxAsync({
|
|
16752
|
+
...options,
|
|
16753
|
+
tag: Tag.SpendTx,
|
|
16754
|
+
senderId,
|
|
16755
|
+
recipientId,
|
|
16756
|
+
amount: desiredAmount
|
|
16757
|
+
}), Tag.SpendTx);
|
|
16758
|
+
// Reducing of the amount may reduce transaction fee, so this is not completely accurate
|
|
16759
|
+
const amount = desiredAmount.plus(fee).gt(balance) ? balance.minus(fee) : desiredAmount;
|
|
16760
|
+
return sendTransaction(await buildTxAsync({
|
|
16761
|
+
...options,
|
|
16762
|
+
tag: Tag.SpendTx,
|
|
16763
|
+
senderId,
|
|
16764
|
+
recipientId,
|
|
16765
|
+
amount
|
|
16766
|
+
}), options);
|
|
16767
|
+
}
|
|
16768
|
+
/**
|
|
16769
|
+
* Submit transaction of another account paying for it (fee and gas)
|
|
16770
|
+
* @category chain
|
|
16771
|
+
* @param transaction - tx_<base64>-encoded transaction
|
|
16772
|
+
* @param options - Options
|
|
16773
|
+
* @returns Object Transaction
|
|
16774
|
+
*/
|
|
16775
|
+
async function payForTransaction(transaction, options) {
|
|
16776
|
+
return sendTransaction(await buildTxAsync({
|
|
16263
16777
|
...options,
|
|
16264
|
-
|
|
16265
|
-
|
|
16266
|
-
|
|
16267
|
-
});
|
|
16268
|
-
return {
|
|
16269
|
-
...(await send(oracleRegisterTx, options)),
|
|
16270
|
-
...(await getOracleObject(encode(decode(accountId), Encoding.OracleAddress), options))
|
|
16271
|
-
};
|
|
16778
|
+
tag: Tag.PayingForTx,
|
|
16779
|
+
payerId: options.onAccount.address,
|
|
16780
|
+
tx: transaction
|
|
16781
|
+
}), options);
|
|
16272
16782
|
}
|
|
16273
16783
|
;// 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
16784
|
/**
|
|
16292
16785
|
* Generalized Account module - routines to use generalized account
|
|
16293
16786
|
*/
|
|
@@ -16300,8 +16793,6 @@ async function registerOracle(queryFormat, responseFormat, options) {
|
|
|
16300
16793
|
|
|
16301
16794
|
|
|
16302
16795
|
|
|
16303
|
-
|
|
16304
|
-
|
|
16305
16796
|
/**
|
|
16306
16797
|
* Convert current account to GA
|
|
16307
16798
|
* @category contract
|
|
@@ -16339,8 +16830,9 @@ async function createGeneralizedAccount(authFnName, args, {
|
|
|
16339
16830
|
sourceCode,
|
|
16340
16831
|
fileSystem
|
|
16341
16832
|
});
|
|
16342
|
-
const tx = await
|
|
16833
|
+
const tx = await buildTxAsync({
|
|
16343
16834
|
...options,
|
|
16835
|
+
tag: Tag.GaAttachTx,
|
|
16344
16836
|
onNode,
|
|
16345
16837
|
code: await contract.$compile(),
|
|
16346
16838
|
gasLimit: (_options$gasLimit = options.gasLimit) !== null && _options$gasLimit !== void 0 ? _options$gasLimit : await contract._estimateGas('init', args, options),
|
|
@@ -16352,7 +16844,7 @@ async function createGeneralizedAccount(authFnName, args, {
|
|
|
16352
16844
|
const {
|
|
16353
16845
|
hash: transaction,
|
|
16354
16846
|
rawTx
|
|
16355
|
-
} = await
|
|
16847
|
+
} = await sendTransaction(tx, {
|
|
16356
16848
|
onNode,
|
|
16357
16849
|
onAccount,
|
|
16358
16850
|
onCompiler,
|
|
@@ -16366,21 +16858,103 @@ async function createGeneralizedAccount(authFnName, args, {
|
|
|
16366
16858
|
});
|
|
16367
16859
|
}
|
|
16368
16860
|
/**
|
|
16369
|
-
* Build a transaction hash the same as `Auth.tx_hash`
|
|
16861
|
+
* Build a transaction hash the same as `Auth.tx_hash` by GaMetaTx payload
|
|
16370
16862
|
* @category contract
|
|
16371
16863
|
* @param transaction - tx-encoded transaction
|
|
16372
16864
|
* @param options - Options
|
|
16865
|
+
* @param options.fee - GaMetaTx fee, required in Ceres
|
|
16866
|
+
* @param options.gasPrice - GaMetaTx gasPrice, required in Ceres
|
|
16373
16867
|
* @param options.onNode - Node to use
|
|
16374
16868
|
* @returns Transaction hash
|
|
16375
16869
|
*/
|
|
16376
16870
|
async function buildAuthTxHash(transaction, {
|
|
16871
|
+
fee,
|
|
16872
|
+
gasPrice,
|
|
16873
|
+
onNode
|
|
16874
|
+
}) {
|
|
16875
|
+
const {
|
|
16876
|
+
nodeNetworkId,
|
|
16877
|
+
consensusProtocolVersion
|
|
16878
|
+
} = await onNode.getNodeInfo();
|
|
16879
|
+
let payload = hash(concatBuffers([Buffer.from(nodeNetworkId), decode(transaction)]));
|
|
16880
|
+
if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
|
|
16881
|
+
if (fee == null) throw new ArgumentError('fee', 'provided (in Ceres)', fee);
|
|
16882
|
+
if (gasPrice == null) throw new ArgumentError('gasPrice', 'provided (in Ceres)', gasPrice);
|
|
16883
|
+
payload = hash(decode(buildTx({
|
|
16884
|
+
tag: Tag.GaMetaTxAuthData,
|
|
16885
|
+
fee,
|
|
16886
|
+
gasPrice,
|
|
16887
|
+
txHash: encode(payload, Encoding.TxHash)
|
|
16888
|
+
})));
|
|
16889
|
+
}
|
|
16890
|
+
return payload;
|
|
16891
|
+
}
|
|
16892
|
+
|
|
16893
|
+
/**
|
|
16894
|
+
* Build a transaction hash the same as `Auth.tx_hash` by GaMetaTx
|
|
16895
|
+
* @category contract
|
|
16896
|
+
* @param transaction - tx-encoded signed GaMeta transaction
|
|
16897
|
+
* @param options - Options
|
|
16898
|
+
* @param options.onNode - Node to use
|
|
16899
|
+
* @returns Transaction hash
|
|
16900
|
+
*/
|
|
16901
|
+
async function buildAuthTxHashByGaMetaTx(transaction, {
|
|
16377
16902
|
onNode
|
|
16378
16903
|
}) {
|
|
16379
|
-
|
|
16904
|
+
const txParams = unpackTx(transaction, Tag.SignedTx);
|
|
16905
|
+
if (txParams.encodedTx.tag !== Tag.GaMetaTx) {
|
|
16906
|
+
throw new ArgumentError('transaction', 'to include GaMetaTx', Tag[txParams.encodedTx.tag]);
|
|
16907
|
+
}
|
|
16908
|
+
return buildAuthTxHash(buildTx(txParams.encodedTx.tx.encodedTx), {
|
|
16909
|
+
fee: txParams.encodedTx.fee,
|
|
16910
|
+
gasPrice: txParams.encodedTx.gasPrice,
|
|
16911
|
+
onNode
|
|
16912
|
+
});
|
|
16380
16913
|
}
|
|
16381
16914
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/helpers/defineProperty.js
|
|
16382
16915
|
var defineProperty = __webpack_require__(1125);
|
|
16383
16916
|
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
|
|
16917
|
+
;// CONCATENATED MODULE: ./src/contract/delegation-signature.ts
|
|
16918
|
+
|
|
16919
|
+
|
|
16920
|
+
|
|
16921
|
+
/**
|
|
16922
|
+
* Helper to generate a signature to delegate
|
|
16923
|
+
* - pre-claim/claim/transfer/revoke of a name to a contract.
|
|
16924
|
+
* - register/extend/respond of an Oracle to a contract.
|
|
16925
|
+
* @category contract
|
|
16926
|
+
* @param contractAddress - Address of contract to delegate access
|
|
16927
|
+
* @param ids - The list of id's to prepend
|
|
16928
|
+
* @param options - Options
|
|
16929
|
+
* @param options.omitAddress - Prepend delegation signature with an account address
|
|
16930
|
+
* @param options.onAccount - Account to use
|
|
16931
|
+
* @param options.onNode - Node to use
|
|
16932
|
+
* @returns Signature
|
|
16933
|
+
* @example
|
|
16934
|
+
* ```js
|
|
16935
|
+
* const aeSdk = new AeSdk({ ... })
|
|
16936
|
+
* const contractAddress = 'ct_asd2ks...'
|
|
16937
|
+
* const aensName = 'example.chain'
|
|
16938
|
+
* const onAccount = new MemoryAccount(...) // Sign with a specific account
|
|
16939
|
+
* // Preclaim signature
|
|
16940
|
+
* const preclaimSig = await aeSdk.createDelegationSignature(contractAddress, [], { onAccount })
|
|
16941
|
+
* // Claim, transfer and revoke signature
|
|
16942
|
+
* const aensDelegationSig = await aeSdk
|
|
16943
|
+
* .createDelegationSignature(contractAddress, [aensName], { onAccount })
|
|
16944
|
+
*
|
|
16945
|
+
* const oracleQueryId = 'oq_...'
|
|
16946
|
+
* const onAccount = new MemoryAccount(...) // Sign with a specific account
|
|
16947
|
+
* // Oracle register and extend signature
|
|
16948
|
+
* const oracleDelegationSig = await aeSdk
|
|
16949
|
+
* .createDelegationSignature(contractAddress, [], { onAccount })
|
|
16950
|
+
* // Oracle respond signature
|
|
16951
|
+
* const respondSig = await aeSdk
|
|
16952
|
+
* .createDelegationSignature(contractAddress, [oracleQueryId], { onAccount, omitAddress: true })
|
|
16953
|
+
* ```
|
|
16954
|
+
*/
|
|
16955
|
+
async function createDelegationSignature(contractAddress, ids, options) {
|
|
16956
|
+
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);
|
|
16957
|
+
}
|
|
16384
16958
|
;// CONCATENATED MODULE: ./src/AeSdkMethods.ts
|
|
16385
16959
|
|
|
16386
16960
|
|
|
@@ -16417,6 +16991,7 @@ const methods = {
|
|
|
16417
16991
|
...aens_namespaceObject,
|
|
16418
16992
|
...spend_namespaceObject,
|
|
16419
16993
|
...oracle_namespaceObject,
|
|
16994
|
+
createDelegationSignature: createDelegationSignature,
|
|
16420
16995
|
...ga_namespaceObject
|
|
16421
16996
|
};
|
|
16422
16997
|
/**
|
|
@@ -16437,9 +17012,7 @@ class AeSdkMethods {
|
|
|
16437
17012
|
* @param options - Options
|
|
16438
17013
|
*/
|
|
16439
17014
|
constructor(options = {}) {
|
|
16440
|
-
defineProperty_default()(this, "_options", {
|
|
16441
|
-
denomination: AE_AMOUNT_FORMATS.AETTOS
|
|
16442
|
-
});
|
|
17015
|
+
defineProperty_default()(this, "_options", {});
|
|
16443
17016
|
Object.assign(this._options, options);
|
|
16444
17017
|
}
|
|
16445
17018
|
|
|
@@ -16459,9 +17032,8 @@ class AeSdkMethods {
|
|
|
16459
17032
|
onAccount: getValueOrErrorProxy(() => this._resolveAccount())
|
|
16460
17033
|
};
|
|
16461
17034
|
}
|
|
16462
|
-
async buildTx(
|
|
16463
|
-
|
|
16464
|
-
return _buildTx(txType, {
|
|
17035
|
+
async buildTx(options) {
|
|
17036
|
+
return buildTxAsync({
|
|
16465
17037
|
...this._getOptions(),
|
|
16466
17038
|
...options
|
|
16467
17039
|
});
|
|
@@ -16718,29 +17290,6 @@ class AeSdk extends AeSdkBase {
|
|
|
16718
17290
|
this.selectedAddress = address;
|
|
16719
17291
|
}
|
|
16720
17292
|
}
|
|
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
17293
|
;// CONCATENATED MODULE: ./src/aepp-wallet-communication/schema.ts
|
|
16745
17294
|
|
|
16746
17295
|
// eslint-disable-next-line max-classes-per-file
|
|
@@ -17025,6 +17574,10 @@ var _processResponse = /*#__PURE__*/new WeakSet();
|
|
|
17025
17574
|
*/
|
|
17026
17575
|
class RpcClient {
|
|
17027
17576
|
constructor(connection, onDisconnect, methods) {
|
|
17577
|
+
/**
|
|
17578
|
+
* Process response message
|
|
17579
|
+
* @param msg - Message object
|
|
17580
|
+
*/
|
|
17028
17581
|
RpcClient_classPrivateMethodInitSpec(this, _processResponse);
|
|
17029
17582
|
RpcClient_classPrivateMethodInitSpec(this, _sendResponse);
|
|
17030
17583
|
RpcClient_classPrivateMethodInitSpec(this, _sendRequest);
|
|
@@ -17069,11 +17622,6 @@ class RpcClient {
|
|
|
17069
17622
|
notify(name, params) {
|
|
17070
17623
|
RpcClient_classPrivateMethodGet(this, _sendRequest, _sendRequest2).call(this, undefined, name, params);
|
|
17071
17624
|
}
|
|
17072
|
-
|
|
17073
|
-
/**
|
|
17074
|
-
* Process response message
|
|
17075
|
-
* @param msg - Message object
|
|
17076
|
-
*/
|
|
17077
17625
|
}
|
|
17078
17626
|
async function _handleMessage2(msg, origin) {
|
|
17079
17627
|
if ((msg === null || msg === void 0 ? void 0 : msg.jsonrpc) !== '2.0') throw new InvalidRpcMessageError(JSON.stringify(msg));
|
|
@@ -17506,7 +18054,7 @@ class AeSdkWallet extends AeSdk {
|
|
|
17506
18054
|
}
|
|
17507
18055
|
try {
|
|
17508
18056
|
return json_big.parse(json_big.stringify({
|
|
17509
|
-
transactionHash: await this.
|
|
18057
|
+
transactionHash: await this.sendTransaction(tx, {
|
|
17510
18058
|
...parameters,
|
|
17511
18059
|
verify: false
|
|
17512
18060
|
})
|
|
@@ -17578,105 +18126,11 @@ class AeSdkWallet extends AeSdk {
|
|
|
17578
18126
|
};
|
|
17579
18127
|
}
|
|
17580
18128
|
}
|
|
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
18129
|
;// CONCATENATED MODULE: ./src/account/Generalized.ts
|
|
17659
18130
|
|
|
17660
18131
|
|
|
17661
18132
|
function Generalized_classPrivateFieldInitSpec(obj, privateMap, value) { Generalized_checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
17662
18133
|
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
18134
|
|
|
17681
18135
|
|
|
17682
18136
|
|
|
@@ -17724,8 +18178,10 @@ class AccountGeneralized extends AccountBase {
|
|
|
17724
18178
|
callData,
|
|
17725
18179
|
sourceCode,
|
|
17726
18180
|
args,
|
|
17727
|
-
|
|
17728
|
-
|
|
18181
|
+
fee,
|
|
18182
|
+
gasLimit,
|
|
18183
|
+
gasPrice
|
|
18184
|
+
} = typeof authData === 'function' ? await authData(tx) : authData;
|
|
17729
18185
|
const authCallData = callData !== null && callData !== void 0 ? callData : await (async () => {
|
|
17730
18186
|
if (classPrivateFieldGet_default()(this, _authFun) == null) {
|
|
17731
18187
|
const account = await getAccount(this.address, {
|
|
@@ -17749,16 +18205,18 @@ class AccountGeneralized extends AccountBase {
|
|
|
17749
18205
|
});
|
|
17750
18206
|
return contract._calldata.encode(contract._name, classPrivateFieldGet_default()(this, _authFun), args);
|
|
17751
18207
|
})();
|
|
17752
|
-
const gaMetaTx = await
|
|
17753
|
-
|
|
18208
|
+
const gaMetaTx = await buildTxAsync({
|
|
18209
|
+
tag: Tag.GaMetaTx,
|
|
18210
|
+
tx: {
|
|
17754
18211
|
tag: Tag.SignedTx,
|
|
17755
18212
|
encodedTx: decode(tx),
|
|
17756
18213
|
signatures: []
|
|
17757
|
-
}
|
|
18214
|
+
},
|
|
17758
18215
|
gaId: this.address,
|
|
17759
18216
|
authData: authCallData,
|
|
18217
|
+
fee,
|
|
17760
18218
|
gasLimit,
|
|
17761
|
-
|
|
18219
|
+
gasPrice,
|
|
17762
18220
|
onNode
|
|
17763
18221
|
});
|
|
17764
18222
|
return buildTx({
|
|
@@ -18099,10 +18557,10 @@ const ErrorPos = {
|
|
|
18099
18557
|
}
|
|
18100
18558
|
}
|
|
18101
18559
|
};
|
|
18102
|
-
const
|
|
18560
|
+
const CompileResult = {
|
|
18103
18561
|
type: {
|
|
18104
18562
|
name: "Composite",
|
|
18105
|
-
className: "
|
|
18563
|
+
className: "CompileResult",
|
|
18106
18564
|
modelProperties: {
|
|
18107
18565
|
bytecode: {
|
|
18108
18566
|
serializedName: "bytecode",
|
|
@@ -18110,6 +18568,23 @@ const mappers_ByteCode = {
|
|
|
18110
18568
|
type: {
|
|
18111
18569
|
name: "String"
|
|
18112
18570
|
}
|
|
18571
|
+
},
|
|
18572
|
+
aci: {
|
|
18573
|
+
serializedName: "aci",
|
|
18574
|
+
required: true,
|
|
18575
|
+
type: {
|
|
18576
|
+
name: "Sequence",
|
|
18577
|
+
element: {
|
|
18578
|
+
type: {
|
|
18579
|
+
name: "Dictionary",
|
|
18580
|
+
value: {
|
|
18581
|
+
type: {
|
|
18582
|
+
name: "any"
|
|
18583
|
+
}
|
|
18584
|
+
}
|
|
18585
|
+
}
|
|
18586
|
+
}
|
|
18587
|
+
}
|
|
18113
18588
|
}
|
|
18114
18589
|
}
|
|
18115
18590
|
}
|
|
@@ -18583,7 +19058,6 @@ const body7 = {
|
|
|
18583
19058
|
|
|
18584
19059
|
|
|
18585
19060
|
|
|
18586
|
-
|
|
18587
19061
|
class Compiler extends core_client_.ServiceClient {
|
|
18588
19062
|
/**
|
|
18589
19063
|
* Initializes a new instance of the Compiler class.
|
|
@@ -18591,7 +19065,7 @@ class Compiler extends core_client_.ServiceClient {
|
|
|
18591
19065
|
* @param options The parameter options
|
|
18592
19066
|
*/
|
|
18593
19067
|
constructor($host, options) {
|
|
18594
|
-
var _ref, _options$endpoint
|
|
19068
|
+
var _ref, _options$endpoint;
|
|
18595
19069
|
if ($host === undefined) {
|
|
18596
19070
|
throw new Error("'$host' cannot be null");
|
|
18597
19071
|
}
|
|
@@ -18611,24 +19085,9 @@ class Compiler extends core_client_.ServiceClient {
|
|
|
18611
19085
|
userAgentOptions: {
|
|
18612
19086
|
userAgentPrefix
|
|
18613
19087
|
},
|
|
18614
|
-
|
|
19088
|
+
endpoint: (_ref = (_options$endpoint = options.endpoint) !== null && _options$endpoint !== void 0 ? _options$endpoint : options.baseUri) !== null && _ref !== void 0 ? _ref : "{$host}"
|
|
18615
19089
|
};
|
|
18616
19090
|
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
19091
|
// Parameter assignments
|
|
18633
19092
|
this.$host = $host;
|
|
18634
19093
|
}
|
|
@@ -18646,7 +19105,7 @@ class Compiler extends core_client_.ServiceClient {
|
|
|
18646
19105
|
}
|
|
18647
19106
|
|
|
18648
19107
|
/**
|
|
18649
|
-
* Compile a sophia contract from source and return byte code
|
|
19108
|
+
* Compile a sophia contract from source and return byte code and ACI
|
|
18650
19109
|
* @param body contract code
|
|
18651
19110
|
* @param options The options parameters.
|
|
18652
19111
|
*/
|
|
@@ -18818,7 +19277,7 @@ const compileContractOperationSpec = {
|
|
|
18818
19277
|
httpMethod: "POST",
|
|
18819
19278
|
responses: {
|
|
18820
19279
|
200: {
|
|
18821
|
-
bodyMapper:
|
|
19280
|
+
bodyMapper: CompileResult
|
|
18822
19281
|
},
|
|
18823
19282
|
400: {
|
|
18824
19283
|
bodyMapper: {
|
|
@@ -19095,22 +19554,6 @@ const apiOperationSpec = {
|
|
|
19095
19554
|
serializer: compiler_serializer
|
|
19096
19555
|
};
|
|
19097
19556
|
;// 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
19557
|
|
|
19115
19558
|
|
|
19116
19559
|
|
|
@@ -19143,7 +19586,7 @@ class CompilerHttp extends CompilerBase {
|
|
|
19143
19586
|
}${body.info != null ? ` (${JSON.stringify(body.info)})` : ''}`;
|
|
19144
19587
|
}
|
|
19145
19588
|
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')}`;
|
|
19589
|
+
message += `\n${body.map(e => `${e.type}:${e.pos.line}:${e.pos.col}: ${e.message}${e.context != null ? ` (${e.context})` : ''}`).join('\n')}`;
|
|
19147
19590
|
}
|
|
19148
19591
|
return message;
|
|
19149
19592
|
})]
|
|
@@ -19151,28 +19594,20 @@ class CompilerHttp extends CompilerBase {
|
|
|
19151
19594
|
if (ignoreVersion !== true) {
|
|
19152
19595
|
const versionPromise = this.api.apiVersion().then(({
|
|
19153
19596
|
apiVersion
|
|
19154
|
-
}) => apiVersion);
|
|
19155
|
-
this.api.pipeline.addPolicy(genVersionCheckPolicy('compiler', '/api-version', versionPromise, '7.
|
|
19597
|
+
}) => apiVersion, error => error);
|
|
19598
|
+
this.api.pipeline.addPolicy(genVersionCheckPolicy('compiler', '/api-version', versionPromise, '7.1.1', '8.0.0'));
|
|
19156
19599
|
}
|
|
19157
19600
|
}
|
|
19158
19601
|
async compileBySourceCode(sourceCode, fileSystem) {
|
|
19159
19602
|
try {
|
|
19160
|
-
const
|
|
19161
|
-
code: sourceCode,
|
|
19162
|
-
options: {
|
|
19163
|
-
fileSystem
|
|
19164
|
-
}
|
|
19165
|
-
}).then(res => res.bytecode), this.api.generateACI({
|
|
19603
|
+
const res = await this.api.compileContract({
|
|
19166
19604
|
code: sourceCode,
|
|
19167
19605
|
options: {
|
|
19168
19606
|
fileSystem
|
|
19169
19607
|
}
|
|
19170
|
-
})
|
|
19608
|
+
});
|
|
19171
19609
|
// TODO: should be fixed when the compiledAci interface gets updated
|
|
19172
|
-
return
|
|
19173
|
-
bytecode,
|
|
19174
|
-
aci: aci
|
|
19175
|
-
};
|
|
19610
|
+
return res;
|
|
19176
19611
|
} catch (error) {
|
|
19177
19612
|
if (error instanceof core_rest_pipeline_.RestError && error.statusCode === 400) {
|
|
19178
19613
|
throw new CompilerError(error.message.replace(/^aci error:/, 'compile error:'));
|
|
@@ -19209,23 +19644,6 @@ class CompilerHttp extends CompilerBase {
|
|
|
19209
19644
|
}
|
|
19210
19645
|
}
|
|
19211
19646
|
;// 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
19647
|
/**
|
|
19230
19648
|
* Convert string from snake_case to PascalCase
|
|
19231
19649
|
* @param s - String to convert
|
|
@@ -19246,22 +19664,7 @@ function pascalToSnake(s) {
|
|
|
19246
19664
|
// EXTERNAL MODULE: external "websocket"
|
|
19247
19665
|
var external_websocket_ = __webpack_require__(8079);
|
|
19248
19666
|
;// 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
|
-
*/
|
|
19667
|
+
|
|
19265
19668
|
|
|
19266
19669
|
|
|
19267
19670
|
|
|
@@ -19299,7 +19702,7 @@ function changeState(channel, newState) {
|
|
|
19299
19702
|
channel._state = newState;
|
|
19300
19703
|
emit(channel, 'stateChanged', newState);
|
|
19301
19704
|
}
|
|
19302
|
-
function
|
|
19705
|
+
function send(channel, message) {
|
|
19303
19706
|
if (channel._options.debug) console.log('Send message: ', message);
|
|
19304
19707
|
channel._websocket.send(json_big.stringify({
|
|
19305
19708
|
jsonrpc: '2.0',
|
|
@@ -19307,7 +19710,7 @@ function internal_send(channel, message) {
|
|
|
19307
19710
|
}));
|
|
19308
19711
|
}
|
|
19309
19712
|
function notify(channel, method, params = {}) {
|
|
19310
|
-
|
|
19713
|
+
send(channel, {
|
|
19311
19714
|
method,
|
|
19312
19715
|
params
|
|
19313
19716
|
});
|
|
@@ -19345,11 +19748,23 @@ async function enqueueAction(channel, guard, action) {
|
|
|
19345
19748
|
return promise;
|
|
19346
19749
|
}
|
|
19347
19750
|
async function handleMessage(channel, message) {
|
|
19751
|
+
var _message$params, _message$params$data, _message$params$data$, _message$params$data$2;
|
|
19348
19752
|
const {
|
|
19349
19753
|
handler,
|
|
19350
19754
|
state: st
|
|
19351
19755
|
} = channel._fsm;
|
|
19352
|
-
|
|
19756
|
+
const nextState = await Promise.resolve(handler(channel, message, st));
|
|
19757
|
+
enterState(channel, nextState);
|
|
19758
|
+
// TODO: emit message and handler name (?) to move this code to Contract constructor
|
|
19759
|
+
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'
|
|
19760
|
+
// if name is channelOpen, the contract was created by other participant
|
|
19761
|
+
&& (nextState === null || nextState === void 0 ? void 0 : nextState.handler.name) === 'channelOpen') {
|
|
19762
|
+
var _message$params2, _message$params2$data, _message$params2$data2, _message$params2$data3;
|
|
19763
|
+
const round = channel.round();
|
|
19764
|
+
if (round == null) throw new UnexpectedTsError('Round is null');
|
|
19765
|
+
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;
|
|
19766
|
+
emit(channel, 'newContract', encodeContractAddress(owner, round + 1));
|
|
19767
|
+
}
|
|
19353
19768
|
}
|
|
19354
19769
|
async function dequeueMessage(channel) {
|
|
19355
19770
|
if (channel._isMessageQueueLocked) return;
|
|
@@ -19421,7 +19836,7 @@ async function call(channel, method, params) {
|
|
|
19421
19836
|
reject(new ChannelCallError(message.error.message + details));
|
|
19422
19837
|
} else resolve(message.result);
|
|
19423
19838
|
});
|
|
19424
|
-
|
|
19839
|
+
send(channel, {
|
|
19425
19840
|
method,
|
|
19426
19841
|
id,
|
|
19427
19842
|
params
|
|
@@ -19457,7 +19872,10 @@ async function initialize(channel, connectionHandler, openHandler, {
|
|
|
19457
19872
|
const {
|
|
19458
19873
|
signedTx
|
|
19459
19874
|
} = await channel.state();
|
|
19460
|
-
|
|
19875
|
+
if (signedTx == null) {
|
|
19876
|
+
throw new ChannelError('`signedTx` missed in state while reconnection');
|
|
19877
|
+
}
|
|
19878
|
+
changeState(channel, buildTx(signedTx));
|
|
19461
19879
|
}
|
|
19462
19880
|
ping(channel);
|
|
19463
19881
|
},
|
|
@@ -19472,22 +19890,6 @@ async function initialize(channel, connectionHandler, openHandler, {
|
|
|
19472
19890
|
});
|
|
19473
19891
|
}
|
|
19474
19892
|
;// 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
19893
|
/* eslint-disable consistent-return */
|
|
19492
19894
|
/* eslint-disable default-case */
|
|
19493
19895
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
@@ -19496,6 +19898,7 @@ async function initialize(channel, connectionHandler, openHandler, {
|
|
|
19496
19898
|
|
|
19497
19899
|
|
|
19498
19900
|
|
|
19901
|
+
|
|
19499
19902
|
async function appendSignature(tx, signFn) {
|
|
19500
19903
|
const {
|
|
19501
19904
|
signatures,
|
|
@@ -19615,7 +20018,10 @@ async function awaitingReconnection(channel, message, state) {
|
|
|
19615
20018
|
if (message.method === 'channels.info') {
|
|
19616
20019
|
if (message.params.data.event === 'fsm_up') {
|
|
19617
20020
|
channel._fsmId = message.params.data.fsm_id;
|
|
19618
|
-
|
|
20021
|
+
const {
|
|
20022
|
+
signedTx
|
|
20023
|
+
} = await channel.state();
|
|
20024
|
+
changeState(channel, signedTx == null ? '' : buildTx(signedTx));
|
|
19619
20025
|
return {
|
|
19620
20026
|
handler: channelOpen
|
|
19621
20027
|
};
|
|
@@ -19714,7 +20120,7 @@ async function channelOpen(channel, message, state) {
|
|
|
19714
20120
|
//
|
|
19715
20121
|
// We should enter intermediate state where offchain transactions
|
|
19716
20122
|
// are blocked until channel is reestablished.
|
|
19717
|
-
emit(channel, message.params.data.event);
|
|
20123
|
+
emit(channel, snakeToPascal(message.params.data.event));
|
|
19718
20124
|
return {
|
|
19719
20125
|
handler: channelOpen
|
|
19720
20126
|
};
|
|
@@ -19870,22 +20276,6 @@ function channelClosed(_channel, message, state) {
|
|
|
19870
20276
|
var external_events_ = __webpack_require__(3735);
|
|
19871
20277
|
;// CONCATENATED MODULE: ./src/channel/Base.ts
|
|
19872
20278
|
|
|
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
20279
|
|
|
19890
20280
|
|
|
19891
20281
|
|
|
@@ -19899,6 +20289,7 @@ function snakeToPascalObjKeys(obj) {
|
|
|
19899
20289
|
[snakeToPascal(key)]: val
|
|
19900
20290
|
}), {});
|
|
19901
20291
|
}
|
|
20292
|
+
|
|
19902
20293
|
/**
|
|
19903
20294
|
* Channel
|
|
19904
20295
|
* @example
|
|
@@ -19930,6 +20321,7 @@ class Base_Channel {
|
|
|
19930
20321
|
defineProperty_default()(this, "_actionQueue", []);
|
|
19931
20322
|
defineProperty_default()(this, "_isActionQueueLocked", false);
|
|
19932
20323
|
defineProperty_default()(this, "_status", 'disconnected');
|
|
20324
|
+
defineProperty_default()(this, "_state", '');
|
|
19933
20325
|
}
|
|
19934
20326
|
/**
|
|
19935
20327
|
* @param options - Channel params
|
|
@@ -19995,18 +20387,22 @@ class Base_Channel {
|
|
|
19995
20387
|
* Possible events:
|
|
19996
20388
|
*
|
|
19997
20389
|
* - "error"
|
|
20390
|
+
* - "stateChanged"
|
|
20391
|
+
* - "statusChanged"
|
|
20392
|
+
* - "message"
|
|
20393
|
+
* - "peerDisconnected"
|
|
19998
20394
|
* - "onChainTx"
|
|
19999
20395
|
* - "ownWithdrawLocked"
|
|
20000
20396
|
* - "withdrawLocked"
|
|
20001
20397
|
* - "ownDepositLocked"
|
|
20002
20398
|
* - "depositLocked"
|
|
20399
|
+
* - "channelReestablished"
|
|
20400
|
+
* - "newContract"
|
|
20003
20401
|
*
|
|
20004
|
-
* TODO: the event list looks outdated
|
|
20005
20402
|
*
|
|
20006
20403
|
* @param eventName - Event name
|
|
20007
20404
|
* @param callback - Callback function
|
|
20008
20405
|
*/
|
|
20009
|
-
// TODO define specific callback type depending on the event name
|
|
20010
20406
|
on(eventName, callback) {
|
|
20011
20407
|
this._eventEmitter.on(eventName, callback);
|
|
20012
20408
|
}
|
|
@@ -20038,7 +20434,17 @@ class Base_Channel {
|
|
|
20038
20434
|
* Get current state
|
|
20039
20435
|
*/
|
|
20040
20436
|
async state() {
|
|
20041
|
-
|
|
20437
|
+
const res = snakeToPascalObjKeys(await call(this, 'channels.get.offchain_state', {}));
|
|
20438
|
+
return {
|
|
20439
|
+
calls: unpackTx(res.calls, Tag.CallsMtree),
|
|
20440
|
+
...(res.halfSignedTx !== '' && {
|
|
20441
|
+
halfSignedTx: unpackTx(res.halfSignedTx, Tag.SignedTx)
|
|
20442
|
+
}),
|
|
20443
|
+
...(res.signedTx !== '' && {
|
|
20444
|
+
signedTx: unpackTx(res.signedTx, Tag.SignedTx)
|
|
20445
|
+
}),
|
|
20446
|
+
trees: unpackTx(res.trees, Tag.StateTrees)
|
|
20447
|
+
};
|
|
20042
20448
|
}
|
|
20043
20449
|
|
|
20044
20450
|
/**
|
|
@@ -20048,20 +20454,17 @@ class Base_Channel {
|
|
|
20048
20454
|
* it will return `null`.
|
|
20049
20455
|
*/
|
|
20050
20456
|
round() {
|
|
20051
|
-
if (this._state
|
|
20457
|
+
if (this._state === '') {
|
|
20052
20458
|
return null;
|
|
20053
20459
|
}
|
|
20054
|
-
const
|
|
20055
|
-
|
|
20056
|
-
round
|
|
20057
|
-
} = unpackTx(this._state, Tag.SignedTx).encodedTx;
|
|
20058
|
-
switch (tag) {
|
|
20460
|
+
const params = unpackTx(this._state, Tag.SignedTx).encodedTx;
|
|
20461
|
+
switch (params.tag) {
|
|
20059
20462
|
case Tag.ChannelCreateTx:
|
|
20060
20463
|
return 1;
|
|
20061
20464
|
case Tag.ChannelOffChainTx:
|
|
20062
20465
|
case Tag.ChannelWithdrawTx:
|
|
20063
20466
|
case Tag.ChannelDepositTx:
|
|
20064
|
-
return round;
|
|
20467
|
+
return params.round;
|
|
20065
20468
|
default:
|
|
20066
20469
|
return null;
|
|
20067
20470
|
}
|
|
@@ -20156,23 +20559,6 @@ class Base_Channel {
|
|
|
20156
20559
|
}
|
|
20157
20560
|
}
|
|
20158
20561
|
;// 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
20562
|
|
|
20177
20563
|
|
|
20178
20564
|
|
|
@@ -20538,23 +20924,6 @@ class ChannelSpend extends Base_Channel {
|
|
|
20538
20924
|
}
|
|
20539
20925
|
}
|
|
20540
20926
|
;// 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
20927
|
|
|
20559
20928
|
|
|
20560
20929
|
|
|
@@ -20632,15 +21001,18 @@ class ChannelContract extends ChannelSpend {
|
|
|
20632
21001
|
await signAndNotify(this, 'channels.update', message.params.data, async tx => state.sign(tx));
|
|
20633
21002
|
return {
|
|
20634
21003
|
handler: (_2, message2, state2) => awaitingCompletion(this, message2, state2, () => {
|
|
20635
|
-
const
|
|
20636
|
-
|
|
20637
|
-
|
|
21004
|
+
const params = unpackTx(message2.params.data.state, Tag.SignedTx).encodedTx;
|
|
21005
|
+
if (params.tag !== Tag.ChannelOffChainTx) {
|
|
21006
|
+
throw new ChannelError(`Tag should be ${Tag[Tag.ChannelOffChainTx]}, got ${Tag[params.tag]} instead`);
|
|
21007
|
+
}
|
|
20638
21008
|
const addressKey = this._options.role === 'initiator' ? 'initiatorId' : 'responderId';
|
|
20639
21009
|
const owner = this._options[addressKey];
|
|
20640
21010
|
changeState(this, message2.params.data.state);
|
|
21011
|
+
const address = encodeContractAddress(owner, params.round);
|
|
21012
|
+
emit(this, 'newContract', address);
|
|
20641
21013
|
state2.resolve({
|
|
20642
21014
|
accepted: true,
|
|
20643
|
-
address
|
|
21015
|
+
address,
|
|
20644
21016
|
signedTx: message2.params.data.state
|
|
20645
21017
|
});
|
|
20646
21018
|
return {
|
|
@@ -20950,23 +21322,6 @@ class ChannelContract extends ChannelSpend {
|
|
|
20950
21322
|
}
|
|
20951
21323
|
}
|
|
20952
21324
|
;// 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
21325
|
/**
|
|
20971
21326
|
* Browser connection proxy
|
|
20972
21327
|
* Provide functionality to easily forward messages from one connection to another and back
|
|
@@ -20984,23 +21339,6 @@ class ChannelContract extends ChannelSpend {
|
|
|
20984
21339
|
};
|
|
20985
21340
|
});
|
|
20986
21341
|
;// 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
21342
|
|
|
21005
21343
|
|
|
21006
21344
|
/**
|
|
@@ -21058,23 +21396,6 @@ class BrowserConnection {
|
|
|
21058
21396
|
|
|
21059
21397
|
function BrowserWindowMessage_classPrivateFieldInitSpec(obj, privateMap, value) { BrowserWindowMessage_checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
21060
21398
|
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
21399
|
|
|
21079
21400
|
|
|
21080
21401
|
|
|
@@ -21169,23 +21490,6 @@ class BrowserWindowMessageConnection extends BrowserConnection {
|
|
|
21169
21490
|
}
|
|
21170
21491
|
}
|
|
21171
21492
|
;// 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
21493
|
|
|
21190
21494
|
|
|
21191
21495
|
|
|
@@ -21232,23 +21536,6 @@ class BrowserWindowMessageConnection extends BrowserConnection {
|
|
|
21232
21536
|
|
|
21233
21537
|
function BrowserRuntime_classPrivateFieldInitSpec(obj, privateMap, value) { BrowserRuntime_checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
21234
21538
|
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
21539
|
|
|
21253
21540
|
|
|
21254
21541
|
|
|
@@ -21298,22 +21585,7 @@ class BrowserRuntimeConnection extends BrowserConnection {
|
|
|
21298
21585
|
}
|
|
21299
21586
|
}
|
|
21300
21587
|
;// 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
|
-
*/
|
|
21588
|
+
// TODO: avoid `export * from`
|
|
21317
21589
|
|
|
21318
21590
|
|
|
21319
21591
|
|
|
@@ -21321,6 +21593,7 @@ class BrowserRuntimeConnection extends BrowserConnection {
|
|
|
21321
21593
|
|
|
21322
21594
|
|
|
21323
21595
|
|
|
21596
|
+
// TODO: move to constants
|
|
21324
21597
|
|
|
21325
21598
|
|
|
21326
21599
|
|
|
@@ -21418,21 +21691,15 @@ class CompilerCli extends CompilerBase {
|
|
|
21418
21691
|
}
|
|
21419
21692
|
async compile(path) {
|
|
21420
21693
|
await classPrivateFieldGet_default()(this, _ensureCompatibleVersion);
|
|
21421
|
-
let bytecode;
|
|
21422
|
-
let aciCli;
|
|
21423
21694
|
try {
|
|
21424
|
-
[bytecode,
|
|
21695
|
+
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))]);
|
|
21696
|
+
return {
|
|
21697
|
+
bytecode: bytecode.trimEnd(),
|
|
21698
|
+
aci: aci
|
|
21699
|
+
};
|
|
21425
21700
|
} catch (error) {
|
|
21426
21701
|
throw new CompilerError(error.message);
|
|
21427
21702
|
}
|
|
21428
|
-
const aci = {
|
|
21429
|
-
encodedAci: aciCli[0],
|
|
21430
|
-
externalEncodedAci: aciCli.slice(1)
|
|
21431
|
-
};
|
|
21432
|
-
return {
|
|
21433
|
-
bytecode: bytecode.trimEnd(),
|
|
21434
|
-
aci: aci
|
|
21435
|
-
};
|
|
21436
21703
|
}
|
|
21437
21704
|
async compileBySourceCode(sourceCode, fileSystem) {
|
|
21438
21705
|
const tmp = await Cli_classStaticPrivateMethodGet(CompilerCli, CompilerCli, _saveContractToTmpDir).call(CompilerCli, sourceCode, fileSystem);
|