@aeternity/aepp-sdk 13.0.0-alpha.1 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/aesophia_cli +0 -0
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +1 -1
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +1833 -1543
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdk.mjs.map +1 -1
- package/es/AeSdkAepp.d.ts +5 -4
- package/es/AeSdkAepp.mjs +13 -17
- package/es/AeSdkAepp.mjs.map +1 -1
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkMethods.d.ts +11 -12
- package/es/AeSdkMethods.mjs +6 -8
- package/es/AeSdkMethods.mjs.map +1 -1
- package/es/AeSdkWallet.mjs +1 -1
- package/es/AeSdkWallet.mjs.map +1 -1
- package/es/Node.d.ts +5 -1
- package/es/Node.mjs +11 -5
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +11 -6
- package/es/account/Base.mjs +0 -17
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Generalized.mjs +12 -25
- package/es/account/Generalized.mjs.map +1 -1
- package/es/account/Ledger.mjs.map +1 -1
- package/es/account/LedgerFactory.mjs.map +1 -1
- package/es/account/Memory.d.ts +2 -1
- package/es/account/Memory.mjs +9 -21
- package/es/account/Memory.mjs.map +1 -1
- package/es/account/Rpc.mjs.map +1 -1
- package/es/aens.d.ts +12 -14
- package/es/aens.mjs +17 -31
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/Browser.mjs +0 -16
- package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +0 -16
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +0 -16
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection-proxy.mjs +0 -17
- package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +4 -5
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/types.d.ts +6 -2
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
- package/es/aepp-wallet-communication/schema.mjs.map +1 -1
- package/es/aepp-wallet-communication/wallet-detector.mjs +0 -16
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
- package/es/apis/compiler/compiler.d.ts +1 -1
- package/es/apis/compiler/compiler.mjs +4 -20
- package/es/apis/compiler/compiler.mjs.map +1 -1
- package/es/apis/compiler/models/index.d.ts +3 -2
- package/es/apis/compiler/models/index.mjs.map +1 -1
- package/es/apis/compiler/models/mappers.d.ts +1 -1
- package/es/apis/compiler/models/mappers.mjs +19 -2
- package/es/apis/compiler/models/mappers.mjs.map +1 -1
- package/es/apis/node/models/index.d.ts +15 -15
- package/es/apis/node/models/index.mjs.map +1 -1
- package/es/apis/node/models/mappers.d.ts +1 -1
- package/es/apis/node/models/mappers.mjs +2 -1
- package/es/apis/node/models/mappers.mjs.map +1 -1
- package/es/apis/node/models/parameters.d.ts +2 -2
- package/es/apis/node/models/parameters.mjs +2 -2
- package/es/apis/node/models/parameters.mjs.map +1 -1
- package/es/apis/node/node.mjs +3 -19
- package/es/apis/node/node.mjs.map +1 -1
- package/es/chain.d.ts +8 -8
- package/es/chain.mjs +20 -23
- package/es/chain.mjs.map +1 -1
- package/es/channel/Base.d.ts +25 -12
- package/es/channel/Base.mjs +23 -26
- package/es/channel/Base.mjs.map +1 -1
- package/es/channel/Contract.mjs +8 -21
- package/es/channel/Contract.mjs.map +1 -1
- package/es/channel/Spend.d.ts +4 -2
- package/es/channel/Spend.mjs +0 -16
- package/es/channel/Spend.mjs.map +1 -1
- package/es/channel/handlers.mjs +6 -18
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/internal.d.ts +19 -2
- package/es/channel/internal.mjs +19 -19
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Contract.d.ts +30 -85
- package/es/contract/Contract.mjs +197 -215
- package/es/contract/Contract.mjs.map +1 -1
- package/es/contract/compiler/Base.d.ts +10 -14
- package/es/contract/compiler/Base.mjs.map +1 -1
- package/es/contract/compiler/Cli.mjs +5 -11
- package/es/contract/compiler/Cli.mjs.map +1 -1
- package/es/contract/compiler/Http.mjs +6 -30
- package/es/contract/compiler/Http.mjs.map +1 -1
- package/es/contract/compiler/HttpNode.mjs.map +1 -1
- package/es/contract/compiler/getFileSystem.mjs.map +1 -1
- package/es/contract/delegation-signature.d.ts +43 -0
- package/es/contract/delegation-signature.mjs +45 -0
- package/es/contract/delegation-signature.mjs.map +1 -0
- package/es/contract/ga.d.ts +23 -7
- package/es/contract/ga.mjs +52 -27
- package/es/contract/ga.mjs.map +1 -1
- package/es/index-browser.d.ts +5 -4
- package/es/index-browser.mjs +7 -21
- package/es/index-browser.mjs.map +1 -1
- package/es/oracle.d.ts +12 -17
- package/es/oracle.mjs +28 -48
- package/es/oracle.mjs.map +1 -1
- package/es/spend.d.ts +19 -27
- package/es/spend.mjs +20 -43
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/SchemaTypes.d.ts +37 -0
- package/es/tx/builder/SchemaTypes.mjs +2 -0
- package/es/tx/builder/SchemaTypes.mjs.map +1 -0
- package/es/tx/builder/constants.d.ts +4 -2
- package/es/tx/builder/constants.mjs +2 -0
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/field-types/abi-version.d.ts +11 -2
- package/es/tx/builder/field-types/abi-version.mjs +24 -4
- package/es/tx/builder/field-types/abi-version.mjs.map +1 -1
- package/es/tx/builder/field-types/address.mjs.map +1 -1
- package/es/tx/builder/field-types/array.d.ts +1 -1
- package/es/tx/builder/field-types/array.mjs.map +1 -1
- package/es/tx/builder/field-types/boolean.mjs.map +1 -1
- package/es/tx/builder/field-types/coin-amount.d.ts +3 -4
- package/es/tx/builder/field-types/coin-amount.mjs +4 -5
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
- package/es/tx/builder/field-types/ct-version.d.ts +22 -3
- package/es/tx/builder/field-types/ct-version.mjs +32 -4
- package/es/tx/builder/field-types/ct-version.mjs.map +1 -1
- package/es/tx/builder/field-types/deposit.d.ts +2 -1
- package/es/tx/builder/field-types/deposit.mjs +3 -2
- package/es/tx/builder/field-types/deposit.mjs.map +1 -1
- package/es/tx/builder/field-types/encoded.d.ts +1 -1
- package/es/tx/builder/field-types/encoded.mjs.map +1 -1
- package/es/tx/builder/field-types/entry.mjs +3 -0
- package/es/tx/builder/field-types/entry.mjs.map +1 -1
- package/es/tx/builder/field-types/enumeration.mjs.map +1 -1
- package/es/tx/builder/field-types/fee.d.ts +3 -1
- package/es/tx/builder/field-types/fee.mjs +5 -1
- package/es/tx/builder/field-types/fee.mjs.map +1 -1
- package/es/tx/builder/field-types/field.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-limit.d.ts +3 -2
- package/es/tx/builder/field-types/gas-limit.mjs +4 -2
- package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-price.d.ts +3 -1
- package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
- package/es/tx/builder/field-types/index.d.ts +52 -13
- package/es/tx/builder/field-types/index.mjs +10 -2
- package/es/tx/builder/field-types/index.mjs.map +1 -1
- package/es/tx/builder/field-types/map.d.ts +13 -0
- package/es/tx/builder/field-types/map.mjs +49 -0
- package/es/tx/builder/field-types/map.mjs.map +1 -0
- package/es/tx/builder/field-types/mptree.d.ts +7 -2
- package/es/tx/builder/field-types/mptree.mjs +5 -7
- package/es/tx/builder/field-types/mptree.mjs.map +1 -1
- package/es/tx/builder/field-types/name-fee.d.ts +1 -1
- package/es/tx/builder/field-types/name-fee.mjs +2 -2
- package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
- package/es/tx/builder/field-types/name-id.mjs.map +1 -1
- package/es/tx/builder/field-types/name.mjs.map +1 -1
- package/es/tx/builder/field-types/nonce.d.ts +14 -0
- package/es/tx/builder/field-types/nonce.mjs +29 -0
- package/es/tx/builder/field-types/nonce.mjs.map +1 -0
- package/es/tx/builder/field-types/pointers.mjs.map +1 -1
- package/es/tx/builder/field-types/raw.mjs.map +1 -1
- package/es/tx/builder/field-types/short-u-int-const.d.ts +4 -2
- package/es/tx/builder/field-types/short-u-int-const.mjs +12 -8
- package/es/tx/builder/field-types/short-u-int-const.mjs.map +1 -1
- package/es/tx/builder/field-types/short-u-int.mjs.map +1 -1
- package/es/tx/builder/field-types/string.mjs.map +1 -1
- package/es/tx/builder/field-types/ttl.d.ts +11 -0
- package/es/tx/builder/field-types/ttl.mjs +21 -0
- package/es/tx/builder/field-types/ttl.mjs.map +1 -0
- package/es/tx/builder/field-types/u-int.mjs.map +1 -1
- package/es/tx/builder/field-types/wrapped.d.ts +14 -0
- package/es/tx/builder/field-types/wrapped.mjs +22 -0
- package/es/tx/builder/field-types/wrapped.mjs.map +1 -0
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +20 -20
- package/es/tx/builder/index.mjs +54 -64
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +2735 -2865
- package/es/tx/builder/schema.generated.d.ts +2011 -0
- package/es/tx/builder/schema.generated.mjs +2 -0
- package/es/tx/builder/schema.generated.mjs.map +1 -0
- package/es/tx/builder/schema.mjs +459 -155
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/execution-cost.d.ts +35 -0
- package/es/tx/execution-cost.mjs +123 -0
- package/es/tx/execution-cost.mjs.map +1 -0
- package/es/tx/transaction-signer.d.ts +6 -0
- package/es/tx/transaction-signer.mjs +27 -0
- package/es/tx/transaction-signer.mjs.map +1 -0
- package/es/tx/validator.mjs +60 -109
- package/es/tx/validator.mjs.map +1 -1
- package/es/utils/amount-formatter.mjs +0 -16
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.d.ts +3 -2
- package/es/utils/autorest.mjs +43 -11
- package/es/utils/autorest.mjs.map +1 -1
- package/es/utils/bytes.mjs +0 -16
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/crypto.mjs +0 -16
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/encoder.mjs.map +1 -1
- package/es/utils/errors.d.ts +14 -31
- package/es/utils/errors.mjs +3 -33
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/hd-wallet.mjs.map +1 -1
- package/es/utils/json-big.mjs.map +1 -1
- package/es/utils/keystore.mjs.map +1 -1
- package/es/utils/other.d.ts +1 -1
- package/es/utils/other.mjs.map +1 -1
- package/es/utils/semver-satisfies.mjs.map +1 -1
- package/es/utils/string.mjs +0 -17
- package/es/utils/string.mjs.map +1 -1
- package/package.json +34 -30
- package/src/AeSdkAepp.ts +16 -14
- package/src/AeSdkMethods.ts +11 -16
- package/src/AeSdkWallet.ts +1 -1
- package/src/Node.ts +17 -6
- package/src/account/Base.ts +11 -22
- package/src/account/Generalized.ts +9 -24
- package/src/account/Memory.ts +14 -21
- package/src/aens.ts +31 -47
- package/src/aepp-wallet-communication/connection/Browser.ts +0 -17
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +0 -17
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +0 -17
- package/src/aepp-wallet-communication/connection-proxy.ts +0 -17
- package/src/aepp-wallet-communication/rpc/types.ts +7 -2
- package/src/aepp-wallet-communication/wallet-detector.ts +0 -17
- package/src/apis/compiler/compiler.ts +3 -27
- package/src/apis/compiler/models/index.ts +3 -2
- package/src/apis/compiler/models/mappers.ts +15 -2
- package/src/apis/node/models/index.ts +16 -15
- package/src/apis/node/models/mappers.ts +2 -1
- package/src/apis/node/models/parameters.ts +2 -2
- package/src/apis/node/node.ts +3 -27
- package/src/chain.ts +29 -28
- package/src/channel/Base.ts +33 -33
- package/src/channel/Contract.ts +8 -23
- package/src/channel/Spend.ts +2 -17
- package/src/channel/handlers.ts +5 -18
- package/src/channel/internal.ts +40 -22
- package/src/contract/Contract.ts +161 -170
- package/src/contract/compiler/Base.ts +10 -14
- package/src/contract/compiler/Cli.ts +5 -11
- package/src/contract/compiler/Http.ts +6 -25
- package/src/contract/delegation-signature.ts +56 -0
- package/src/contract/ga.ts +53 -32
- package/src/index-browser.ts +15 -21
- package/src/oracle.ts +46 -56
- package/src/spend.ts +33 -67
- package/src/tx/builder/SchemaTypes.ts +79 -0
- package/src/tx/builder/constants.ts +2 -0
- package/src/tx/builder/field-types/abi-version.ts +29 -6
- package/src/tx/builder/field-types/array.ts +1 -1
- package/src/tx/builder/field-types/coin-amount.ts +6 -4
- package/src/tx/builder/field-types/ct-version.ts +37 -4
- package/src/tx/builder/field-types/deposit.ts +3 -1
- package/src/tx/builder/field-types/encoded.ts +1 -1
- package/src/tx/builder/field-types/entry.ts +8 -3
- package/src/tx/builder/field-types/fee.ts +6 -4
- package/src/tx/builder/field-types/gas-limit.ts +2 -2
- package/src/tx/builder/field-types/index.ts +15 -1
- package/src/tx/builder/field-types/map.ts +45 -0
- package/src/tx/builder/field-types/mptree.ts +4 -3
- package/src/tx/builder/field-types/name-fee.ts +2 -1
- package/src/tx/builder/field-types/nonce.ts +40 -0
- package/src/tx/builder/field-types/short-u-int-const.ts +18 -8
- package/src/tx/builder/field-types/ttl.ts +24 -0
- package/src/tx/builder/field-types/wrapped.ts +32 -0
- package/src/tx/builder/index.ts +57 -71
- package/src/tx/builder/schema.generated.ts +2013 -0
- package/src/tx/builder/schema.ts +544 -624
- package/src/tx/execution-cost.ts +146 -0
- package/src/tx/transaction-signer.ts +27 -0
- package/src/tx/validator.ts +60 -91
- package/src/utils/amount-formatter.ts +0 -16
- package/src/utils/autorest.ts +52 -11
- package/src/utils/bytes.ts +0 -16
- package/src/utils/crypto.ts +0 -16
- package/src/utils/errors.ts +16 -45
- package/src/utils/string.ts +0 -17
- package/types-legacy/ts4.2/AeSdkAepp.d.ts +5 -4
- package/types-legacy/ts4.2/AeSdkMethods.d.ts +11 -12
- package/types-legacy/ts4.2/Node.d.ts +5 -1
- package/types-legacy/ts4.2/account/Base.d.ts +11 -6
- package/types-legacy/ts4.2/account/Memory.d.ts +2 -1
- package/types-legacy/ts4.2/aens.d.ts +12 -14
- package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +6 -2
- package/types-legacy/ts4.2/apis/compiler/compiler.d.ts +1 -1
- package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +3 -2
- package/types-legacy/ts4.2/apis/compiler/models/mappers.d.ts +1 -1
- package/types-legacy/ts4.2/apis/node/models/index.d.ts +15 -15
- package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +1 -1
- package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +2 -2
- package/types-legacy/ts4.2/chain.d.ts +8 -8
- package/types-legacy/ts4.2/channel/Base.d.ts +25 -12
- package/types-legacy/ts4.2/channel/Spend.d.ts +4 -2
- package/types-legacy/ts4.2/channel/internal.d.ts +22 -2
- package/types-legacy/ts4.2/contract/Contract.d.ts +29 -84
- package/types-legacy/ts4.2/contract/compiler/Base.d.ts +10 -14
- package/types-legacy/ts4.2/contract/delegation-signature.d.ts +43 -0
- package/types-legacy/ts4.2/contract/ga.d.ts +23 -7
- package/types-legacy/ts4.2/index-browser.d.ts +5 -4
- package/types-legacy/ts4.2/oracle.d.ts +12 -17
- package/types-legacy/ts4.2/spend.d.ts +19 -27
- package/types-legacy/ts4.2/tx/builder/SchemaTypes.d.ts +37 -0
- package/types-legacy/ts4.2/tx/builder/constants.d.ts +4 -2
- package/types-legacy/ts4.2/tx/builder/field-types/abi-version.d.ts +11 -2
- package/types-legacy/ts4.2/tx/builder/field-types/array.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +3 -4
- package/types-legacy/ts4.2/tx/builder/field-types/ct-version.d.ts +33 -3
- package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +2 -1
- package/types-legacy/ts4.2/tx/builder/field-types/encoded.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +3 -1
- package/types-legacy/ts4.2/tx/builder/field-types/gas-limit.d.ts +3 -2
- package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +3 -1
- package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +52 -13
- package/types-legacy/ts4.2/tx/builder/field-types/map.d.ts +13 -0
- package/types-legacy/ts4.2/tx/builder/field-types/mptree.d.ts +7 -2
- package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/nonce.d.ts +14 -0
- package/types-legacy/ts4.2/tx/builder/field-types/short-u-int-const.d.ts +4 -2
- package/types-legacy/ts4.2/tx/builder/field-types/ttl.d.ts +11 -0
- package/types-legacy/ts4.2/tx/builder/field-types/wrapped.d.ts +14 -0
- package/types-legacy/ts4.2/tx/builder/index.d.ts +23 -20
- package/types-legacy/ts4.2/tx/builder/schema.d.ts +2962 -4629
- package/types-legacy/ts4.2/tx/builder/schema.generated.d.ts +2011 -0
- package/types-legacy/ts4.2/tx/execution-cost.d.ts +35 -0
- package/types-legacy/ts4.2/tx/transaction-signer.d.ts +6 -0
- package/types-legacy/ts4.2/utils/autorest.d.ts +3 -2
- package/types-legacy/ts4.2/utils/errors.d.ts +14 -31
- package/types-legacy/ts4.2/utils/other.d.ts +1 -1
- package/types-legacy/ts4.5/AeSdkAepp.d.ts +5 -4
- package/types-legacy/ts4.5/AeSdkMethods.d.ts +11 -12
- package/types-legacy/ts4.5/Node.d.ts +5 -1
- package/types-legacy/ts4.5/account/Base.d.ts +11 -6
- package/types-legacy/ts4.5/account/Memory.d.ts +2 -1
- package/types-legacy/ts4.5/aens.d.ts +12 -14
- package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +6 -2
- package/types-legacy/ts4.5/apis/compiler/compiler.d.ts +1 -1
- package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +3 -2
- package/types-legacy/ts4.5/apis/compiler/models/mappers.d.ts +1 -1
- package/types-legacy/ts4.5/apis/node/models/index.d.ts +15 -15
- package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +1 -1
- package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +2 -2
- package/types-legacy/ts4.5/chain.d.ts +8 -8
- package/types-legacy/ts4.5/channel/Base.d.ts +25 -12
- package/types-legacy/ts4.5/channel/Spend.d.ts +4 -2
- package/types-legacy/ts4.5/channel/internal.d.ts +22 -2
- package/types-legacy/ts4.5/contract/Contract.d.ts +29 -84
- package/types-legacy/ts4.5/contract/compiler/Base.d.ts +10 -14
- package/types-legacy/ts4.5/contract/delegation-signature.d.ts +43 -0
- package/types-legacy/ts4.5/contract/ga.d.ts +23 -7
- package/types-legacy/ts4.5/index-browser.d.ts +5 -4
- package/types-legacy/ts4.5/oracle.d.ts +12 -17
- package/types-legacy/ts4.5/spend.d.ts +19 -27
- package/types-legacy/ts4.5/tx/builder/SchemaTypes.d.ts +37 -0
- package/types-legacy/ts4.5/tx/builder/constants.d.ts +4 -2
- package/types-legacy/ts4.5/tx/builder/field-types/abi-version.d.ts +11 -2
- package/types-legacy/ts4.5/tx/builder/field-types/array.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +3 -4
- package/types-legacy/ts4.5/tx/builder/field-types/ct-version.d.ts +33 -3
- package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +2 -1
- package/types-legacy/ts4.5/tx/builder/field-types/encoded.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +3 -1
- package/types-legacy/ts4.5/tx/builder/field-types/gas-limit.d.ts +3 -2
- package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +3 -1
- package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +52 -13
- package/types-legacy/ts4.5/tx/builder/field-types/map.d.ts +13 -0
- package/types-legacy/ts4.5/tx/builder/field-types/mptree.d.ts +7 -2
- package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/nonce.d.ts +14 -0
- package/types-legacy/ts4.5/tx/builder/field-types/short-u-int-const.d.ts +4 -2
- package/types-legacy/ts4.5/tx/builder/field-types/ttl.d.ts +11 -0
- package/types-legacy/ts4.5/tx/builder/field-types/wrapped.d.ts +14 -0
- package/types-legacy/ts4.5/tx/builder/index.d.ts +23 -20
- package/types-legacy/ts4.5/tx/builder/schema.d.ts +2962 -4629
- package/types-legacy/ts4.5/tx/builder/schema.generated.d.ts +2011 -0
- package/types-legacy/ts4.5/tx/execution-cost.d.ts +35 -0
- package/types-legacy/ts4.5/tx/transaction-signer.d.ts +6 -0
- package/types-legacy/ts4.5/utils/autorest.d.ts +3 -2
- package/types-legacy/ts4.5/utils/errors.d.ts +14 -31
- package/types-legacy/ts4.5/utils/other.d.ts +1 -1
- package/es/tx/index.d.ts +0 -19
- package/es/tx/index.mjs +0 -115
- package/es/tx/index.mjs.map +0 -1
- package/src/apis/compiler/code-model-v4.yaml +0 -2442
- package/src/apis/node/code-model-v4.yaml +0 -10080
- package/src/tx/index.ts +0 -129
- package/types-legacy/ts4.2/tx/index.d.ts +0 -19
- package/types-legacy/ts4.5/tx/index.d.ts +0 -19
package/es/contract/ga.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generalized Account module - routines to use generalized account
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
import {
|
|
4
|
+
/// <reference types="node" />
|
|
5
|
+
import { Int, Tag } from '../tx/builder/constants';
|
|
6
|
+
import { BuildTxOptions } from '../tx/builder';
|
|
6
7
|
import { Encoded } from '../utils/encoder';
|
|
7
8
|
import AccountBase from '../account/Base';
|
|
8
9
|
import Contract from './Contract';
|
|
9
|
-
import { SendOptions } from '../spend';
|
|
10
10
|
import Node from '../Node';
|
|
11
|
+
import { SendTransactionOptions } from '../chain';
|
|
11
12
|
import CompilerBase from './compiler/Base';
|
|
12
13
|
/**
|
|
13
14
|
* Convert current account to GA
|
|
@@ -24,21 +25,36 @@ export declare function createGeneralizedAccount(authFnName: string, args: any[]
|
|
|
24
25
|
rawTx: Encoded.Transaction;
|
|
25
26
|
gaContractId: Encoded.ContractAddress;
|
|
26
27
|
}>>;
|
|
27
|
-
interface CreateGeneralizedAccountOptions extends BuildTxOptions<Tag.GaAttachTx, 'authFun' | 'callData' | 'code' | 'ownerId' | 'gasLimit'>,
|
|
28
|
+
interface CreateGeneralizedAccountOptions extends BuildTxOptions<Tag.GaAttachTx, 'authFun' | 'callData' | 'code' | 'ownerId' | 'gasLimit'>, SendTransactionOptions, Pick<Parameters<typeof Contract.initialize>[0], 'bytecode' | 'aci' | 'sourceCodePath' | 'sourceCode' | 'fileSystem'> {
|
|
28
29
|
onAccount: AccountBase;
|
|
29
30
|
onCompiler: CompilerBase;
|
|
30
31
|
onNode: Node;
|
|
31
32
|
gasLimit?: number;
|
|
32
33
|
}
|
|
33
34
|
/**
|
|
34
|
-
* Build a transaction hash the same as `Auth.tx_hash`
|
|
35
|
+
* Build a transaction hash the same as `Auth.tx_hash` by GaMetaTx payload
|
|
35
36
|
* @category contract
|
|
36
37
|
* @param transaction - tx-encoded transaction
|
|
37
38
|
* @param options - Options
|
|
39
|
+
* @param options.fee - GaMetaTx fee, required in Ceres
|
|
40
|
+
* @param options.gasPrice - GaMetaTx gasPrice, required in Ceres
|
|
38
41
|
* @param options.onNode - Node to use
|
|
39
42
|
* @returns Transaction hash
|
|
40
43
|
*/
|
|
41
|
-
export declare function buildAuthTxHash(transaction: Encoded.Transaction, { onNode }: {
|
|
44
|
+
export declare function buildAuthTxHash(transaction: Encoded.Transaction, { fee, gasPrice, onNode }: {
|
|
45
|
+
fee?: Int;
|
|
46
|
+
gasPrice?: Int;
|
|
42
47
|
onNode: Node;
|
|
43
|
-
}): Promise<
|
|
48
|
+
}): Promise<Buffer>;
|
|
49
|
+
/**
|
|
50
|
+
* Build a transaction hash the same as `Auth.tx_hash` by GaMetaTx
|
|
51
|
+
* @category contract
|
|
52
|
+
* @param transaction - tx-encoded signed GaMeta transaction
|
|
53
|
+
* @param options - Options
|
|
54
|
+
* @param options.onNode - Node to use
|
|
55
|
+
* @returns Transaction hash
|
|
56
|
+
*/
|
|
57
|
+
export declare function buildAuthTxHashByGaMetaTx(transaction: Encoded.Transaction, { onNode }: {
|
|
58
|
+
onNode: Node;
|
|
59
|
+
}): Promise<Buffer>;
|
|
44
60
|
export {};
|
package/es/contract/ga.mjs
CHANGED
|
@@ -2,35 +2,17 @@ import _buffer from "buffer";
|
|
|
2
2
|
const {
|
|
3
3
|
Buffer: _Buffer
|
|
4
4
|
} = _buffer;
|
|
5
|
-
/*
|
|
6
|
-
* ISC License (ISC)
|
|
7
|
-
* Copyright (c) 2022 aeternity developers
|
|
8
|
-
*
|
|
9
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
10
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
11
|
-
* copyright notice and this permission notice appear in all copies.
|
|
12
|
-
*
|
|
13
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
14
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
15
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
16
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
17
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
18
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
20
|
-
*/
|
|
21
5
|
/**
|
|
22
6
|
* Generalized Account module - routines to use generalized account
|
|
23
7
|
*/
|
|
24
|
-
import { Tag } from "../tx/builder/constants.mjs";
|
|
25
|
-
import { buildContractIdByContractTx } from "../tx/builder/index.mjs";
|
|
26
|
-
import { _buildTx } from "../tx/index.mjs";
|
|
8
|
+
import { ConsensusProtocolVersion, Tag } from "../tx/builder/constants.mjs";
|
|
9
|
+
import { buildContractIdByContractTx, buildTx, buildTxAsync, unpackTx } from "../tx/builder/index.mjs";
|
|
27
10
|
import { hash } from "../utils/crypto.mjs";
|
|
28
|
-
import { decode } from "../utils/encoder.mjs";
|
|
29
|
-
import { IllegalArgumentError } from "../utils/errors.mjs";
|
|
11
|
+
import { decode, encode, Encoding } from "../utils/encoder.mjs";
|
|
12
|
+
import { ArgumentError, IllegalArgumentError } from "../utils/errors.mjs";
|
|
30
13
|
import { concatBuffers } from "../utils/other.mjs";
|
|
31
14
|
import Contract from "./Contract.mjs";
|
|
32
|
-
import {
|
|
33
|
-
import { getAccount } from "../chain.mjs";
|
|
15
|
+
import { sendTransaction, getAccount } from "../chain.mjs";
|
|
34
16
|
/**
|
|
35
17
|
* Convert current account to GA
|
|
36
18
|
* @category contract
|
|
@@ -69,8 +51,9 @@ export async function createGeneralizedAccount(authFnName, args, _ref) {
|
|
|
69
51
|
sourceCode,
|
|
70
52
|
fileSystem
|
|
71
53
|
});
|
|
72
|
-
const tx = await
|
|
54
|
+
const tx = await buildTxAsync({
|
|
73
55
|
...options,
|
|
56
|
+
tag: Tag.GaAttachTx,
|
|
74
57
|
onNode,
|
|
75
58
|
code: await contract.$compile(),
|
|
76
59
|
gasLimit: (_options$gasLimit = options.gasLimit) !== null && _options$gasLimit !== void 0 ? _options$gasLimit : await contract._estimateGas('init', args, options),
|
|
@@ -82,7 +65,7 @@ export async function createGeneralizedAccount(authFnName, args, _ref) {
|
|
|
82
65
|
const {
|
|
83
66
|
hash: transaction,
|
|
84
67
|
rawTx
|
|
85
|
-
} = await
|
|
68
|
+
} = await sendTransaction(tx, {
|
|
86
69
|
onNode,
|
|
87
70
|
onAccount,
|
|
88
71
|
onCompiler,
|
|
@@ -96,17 +79,59 @@ export async function createGeneralizedAccount(authFnName, args, _ref) {
|
|
|
96
79
|
});
|
|
97
80
|
}
|
|
98
81
|
/**
|
|
99
|
-
* Build a transaction hash the same as `Auth.tx_hash`
|
|
82
|
+
* Build a transaction hash the same as `Auth.tx_hash` by GaMetaTx payload
|
|
100
83
|
* @category contract
|
|
101
84
|
* @param transaction - tx-encoded transaction
|
|
102
85
|
* @param options - Options
|
|
86
|
+
* @param options.fee - GaMetaTx fee, required in Ceres
|
|
87
|
+
* @param options.gasPrice - GaMetaTx gasPrice, required in Ceres
|
|
103
88
|
* @param options.onNode - Node to use
|
|
104
89
|
* @returns Transaction hash
|
|
105
90
|
*/
|
|
106
91
|
export async function buildAuthTxHash(transaction, _ref2) {
|
|
107
92
|
let {
|
|
93
|
+
fee,
|
|
94
|
+
gasPrice,
|
|
108
95
|
onNode
|
|
109
96
|
} = _ref2;
|
|
110
|
-
|
|
97
|
+
const {
|
|
98
|
+
nodeNetworkId,
|
|
99
|
+
consensusProtocolVersion
|
|
100
|
+
} = await onNode.getNodeInfo();
|
|
101
|
+
let payload = hash(concatBuffers([_Buffer.from(nodeNetworkId), decode(transaction)]));
|
|
102
|
+
if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
|
|
103
|
+
if (fee == null) throw new ArgumentError('fee', 'provided (in Ceres)', fee);
|
|
104
|
+
if (gasPrice == null) throw new ArgumentError('gasPrice', 'provided (in Ceres)', gasPrice);
|
|
105
|
+
payload = hash(decode(buildTx({
|
|
106
|
+
tag: Tag.GaMetaTxAuthData,
|
|
107
|
+
fee,
|
|
108
|
+
gasPrice,
|
|
109
|
+
txHash: encode(payload, Encoding.TxHash)
|
|
110
|
+
})));
|
|
111
|
+
}
|
|
112
|
+
return payload;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Build a transaction hash the same as `Auth.tx_hash` by GaMetaTx
|
|
117
|
+
* @category contract
|
|
118
|
+
* @param transaction - tx-encoded signed GaMeta transaction
|
|
119
|
+
* @param options - Options
|
|
120
|
+
* @param options.onNode - Node to use
|
|
121
|
+
* @returns Transaction hash
|
|
122
|
+
*/
|
|
123
|
+
export async function buildAuthTxHashByGaMetaTx(transaction, _ref3) {
|
|
124
|
+
let {
|
|
125
|
+
onNode
|
|
126
|
+
} = _ref3;
|
|
127
|
+
const txParams = unpackTx(transaction, Tag.SignedTx);
|
|
128
|
+
if (txParams.encodedTx.tag !== Tag.GaMetaTx) {
|
|
129
|
+
throw new ArgumentError('transaction', 'to include GaMetaTx', Tag[txParams.encodedTx.tag]);
|
|
130
|
+
}
|
|
131
|
+
return buildAuthTxHash(buildTx(txParams.encodedTx.tx.encodedTx), {
|
|
132
|
+
fee: txParams.encodedTx.fee,
|
|
133
|
+
gasPrice: txParams.encodedTx.gasPrice,
|
|
134
|
+
onNode
|
|
135
|
+
});
|
|
111
136
|
}
|
|
112
137
|
//# sourceMappingURL=ga.mjs.map
|
package/es/contract/ga.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ga.mjs","names":["Tag","buildContractIdByContractTx","
|
|
1
|
+
{"version":3,"file":"ga.mjs","names":["ConsensusProtocolVersion","Tag","buildContractIdByContractTx","buildTx","buildTxAsync","unpackTx","hash","decode","encode","Encoding","ArgumentError","IllegalArgumentError","concatBuffers","Contract","sendTransaction","getAccount","createGeneralizedAccount","authFnName","args","_ref","_options$gasLimit","onAccount","onCompiler","onNode","bytecode","aci","sourceCodePath","sourceCode","fileSystem","options","ownerId","address","kind","contract","initialize","tx","tag","GaAttachTx","code","$compile","gasLimit","_estimateGas","callData","_calldata","_name","authFun","contractId","transaction","rawTx","Object","freeze","owner","gaContractId","buildAuthTxHash","_ref2","fee","gasPrice","nodeNetworkId","consensusProtocolVersion","getNodeInfo","payload","_Buffer","from","Ceres","GaMetaTxAuthData","txHash","TxHash","buildAuthTxHashByGaMetaTx","_ref3","txParams","SignedTx","encodedTx","GaMetaTx"],"sources":["../../src/contract/ga.ts"],"sourcesContent":["/**\n * Generalized Account module - routines to use generalized account\n */\n\nimport { ConsensusProtocolVersion, Int, Tag } from '../tx/builder/constants';\nimport {\n buildContractIdByContractTx, buildTx, buildTxAsync, BuildTxOptions, unpackTx,\n} from '../tx/builder';\nimport { hash } from '../utils/crypto';\nimport {\n decode, encode, Encoded, Encoding,\n} from '../utils/encoder';\nimport { ArgumentError, IllegalArgumentError } from '../utils/errors';\nimport { concatBuffers } from '../utils/other';\nimport AccountBase from '../account/Base';\nimport Contract from './Contract';\nimport Node from '../Node';\nimport { sendTransaction, SendTransactionOptions, getAccount } from '../chain';\nimport CompilerBase from './compiler/Base';\n\n/**\n * Convert current account to GA\n * @category contract\n * @param authFnName - Authorization function name\n * @param sourceCode - Auth contract source code\n * @param args - init arguments\n * @param options - Options\n * @returns General Account Object\n */\nexport async function createGeneralizedAccount(\n authFnName: string,\n args: any[],\n {\n onAccount, onCompiler, onNode, bytecode, aci, sourceCodePath, sourceCode, fileSystem, ...options\n }: CreateGeneralizedAccountOptions,\n): Promise<Readonly<{\n owner: Encoded.AccountAddress;\n transaction: Encoded.TxHash;\n rawTx: Encoded.Transaction;\n gaContractId: Encoded.ContractAddress;\n }>> {\n const ownerId = onAccount.address;\n if ((await getAccount(ownerId, { onNode })).kind === 'generalized') {\n throw new IllegalArgumentError(`Account ${ownerId} is already GA`);\n }\n\n const contract = await Contract.initialize<{ init: (...a: any[]) => void }>({\n onAccount, onCompiler, onNode, bytecode, aci, sourceCodePath, sourceCode, fileSystem,\n });\n\n const tx = await buildTxAsync({\n ...options,\n tag: Tag.GaAttachTx,\n onNode,\n code: await contract.$compile(),\n gasLimit: options.gasLimit ?? await contract._estimateGas('init', args, options),\n ownerId,\n callData: contract._calldata.encode(contract._name, 'init', args),\n authFun: hash(authFnName),\n });\n const contractId = buildContractIdByContractTx(tx);\n const { hash: transaction, rawTx } = await sendTransaction(tx, {\n onNode, onAccount, onCompiler, ...options,\n });\n\n return Object.freeze({\n owner: ownerId,\n transaction,\n rawTx,\n gaContractId: contractId,\n });\n}\n\ninterface CreateGeneralizedAccountOptions extends\n BuildTxOptions<Tag.GaAttachTx, 'authFun' | 'callData' | 'code' | 'ownerId' | 'gasLimit'>,\n SendTransactionOptions,\n Pick<\n Parameters<typeof Contract.initialize>[0],\n 'bytecode' | 'aci' | 'sourceCodePath' | 'sourceCode' | 'fileSystem'\n > {\n onAccount: AccountBase;\n onCompiler: CompilerBase;\n onNode: Node;\n gasLimit?: number;\n}\n\n/**\n * Build a transaction hash the same as `Auth.tx_hash` by GaMetaTx payload\n * @category contract\n * @param transaction - tx-encoded transaction\n * @param options - Options\n * @param options.fee - GaMetaTx fee, required in Ceres\n * @param options.gasPrice - GaMetaTx gasPrice, required in Ceres\n * @param options.onNode - Node to use\n * @returns Transaction hash\n */\nexport async function buildAuthTxHash(\n transaction: Encoded.Transaction,\n { fee, gasPrice, onNode }: { fee?: Int; gasPrice?: Int; onNode: Node },\n): Promise<Buffer> {\n const { nodeNetworkId, consensusProtocolVersion } = await onNode.getNodeInfo();\n let payload = hash(concatBuffers([Buffer.from(nodeNetworkId), decode(transaction)]));\n if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {\n if (fee == null) throw new ArgumentError('fee', 'provided (in Ceres)', fee);\n if (gasPrice == null) throw new ArgumentError('gasPrice', 'provided (in Ceres)', gasPrice);\n payload = hash(decode(buildTx({\n tag: Tag.GaMetaTxAuthData,\n fee,\n gasPrice,\n txHash: encode(payload, Encoding.TxHash),\n })));\n }\n return payload;\n}\n\n/**\n * Build a transaction hash the same as `Auth.tx_hash` by GaMetaTx\n * @category contract\n * @param transaction - tx-encoded signed GaMeta transaction\n * @param options - Options\n * @param options.onNode - Node to use\n * @returns Transaction hash\n */\nexport async function buildAuthTxHashByGaMetaTx(\n transaction: Encoded.Transaction,\n { onNode }: { onNode: Node },\n): Promise<Buffer> {\n const txParams = unpackTx(transaction, Tag.SignedTx);\n if (txParams.encodedTx.tag !== Tag.GaMetaTx) {\n throw new ArgumentError('transaction', 'to include GaMetaTx', Tag[txParams.encodedTx.tag]);\n }\n return buildAuthTxHash(buildTx(txParams.encodedTx.tx.encodedTx), {\n fee: txParams.encodedTx.fee,\n gasPrice: txParams.encodedTx.gasPrice,\n onNode,\n });\n}\n"],"mappings":"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"}
|
package/es/index-browser.d.ts
CHANGED
|
@@ -2,14 +2,15 @@ export * from './chain';
|
|
|
2
2
|
export * from './utils/crypto';
|
|
3
3
|
export * from './utils/keystore';
|
|
4
4
|
export * from './utils/bytes';
|
|
5
|
-
export
|
|
6
|
-
export * from './tx/builder';
|
|
5
|
+
export { buildTx, buildTxAsync, buildTxHash, unpackTx, buildContractIdByContractTx, } from './tx/builder';
|
|
7
6
|
export * from './tx/builder/helpers';
|
|
8
7
|
export * from './tx/builder/constants';
|
|
9
|
-
export
|
|
8
|
+
export { ORACLE_TTL_TYPES, ORACLE_TTL, QUERY_TTL, RESPONSE_TTL, DRY_RUN_ACCOUNT, CallReturnType, } from './tx/builder/schema';
|
|
9
|
+
export { getExecutionCost, getExecutionCostBySignedTx, getExecutionCostUsingNode, } from './tx/execution-cost';
|
|
10
|
+
export { default as getTransactionSignerAddress } from './tx/transaction-signer';
|
|
10
11
|
export * from './utils/amount-formatter';
|
|
11
12
|
export * from './utils/hd-wallet';
|
|
12
|
-
export { encode, decode, Encoding } from './utils/encoder';
|
|
13
|
+
export { encode, decode, Encoding, Encoded, } from './utils/encoder';
|
|
13
14
|
export * from './aens';
|
|
14
15
|
export { default as Contract } from './contract/Contract';
|
|
15
16
|
export type { ContractMethodsBase } from './contract/Contract';
|
package/es/index-browser.mjs
CHANGED
|
@@ -1,31 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
* ISC License (ISC)
|
|
3
|
-
* Copyright (c) 2022 aeternity developers
|
|
4
|
-
*
|
|
5
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
7
|
-
* copyright notice and this permission notice appear in all copies.
|
|
8
|
-
*
|
|
9
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
-
*/
|
|
1
|
+
// TODO: avoid `export * from`
|
|
17
2
|
export * from "./chain.mjs";
|
|
18
3
|
export * from "./utils/crypto.mjs";
|
|
19
4
|
export * from "./utils/keystore.mjs";
|
|
20
5
|
export * from "./utils/bytes.mjs";
|
|
21
|
-
export
|
|
22
|
-
export * from "./tx/builder/index.mjs";
|
|
6
|
+
export { buildTx, buildTxAsync, buildTxHash, unpackTx, buildContractIdByContractTx } from "./tx/builder/index.mjs";
|
|
23
7
|
export * from "./tx/builder/helpers.mjs";
|
|
24
|
-
export * from "./tx/builder/constants.mjs";
|
|
25
|
-
export
|
|
8
|
+
export * from "./tx/builder/constants.mjs"; // TODO: move to constants
|
|
9
|
+
export { ORACLE_TTL_TYPES, ORACLE_TTL, QUERY_TTL, RESPONSE_TTL, DRY_RUN_ACCOUNT, CallReturnType } from "./tx/builder/schema.mjs";
|
|
10
|
+
export { getExecutionCost, getExecutionCostBySignedTx, getExecutionCostUsingNode } from "./tx/execution-cost.mjs";
|
|
11
|
+
export { default as getTransactionSignerAddress } from "./tx/transaction-signer.mjs";
|
|
26
12
|
export * from "./utils/amount-formatter.mjs";
|
|
27
13
|
export * from "./utils/hd-wallet.mjs";
|
|
28
|
-
export { encode, decode, Encoding } from "./utils/encoder.mjs";
|
|
14
|
+
export { encode, decode, Encoding, Encoded } from "./utils/encoder.mjs";
|
|
29
15
|
export * from "./aens.mjs";
|
|
30
16
|
export { default as Contract } from "./contract/Contract.mjs";
|
|
31
17
|
export * from "./oracle.mjs";
|
package/es/index-browser.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-browser.mjs","names":["encode","decode","Encoding","
|
|
1
|
+
{"version":3,"file":"index-browser.mjs","names":["buildTx","buildTxAsync","buildTxHash","unpackTx","buildContractIdByContractTx","ORACLE_TTL_TYPES","ORACLE_TTL","QUERY_TTL","RESPONSE_TTL","DRY_RUN_ACCOUNT","CallReturnType","getExecutionCost","getExecutionCostBySignedTx","getExecutionCostUsingNode","default","getTransactionSignerAddress","encode","decode","Encoding","Encoded","Contract","AeSdkMethods","AeSdkBase","AeSdk","AeSdkAepp","AeSdkWallet","Node","verifyTransaction","AccountBase","MemoryAccount","AccountGeneralized","AccountLedger","AccountLedgerFactory","CompilerBase","CompilerHttp","Channel","connectionProxy","walletDetector","BrowserRuntimeConnection","BrowserWindowMessageConnection"],"sources":["../src/index-browser.ts"],"sourcesContent":["// TODO: avoid `export * from`\nexport * from './chain';\nexport * from './utils/crypto';\nexport * from './utils/keystore';\nexport * from './utils/bytes';\nexport {\n buildTx, buildTxAsync, buildTxHash, unpackTx, buildContractIdByContractTx,\n} from './tx/builder';\nexport * from './tx/builder/helpers';\nexport * from './tx/builder/constants';\n// TODO: move to constants\nexport {\n ORACLE_TTL_TYPES, ORACLE_TTL, QUERY_TTL, RESPONSE_TTL, DRY_RUN_ACCOUNT, CallReturnType,\n} from './tx/builder/schema';\nexport {\n getExecutionCost, getExecutionCostBySignedTx, getExecutionCostUsingNode,\n} from './tx/execution-cost';\nexport { default as getTransactionSignerAddress } from './tx/transaction-signer';\nexport * from './utils/amount-formatter';\nexport * from './utils/hd-wallet';\nexport {\n encode, decode, Encoding, Encoded,\n} from './utils/encoder';\nexport * from './aens';\nexport { default as Contract } from './contract/Contract';\nexport type { ContractMethodsBase } from './contract/Contract';\nexport * from './oracle';\nexport * from './spend';\nexport * from './contract/ga';\n\nexport { default as AeSdkMethods } from './AeSdkMethods';\nexport { default as AeSdkBase } from './AeSdkBase';\nexport { default as AeSdk } from './AeSdk';\nexport { default as AeSdkAepp } from './AeSdkAepp';\nexport { default as AeSdkWallet } from './AeSdkWallet';\nexport { default as Node } from './Node';\nexport { default as verifyTransaction } from './tx/validator';\nexport { default as AccountBase } from './account/Base';\nexport { default as MemoryAccount } from './account/Memory';\nexport { default as AccountGeneralized } from './account/Generalized';\nexport { default as AccountLedger } from './account/Ledger';\nexport { default as AccountLedgerFactory } from './account/LedgerFactory';\nexport { default as CompilerBase } from './contract/compiler/Base';\nexport { default as CompilerHttp } from './contract/compiler/Http';\nexport { default as Channel } from './channel/Contract';\n\nexport { default as connectionProxy } from './aepp-wallet-communication/connection-proxy';\nexport * from './aepp-wallet-communication/schema';\nexport { default as walletDetector } from './aepp-wallet-communication/wallet-detector';\nexport { default as BrowserRuntimeConnection } from './aepp-wallet-communication/connection/BrowserRuntime';\nexport { default as BrowserWindowMessageConnection } from './aepp-wallet-communication/connection/BrowserWindowMessage';\nexport * from './utils/errors';\n"],"mappings":"AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAMEA,OAAO,EAAEC,YAAY,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,2BAA2B;AAAA;AAAA,4CAI3E;AAAA,SAEEC,gBAAgB,EAAEC,UAAU,EAAEC,SAAS,EAAEC,YAAY,EAAEC,eAAe,EAAEC,cAAc;AAAA,SAGtFC,gBAAgB,EAAEC,0BAA0B,EAAEC,yBAAyB;AAAA,SAEhEC,OAAO,IAAIC,2BAA2B;AAAA;AAAA;AAAA,SAI7CC,MAAM,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,OAAO;AAAA;AAAA,SAG1BL,OAAO,IAAIM,QAAQ;AAAA;AAAA;AAAA;AAAA,SAMnBN,OAAO,IAAIO,YAAY;AAAA,SACvBP,OAAO,IAAIQ,SAAS;AAAA,SACpBR,OAAO,IAAIS,KAAK;AAAA,SAChBT,OAAO,IAAIU,SAAS;AAAA,SACpBV,OAAO,IAAIW,WAAW;AAAA,SACtBX,OAAO,IAAIY,IAAI;AAAA,SACfZ,OAAO,IAAIa,iBAAiB;AAAA,SAC5Bb,OAAO,IAAIc,WAAW;AAAA,SACtBd,OAAO,IAAIe,aAAa;AAAA,SACxBf,OAAO,IAAIgB,kBAAkB;AAAA,SAC7BhB,OAAO,IAAIiB,aAAa;AAAA,SACxBjB,OAAO,IAAIkB,oBAAoB;AAAA,SAC/BlB,OAAO,IAAImB,YAAY;AAAA,SACvBnB,OAAO,IAAIoB,YAAY;AAAA,SACvBpB,OAAO,IAAIqB,OAAO;AAAA,SAElBrB,OAAO,IAAIsB,eAAe;AAAA;AAAA,SAE1BtB,OAAO,IAAIuB,cAAc;AAAA,SACzBvB,OAAO,IAAIwB,wBAAwB;AAAA,SACnCxB,OAAO,IAAIyB,8BAA8B;AAAA"}
|
package/es/oracle.d.ts
CHANGED
|
@@ -5,13 +5,11 @@
|
|
|
5
5
|
* https://github.com/aeternity/protocol/blob/master/ORACLE.md in the protocol
|
|
6
6
|
* repository.
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import { send, SendOptions } from './spend';
|
|
8
|
+
import { BuildTxOptions } from './tx/builder';
|
|
10
9
|
import { ORACLE_TTL_TYPES } from './tx/builder/schema';
|
|
11
10
|
import { Tag } from './tx/builder/constants';
|
|
12
11
|
import { Encoded } from './utils/encoder';
|
|
13
|
-
import { _getPollInterval } from './chain';
|
|
14
|
-
import { BuildTxOptions } from './tx';
|
|
12
|
+
import { _getPollInterval, sendTransaction, SendTransactionOptions } from './chain';
|
|
15
13
|
import Node from './Node';
|
|
16
14
|
import AccountBase from './account/Base';
|
|
17
15
|
type OracleQueries = Awaited<ReturnType<Node['getOracleQueriesByPubkey']>>['oracleQueries'];
|
|
@@ -25,7 +23,7 @@ type OracleQueries = Awaited<ReturnType<Node['getOracleQueriesByPubkey']>>['orac
|
|
|
25
23
|
* @param options.onNode - Node to use
|
|
26
24
|
* @returns Callback to stop polling function
|
|
27
25
|
*/
|
|
28
|
-
export declare function pollForQueries(oracleId: Encoded.OracleAddress, onQuery: (
|
|
26
|
+
export declare function pollForQueries(oracleId: Encoded.OracleAddress, onQuery: (query: OracleQueries[number]) => void, { interval, onNode, ...options }: {
|
|
29
27
|
interval?: number;
|
|
30
28
|
onNode: Node;
|
|
31
29
|
} & Parameters<typeof _getPollInterval>[1]): () => void;
|
|
@@ -55,7 +53,7 @@ export declare function getQueryObject(oracleId: Encoded.OracleAddress, queryId:
|
|
|
55
53
|
interface GetQueryObjectReturnType extends Awaited<ReturnType<Node['getOracleQueryByPubkeyAndQueryId']>> {
|
|
56
54
|
decodedQuery: string;
|
|
57
55
|
decodedResponse: string;
|
|
58
|
-
respond: (response: string, options?: Parameters<typeof respondToQuery>[
|
|
56
|
+
respond: (response: string, options?: Parameters<typeof respondToQuery>[2]) => ReturnType<typeof respondToQuery>;
|
|
59
57
|
pollForResponse: (options?: Parameters<typeof pollForQueryResponse>[2]) => ReturnType<typeof pollForQueryResponse>;
|
|
60
58
|
}
|
|
61
59
|
/**
|
|
@@ -71,8 +69,8 @@ interface GetQueryObjectReturnType extends Awaited<ReturnType<Node['getOracleQue
|
|
|
71
69
|
* @param options.ttl - Transaction time to leave
|
|
72
70
|
* @returns Query object
|
|
73
71
|
*/
|
|
74
|
-
export declare function postQueryToOracle(oracleId: Encoded.OracleAddress, query: string, options: PostQueryToOracleOptions): Promise<Awaited<ReturnType<typeof
|
|
75
|
-
type PostQueryToOracleOptionsType = Parameters<typeof
|
|
72
|
+
export declare function postQueryToOracle(oracleId: Encoded.OracleAddress, query: string, options: PostQueryToOracleOptions): Promise<Awaited<ReturnType<typeof sendTransaction>> & Awaited<ReturnType<typeof getQueryObject>>>;
|
|
73
|
+
type PostQueryToOracleOptionsType = Parameters<typeof sendTransaction>[1] & Parameters<typeof getQueryObject>[2] & BuildTxOptions<Tag.OracleQueryTx, 'oracleId' | 'senderId' | 'query' | 'queryTtlType' | 'queryTtlValue' | 'responseTtlType' | 'responseTtlValue'> & {
|
|
76
74
|
queryTtlType?: ORACLE_TTL_TYPES;
|
|
77
75
|
queryTtlValue?: number;
|
|
78
76
|
responseTtlType?: ORACLE_TTL_TYPES;
|
|
@@ -83,7 +81,6 @@ interface PostQueryToOracleOptions extends PostQueryToOracleOptionsType {
|
|
|
83
81
|
/**
|
|
84
82
|
* Extend oracle ttl
|
|
85
83
|
* @category oracle
|
|
86
|
-
* @param oracleId - Oracle public key
|
|
87
84
|
* @param options - Options object
|
|
88
85
|
* @param options.fee - fee Transaction fee
|
|
89
86
|
* @param options.ttl - Transaction time to leave
|
|
@@ -91,8 +88,8 @@ interface PostQueryToOracleOptions extends PostQueryToOracleOptionsType {
|
|
|
91
88
|
* @param options.oracleTtlValue - Oracle time to leave for extend
|
|
92
89
|
* @returns Oracle object
|
|
93
90
|
*/
|
|
94
|
-
export declare function extendOracleTtl(
|
|
95
|
-
type ExtendOracleTtlOptionsType =
|
|
91
|
+
export declare function extendOracleTtl(options: ExtendOracleTtlOptions): Promise<Awaited<ReturnType<typeof sendTransaction>> & Awaited<ReturnType<typeof getOracleObject>>>;
|
|
92
|
+
type ExtendOracleTtlOptionsType = SendTransactionOptions & Parameters<typeof getOracleObject>[1] & BuildTxOptions<Tag.OracleExtendTx, 'oracleTtlType' | 'oracleTtlValue' | 'callerId' | 'oracleId'> & {
|
|
96
93
|
oracleTtlType?: ORACLE_TTL_TYPES;
|
|
97
94
|
oracleTtlValue?: number;
|
|
98
95
|
};
|
|
@@ -101,7 +98,6 @@ interface ExtendOracleTtlOptions extends ExtendOracleTtlOptionsType {
|
|
|
101
98
|
/**
|
|
102
99
|
* Extend oracle ttl
|
|
103
100
|
* @category oracle
|
|
104
|
-
* @param oracleId - Oracle public key
|
|
105
101
|
* @param queryId - Oracle query id
|
|
106
102
|
* @param response - Oracle query response
|
|
107
103
|
* @param options - Options object
|
|
@@ -110,8 +106,8 @@ interface ExtendOracleTtlOptions extends ExtendOracleTtlOptionsType {
|
|
|
110
106
|
* @param options.ttl - Transaction time to leave
|
|
111
107
|
* @returns Oracle object
|
|
112
108
|
*/
|
|
113
|
-
export declare function respondToQuery(
|
|
114
|
-
type RespondToQueryOptionsType =
|
|
109
|
+
export declare function respondToQuery(queryId: Encoded.OracleQueryId, response: string, options: RespondToQueryOptions): Promise<Awaited<ReturnType<typeof sendTransaction>> & Awaited<ReturnType<typeof getOracleObject>>>;
|
|
110
|
+
type RespondToQueryOptionsType = SendTransactionOptions & Parameters<typeof getOracleObject>[1] & BuildTxOptions<Tag.OracleResponseTx, 'callerId' | 'oracleId' | 'queryId' | 'response' | 'responseTtlType' | 'responseTtlValue'> & {
|
|
115
111
|
responseTtlType?: ORACLE_TTL_TYPES;
|
|
116
112
|
responseTtlValue?: number;
|
|
117
113
|
};
|
|
@@ -150,9 +146,8 @@ interface GetOracleObjectReturnType extends Awaited<ReturnType<Node['getOracleBy
|
|
|
150
146
|
* @param options.ttl - Transaction time to leave
|
|
151
147
|
* @returns Oracle object
|
|
152
148
|
*/
|
|
153
|
-
export declare function registerOracle(queryFormat: string, responseFormat: string, options: RegisterOracleOptions): Promise<Awaited<ReturnType<typeof
|
|
154
|
-
type RegisterOracleOptionsType =
|
|
155
|
-
queryFee?: number | string | BigNumber;
|
|
149
|
+
export declare function registerOracle(queryFormat: string, responseFormat: string, options: RegisterOracleOptions): Promise<Awaited<ReturnType<typeof sendTransaction>> & Awaited<ReturnType<typeof getOracleObject>>>;
|
|
150
|
+
type RegisterOracleOptionsType = SendTransactionOptions & Parameters<typeof getOracleObject>[1] & BuildTxOptions<Tag.OracleRegisterTx, 'accountId' | 'queryFormat' | 'responseFormat' | 'oracleTtlType' | 'oracleTtlValue'> & {
|
|
156
151
|
oracleTtlType?: ORACLE_TTL_TYPES;
|
|
157
152
|
oracleTtlValue?: number;
|
|
158
153
|
};
|
package/es/oracle.mjs
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ISC License (ISC)
|
|
3
|
-
* Copyright (c) 2022 aeternity developers
|
|
4
|
-
*
|
|
5
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
7
|
-
* copyright notice and this permission notice appear in all copies.
|
|
8
|
-
*
|
|
9
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
-
*/
|
|
17
1
|
/**
|
|
18
2
|
* Oracle methods - routines to interact with the æternity oracle system
|
|
19
3
|
*
|
|
@@ -21,16 +5,14 @@
|
|
|
21
5
|
* https://github.com/aeternity/protocol/blob/master/ORACLE.md in the protocol
|
|
22
6
|
* repository.
|
|
23
7
|
*/
|
|
24
|
-
import { send } from "./spend.mjs";
|
|
25
8
|
import { mapObject, pause } from "./utils/other.mjs";
|
|
26
9
|
import { oracleQueryId } from "./tx/builder/helpers.mjs";
|
|
27
|
-
import { unpackTx } from "./tx/builder/index.mjs";
|
|
28
|
-
import { ORACLE_TTL,
|
|
10
|
+
import { unpackTx, buildTxAsync } from "./tx/builder/index.mjs";
|
|
11
|
+
import { ORACLE_TTL, QUERY_TTL, RESPONSE_TTL } from "./tx/builder/schema.mjs";
|
|
29
12
|
import { Tag } from "./tx/builder/constants.mjs";
|
|
30
13
|
import { RequestTimedOutError } from "./utils/errors.mjs";
|
|
31
14
|
import { decode, encode, Encoding } from "./utils/encoder.mjs";
|
|
32
|
-
import { _getPollInterval, getHeight } from "./chain.mjs";
|
|
33
|
-
import { _buildTx } from "./tx/index.mjs";
|
|
15
|
+
import { _getPollInterval, getHeight, sendTransaction } from "./chain.mjs";
|
|
34
16
|
/**
|
|
35
17
|
* Poll for oracle queries
|
|
36
18
|
* @category oracle
|
|
@@ -58,13 +40,10 @@ export function pollForQueries(oracleId, onQuery, _ref) {
|
|
|
58
40
|
} = _ref2;
|
|
59
41
|
return !knownQueryIds.has(id);
|
|
60
42
|
});
|
|
61
|
-
queries.forEach(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} = _ref3;
|
|
65
|
-
return knownQueryIds.add(id);
|
|
43
|
+
queries.forEach(query => {
|
|
44
|
+
knownQueryIds.add(query.id);
|
|
45
|
+
onQuery(query);
|
|
66
46
|
});
|
|
67
|
-
if (queries.length > 0) onQuery(queries);
|
|
68
47
|
};
|
|
69
48
|
let stopped = false;
|
|
70
49
|
|
|
@@ -92,13 +71,13 @@ export function pollForQueries(oracleId, onQuery, _ref) {
|
|
|
92
71
|
* @param options.onNode - Node to use
|
|
93
72
|
* @returns OracleQuery object
|
|
94
73
|
*/
|
|
95
|
-
export async function pollForQueryResponse(oracleId, queryId,
|
|
74
|
+
export async function pollForQueryResponse(oracleId, queryId, _ref3) {
|
|
96
75
|
var _interval2;
|
|
97
76
|
let {
|
|
98
77
|
interval,
|
|
99
78
|
onNode,
|
|
100
79
|
...options
|
|
101
|
-
} =
|
|
80
|
+
} = _ref3;
|
|
102
81
|
(_interval2 = interval) !== null && _interval2 !== void 0 ? _interval2 : interval = _getPollInterval('microblock', options);
|
|
103
82
|
let height;
|
|
104
83
|
let ttl;
|
|
@@ -134,7 +113,7 @@ export async function getQueryObject(oracleId, queryId, options) {
|
|
|
134
113
|
decodedResponse: decode(record.response).toString(),
|
|
135
114
|
respond: async (response, opt) =>
|
|
136
115
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
137
|
-
respondToQuery(
|
|
116
|
+
respondToQuery(queryId, response, {
|
|
138
117
|
...options,
|
|
139
118
|
...opt
|
|
140
119
|
}),
|
|
@@ -161,12 +140,13 @@ export async function postQueryToOracle(oracleId, query, options) {
|
|
|
161
140
|
var _options$queryFee;
|
|
162
141
|
(_options$queryFee = options.queryFee) !== null && _options$queryFee !== void 0 ? _options$queryFee : options.queryFee = (await options.onNode.getOracleByPubkey(oracleId)).queryFee.toString();
|
|
163
142
|
const senderId = options.onAccount.address;
|
|
164
|
-
const oracleQueryTx = await
|
|
143
|
+
const oracleQueryTx = await buildTxAsync({
|
|
165
144
|
queryTtlType: QUERY_TTL.type,
|
|
166
145
|
queryTtlValue: QUERY_TTL.value,
|
|
167
146
|
responseTtlType: RESPONSE_TTL.type,
|
|
168
147
|
responseTtlValue: RESPONSE_TTL.value,
|
|
169
148
|
...options,
|
|
149
|
+
tag: Tag.OracleQueryTx,
|
|
170
150
|
oracleId,
|
|
171
151
|
senderId,
|
|
172
152
|
query
|
|
@@ -176,14 +156,13 @@ export async function postQueryToOracle(oracleId, query, options) {
|
|
|
176
156
|
} = unpackTx(oracleQueryTx, Tag.OracleQueryTx);
|
|
177
157
|
const queryId = oracleQueryId(senderId, nonce, oracleId);
|
|
178
158
|
return {
|
|
179
|
-
...(await
|
|
159
|
+
...(await sendTransaction(oracleQueryTx, options)),
|
|
180
160
|
...(await getQueryObject(oracleId, queryId, options))
|
|
181
161
|
};
|
|
182
162
|
}
|
|
183
163
|
/**
|
|
184
164
|
* Extend oracle ttl
|
|
185
165
|
* @category oracle
|
|
186
|
-
* @param oracleId - Oracle public key
|
|
187
166
|
* @param options - Options object
|
|
188
167
|
* @param options.fee - fee Transaction fee
|
|
189
168
|
* @param options.ttl - Transaction time to leave
|
|
@@ -191,16 +170,17 @@ export async function postQueryToOracle(oracleId, query, options) {
|
|
|
191
170
|
* @param options.oracleTtlValue - Oracle time to leave for extend
|
|
192
171
|
* @returns Oracle object
|
|
193
172
|
*/
|
|
194
|
-
export async function extendOracleTtl(
|
|
195
|
-
const
|
|
173
|
+
export async function extendOracleTtl(options) {
|
|
174
|
+
const oracleId = encode(decode(options.onAccount.address), Encoding.OracleAddress);
|
|
175
|
+
const oracleExtendTx = await buildTxAsync({
|
|
196
176
|
oracleTtlType: ORACLE_TTL.type,
|
|
197
177
|
oracleTtlValue: ORACLE_TTL.value,
|
|
198
178
|
...options,
|
|
199
|
-
|
|
179
|
+
tag: Tag.OracleExtendTx,
|
|
200
180
|
oracleId
|
|
201
181
|
});
|
|
202
182
|
return {
|
|
203
|
-
...(await
|
|
183
|
+
...(await sendTransaction(oracleExtendTx, options)),
|
|
204
184
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
205
185
|
...(await getOracleObject(oracleId, options))
|
|
206
186
|
};
|
|
@@ -208,7 +188,6 @@ export async function extendOracleTtl(oracleId, options) {
|
|
|
208
188
|
/**
|
|
209
189
|
* Extend oracle ttl
|
|
210
190
|
* @category oracle
|
|
211
|
-
* @param oracleId - Oracle public key
|
|
212
191
|
* @param queryId - Oracle query id
|
|
213
192
|
* @param response - Oracle query response
|
|
214
193
|
* @param options - Options object
|
|
@@ -217,18 +196,19 @@ export async function extendOracleTtl(oracleId, options) {
|
|
|
217
196
|
* @param options.ttl - Transaction time to leave
|
|
218
197
|
* @returns Oracle object
|
|
219
198
|
*/
|
|
220
|
-
export async function respondToQuery(
|
|
221
|
-
const
|
|
199
|
+
export async function respondToQuery(queryId, response, options) {
|
|
200
|
+
const oracleId = encode(decode(options.onAccount.address), Encoding.OracleAddress);
|
|
201
|
+
const oracleRespondTx = await buildTxAsync({
|
|
222
202
|
responseTtlType: RESPONSE_TTL.type,
|
|
223
203
|
responseTtlValue: RESPONSE_TTL.value,
|
|
224
204
|
...options,
|
|
225
|
-
|
|
205
|
+
tag: Tag.OracleResponseTx,
|
|
226
206
|
oracleId,
|
|
227
207
|
queryId,
|
|
228
208
|
response
|
|
229
209
|
});
|
|
230
210
|
return {
|
|
231
|
-
...(await
|
|
211
|
+
...(await sendTransaction(oracleRespondTx, options)),
|
|
232
212
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
233
213
|
...(await getOracleObject(oracleId, options))
|
|
234
214
|
};
|
|
@@ -250,8 +230,8 @@ export async function getOracleObject(oracleId, options) {
|
|
|
250
230
|
respondToQuery,
|
|
251
231
|
extendOracle: extendOracleTtl,
|
|
252
232
|
getQuery: getQueryObject
|
|
253
|
-
},
|
|
254
|
-
let [name, handler] =
|
|
233
|
+
}, _ref4 => {
|
|
234
|
+
let [name, handler] = _ref4;
|
|
255
235
|
return [name, function () {
|
|
256
236
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
257
237
|
args[_key] = arguments[_key];
|
|
@@ -263,7 +243,7 @@ export async function getOracleObject(oracleId, options) {
|
|
|
263
243
|
...lastArg
|
|
264
244
|
});
|
|
265
245
|
} else args.push(options);
|
|
266
|
-
return handler(oracleId, ...args);
|
|
246
|
+
return handler(...(['extendOracle', 'respondToQuery'].includes(name) ? [] : [oracleId]), ...args);
|
|
267
247
|
}];
|
|
268
248
|
})
|
|
269
249
|
};
|
|
@@ -283,17 +263,17 @@ export async function getOracleObject(oracleId, options) {
|
|
|
283
263
|
*/
|
|
284
264
|
export async function registerOracle(queryFormat, responseFormat, options) {
|
|
285
265
|
const accountId = options.onAccount.address;
|
|
286
|
-
const oracleRegisterTx = await
|
|
287
|
-
queryFee: QUERY_FEE,
|
|
266
|
+
const oracleRegisterTx = await buildTxAsync({
|
|
288
267
|
oracleTtlValue: ORACLE_TTL.value,
|
|
289
268
|
oracleTtlType: ORACLE_TTL.type,
|
|
290
269
|
...options,
|
|
270
|
+
tag: Tag.OracleRegisterTx,
|
|
291
271
|
accountId,
|
|
292
272
|
queryFormat,
|
|
293
273
|
responseFormat
|
|
294
274
|
});
|
|
295
275
|
return {
|
|
296
|
-
...(await
|
|
276
|
+
...(await sendTransaction(oracleRegisterTx, options)),
|
|
297
277
|
...(await getOracleObject(encode(decode(accountId), Encoding.OracleAddress), options))
|
|
298
278
|
};
|
|
299
279
|
}
|