@aeternity/aepp-sdk 11.0.1 → 12.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/LICENSE +1 -1
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.LICENSE.txt +12 -19
- 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 +1 -1
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdk.d.ts +37 -0
- package/es/AeSdk.mjs +81 -0
- package/es/AeSdk.mjs.map +1 -0
- package/es/AeSdkAepp.d.ts +69 -0
- package/es/AeSdkAepp.mjs +175 -0
- package/es/AeSdkAepp.mjs.map +1 -0
- package/es/AeSdkBase.d.ts +212 -0
- package/es/AeSdkBase.mjs +310 -0
- package/es/AeSdkBase.mjs.map +1 -0
- package/es/AeSdkWallet.d.ts +103 -0
- package/es/AeSdkWallet.mjs +322 -0
- package/es/AeSdkWallet.mjs.map +1 -0
- package/es/Node.d.ts +44 -0
- package/es/Node.mjs +141 -0
- package/es/Node.mjs.map +1 -0
- package/es/account/Base.d.ts +65 -0
- package/es/account/Base.mjs +123 -0
- package/es/account/Base.mjs.map +1 -0
- package/es/account/Memory.d.ts +25 -0
- package/es/account/Memory.mjs +81 -0
- package/es/account/Memory.mjs.map +1 -0
- package/es/account/Rpc.d.ts +27 -0
- package/es/account/Rpc.mjs +79 -0
- package/es/account/Rpc.mjs.map +1 -0
- package/es/aens.d.ts +209 -0
- package/es/aens.mjs +332 -0
- package/es/aens.mjs.map +1 -0
- package/es/aepp-wallet-communication/connection/Browser.d.ts +32 -0
- package/es/aepp-wallet-communication/connection/Browser.mjs +70 -0
- package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +17 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +57 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -0
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +35 -0
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +142 -0
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -0
- package/es/aepp-wallet-communication/connection-proxy.d.ts +10 -0
- package/{src/utils/crypto-ts.ts → es/aepp-wallet-communication/connection-proxy.mjs} +15 -11
- package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -0
- package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +33 -0
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +169 -0
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -0
- package/es/aepp-wallet-communication/rpc/types.d.ts +77 -0
- package/es/aepp-wallet-communication/rpc/types.mjs +3 -0
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -0
- package/es/aepp-wallet-communication/schema.d.ts +90 -46
- package/es/aepp-wallet-communication/schema.mjs +214 -0
- package/es/aepp-wallet-communication/schema.mjs.map +1 -0
- package/es/aepp-wallet-communication/wallet-detector.d.ts +24 -0
- package/es/aepp-wallet-communication/wallet-detector.mjs +63 -0
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -0
- package/es/apis/compiler/compiler.d.ts +92 -0
- package/es/apis/compiler/compiler.mjs +576 -0
- package/es/apis/compiler/compiler.mjs.map +1 -0
- package/es/apis/compiler/index.d.ts +2 -0
- package/es/apis/compiler/index.mjs +3 -0
- package/es/apis/compiler/index.mjs.map +1 -0
- package/es/apis/compiler/models/index.d.ts +248 -0
- package/es/apis/compiler/models/index.mjs +48 -0
- package/es/apis/compiler/models/index.mjs.map +1 -0
- package/es/apis/compiler/models/mappers.d.ts +23 -0
- package/es/apis/compiler/models/mappers.mjs +585 -0
- package/es/apis/compiler/models/mappers.mjs.map +1 -0
- package/es/apis/compiler/models/parameters.d.ts +13 -0
- package/es/apis/compiler/models/parameters.mjs +71 -0
- package/es/apis/compiler/models/parameters.mjs.map +1 -0
- package/es/apis/node/index.d.ts +2 -0
- package/es/apis/node/index.mjs +3 -0
- package/es/apis/node/index.mjs.map +1 -0
- package/es/apis/node/models/index.d.ts +1061 -0
- package/es/apis/node/models/index.mjs +2 -0
- package/es/apis/node/models/index.mjs.map +1 -0
- package/es/apis/node/models/mappers.d.ts +95 -0
- package/es/apis/node/models/mappers.mjs +4164 -0
- package/es/apis/node/models/mappers.mjs.map +1 -0
- package/es/apis/node/models/parameters.d.ts +17 -0
- package/es/apis/node/models/parameters.mjs +165 -0
- package/es/apis/node/models/parameters.mjs.map +1 -0
- package/es/apis/node/node.d.ts +215 -0
- package/es/apis/node/node.mjs +1165 -0
- package/es/apis/node/node.mjs.map +1 -0
- package/es/chain.d.ts +220 -0
- package/es/chain.mjs +524 -0
- package/es/chain.mjs.map +1 -0
- package/es/channel/handlers.d.ts +34 -0
- package/es/channel/handlers.mjs +147 -112
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/index.d.ts +634 -0
- package/es/channel/index.mjs +898 -900
- package/es/channel/index.mjs.map +1 -1
- package/es/channel/internal.d.ts +100 -0
- package/es/channel/internal.mjs +97 -51
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Compiler.d.ts +17 -0
- package/es/contract/Compiler.mjs +67 -0
- package/es/contract/Compiler.mjs.map +1 -0
- package/es/contract/aci.d.ts +125 -0
- package/es/contract/aci.mjs +199 -180
- package/es/contract/aci.mjs.map +1 -1
- package/es/contract/ga.d.ts +68 -0
- package/es/contract/ga.mjs +190 -0
- package/es/contract/ga.mjs.map +1 -0
- package/es/contract/methods.d.ts +68 -0
- package/es/contract/methods.mjs +101 -0
- package/es/contract/methods.mjs.map +1 -0
- package/es/index.d.ts +32 -0
- package/es/index.mjs +32 -40
- package/es/index.mjs.map +1 -1
- package/es/oracle.d.ts +154 -0
- package/es/oracle.mjs +288 -0
- package/es/oracle.mjs.map +1 -0
- package/es/spend.d.ts +61 -0
- package/es/spend.mjs +122 -0
- package/es/spend.mjs.map +1 -0
- package/es/tx/builder/constants.d.ts +41 -0
- package/es/tx/builder/constants.mjs +11 -19
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/field-types.d.ts +62 -0
- package/es/tx/builder/field-types.mjs +62 -10
- package/es/tx/builder/field-types.mjs.map +1 -1
- package/es/tx/builder/helpers.d.ts +131 -0
- package/es/tx/builder/helpers.mjs +71 -169
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +75 -0
- package/es/tx/builder/index.mjs +141 -323
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +350 -0
- package/es/tx/builder/schema.mjs +173 -510
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/index.d.ts +63 -0
- package/es/tx/index.mjs +171 -265
- package/es/tx/index.mjs.map +1 -1
- package/es/tx/min-fee.d.ts +20 -0
- package/es/tx/min-fee.mjs +148 -0
- package/es/tx/min-fee.mjs.map +1 -0
- package/es/tx/validator.d.ts +19 -0
- package/es/tx/validator.mjs +64 -71
- package/es/tx/validator.mjs.map +1 -1
- package/es/typings/@aeternity__argon2-browser/index.d.mjs +2 -0
- package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +1 -0
- package/es/typings/@aeternity__uuid/index.d.mjs +2 -0
- package/es/typings/@aeternity__uuid/index.d.mjs.map +1 -0
- package/es/typings/bip32-path/index.d.mjs +2 -0
- package/es/typings/bip32-path/index.d.mjs.map +1 -0
- package/es/typings/blakejs/index.d.mjs.map +1 -1
- package/es/typings/tweetnacl-auth/index.d.mjs +2 -0
- package/es/typings/tweetnacl-auth/index.d.mjs.map +1 -0
- package/es/utils/amount-formatter.d.ts +42 -0
- package/es/utils/amount-formatter.mjs +28 -41
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.d.ts +6 -0
- package/es/utils/autorest.mjs +97 -0
- package/es/utils/autorest.mjs.map +1 -0
- package/es/utils/bignumber.d.ts +13 -0
- package/es/utils/bignumber.mjs +10 -8
- package/es/utils/bignumber.mjs.map +1 -1
- package/es/{bytes.d.ts → utils/bytes.d.ts} +10 -13
- package/es/utils/bytes.mjs +10 -14
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/crypto.d.ts +103 -0
- package/es/utils/crypto.mjs +60 -68
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/encoder.d.ts +26 -0
- package/es/utils/encoder.mjs +47 -51
- package/es/utils/encoder.mjs.map +1 -1
- package/es/{errors.d.ts → utils/errors.d.ts} +254 -57
- package/es/utils/errors.mjs +318 -125
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/hd-wallet.d.ts +34 -0
- package/es/utils/hd-wallet.mjs +27 -16
- package/es/utils/hd-wallet.mjs.map +1 -1
- package/es/utils/json-big.d.ts +5 -0
- package/es/utils/json-big.mjs +10 -14
- package/es/utils/json-big.mjs.map +1 -1
- package/es/utils/keystore.d.ts +51 -0
- package/es/utils/keystore.mjs +98 -193
- package/es/utils/keystore.mjs.map +1 -1
- package/es/{mptree.d.ts → utils/mptree.d.ts} +5 -8
- package/es/utils/mptree.mjs +13 -14
- package/es/utils/mptree.mjs.map +1 -1
- package/es/utils/other.d.ts +14 -0
- package/es/utils/other.mjs +21 -36
- package/es/utils/other.mjs.map +1 -1
- package/es/{semver-satisfies.d.ts → utils/semver-satisfies.d.ts} +0 -0
- package/es/utils/semver-satisfies.mjs.map +1 -1
- package/es/utils/string.d.ts +24 -0
- package/es/utils/string.mjs +8 -10
- package/es/utils/string.mjs.map +1 -1
- package/package.json +49 -39
- package/src/AeSdk.ts +65 -0
- package/src/AeSdkAepp.ts +167 -0
- package/src/AeSdkBase.ts +320 -0
- package/src/AeSdkWallet.ts +332 -0
- package/src/Node.ts +167 -0
- package/src/account/Base.ts +114 -0
- package/src/account/Memory.ts +83 -0
- package/src/account/Rpc.ts +67 -0
- package/src/aens.ts +391 -0
- package/src/aepp-wallet-communication/connection/Browser.ts +68 -0
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +58 -0
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +111 -0
- package/{es/utils/crypto-ts.mjs → src/aepp-wallet-communication/connection-proxy.ts} +16 -17
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +137 -0
- package/src/aepp-wallet-communication/rpc/types.ts +66 -0
- package/src/aepp-wallet-communication/schema.ts +181 -0
- package/src/aepp-wallet-communication/wallet-detector.ts +71 -0
- package/src/apis/compiler/code-model-v4.yaml +2649 -0
- package/src/apis/compiler/compiler.ts +585 -0
- package/src/apis/compiler/index.ts +2 -0
- package/src/apis/compiler/models/index.ts +301 -0
- package/src/apis/compiler/models/mappers.ts +583 -0
- package/src/apis/compiler/models/parameters.ts +93 -0
- package/src/apis/node/code-model-v4.yaml +10046 -0
- package/src/apis/node/index.ts +2 -0
- package/src/apis/node/models/index.ts +1253 -0
- package/src/apis/node/models/mappers.ts +4278 -0
- package/src/apis/node/models/parameters.ts +188 -0
- package/src/apis/node/node.ts +1299 -0
- package/src/chain.ts +444 -0
- package/src/channel/{handlers.js → handlers.ts} +220 -128
- package/src/channel/index.ts +991 -0
- package/src/channel/internal.ts +345 -0
- package/src/contract/Compiler.ts +66 -0
- package/src/contract/aci.ts +529 -0
- package/src/contract/ga.ts +178 -0
- package/src/contract/methods.ts +118 -0
- package/src/index.ts +51 -0
- package/src/oracle.ts +342 -0
- package/src/spend.ts +152 -0
- package/src/tx/builder/{constants.js → constants.ts} +12 -16
- package/src/tx/builder/field-types.ts +111 -0
- package/src/tx/builder/helpers.ts +253 -0
- package/src/tx/builder/index.ts +394 -0
- package/src/tx/builder/schema.ts +771 -0
- package/src/tx/index.ts +199 -0
- package/src/tx/min-fee.ts +136 -0
- package/src/tx/validator.ts +226 -0
- package/src/typings/@aeternity__argon2-browser/index.d.ts +3 -0
- package/src/typings/@aeternity__uuid/index.d.ts +3 -0
- package/src/typings/bip32-path/index.d.ts +33 -0
- package/src/typings/tweetnacl-auth/index.d.ts +14 -0
- package/src/utils/amount-formatter.ts +29 -42
- package/src/utils/autorest.ts +90 -0
- package/src/utils/bignumber.ts +9 -11
- package/src/utils/bytes.ts +12 -14
- package/src/utils/crypto.ts +217 -0
- package/src/utils/encoder.ts +52 -55
- package/src/utils/errors.ts +268 -134
- package/src/utils/hd-wallet.ts +134 -0
- package/src/utils/json-big.ts +26 -0
- package/src/utils/keystore.ts +179 -0
- package/src/utils/mptree.ts +14 -14
- package/src/utils/other.ts +28 -43
- package/src/utils/string.ts +8 -10
- package/es/account/base.mjs +0 -179
- package/es/account/base.mjs.map +0 -1
- package/es/account/memory.mjs +0 -99
- package/es/account/memory.mjs.map +0 -1
- package/es/account/multiple.mjs +0 -179
- package/es/account/multiple.mjs.map +0 -1
- package/es/ae/aens.mjs +0 -404
- package/es/ae/aens.mjs.map +0 -1
- package/es/ae/aepp.mjs +0 -45
- package/es/ae/aepp.mjs.map +0 -1
- package/es/ae/contract.mjs +0 -159
- package/es/ae/contract.mjs.map +0 -1
- package/es/ae/index.mjs +0 -207
- package/es/ae/index.mjs.map +0 -1
- package/es/ae/oracle.mjs +0 -339
- package/es/ae/oracle.mjs.map +0 -1
- package/es/ae/universal.mjs +0 -45
- package/es/ae/universal.mjs.map +0 -1
- package/es/ae/wallet.mjs +0 -50
- package/es/ae/wallet.mjs.map +0 -1
- package/es/amount-formatter.d.ts +0 -58
- package/es/bignumber.d.ts +0 -18
- package/es/chain/index.mjs +0 -272
- package/es/chain/index.mjs.map +0 -1
- package/es/chain/node.mjs +0 -442
- package/es/chain/node.mjs.map +0 -1
- package/es/contract/compiler.mjs +0 -115
- package/es/contract/compiler.mjs.map +0 -1
- package/es/contract/ga/helpers.mjs +0 -30
- package/es/contract/ga/helpers.mjs.map +0 -1
- package/es/contract/ga/index.mjs +0 -178
- package/es/contract/ga/index.mjs.map +0 -1
- package/es/crypto-ts.d.ts +0 -9
- package/es/encoder.d.ts +0 -26
- package/es/node-pool/index.mjs +0 -188
- package/es/node-pool/index.mjs.map +0 -1
- package/es/node.mjs +0 -133
- package/es/node.mjs.map +0 -1
- package/es/other.d.ts +0 -31
- package/es/string.d.ts +0 -26
- package/es/tx/tx-object.mjs +0 -283
- package/es/tx/tx-object.mjs.map +0 -1
- package/es/tx/tx.mjs +0 -938
- package/es/tx/tx.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.mjs +0 -132
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs +0 -183
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/index.mjs +0 -87
- package/es/utils/aepp-wallet-communication/connection/index.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/content-script-bridge.mjs +0 -98
- package/es/utils/aepp-wallet-communication/content-script-bridge.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/helpers.mjs +0 -92
- package/es/utils/aepp-wallet-communication/helpers.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs +0 -375
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs +0 -275
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs +0 -541
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/schema.mjs +0 -102
- package/es/utils/aepp-wallet-communication/schema.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/wallet-detector.mjs +0 -110
- package/es/utils/aepp-wallet-communication/wallet-detector.mjs.map +0 -1
- package/es/utils/async-init.mjs +0 -64
- package/es/utils/async-init.mjs.map +0 -1
- package/es/utils/crypto-ts.mjs.map +0 -1
- package/es/utils/swagger.mjs +0 -164
- package/es/utils/swagger.mjs.map +0 -1
- package/src/account/base.js +0 -153
- package/src/account/memory.js +0 -83
- package/src/account/multiple.js +0 -162
- package/src/ae/aens.js +0 -361
- package/src/ae/aepp.js +0 -45
- package/src/ae/contract.js +0 -148
- package/src/ae/index.js +0 -168
- package/src/ae/oracle.js +0 -311
- package/src/ae/universal.js +0 -47
- package/src/ae/wallet.js +0 -50
- package/src/chain/index.js +0 -269
- package/src/chain/node.js +0 -320
- package/src/channel/index.js +0 -903
- package/src/channel/internal.js +0 -236
- package/src/contract/aci.js +0 -376
- package/src/contract/compiler.js +0 -100
- package/src/contract/ga/helpers.js +0 -19
- package/src/contract/ga/index.js +0 -150
- package/src/index.js +0 -89
- package/src/node-pool/index.js +0 -172
- package/src/node.js +0 -116
- package/src/tx/builder/field-types.js +0 -61
- package/src/tx/builder/helpers.js +0 -334
- package/src/tx/builder/index.js +0 -465
- package/src/tx/builder/schema.js +0 -1100
- package/src/tx/index.js +0 -301
- package/src/tx/tx-object.js +0 -187
- package/src/tx/tx.js +0 -631
- package/src/tx/validator.js +0 -181
- package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +0 -119
- package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +0 -165
- package/src/utils/aepp-wallet-communication/connection/index.js +0 -85
- package/src/utils/aepp-wallet-communication/content-script-bridge.js +0 -86
- package/src/utils/aepp-wallet-communication/helpers.js +0 -60
- package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +0 -294
- package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +0 -232
- package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +0 -401
- package/src/utils/aepp-wallet-communication/schema.ts +0 -80
- package/src/utils/aepp-wallet-communication/wallet-detector.js +0 -92
- package/src/utils/async-init.js +0 -45
- package/src/utils/crypto.js +0 -219
- package/src/utils/hd-wallet.js +0 -100
- package/src/utils/json-big.js +0 -26
- package/src/utils/keystore.js +0 -219
- package/src/utils/swagger.js +0 -156
package/es/ae/aens.mjs
DELETED
|
@@ -1,404 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ISC License (ISC)
|
|
3
|
-
* Copyright (c) 2018 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
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Aens module - routines to interact with the æternity naming system
|
|
20
|
-
*
|
|
21
|
-
* The high-level description of the naming system is
|
|
22
|
-
* https://github.com/aeternity/protocol/blob/master/AENS.md in the protocol
|
|
23
|
-
* repository.
|
|
24
|
-
* @module @aeternity/aepp-sdk/es/ae/aens
|
|
25
|
-
* @export Aens
|
|
26
|
-
* @example import { Aens } from '@aeternity/aepp-sdk'
|
|
27
|
-
*/
|
|
28
|
-
import { salt } from "../utils/crypto.mjs";
|
|
29
|
-
import { commitmentHash, ensureNameValid, isAuctionName } from "../tx/builder/helpers.mjs";
|
|
30
|
-
import Ae from "./index.mjs";
|
|
31
|
-
import { CLIENT_TTL, NAME_TTL } from "../tx/builder/schema.mjs";
|
|
32
|
-
import { ArgumentError } from "../utils/errors.mjs";
|
|
33
|
-
/**
|
|
34
|
-
* Revoke a name
|
|
35
|
-
* @instance
|
|
36
|
-
* @function
|
|
37
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
38
|
-
* @category async
|
|
39
|
-
* @param {String} name Name hash
|
|
40
|
-
* @param {Object} [options={}] options
|
|
41
|
-
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
42
|
-
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
43
|
-
* @param {Number|String|BigNumber} [options.fee] fee
|
|
44
|
-
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
45
|
-
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
46
|
-
* @return {Promise<Object>} Transaction result
|
|
47
|
-
* @example
|
|
48
|
-
* const name = 'test.chain'
|
|
49
|
-
* const nameObject = await sdkInstance.aensQuery(name)
|
|
50
|
-
*
|
|
51
|
-
* await sdkInstance.aensRevoke(name, { fee, ttl , nonce })
|
|
52
|
-
* // or
|
|
53
|
-
* await nameObject.revoke({ fee, ttl, nonce })
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
async function revoke(name) {
|
|
57
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
58
|
-
ensureNameValid(name);
|
|
59
|
-
const opt = { ...this.Ae.defaults,
|
|
60
|
-
...options
|
|
61
|
-
};
|
|
62
|
-
const nameRevokeTx = await this.nameRevokeTx({ ...opt,
|
|
63
|
-
nameId: name,
|
|
64
|
-
accountId: await this.address(opt)
|
|
65
|
-
});
|
|
66
|
-
return this.send(nameRevokeTx, opt);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Update a name
|
|
70
|
-
* @instance
|
|
71
|
-
* @function
|
|
72
|
-
* @category async
|
|
73
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
74
|
-
* @param {String} name AENS name
|
|
75
|
-
* @param {Object.<string, string>} pointers Map of pointer keys to corresponding addresses
|
|
76
|
-
* @param {Object} [options={}]
|
|
77
|
-
* @param {Boolean} [options.extendPointers] Get the pointers from the node and merge with provided
|
|
78
|
-
* ones. Pointers with the same type will be overwritten
|
|
79
|
-
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you
|
|
80
|
-
* pass publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
81
|
-
* @param {Number|String|BigNumber} [options.fee] fee
|
|
82
|
-
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
83
|
-
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
84
|
-
* @param {Number|String|BigNumber} [options.nameTtl=50000] Name ttl represented in number of
|
|
85
|
-
* blocks (Max value is 50000 blocks)
|
|
86
|
-
* @param {Number|String|BigNumber} [options.clientTtl=84600] a suggestion as to how long any
|
|
87
|
-
* clients should cache this information
|
|
88
|
-
* @return {Promise<Object>}
|
|
89
|
-
* @throws Invalid pointer array error
|
|
90
|
-
* @example
|
|
91
|
-
* const name = 'test.chain'
|
|
92
|
-
* const pointersArray = ['ak_asd23dasdas...,' 'ct_asdf34fasdasd...']
|
|
93
|
-
* const nameObject = await sdkInstance.aensQuery(name)
|
|
94
|
-
*
|
|
95
|
-
* await sdkInstance.aensUpdate(name, pointersArray, { nameTtl, ttl, fee, nonce, clientTtl })
|
|
96
|
-
* // or
|
|
97
|
-
* await nameObject.update(pointers, { nameTtl, ttl, fee, nonce, clientTtl })
|
|
98
|
-
*/
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
async function update(name) {
|
|
102
|
-
let pointers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
103
|
-
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
104
|
-
ensureNameValid(name);
|
|
105
|
-
const opt = { ...this.Ae.defaults,
|
|
106
|
-
...options
|
|
107
|
-
};
|
|
108
|
-
const allPointers = { ...(options.extendPointers && Object.fromEntries((await this.getName(name)).pointers.map(_ref => {
|
|
109
|
-
let {
|
|
110
|
-
key,
|
|
111
|
-
id
|
|
112
|
-
} = _ref;
|
|
113
|
-
return [key, id];
|
|
114
|
-
}))),
|
|
115
|
-
...pointers
|
|
116
|
-
};
|
|
117
|
-
const nameUpdateTx = await this.nameUpdateTx({ ...opt,
|
|
118
|
-
nameId: name,
|
|
119
|
-
accountId: await this.address(opt),
|
|
120
|
-
pointers: Object.entries(allPointers).map(_ref2 => {
|
|
121
|
-
let [key, id] = _ref2;
|
|
122
|
-
return {
|
|
123
|
-
key,
|
|
124
|
-
id
|
|
125
|
-
};
|
|
126
|
-
})
|
|
127
|
-
});
|
|
128
|
-
return this.send(nameUpdateTx, opt);
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Transfer a domain to another account
|
|
132
|
-
* @instance
|
|
133
|
-
* @function
|
|
134
|
-
* @category async
|
|
135
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
136
|
-
* @param {String} name AENS name
|
|
137
|
-
* @param {String} account Recipient account publick key
|
|
138
|
-
* @param {Object} [options={}]
|
|
139
|
-
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
140
|
-
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
141
|
-
* @param {Number|String|BigNumber} [options.fee] fee
|
|
142
|
-
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
143
|
-
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
144
|
-
* @return {Promise<Object>} Transaction result
|
|
145
|
-
* @example
|
|
146
|
-
* const name = 'test.chain'
|
|
147
|
-
* const recipientPub = 'ak_asd23dasdas...'
|
|
148
|
-
* const nameObject = await sdkInstance.aensQuery(name)
|
|
149
|
-
*
|
|
150
|
-
* await sdkInstance.aensTransfer(name, recipientPub, { ttl, fee, nonce })
|
|
151
|
-
* // or
|
|
152
|
-
* await nameObject.transfer(recipientPub, { ttl, fee, nonce })
|
|
153
|
-
*/
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
async function transfer(name, account) {
|
|
157
|
-
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
158
|
-
ensureNameValid(name);
|
|
159
|
-
const opt = { ...this.Ae.defaults,
|
|
160
|
-
...options
|
|
161
|
-
};
|
|
162
|
-
const nameTransferTx = await this.nameTransferTx({ ...opt,
|
|
163
|
-
nameId: name,
|
|
164
|
-
accountId: await this.address(opt),
|
|
165
|
-
recipientId: account
|
|
166
|
-
});
|
|
167
|
-
return this.send(nameTransferTx, opt);
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Query the AENS name info from the node
|
|
171
|
-
* and return the object with info and predefined functions for manipulating name
|
|
172
|
-
* @instance
|
|
173
|
-
* @function
|
|
174
|
-
* @category async
|
|
175
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
176
|
-
* @param {String} name
|
|
177
|
-
* @param {Object} opt Options
|
|
178
|
-
* @return {Promise<Object>}
|
|
179
|
-
* @example
|
|
180
|
-
* const nameObject = sdkInstance.aensQuery('test.chain')
|
|
181
|
-
* console.log(nameObject)
|
|
182
|
-
* {
|
|
183
|
-
* id, // name hash
|
|
184
|
-
* pointers, // array of pointers
|
|
185
|
-
* update, // Update name function
|
|
186
|
-
* extendTtl, // Extend Ttl name function
|
|
187
|
-
* transfer, // Transfer name function
|
|
188
|
-
* revoke // Revoke name function
|
|
189
|
-
* }
|
|
190
|
-
*/
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
async function query(name) {
|
|
194
|
-
var _this = this;
|
|
195
|
-
|
|
196
|
-
let opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
197
|
-
ensureNameValid(name);
|
|
198
|
-
const o = await this.getName(name);
|
|
199
|
-
return Object.freeze(Object.assign(o, {
|
|
200
|
-
pointers: o.pointers || [],
|
|
201
|
-
update: async function (pointers) {
|
|
202
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
203
|
-
return { ...(await _this.aensUpdate(name, pointers, { ...opt,
|
|
204
|
-
...options
|
|
205
|
-
})),
|
|
206
|
-
...(await _this.aensQuery(name))
|
|
207
|
-
};
|
|
208
|
-
},
|
|
209
|
-
transfer: async function (account) {
|
|
210
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
211
|
-
return { ...(await _this.aensTransfer(name, account, { ...opt,
|
|
212
|
-
...options
|
|
213
|
-
})),
|
|
214
|
-
...(await _this.aensQuery(name))
|
|
215
|
-
};
|
|
216
|
-
},
|
|
217
|
-
revoke: async function () {
|
|
218
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
219
|
-
return _this.aensRevoke(name, { ...opt,
|
|
220
|
-
...options
|
|
221
|
-
});
|
|
222
|
-
},
|
|
223
|
-
extendTtl: async function () {
|
|
224
|
-
let nameTtl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : NAME_TTL;
|
|
225
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
226
|
-
|
|
227
|
-
if (typeof nameTtl !== 'number' || nameTtl > NAME_TTL || nameTtl <= 0) {
|
|
228
|
-
throw new ArgumentError('nameTtl', `a number between 1 and ${NAME_TTL} blocks`, nameTtl);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
return { ...(await _this.aensUpdate(name, {}, { ...opt,
|
|
232
|
-
...options,
|
|
233
|
-
nameTtl,
|
|
234
|
-
extendPointers: true
|
|
235
|
-
})),
|
|
236
|
-
...(await _this.aensQuery(name))
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
}));
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Claim a previously preclaimed registration. This can only be done after the
|
|
243
|
-
* preclaim step
|
|
244
|
-
* @instance
|
|
245
|
-
* @function
|
|
246
|
-
* @category async
|
|
247
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
248
|
-
* @param {String} name
|
|
249
|
-
* @param {Number} salt Salt from pre-claim, or 0 if it's a bid
|
|
250
|
-
* @param {Object} [options] options
|
|
251
|
-
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
252
|
-
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
253
|
-
* @param {Number|String|BigNumber} [options.fee] fee
|
|
254
|
-
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
255
|
-
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
256
|
-
* @param {Number|String} [options.nameFee] Name Fee (By default calculated by sdk)
|
|
257
|
-
* @return {Promise<Object>} the result of the claim
|
|
258
|
-
* @example
|
|
259
|
-
* const name = 'test.chain'
|
|
260
|
-
* const salt = preclaimResult.salt // salt from pre-claim transaction
|
|
261
|
-
*
|
|
262
|
-
* await sdkInstance.aensClaim(name, salt, { ttl, fee, nonce, nameFee })
|
|
263
|
-
*/
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
async function claim(name, salt, options) {
|
|
267
|
-
ensureNameValid(name);
|
|
268
|
-
const opt = { ...this.Ae.defaults,
|
|
269
|
-
...options
|
|
270
|
-
};
|
|
271
|
-
const claimTx = await this.nameClaimTx({ ...opt,
|
|
272
|
-
accountId: await this.address(opt),
|
|
273
|
-
nameSalt: salt,
|
|
274
|
-
name
|
|
275
|
-
});
|
|
276
|
-
const result = await this.send(claimTx, opt);
|
|
277
|
-
|
|
278
|
-
if (!isAuctionName(name)) {
|
|
279
|
-
const nameInter = opt.waitMined ? await this.aensQuery(name, opt) : {};
|
|
280
|
-
return Object.assign(result, nameInter);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
return { ...result,
|
|
284
|
-
nameFee: opt.nameFee
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* Preclaim a name. Sends a hash of the name and a random salt to the node
|
|
289
|
-
* @instance
|
|
290
|
-
* @function
|
|
291
|
-
* @category async
|
|
292
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
293
|
-
* @param {String} name
|
|
294
|
-
* @param {Object} [options={}]
|
|
295
|
-
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
296
|
-
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
297
|
-
* @param {Number|String|BigNumber} [options.fee] fee
|
|
298
|
-
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
299
|
-
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
300
|
-
* @return {Promise<Object>}
|
|
301
|
-
* @example
|
|
302
|
-
* const name = 'test.chain'
|
|
303
|
-
* const salt = preclaimResult.salt // salt from pre-claim transaction
|
|
304
|
-
*
|
|
305
|
-
* await sdkInstance.aensPreclaim(name, { ttl, fee, nonce })
|
|
306
|
-
* {
|
|
307
|
-
* ...transactionResult,
|
|
308
|
-
* claim, // Claim function (options={}) => claimTransactionResult
|
|
309
|
-
* salt,
|
|
310
|
-
* commitmentId
|
|
311
|
-
* }
|
|
312
|
-
*/
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
async function preclaim(name) {
|
|
316
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
317
|
-
ensureNameValid(name);
|
|
318
|
-
const opt = { ...this.Ae.defaults,
|
|
319
|
-
...options
|
|
320
|
-
};
|
|
321
|
-
|
|
322
|
-
const _salt = salt();
|
|
323
|
-
|
|
324
|
-
const height = await this.height();
|
|
325
|
-
const commitmentId = commitmentHash(name, _salt);
|
|
326
|
-
const preclaimTx = await this.namePreclaimTx({ ...opt,
|
|
327
|
-
accountId: await this.address(opt),
|
|
328
|
-
commitmentId
|
|
329
|
-
});
|
|
330
|
-
const result = await this.send(preclaimTx, opt);
|
|
331
|
-
return Object.freeze({ ...result,
|
|
332
|
-
height,
|
|
333
|
-
claim: options => this.aensClaim(name, _salt, { ...options,
|
|
334
|
-
onAccount: opt.onAccount
|
|
335
|
-
}),
|
|
336
|
-
salt: _salt,
|
|
337
|
-
commitmentId
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Bid to name auction
|
|
342
|
-
* @instance
|
|
343
|
-
* @function
|
|
344
|
-
* @category async
|
|
345
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
346
|
-
* @param {String} name Domain name
|
|
347
|
-
* @param {String|Number} nameFee Name fee (bid fee)
|
|
348
|
-
* @param {Object} [options={}]
|
|
349
|
-
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
350
|
-
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
351
|
-
* @param {Number|String|BigNumber} [options.fee] fee
|
|
352
|
-
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
353
|
-
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
354
|
-
* @return {Promise<Object>} Transaction result
|
|
355
|
-
* @example
|
|
356
|
-
* const name = 'test.chain'
|
|
357
|
-
* const bidFee = computeBidFee(name, startFee, incrementPercentage)
|
|
358
|
-
*
|
|
359
|
-
* await sdkInstance.aensBid(name, 213109412839123, { ttl, fee, nonce })
|
|
360
|
-
*/
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
async function bid(name, nameFee) {
|
|
364
|
-
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
365
|
-
return this.aensClaim(name, 0, { ...options,
|
|
366
|
-
nameFee,
|
|
367
|
-
vsn: 2
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* Aens Stamp
|
|
372
|
-
*
|
|
373
|
-
* Aens provides name-system related methods atop
|
|
374
|
-
* {@link module:@aeternity/aepp-sdk/es/ae--Ae} clients.
|
|
375
|
-
* @function
|
|
376
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
377
|
-
* @rtype Stamp
|
|
378
|
-
* @param {Object} [options={}] - Initializer object
|
|
379
|
-
* @return {Object} Aens instance
|
|
380
|
-
*/
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
const Aens = Ae.compose({
|
|
384
|
-
methods: {
|
|
385
|
-
aensQuery: query,
|
|
386
|
-
aensPreclaim: preclaim,
|
|
387
|
-
aensClaim: claim,
|
|
388
|
-
aensUpdate: update,
|
|
389
|
-
aensTransfer: transfer,
|
|
390
|
-
aensRevoke: revoke,
|
|
391
|
-
aensBid: bid
|
|
392
|
-
},
|
|
393
|
-
deepProps: {
|
|
394
|
-
Ae: {
|
|
395
|
-
defaults: {
|
|
396
|
-
clientTtl: CLIENT_TTL,
|
|
397
|
-
nameTtl: NAME_TTL // aec_governance:name_claim_max_expiration() => 50000
|
|
398
|
-
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
export default Aens;
|
|
404
|
-
//# sourceMappingURL=aens.mjs.map
|
package/es/ae/aens.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ae/aens.js"],"names":["salt","commitmentHash","ensureNameValid","isAuctionName","Ae","CLIENT_TTL","NAME_TTL","ArgumentError","revoke","name","options","opt","defaults","nameRevokeTx","nameId","accountId","address","send","update","pointers","allPointers","extendPointers","Object","fromEntries","getName","map","key","id","nameUpdateTx","entries","transfer","account","nameTransferTx","recipientId","query","o","freeze","assign","aensUpdate","aensQuery","aensTransfer","aensRevoke","extendTtl","nameTtl","claim","claimTx","nameClaimTx","nameSalt","result","nameInter","waitMined","nameFee","preclaim","_salt","height","commitmentId","preclaimTx","namePreclaimTx","aensClaim","onAccount","bid","vsn","Aens","compose","methods","aensPreclaim","aensBid","deepProps","clientTtl"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;SAESA,I;SACAC,c,EAAgBC,e,EAAiBC,a;OACnCC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ejD,IAAf,EAAqB4C,KAArB,EAA4B,EAAE,GAAG3C,OAAL;AAAciD,MAAAA,SAAS,EAAEhD,GAAG,CAACgD;AAA7B,KAA5B,CAHC;AAInB3D,IAAAA,IAAI,EAAEqD,KAJa;AAKnBE,IAAAA;AALmB,GAAd,CAAP;AAOD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,eAAeK,GAAf,CAAoBnD,IAApB,EAA0B0C,OAA1B,EAAiD;AAAA,MAAdzC,OAAc,uEAAJ,EAAI;AAC/C,SAAO,KAAKgD,SAAL,CAAejD,IAAf,EAAqB,CAArB,EAAwB,EAAE,GAAGC,OAAL;AAAcyC,IAAAA,OAAd;AAAuBU,IAAAA,GAAG,EAAE;AAA5B,GAAxB,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMC,IAAI,GAAG1D,EAAE,CAAC2D,OAAH,CAAW;AACtBC,EAAAA,OAAO,EAAE;AACPzB,IAAAA,SAAS,EAAEL,KADJ;AAEP+B,IAAAA,YAAY,EAAEb,QAFP;AAGPM,IAAAA,SAAS,EAAEd,KAHJ;AAIPN,IAAAA,UAAU,EAAEpB,MAJL;AAKPsB,IAAAA,YAAY,EAAEV,QALP;AAMPW,IAAAA,UAAU,EAAEjC,MANL;AAOP0D,IAAAA,OAAO,EAAEN;AAPF,GADa;AAUtBO,EAAAA,SAAS,EAAE;AACT/D,IAAAA,EAAE,EAAE;AACFQ,MAAAA,QAAQ,EAAE;AACRwD,QAAAA,SAAS,EAAE/D,UADH;AAERsC,QAAAA,OAAO,EAAErC,QAFD,CAEU;;AAFV;AADR;AADK;AAVW,CAAX,CAAb;AAoBA,eAAewD,IAAf","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2018 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/**\n * Aens module - routines to interact with the æternity naming system\n *\n * The high-level description of the naming system is\n * https://github.com/aeternity/protocol/blob/master/AENS.md in the protocol\n * repository.\n * @module @aeternity/aepp-sdk/es/ae/aens\n * @export Aens\n * @example import { Aens } from '@aeternity/aepp-sdk'\n */\n\nimport { salt } from '../utils/crypto'\nimport { commitmentHash, ensureNameValid, isAuctionName } from '../tx/builder/helpers'\nimport Ae from './'\nimport { CLIENT_TTL, NAME_TTL } from '../tx/builder/schema'\nimport { ArgumentError } from '../utils/errors'\n\n/**\n * Revoke a name\n * @instance\n * @function\n * @alias module:@aeternity/aepp-sdk/es/ae/aens\n * @category async\n * @param {String} name Name hash\n * @param {Object} [options={}] options\n * @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass\n * publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)\n * @param {Number|String|BigNumber} [options.fee] fee\n * @param {Number|String|BigNumber} [options.ttl] ttl\n * @param {Number|String|BigNumber} [options.nonce] nonce\n * @return {Promise<Object>} Transaction result\n * @example\n * const name = 'test.chain'\n * const nameObject = await sdkInstance.aensQuery(name)\n *\n * await sdkInstance.aensRevoke(name, { fee, ttl , nonce })\n * // or\n * await nameObject.revoke({ fee, ttl, nonce })\n */\nasync function revoke (name, options = {}) {\n ensureNameValid(name)\n const opt = { ...this.Ae.defaults, ...options }\n\n const nameRevokeTx = await this.nameRevokeTx({\n ...opt,\n nameId: name,\n accountId: await this.address(opt)\n })\n\n return this.send(nameRevokeTx, opt)\n}\n\n/**\n * Update a name\n * @instance\n * @function\n * @category async\n * @alias module:@aeternity/aepp-sdk/es/ae/aens\n * @param {String} name AENS name\n * @param {Object.<string, string>} pointers Map of pointer keys to corresponding addresses\n * @param {Object} [options={}]\n * @param {Boolean} [options.extendPointers] Get the pointers from the node and merge with provided\n * ones. Pointers with the same type will be overwritten\n * @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you\n * pass publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)\n * @param {Number|String|BigNumber} [options.fee] fee\n * @param {Number|String|BigNumber} [options.ttl] ttl\n * @param {Number|String|BigNumber} [options.nonce] nonce\n * @param {Number|String|BigNumber} [options.nameTtl=50000] Name ttl represented in number of\n * blocks (Max value is 50000 blocks)\n * @param {Number|String|BigNumber} [options.clientTtl=84600] a suggestion as to how long any\n * clients should cache this information\n * @return {Promise<Object>}\n * @throws Invalid pointer array error\n * @example\n * const name = 'test.chain'\n * const pointersArray = ['ak_asd23dasdas...,' 'ct_asdf34fasdasd...']\n * const nameObject = await sdkInstance.aensQuery(name)\n *\n * await sdkInstance.aensUpdate(name, pointersArray, { nameTtl, ttl, fee, nonce, clientTtl })\n * // or\n * await nameObject.update(pointers, { nameTtl, ttl, fee, nonce, clientTtl })\n */\nasync function update (name, pointers = {}, options = {}) {\n ensureNameValid(name)\n const opt = { ...this.Ae.defaults, ...options }\n const allPointers = {\n ...options.extendPointers && Object.fromEntries(\n (await this.getName(name)).pointers.map(({ key, id }) => [key, id])\n ),\n ...pointers\n }\n\n const nameUpdateTx = await this.nameUpdateTx({\n ...opt,\n nameId: name,\n accountId: await this.address(opt),\n pointers: Object.entries(allPointers).map(([key, id]) => ({ key, id }))\n })\n\n return this.send(nameUpdateTx, opt)\n}\n\n/**\n * Transfer a domain to another account\n * @instance\n * @function\n * @category async\n * @alias module:@aeternity/aepp-sdk/es/ae/aens\n * @param {String} name AENS name\n * @param {String} account Recipient account publick key\n * @param {Object} [options={}]\n * @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass\n * publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)\n * @param {Number|String|BigNumber} [options.fee] fee\n * @param {Number|String|BigNumber} [options.ttl] ttl\n * @param {Number|String|BigNumber} [options.nonce] nonce\n * @return {Promise<Object>} Transaction result\n * @example\n * const name = 'test.chain'\n * const recipientPub = 'ak_asd23dasdas...'\n * const nameObject = await sdkInstance.aensQuery(name)\n *\n * await sdkInstance.aensTransfer(name, recipientPub, { ttl, fee, nonce })\n * // or\n * await nameObject.transfer(recipientPub, { ttl, fee, nonce })\n */\nasync function transfer (name, account, options = {}) {\n ensureNameValid(name)\n const opt = { ...this.Ae.defaults, ...options }\n\n const nameTransferTx = await this.nameTransferTx({\n ...opt,\n nameId: name,\n accountId: await this.address(opt),\n recipientId: account\n })\n\n return this.send(nameTransferTx, opt)\n}\n\n/**\n * Query the AENS name info from the node\n * and return the object with info and predefined functions for manipulating name\n * @instance\n * @function\n * @category async\n * @alias module:@aeternity/aepp-sdk/es/ae/aens\n * @param {String} name\n * @param {Object} opt Options\n * @return {Promise<Object>}\n * @example\n * const nameObject = sdkInstance.aensQuery('test.chain')\n * console.log(nameObject)\n * {\n * id, // name hash\n * pointers, // array of pointers\n * update, // Update name function\n * extendTtl, // Extend Ttl name function\n * transfer, // Transfer name function\n * revoke // Revoke name function\n * }\n */\nasync function query (name, opt = {}) {\n ensureNameValid(name)\n const o = await this.getName(name)\n\n return Object.freeze(Object.assign(o, {\n pointers: o.pointers || [],\n update: async (pointers, options = {}) => {\n return {\n ...(await this.aensUpdate(name, pointers, { ...opt, ...options })),\n ...(await this.aensQuery(name))\n }\n },\n transfer: async (account, options = {}) => {\n return {\n ...(await this.aensTransfer(name, account, { ...opt, ...options })),\n ...(await this.aensQuery(name))\n }\n },\n revoke: async (options = {}) => this.aensRevoke(name, { ...opt, ...options }),\n extendTtl: async (nameTtl = NAME_TTL, options = {}) => {\n if (typeof nameTtl !== 'number' || nameTtl > NAME_TTL || nameTtl <= 0) {\n throw new ArgumentError('nameTtl', `a number between 1 and ${NAME_TTL} blocks`, nameTtl)\n }\n\n return {\n ...await this.aensUpdate(name, {}, { ...opt, ...options, nameTtl, extendPointers: true }),\n ...await this.aensQuery(name)\n }\n }\n }))\n}\n\n/**\n * Claim a previously preclaimed registration. This can only be done after the\n * preclaim step\n * @instance\n * @function\n * @category async\n * @alias module:@aeternity/aepp-sdk/es/ae/aens\n * @param {String} name\n * @param {Number} salt Salt from pre-claim, or 0 if it's a bid\n * @param {Object} [options] options\n * @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass\n * publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)\n * @param {Number|String|BigNumber} [options.fee] fee\n * @param {Number|String|BigNumber} [options.ttl] ttl\n * @param {Number|String|BigNumber} [options.nonce] nonce\n * @param {Number|String} [options.nameFee] Name Fee (By default calculated by sdk)\n * @return {Promise<Object>} the result of the claim\n * @example\n * const name = 'test.chain'\n * const salt = preclaimResult.salt // salt from pre-claim transaction\n *\n * await sdkInstance.aensClaim(name, salt, { ttl, fee, nonce, nameFee })\n */\nasync function claim (name, salt, options) {\n ensureNameValid(name)\n const opt = { ...this.Ae.defaults, ...options }\n\n const claimTx = await this.nameClaimTx({\n ...opt,\n accountId: await this.address(opt),\n nameSalt: salt,\n name\n })\n\n const result = await this.send(claimTx, opt)\n if (!isAuctionName(name)) {\n const nameInter = opt.waitMined ? await this.aensQuery(name, opt) : {}\n return Object.assign(result, nameInter)\n }\n return { ...result, nameFee: opt.nameFee }\n}\n\n/**\n * Preclaim a name. Sends a hash of the name and a random salt to the node\n * @instance\n * @function\n * @category async\n * @alias module:@aeternity/aepp-sdk/es/ae/aens\n * @param {String} name\n * @param {Object} [options={}]\n * @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass\n * publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)\n * @param {Number|String|BigNumber} [options.fee] fee\n * @param {Number|String|BigNumber} [options.ttl] ttl\n * @param {Number|String|BigNumber} [options.nonce] nonce\n * @return {Promise<Object>}\n * @example\n * const name = 'test.chain'\n * const salt = preclaimResult.salt // salt from pre-claim transaction\n *\n * await sdkInstance.aensPreclaim(name, { ttl, fee, nonce })\n * {\n * ...transactionResult,\n * claim, // Claim function (options={}) => claimTransactionResult\n * salt,\n * commitmentId\n * }\n */\nasync function preclaim (name, options = {}) {\n ensureNameValid(name)\n const opt = { ...this.Ae.defaults, ...options }\n const _salt = salt()\n const height = await this.height()\n const commitmentId = commitmentHash(name, _salt)\n\n const preclaimTx = await this.namePreclaimTx({\n ...opt,\n accountId: await this.address(opt),\n commitmentId\n })\n\n const result = await this.send(preclaimTx, opt)\n\n return Object.freeze({\n ...result,\n height,\n claim: options => this.aensClaim(name, _salt, { ...options, onAccount: opt.onAccount }),\n salt: _salt,\n commitmentId\n })\n}\n\n/**\n * Bid to name auction\n * @instance\n * @function\n * @category async\n * @alias module:@aeternity/aepp-sdk/es/ae/aens\n * @param {String} name Domain name\n * @param {String|Number} nameFee Name fee (bid fee)\n * @param {Object} [options={}]\n * @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass\n * publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)\n * @param {Number|String|BigNumber} [options.fee] fee\n * @param {Number|String|BigNumber} [options.ttl] ttl\n * @param {Number|String|BigNumber} [options.nonce] nonce\n * @return {Promise<Object>} Transaction result\n * @example\n * const name = 'test.chain'\n * const bidFee = computeBidFee(name, startFee, incrementPercentage)\n *\n * await sdkInstance.aensBid(name, 213109412839123, { ttl, fee, nonce })\n */\nasync function bid (name, nameFee, options = {}) {\n return this.aensClaim(name, 0, { ...options, nameFee, vsn: 2 })\n}\n\n/**\n * Aens Stamp\n *\n * Aens provides name-system related methods atop\n * {@link module:@aeternity/aepp-sdk/es/ae--Ae} clients.\n * @function\n * @alias module:@aeternity/aepp-sdk/es/ae/aens\n * @rtype Stamp\n * @param {Object} [options={}] - Initializer object\n * @return {Object} Aens instance\n */\nconst Aens = Ae.compose({\n methods: {\n aensQuery: query,\n aensPreclaim: preclaim,\n aensClaim: claim,\n aensUpdate: update,\n aensTransfer: transfer,\n aensRevoke: revoke,\n aensBid: bid\n },\n deepProps: {\n Ae: {\n defaults: {\n clientTtl: CLIENT_TTL,\n nameTtl: NAME_TTL // aec_governance:name_claim_max_expiration() => 50000\n }\n }\n }\n})\n\nexport default Aens\n"],"file":"aens.mjs"}
|
package/es/ae/aepp.mjs
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ISC License (ISC)
|
|
3
|
-
* Copyright (c) 2021 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
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Aepp module
|
|
20
|
-
* @module @aeternity/aepp-sdk/es/ae/aepp
|
|
21
|
-
* @export Aepp
|
|
22
|
-
* @example import { RpcAepp } from '@aeternity/aepp-sdk'
|
|
23
|
-
*/
|
|
24
|
-
import Ae from "./index.mjs";
|
|
25
|
-
import Aens from "./aens.mjs";
|
|
26
|
-
import Contract from "./contract.mjs";
|
|
27
|
-
import AeppRpc from "../utils/aepp-wallet-communication/rpc/aepp-rpc.mjs";
|
|
28
|
-
import Chain from "../chain/node.mjs";
|
|
29
|
-
import Tx from "../tx/tx.mjs";
|
|
30
|
-
import Oracle from "./oracle.mjs";
|
|
31
|
-
/**
|
|
32
|
-
* Aepp Stamp
|
|
33
|
-
*
|
|
34
|
-
* Aepp provides base functionality.
|
|
35
|
-
* Expected to use this stamp with a Wallet.
|
|
36
|
-
* {@link module:@aeternity/aepp-sdk/es/ae--Ae} clients.
|
|
37
|
-
* @function
|
|
38
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/aepp
|
|
39
|
-
* @rtype Stamp
|
|
40
|
-
* @param {Object} [options={}] - Initializer object
|
|
41
|
-
* @return {Object} Aepp instance
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
export default Ae.compose(Tx, Oracle, Contract, Aens, Chain, AeppRpc);
|
|
45
|
-
//# sourceMappingURL=aepp.mjs.map
|
package/es/ae/aepp.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ae/aepp.js"],"names":["Ae","Aens","Contract","AeppRpc","Chain","Tx","Oracle","compose"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;OAEOA,E;OACAC,I;OACAC,Q;OACAC,O;OACAC,K;OACAC,E;OACAC,M;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAeN,EAAE,CAACO,OAAH,CAAWF,EAAX,EAAeC,MAAf,EAAuBJ,QAAvB,EAAiCD,IAAjC,EAAuCG,KAAvC,EAA8CD,OAA9C,CAAf","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2021 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/**\n * Aepp module\n * @module @aeternity/aepp-sdk/es/ae/aepp\n * @export Aepp\n * @example import { RpcAepp } from '@aeternity/aepp-sdk'\n */\n\nimport Ae from './'\nimport Aens from './aens'\nimport Contract from './contract'\nimport AeppRpc from '../utils/aepp-wallet-communication/rpc/aepp-rpc'\nimport Chain from '../chain/node'\nimport Tx from '../tx/tx'\nimport Oracle from './oracle'\n\n/**\n * Aepp Stamp\n *\n * Aepp provides base functionality.\n * Expected to use this stamp with a Wallet.\n * {@link module:@aeternity/aepp-sdk/es/ae--Ae} clients.\n * @function\n * @alias module:@aeternity/aepp-sdk/es/ae/aepp\n * @rtype Stamp\n * @param {Object} [options={}] - Initializer object\n * @return {Object} Aepp instance\n */\nexport default Ae.compose(Tx, Oracle, Contract, Aens, Chain, AeppRpc)\n"],"file":"aepp.mjs"}
|
package/es/ae/contract.mjs
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import _buffer from "buffer";
|
|
2
|
-
const {
|
|
3
|
-
Buffer: _Buffer
|
|
4
|
-
} = _buffer;
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* ISC License (ISC)
|
|
8
|
-
* Copyright (c) 2021 aeternity developers
|
|
9
|
-
*
|
|
10
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
11
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
12
|
-
* copyright notice and this permission notice appear in all copies.
|
|
13
|
-
*
|
|
14
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
15
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
16
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
17
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
18
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
19
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
20
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Contract module - routines to interact with the æternity contract
|
|
25
|
-
*
|
|
26
|
-
* High level documentation of the contracts are available at
|
|
27
|
-
* https://github.com/aeternity/protocol/tree/master/contracts and
|
|
28
|
-
*
|
|
29
|
-
* @module @aeternity/aepp-sdk/es/ae/contract
|
|
30
|
-
* @export Contract
|
|
31
|
-
* @example import { Contract } from '@aeternity/aepp-sdk'
|
|
32
|
-
*/
|
|
33
|
-
import Ae from "./index.mjs";
|
|
34
|
-
import ContractCompilerHttp from "../contract/compiler.mjs";
|
|
35
|
-
import getContractInstance from "../contract/aci.mjs";
|
|
36
|
-
import { AMOUNT, MIN_GAS_PRICE } from "../tx/builder/schema.mjs";
|
|
37
|
-
import { decode, produceNameId } from "../tx/builder/helpers.mjs";
|
|
38
|
-
/**
|
|
39
|
-
* Utility method to create a delegate signature for a contract
|
|
40
|
-
* @function
|
|
41
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/contract
|
|
42
|
-
* @category async
|
|
43
|
-
* @param {String[]} ids The list of id's to prepend
|
|
44
|
-
* @param {Object} [opt={}] options
|
|
45
|
-
* @param {{ onAccount: String | Object }} [opt={}] opt Options
|
|
46
|
-
* @return {Promise<String>} Signature in hex representation
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
|
-
async function delegateSignatureCommon() {
|
|
50
|
-
let ids = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
51
|
-
let opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
52
|
-
const signature = await this.sign(_Buffer.concat([_Buffer.from(this.getNetworkId(opt)), ...ids.map(e => decode(e))]), opt);
|
|
53
|
-
return _Buffer.from(signature).toString('hex');
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Helper to generate a signature to delegate pre-claim/claim/transfer/revoke of a name to
|
|
57
|
-
* a contract.
|
|
58
|
-
* @function
|
|
59
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/contract
|
|
60
|
-
* @category async
|
|
61
|
-
* @param {String} contractId Contract Id
|
|
62
|
-
* @param {String} [name] The name
|
|
63
|
-
* @param {{ onAccount: String | Object }} [opt={}] opt Options
|
|
64
|
-
* @return {Promise<String>} Signature for delegation
|
|
65
|
-
* @example
|
|
66
|
-
* const aeSdk = await Universal({ ... })
|
|
67
|
-
* const contractId = 'ct_asd2ks...' // contract address
|
|
68
|
-
* const name = 'example.chain' // AENS name
|
|
69
|
-
* const onAccount = await aeSdk.address() // Sign with a specific account
|
|
70
|
-
* // Preclaim signature
|
|
71
|
-
* const params = { contractId }
|
|
72
|
-
* const preclaimSig = await aeSdk.createAensDelegationSignature(params, { onAccount: current })
|
|
73
|
-
* // Claim, transfer and revoke signature
|
|
74
|
-
* const params = { contractId, name }
|
|
75
|
-
* const aensDelegationSig = await contract.createAensDelegationSignature(
|
|
76
|
-
* params, name, { onAccount: current }
|
|
77
|
-
* )
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
async function createAensDelegationSignature(_ref) {
|
|
82
|
-
let {
|
|
83
|
-
contractId,
|
|
84
|
-
name
|
|
85
|
-
} = _ref;
|
|
86
|
-
let opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
87
|
-
return this.delegateSignatureCommon([await this.address(opt), ...(name ? [produceNameId(name)] : []), contractId], opt);
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Helper to generate a signature to delegate register/extend/respond of a Oracle to a contract.
|
|
91
|
-
* @function
|
|
92
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/contract
|
|
93
|
-
* @category async
|
|
94
|
-
* @param {String} contractId Contract Id
|
|
95
|
-
* @param {String} [queryId] Oracle Query Id
|
|
96
|
-
* @param {{ onAccount: String | Object }} [opt={}] opt Options
|
|
97
|
-
* @return {Promise<String>} Signature for delegation
|
|
98
|
-
* @example
|
|
99
|
-
* const aeSdk = await Universal({ ... })
|
|
100
|
-
* const contractId = 'ct_asd2ks...' // contract address
|
|
101
|
-
* const queryId = 'oq_...' // Oracle Query Id
|
|
102
|
-
* const onAccount = await aeSdk.address() // Sign with a specific account
|
|
103
|
-
* // Oracle register and extend signature
|
|
104
|
-
* const params = { contractId }
|
|
105
|
-
* const oracleDelegationSig = await contract.createOracleDelegationSignature(params, { onAccount })
|
|
106
|
-
* // Oracle respond signature
|
|
107
|
-
* const params = { contractId, queryId }
|
|
108
|
-
* const respondSig = await contract.createOracleDelegationSignature(params, queryId)
|
|
109
|
-
*/
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
async function createOracleDelegationSignature(_ref2) {
|
|
113
|
-
let {
|
|
114
|
-
contractId,
|
|
115
|
-
queryId
|
|
116
|
-
} = _ref2;
|
|
117
|
-
let opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
118
|
-
return this.delegateSignatureCommon([queryId !== null && queryId !== void 0 ? queryId : await this.address(opt), contractId], opt);
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Contract Stamp
|
|
122
|
-
*
|
|
123
|
-
* Provide contract implementation
|
|
124
|
-
* {@link module:@aeternity/aepp-sdk/es/ae--Ae} clients.
|
|
125
|
-
* @function
|
|
126
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/contract
|
|
127
|
-
* @rtype Stamp
|
|
128
|
-
* @param {Object} [options={}] - Initializer object
|
|
129
|
-
* @return {Object} Contract instance
|
|
130
|
-
* @example
|
|
131
|
-
* import { Transaction, MemoryAccount, ChainNode } from '@aeternity/aepp-sdk
|
|
132
|
-
*
|
|
133
|
-
* const ContractWithAE = await Contract
|
|
134
|
-
* .compose(Transaction, MemoryAccount, ChainNode) // AE implementation
|
|
135
|
-
* const client = await ContractWithAe({ url, internalUrl, compilerUrl, keypair, ... })
|
|
136
|
-
*
|
|
137
|
-
*/
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
export default Ae.compose(ContractCompilerHttp, {
|
|
141
|
-
methods: {
|
|
142
|
-
getContractInstance,
|
|
143
|
-
// Delegation for contract
|
|
144
|
-
delegateSignatureCommon,
|
|
145
|
-
// AENS
|
|
146
|
-
createAensDelegationSignature,
|
|
147
|
-
// Oracle
|
|
148
|
-
createOracleDelegationSignature
|
|
149
|
-
},
|
|
150
|
-
deepProps: {
|
|
151
|
-
Ae: {
|
|
152
|
-
defaults: {
|
|
153
|
-
gasPrice: MIN_GAS_PRICE,
|
|
154
|
-
amount: AMOUNT
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
//# sourceMappingURL=contract.mjs.map
|