@aeternity/aepp-sdk 9.0.1 → 11.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 +15 -14
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.LICENSE.txt +7 -36
- 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/account/base.mjs +179 -0
- package/es/account/base.mjs.map +1 -0
- package/es/account/memory.mjs +99 -0
- package/es/account/memory.mjs.map +1 -0
- package/es/account/multiple.mjs +179 -0
- package/es/account/multiple.mjs.map +1 -0
- package/es/ae/aens.mjs +404 -0
- package/es/ae/aens.mjs.map +1 -0
- package/es/ae/{aepp.js → aepp.mjs} +9 -9
- package/es/ae/aepp.mjs.map +1 -0
- package/es/ae/contract.mjs +159 -0
- package/es/ae/contract.mjs.map +1 -0
- package/es/ae/index.mjs +207 -0
- package/es/ae/index.mjs.map +1 -0
- package/es/ae/oracle.mjs +339 -0
- package/es/ae/oracle.mjs.map +1 -0
- package/es/ae/{universal.js → universal.mjs} +10 -10
- package/es/ae/universal.mjs.map +1 -0
- package/es/ae/{wallet.js → wallet.mjs} +10 -10
- package/es/ae/wallet.mjs.map +1 -0
- package/es/aepp-wallet-communication/schema.d.ts +74 -0
- package/es/bignumber.d.ts +1 -7
- package/es/chain/{index.js → index.mjs} +29 -9
- package/es/chain/index.mjs.map +1 -0
- package/es/chain/node.mjs +442 -0
- package/es/chain/node.mjs.map +1 -0
- package/es/channel/handlers.mjs +1110 -0
- package/es/channel/handlers.mjs.map +1 -0
- package/es/channel/{index.js → index.mjs} +245 -472
- package/es/channel/index.mjs.map +1 -0
- package/es/channel/internal.mjs +283 -0
- package/es/channel/internal.mjs.map +1 -0
- package/es/contract/aci.mjs +477 -0
- package/es/contract/aci.mjs.map +1 -0
- package/es/contract/compiler.mjs +115 -0
- package/es/contract/compiler.mjs.map +1 -0
- package/es/contract/ga/helpers.mjs +30 -0
- package/es/contract/ga/helpers.mjs.map +1 -0
- package/es/contract/ga/index.mjs +178 -0
- package/es/contract/ga/index.mjs.map +1 -0
- package/es/errors.d.ts +284 -0
- package/es/index.mjs +57 -0
- package/es/index.mjs.map +1 -0
- package/es/node-pool/index.mjs +188 -0
- package/es/node-pool/index.mjs.map +1 -0
- package/es/node.mjs +133 -0
- package/es/node.mjs.map +1 -0
- package/es/other.d.ts +1 -1
- package/es/tx/builder/field-types.mjs +74 -0
- package/es/tx/builder/field-types.mjs.map +1 -0
- package/es/tx/builder/helpers.mjs +363 -0
- package/es/tx/builder/helpers.mjs.map +1 -0
- package/es/tx/builder/index.mjs +606 -0
- package/es/tx/builder/index.mjs.map +1 -0
- package/es/tx/builder/schema.mjs +760 -0
- package/es/tx/builder/schema.mjs.map +1 -0
- package/es/tx/{index.js → index.mjs} +107 -15
- package/es/tx/index.mjs.map +1 -0
- package/es/tx/tx-object.mjs +283 -0
- package/es/tx/tx-object.mjs.map +1 -0
- package/es/tx/tx.mjs +938 -0
- package/es/tx/tx.mjs.map +1 -0
- package/es/tx/validator.mjs +247 -0
- package/es/tx/validator.mjs.map +1 -0
- package/es/typings/blakejs/index.d.mjs +2 -0
- package/es/typings/blakejs/{index.d.js.map → index.d.mjs.map} +1 -1
- package/es/utils/aepp-wallet-communication/connection/{browser-runtime.js → browser-runtime.mjs} +27 -29
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs +183 -0
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/connection/{index.js → index.mjs} +7 -3
- package/es/utils/aepp-wallet-communication/connection/index.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/{content-script-bridge.js → content-script-bridge.mjs} +29 -23
- package/es/utils/aepp-wallet-communication/content-script-bridge.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/helpers.mjs +92 -0
- package/es/utils/aepp-wallet-communication/helpers.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs +375 -0
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs +275 -0
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs +541 -0
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/schema.mjs +102 -0
- package/es/utils/aepp-wallet-communication/schema.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/wallet-detector.mjs +110 -0
- package/es/utils/aepp-wallet-communication/wallet-detector.mjs.map +1 -0
- package/es/utils/amount-formatter.mjs +139 -0
- package/es/utils/amount-formatter.mjs.map +1 -0
- package/es/utils/async-init.mjs +64 -0
- package/es/utils/async-init.mjs.map +1 -0
- package/es/utils/bignumber.mjs +21 -0
- package/es/utils/bignumber.mjs.map +1 -0
- package/es/utils/{bytes.js → bytes.mjs} +16 -12
- package/es/utils/bytes.mjs.map +1 -0
- package/es/utils/{crypto-ts.js → crypto-ts.mjs} +11 -3
- package/es/utils/crypto-ts.mjs.map +1 -0
- package/es/utils/crypto.mjs +239 -0
- package/es/utils/crypto.mjs.map +1 -0
- package/es/utils/errors.mjs +689 -0
- package/es/utils/errors.mjs.map +1 -0
- package/es/utils/hd-wallet.mjs +111 -0
- package/es/utils/hd-wallet.mjs.map +1 -0
- package/es/utils/json-big.mjs +45 -0
- package/es/utils/json-big.mjs.map +1 -0
- package/es/utils/keystore.mjs +240 -0
- package/es/utils/keystore.mjs.map +1 -0
- package/es/utils/mptree.mjs +161 -0
- package/es/utils/mptree.mjs.map +1 -0
- package/es/utils/other.mjs +43 -0
- package/es/utils/other.mjs.map +1 -0
- package/es/utils/semver-satisfies.mjs +16 -0
- package/es/utils/semver-satisfies.mjs.map +1 -0
- package/es/utils/{string.js → string.mjs} +5 -14
- package/es/utils/string.mjs.map +1 -0
- package/es/utils/swagger.mjs +164 -0
- package/es/utils/swagger.mjs.map +1 -0
- package/package.json +55 -62
- package/src/account/base.js +3 -1
- package/src/account/memory.js +13 -8
- package/src/account/multiple.js +31 -22
- package/src/ae/aens.js +75 -77
- package/src/ae/aepp.js +2 -2
- package/src/ae/contract.js +27 -291
- package/src/ae/index.js +9 -7
- package/src/ae/oracle.js +51 -28
- package/src/ae/universal.js +4 -2
- package/src/ae/wallet.js +2 -2
- package/src/chain/index.js +29 -6
- package/src/chain/node.js +95 -67
- package/src/channel/handlers.js +30 -21
- package/src/channel/index.js +44 -20
- package/src/channel/internal.js +30 -24
- package/src/contract/aci.js +376 -0
- package/src/contract/compiler.js +41 -91
- package/src/contract/ga/helpers.js +10 -13
- package/src/contract/ga/index.js +42 -33
- package/src/index.js +9 -10
- package/src/node-pool/index.js +29 -17
- package/src/node.js +33 -36
- package/src/tx/builder/field-types.js +61 -0
- package/src/tx/builder/helpers.js +126 -84
- package/src/tx/builder/index.js +83 -41
- package/src/tx/builder/schema.js +50 -40
- package/src/tx/index.js +101 -12
- package/src/tx/tx-object.js +35 -15
- package/src/tx/tx.js +232 -153
- package/src/tx/validator.js +34 -12
- package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +11 -5
- package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +35 -13
- package/src/utils/aepp-wallet-communication/connection/index.js +2 -1
- package/src/utils/aepp-wallet-communication/content-script-bridge.js +14 -7
- package/src/utils/aepp-wallet-communication/helpers.js +6 -14
- package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +107 -60
- package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +24 -11
- package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +98 -56
- package/src/utils/aepp-wallet-communication/schema.ts +80 -0
- package/src/utils/aepp-wallet-communication/wallet-detector.js +6 -2
- package/src/utils/amount-formatter.ts +4 -3
- package/src/utils/async-init.js +10 -6
- package/src/utils/bignumber.ts +3 -10
- package/src/utils/bytes.ts +3 -2
- package/src/utils/crypto-ts.ts +2 -2
- package/src/utils/crypto.js +10 -144
- package/src/utils/errors.ts +683 -0
- package/src/utils/hd-wallet.js +11 -26
- package/src/utils/keystore.js +57 -53
- package/src/utils/mptree.ts +12 -6
- package/src/utils/other.ts +1 -1
- package/src/utils/semver-satisfies.ts +1 -1
- package/src/utils/swagger.js +75 -45
- package/es/account/base.js +0 -259
- package/es/account/base.js.map +0 -1
- package/es/account/memory.js +0 -86
- package/es/account/memory.js.map +0 -1
- package/es/account/multiple.js +0 -267
- package/es/account/multiple.js.map +0 -1
- package/es/ae/aens.js +0 -829
- package/es/ae/aens.js.map +0 -1
- package/es/ae/aepp.js.map +0 -1
- package/es/ae/contract.js +0 -985
- package/es/ae/contract.js.map +0 -1
- package/es/ae/index.js +0 -442
- package/es/ae/index.js.map +0 -1
- package/es/ae/oracle.js +0 -690
- package/es/ae/oracle.js.map +0 -1
- package/es/ae/universal.js.map +0 -1
- package/es/ae/wallet.js.map +0 -1
- package/es/chain/index.js.map +0 -1
- package/es/chain/node.js +0 -1119
- package/es/chain/node.js.map +0 -1
- package/es/channel/handlers.js +0 -1601
- package/es/channel/handlers.js.map +0 -1
- package/es/channel/index.js.map +0 -1
- package/es/channel/internal.js +0 -438
- package/es/channel/internal.js.map +0 -1
- package/es/contract/aci/helpers.js +0 -298
- package/es/contract/aci/helpers.js.map +0 -1
- package/es/contract/aci/index.js +0 -517
- package/es/contract/aci/index.js.map +0 -1
- package/es/contract/aci/transformation.js +0 -742
- package/es/contract/aci/transformation.js.map +0 -1
- package/es/contract/compiler.js +0 -316
- package/es/contract/compiler.js.map +0 -1
- package/es/contract/ga/helpers.js +0 -120
- package/es/contract/ga/helpers.js.map +0 -1
- package/es/contract/ga/index.js +0 -307
- package/es/contract/ga/index.js.map +0 -1
- package/es/contract/index.js +0 -158
- package/es/contract/index.js.map +0 -1
- package/es/index.js +0 -57
- package/es/index.js.map +0 -1
- package/es/node-pool/index.js +0 -204
- package/es/node-pool/index.js.map +0 -1
- package/es/node.js +0 -228
- package/es/node.js.map +0 -1
- package/es/tx/builder/helpers.js +0 -355
- package/es/tx/builder/helpers.js.map +0 -1
- package/es/tx/builder/index.js +0 -686
- package/es/tx/builder/index.js.map +0 -1
- package/es/tx/builder/schema.js +0 -695
- package/es/tx/builder/schema.js.map +0 -1
- package/es/tx/index.js.map +0 -1
- package/es/tx/tx-object.js +0 -297
- package/es/tx/tx-object.js.map +0 -1
- package/es/tx/tx.js +0 -1757
- package/es/tx/tx.js.map +0 -1
- package/es/tx/validator.js +0 -344
- package/es/tx/validator.js.map +0 -1
- package/es/typings/blakejs/index.d.js +0 -2
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.js.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.js +0 -211
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.js.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/index.js.map +0 -1
- package/es/utils/aepp-wallet-communication/content-script-bridge.js.map +0 -1
- package/es/utils/aepp-wallet-communication/helpers.js +0 -148
- package/es/utils/aepp-wallet-communication/helpers.js.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js +0 -652
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.js +0 -285
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.js.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js +0 -763
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js.map +0 -1
- package/es/utils/aepp-wallet-communication/schema.js +0 -103
- package/es/utils/aepp-wallet-communication/schema.js.map +0 -1
- package/es/utils/aepp-wallet-communication/wallet-detector.js +0 -135
- package/es/utils/aepp-wallet-communication/wallet-detector.js.map +0 -1
- package/es/utils/amount-formatter.js +0 -152
- package/es/utils/amount-formatter.js.map +0 -1
- package/es/utils/async-init.js +0 -103
- package/es/utils/async-init.js.map +0 -1
- package/es/utils/bignumber.js +0 -36
- package/es/utils/bignumber.js.map +0 -1
- package/es/utils/bytes.js.map +0 -1
- package/es/utils/crypto-ts.js.map +0 -1
- package/es/utils/crypto.js +0 -358
- package/es/utils/crypto.js.map +0 -1
- package/es/utils/hd-wallet.js +0 -148
- package/es/utils/hd-wallet.js.map +0 -1
- package/es/utils/json-big.js +0 -78
- package/es/utils/json-big.js.map +0 -1
- package/es/utils/keystore.js +0 -393
- package/es/utils/keystore.js.map +0 -1
- package/es/utils/mptree.js +0 -198
- package/es/utils/mptree.js.map +0 -1
- package/es/utils/other.js +0 -93
- package/es/utils/other.js.map +0 -1
- package/es/utils/semver-satisfies.js +0 -35
- package/es/utils/semver-satisfies.js.map +0 -1
- package/es/utils/string.js.map +0 -1
- package/es/utils/swagger.js +0 -269
- package/es/utils/swagger.js.map +0 -1
- package/src/contract/aci/helpers.js +0 -140
- package/src/contract/aci/index.js +0 -191
- package/src/contract/aci/transformation.js +0 -464
- package/src/contract/index.js +0 -159
- package/src/utils/aepp-wallet-communication/schema.js +0 -110
package/package.json
CHANGED
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeternity/aepp-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0",
|
|
4
4
|
"description": "SDK for the æternity blockchain",
|
|
5
5
|
"main": "dist/aepp-sdk.js",
|
|
6
6
|
"types": "es/index.d.ts",
|
|
7
|
-
"module": "es/index.
|
|
7
|
+
"module": "es/index.mjs",
|
|
8
8
|
"browser": {
|
|
9
9
|
"dist/aepp-sdk.js": "./dist/aepp-sdk.browser.js"
|
|
10
10
|
},
|
|
11
11
|
"sideEffects": false,
|
|
12
12
|
"scripts": {
|
|
13
|
-
"build:es": "tsc && babel src --config-file ./babel.esm.config.js --out-dir es --extensions
|
|
13
|
+
"build:es": "tsc && babel src --config-file ./babel.esm.config.js --out-dir es --extensions .js,.ts --out-file-extension .mjs --source-maps true",
|
|
14
14
|
"build": "webpack --mode=production && npm run build:es",
|
|
15
15
|
"build:dev": "webpack --mode=development && npm run build:es",
|
|
16
16
|
"docs:examples": "node tooling/docs/examples-to-md.js examples/node/*.js",
|
|
17
17
|
"docs:api": "node apidoc.js",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"test": "nyc
|
|
21
|
-
"
|
|
22
|
-
"test:
|
|
23
|
-
"test:integration:contract,chain": "nyc --require @babel/register --require ts-node/register mocha './test/integration/@(contract|chain).js' --timeout 10m",
|
|
24
|
-
"test:integration:else": "nyc --require @babel/register --require ts-node/register mocha './test/integration/!(channel|accounts|contract|chain).js' --timeout 10m",
|
|
25
|
-
"test:unit": "nyc --require @babel/register --require ts-node/register mocha './test/unit/*'",
|
|
26
|
-
"test:watch": "mocha --recursive --require @babel/register --require ts-node/register --watch --timeout 10m",
|
|
18
|
+
"lint": "eslint .",
|
|
19
|
+
"test": "nyc mocha './test/unit/' './test/integration/'",
|
|
20
|
+
"test:integration": "nyc mocha './test/integration/'",
|
|
21
|
+
"test:unit": "nyc mocha './test/unit/'",
|
|
22
|
+
"test:watch": "mocha './test/unit/' './test/integration/' --watch",
|
|
27
23
|
"prepare": "npm run build",
|
|
28
|
-
"prepublishOnly": "npm run docs:examples
|
|
24
|
+
"prepublishOnly": "npm run docs:examples",
|
|
29
25
|
"release": "standard-version --skip.tag"
|
|
30
26
|
},
|
|
31
27
|
"license": "ISC",
|
|
@@ -36,33 +32,27 @@
|
|
|
36
32
|
"SDK"
|
|
37
33
|
],
|
|
38
34
|
"dependencies": {
|
|
39
|
-
"@aeternity/
|
|
35
|
+
"@aeternity/aepp-calldata": "^1.1.1",
|
|
36
|
+
"@aeternity/argon2-browser": "^0.1.2",
|
|
37
|
+
"@aeternity/blakejs": "^1.1.2",
|
|
40
38
|
"@aeternity/json-bigint": "^0.3.1",
|
|
41
|
-
"@
|
|
39
|
+
"@aeternity/uuid": "^0.0.1",
|
|
40
|
+
"@babel/runtime-corejs3": "^7.17.2",
|
|
42
41
|
"@stamp/it": "^1.1.0",
|
|
43
42
|
"@stamp/required": "^1.0.1",
|
|
44
43
|
"aes-js": "^3.1.2",
|
|
45
|
-
"bignumber.js": "^9.0.
|
|
44
|
+
"bignumber.js": "^9.0.2",
|
|
46
45
|
"bip32-path": "^0.4.2",
|
|
47
|
-
"
|
|
48
|
-
"bs58check": "^2.1.2",
|
|
46
|
+
"bs58": "^4.0.1",
|
|
49
47
|
"buffer": "^6.0.3",
|
|
50
|
-
"cross-fetch": "^3.1.
|
|
51
|
-
"crypto-browserify": "^3.12.0",
|
|
52
|
-
"ed2curve": "^0.3.0",
|
|
48
|
+
"cross-fetch": "^3.1.5",
|
|
53
49
|
"events": "^3.3.0",
|
|
54
|
-
"joi-browser": "^13.4.0",
|
|
55
|
-
"libsodium-wrappers-sumo": "0.7.9",
|
|
56
|
-
"path-browserify": "^1.0.1",
|
|
57
50
|
"process": "^0.11.10",
|
|
58
|
-
"
|
|
59
|
-
"rlp": "2.2.6",
|
|
51
|
+
"rlp": "^3.0.0",
|
|
60
52
|
"sha.js": "^2.4.11",
|
|
61
|
-
"
|
|
62
|
-
"swagger-client": "^3.13.5",
|
|
53
|
+
"swagger-client": "^3.18.4",
|
|
63
54
|
"tweetnacl": "^1.0.3",
|
|
64
55
|
"tweetnacl-auth": "^1.0.1",
|
|
65
|
-
"uuid": "^8.3.2",
|
|
66
56
|
"websocket": "^1.0.34"
|
|
67
57
|
},
|
|
68
58
|
"repository": {
|
|
@@ -70,47 +60,50 @@
|
|
|
70
60
|
"url": "https://github.com/aeternity/aepp-sdk-js"
|
|
71
61
|
},
|
|
72
62
|
"devDependencies": {
|
|
73
|
-
"@babel/cli": "7.
|
|
74
|
-
"@babel/core": "7.
|
|
75
|
-
"@babel/node": "7.
|
|
76
|
-
"@babel/plugin-
|
|
77
|
-
"@babel/
|
|
78
|
-
"@babel/
|
|
79
|
-
"@babel/
|
|
80
|
-
"@
|
|
81
|
-
"@
|
|
82
|
-
"@commitlint/cli": "^12.1.4",
|
|
83
|
-
"@commitlint/config-conventional": "^12.1.4",
|
|
63
|
+
"@babel/cli": "^7.17.0",
|
|
64
|
+
"@babel/core": "^7.17.2",
|
|
65
|
+
"@babel/node": "^7.16.8",
|
|
66
|
+
"@babel/plugin-transform-runtime": "^7.17.0",
|
|
67
|
+
"@babel/preset-env": "^7.16.11",
|
|
68
|
+
"@babel/preset-typescript": "^7.16.7",
|
|
69
|
+
"@babel/register": "^7.17.0",
|
|
70
|
+
"@commitlint/cli": "^16.1.0",
|
|
71
|
+
"@commitlint/config-conventional": "^16.0.0",
|
|
84
72
|
"@types/bn.js": "^5.1.0",
|
|
85
|
-
"@types/chai": "^4.
|
|
86
|
-
"@types/mocha": "^
|
|
87
|
-
"@types/node": "^
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
73
|
+
"@types/chai": "^4.3.0",
|
|
74
|
+
"@types/mocha": "^9.1.0",
|
|
75
|
+
"@types/node": "^17.0.17",
|
|
76
|
+
"@typescript-eslint/eslint-plugin": "^5.11.0",
|
|
77
|
+
"@typescript-eslint/parser": "^5.11.0",
|
|
78
|
+
"babel-loader": "^8.2.3",
|
|
79
|
+
"babel-plugin-add-import-extension": "^1.6.0",
|
|
80
|
+
"babel-plugin-import-globals": "^2.0.0",
|
|
81
|
+
"babel-plugin-transform-default-named-imports": "^1.2.2",
|
|
82
|
+
"chai": "^4.3.6",
|
|
91
83
|
"chai-as-promised": "^7.1.1",
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
84
|
+
"eslint": "^8.8.0",
|
|
85
|
+
"eslint-config-standard": "^17.0.0-1",
|
|
86
|
+
"jsdoc-to-markdown": "^7.1.1",
|
|
87
|
+
"mocha": "^9.2.0",
|
|
95
88
|
"nyc": "^15.1.0",
|
|
96
|
-
"sinon": "^
|
|
89
|
+
"sinon": "^13.0.1",
|
|
97
90
|
"source-map": "^0.7.3",
|
|
98
|
-
"standard-version": "^9.3.
|
|
99
|
-
"ts-node": "^10.
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"webpack": "^5.
|
|
103
|
-
"webpack-
|
|
104
|
-
"webpack-cli": "4.7.0"
|
|
91
|
+
"standard-version": "^9.3.2",
|
|
92
|
+
"ts-node": "^10.5.0",
|
|
93
|
+
"typescript": "^4.5.5",
|
|
94
|
+
"webpack": "^5.68.0",
|
|
95
|
+
"webpack-bundle-analyzer": "^4.5.0",
|
|
96
|
+
"webpack-cli": "^4.9.2"
|
|
105
97
|
},
|
|
106
98
|
"files": [
|
|
107
99
|
"dist",
|
|
108
100
|
"src",
|
|
109
101
|
"es"
|
|
110
102
|
],
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
103
|
+
"browserslist": [
|
|
104
|
+
"> 1%",
|
|
105
|
+
"last 2 versions",
|
|
106
|
+
"not dead",
|
|
107
|
+
"not ie 11"
|
|
108
|
+
]
|
|
116
109
|
}
|
package/src/account/base.js
CHANGED
|
@@ -85,7 +85,9 @@ async function signMessage (message, opt = { returnHex: false }) {
|
|
|
85
85
|
* Verify message
|
|
86
86
|
* @instance
|
|
87
87
|
* @category async
|
|
88
|
-
* @rtype (
|
|
88
|
+
* @rtype (
|
|
89
|
+
* msg: String, signature: String, publicKey: String
|
|
90
|
+
* ) => signature: Promise[String], throws: Error
|
|
89
91
|
* @param {String} message - Message to verify
|
|
90
92
|
* @param {String} signature - Signature
|
|
91
93
|
* @param {Object} opt - Options
|
package/src/account/memory.js
CHANGED
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import AccountBase from './base'
|
|
26
|
-
import { sign,
|
|
26
|
+
import { sign, isValidKeypair } from '../utils/crypto'
|
|
27
27
|
import { isHex } from '../utils/string'
|
|
28
28
|
import { decode } from '../tx/builder/helpers'
|
|
29
|
+
import { InvalidKeypairError } from '../utils/errors'
|
|
29
30
|
|
|
30
31
|
const secrets = new WeakMap()
|
|
31
32
|
|
|
@@ -44,21 +45,25 @@ export default AccountBase.compose({
|
|
|
44
45
|
init ({ keypair, gaId }) {
|
|
45
46
|
this.isGa = !!gaId
|
|
46
47
|
if (gaId) {
|
|
47
|
-
|
|
48
|
+
decode(gaId)
|
|
48
49
|
secrets.set(this, { publicKey: gaId })
|
|
49
50
|
return
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
if (!keypair || typeof keypair !== 'object') throw new
|
|
53
|
-
if (!keypair.secretKey || !keypair.publicKey)
|
|
54
|
-
|
|
53
|
+
if (!keypair || typeof keypair !== 'object') throw new InvalidKeypairError('KeyPair must be an object')
|
|
54
|
+
if (!keypair.secretKey || !keypair.publicKey) {
|
|
55
|
+
throw new InvalidKeypairError('KeyPair must must have "secretKey", "publicKey" properties')
|
|
56
|
+
}
|
|
57
|
+
if (typeof keypair.publicKey !== 'string' || keypair.publicKey.indexOf('ak_') === -1) {
|
|
58
|
+
throw new InvalidKeypairError('Public Key must be a base58c string with "ak_" prefix')
|
|
59
|
+
}
|
|
55
60
|
if (
|
|
56
61
|
!Buffer.isBuffer(keypair.secretKey) &&
|
|
57
62
|
(typeof keypair.secretKey === 'string' && !isHex(keypair.secretKey))
|
|
58
|
-
) throw new
|
|
63
|
+
) throw new InvalidKeypairError('Secret key must be hex string or Buffer')
|
|
59
64
|
|
|
60
65
|
const pubBuffer = Buffer.from(decode(keypair.publicKey, 'ak'))
|
|
61
|
-
if (!isValidKeypair(Buffer.from(keypair.secretKey, 'hex'), pubBuffer)) throw new
|
|
66
|
+
if (!isValidKeypair(Buffer.from(keypair.secretKey, 'hex'), pubBuffer)) throw new InvalidKeypairError('Invalid Key Pair')
|
|
62
67
|
|
|
63
68
|
secrets.set(this, {
|
|
64
69
|
secretKey: Buffer.isBuffer(keypair.secretKey) ? keypair.secretKey : Buffer.from(keypair.secretKey, 'hex'),
|
|
@@ -68,7 +73,7 @@ export default AccountBase.compose({
|
|
|
68
73
|
props: { isGa: false },
|
|
69
74
|
methods: {
|
|
70
75
|
sign (data) {
|
|
71
|
-
if (this.isGa) throw new
|
|
76
|
+
if (this.isGa) throw new InvalidKeypairError('You are trying to sign data using generalized account without keypair')
|
|
72
77
|
return Promise.resolve(sign(data, secrets.get(this).secretKey))
|
|
73
78
|
},
|
|
74
79
|
address () {
|
package/src/account/multiple.js
CHANGED
|
@@ -21,11 +21,14 @@
|
|
|
21
21
|
* @export AccountMultiple
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import * as R from 'ramda'
|
|
25
24
|
import AsyncInit from '../utils/async-init'
|
|
26
25
|
import MemoryAccount from './memory'
|
|
27
26
|
import { decode } from '../tx/builder/helpers'
|
|
28
27
|
import AccountBase, { isAccountBase } from './base'
|
|
28
|
+
import {
|
|
29
|
+
UnavailableAccountError,
|
|
30
|
+
TypeError
|
|
31
|
+
} from '../utils/errors'
|
|
29
32
|
|
|
30
33
|
/**
|
|
31
34
|
* AccountMultiple stamp
|
|
@@ -42,7 +45,9 @@ import AccountBase, { isAccountBase } from './base'
|
|
|
42
45
|
* @param {String} [options.address] - Address of account to select
|
|
43
46
|
* @return {Object} AccountMultiple instance
|
|
44
47
|
* @example
|
|
45
|
-
* const accounts = await AccountMultiple({
|
|
48
|
+
* const accounts = await AccountMultiple({
|
|
49
|
+
* accounts: [MemoryAccount({ keypair: 'keypair_object' })]
|
|
50
|
+
* })
|
|
46
51
|
* await accounts.addAccount(account, { select: true }) // Add account and make it selected
|
|
47
52
|
* accounts.removeAccount(address) // Remove account
|
|
48
53
|
* accounts.selectAccount(address) // Select account
|
|
@@ -50,15 +55,11 @@ import AccountBase, { isAccountBase } from './base'
|
|
|
50
55
|
*/
|
|
51
56
|
export default AccountBase.compose(AsyncInit, {
|
|
52
57
|
async init ({ accounts = [], address }) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this.selectedAddress = address
|
|
59
|
-
} else {
|
|
60
|
-
console.warn('No account/accounts supplied')
|
|
61
|
-
}
|
|
58
|
+
this.accounts = Object.fromEntries(await Promise.all(
|
|
59
|
+
accounts.map(async a => [await a.address(), a])
|
|
60
|
+
))
|
|
61
|
+
address = address || Object.keys(this.accounts)[0]
|
|
62
|
+
if (address) this.selectAccount(address)
|
|
62
63
|
},
|
|
63
64
|
props: {
|
|
64
65
|
accounts: {}
|
|
@@ -128,25 +129,33 @@ export default AccountBase.compose(AsyncInit, {
|
|
|
128
129
|
*/
|
|
129
130
|
selectAccount (address) {
|
|
130
131
|
decode(address, 'ak')
|
|
131
|
-
if (!this.accounts[address]) throw new
|
|
132
|
+
if (!this.accounts[address]) throw new UnavailableAccountError(address)
|
|
132
133
|
this.selectedAddress = address
|
|
133
134
|
},
|
|
134
135
|
/**
|
|
135
136
|
* Resolves an account
|
|
136
|
-
* @param account
|
|
137
|
+
* @param account account address (should exist in sdk instance), MemoryAccount or keypair
|
|
137
138
|
* @returns {AccountBase}
|
|
138
139
|
* @private
|
|
139
140
|
*/
|
|
140
141
|
_resolveAccount (account) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
142
|
+
if (account === null) {
|
|
143
|
+
throw new TypeError(
|
|
144
|
+
'Account should be an address (ak-prefixed string), ' +
|
|
145
|
+
'keypair, or instance of account base, got null instead')
|
|
146
|
+
} else {
|
|
147
|
+
switch (typeof account) {
|
|
148
|
+
case 'string':
|
|
149
|
+
decode(account, 'ak')
|
|
150
|
+
if (!this.accounts[account]) throw new UnavailableAccountError(account)
|
|
151
|
+
return this.accounts[account]
|
|
152
|
+
case 'object':
|
|
153
|
+
return isAccountBase(account) ? account : MemoryAccount({ keypair: account })
|
|
154
|
+
default:
|
|
155
|
+
throw new TypeError(
|
|
156
|
+
'Account should be an address (ak-prefixed string), ' +
|
|
157
|
+
`keypair, or instance of account base, got ${account} instead`)
|
|
158
|
+
}
|
|
150
159
|
}
|
|
151
160
|
}
|
|
152
161
|
}
|
package/src/ae/aens.js
CHANGED
|
@@ -26,18 +26,11 @@
|
|
|
26
26
|
* @example import { Aens } from '@aeternity/aepp-sdk'
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
-
import * as R from 'ramda'
|
|
30
29
|
import { salt } from '../utils/crypto'
|
|
31
|
-
import {
|
|
32
|
-
commitmentHash,
|
|
33
|
-
ensureNameValid,
|
|
34
|
-
getMinimumNameFee,
|
|
35
|
-
classify,
|
|
36
|
-
isAuctionName,
|
|
37
|
-
validatePointers, encode, produceNameId
|
|
38
|
-
} from '../tx/builder/helpers'
|
|
30
|
+
import { commitmentHash, ensureNameValid, isAuctionName } from '../tx/builder/helpers'
|
|
39
31
|
import Ae from './'
|
|
40
|
-
import { CLIENT_TTL,
|
|
32
|
+
import { CLIENT_TTL, NAME_TTL } from '../tx/builder/schema'
|
|
33
|
+
import { ArgumentError } from '../utils/errors'
|
|
41
34
|
|
|
42
35
|
/**
|
|
43
36
|
* Revoke a name
|
|
@@ -47,11 +40,11 @@ import { CLIENT_TTL, NAME_FEE, NAME_TTL } from '../tx/builder/schema'
|
|
|
47
40
|
* @category async
|
|
48
41
|
* @param {String} name Name hash
|
|
49
42
|
* @param {Object} [options={}] options
|
|
50
|
-
* @param {
|
|
51
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
52
|
-
* @param {
|
|
53
|
-
* @param {
|
|
54
|
-
* @param {
|
|
43
|
+
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
44
|
+
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
45
|
+
* @param {Number|String|BigNumber} [options.fee] fee
|
|
46
|
+
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
47
|
+
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
55
48
|
* @return {Promise<Object>} Transaction result
|
|
56
49
|
* @example
|
|
57
50
|
* const name = 'test.chain'
|
|
@@ -63,12 +56,13 @@ import { CLIENT_TTL, NAME_FEE, NAME_TTL } from '../tx/builder/schema'
|
|
|
63
56
|
*/
|
|
64
57
|
async function revoke (name, options = {}) {
|
|
65
58
|
ensureNameValid(name)
|
|
66
|
-
const opt =
|
|
59
|
+
const opt = { ...this.Ae.defaults, ...options }
|
|
67
60
|
|
|
68
|
-
const nameRevokeTx = await this.nameRevokeTx(
|
|
69
|
-
|
|
61
|
+
const nameRevokeTx = await this.nameRevokeTx({
|
|
62
|
+
...opt,
|
|
63
|
+
nameId: name,
|
|
70
64
|
accountId: await this.address(opt)
|
|
71
|
-
})
|
|
65
|
+
})
|
|
72
66
|
|
|
73
67
|
return this.send(nameRevokeTx, opt)
|
|
74
68
|
}
|
|
@@ -80,16 +74,19 @@ async function revoke (name, options = {}) {
|
|
|
80
74
|
* @category async
|
|
81
75
|
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
82
76
|
* @param {String} name AENS name
|
|
83
|
-
* @param {
|
|
77
|
+
* @param {Object.<string, string>} pointers Map of pointer keys to corresponding addresses
|
|
84
78
|
* @param {Object} [options={}]
|
|
85
|
-
* @param {Boolean} [options.extendPointers
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* @param {
|
|
90
|
-
* @param {
|
|
91
|
-
* @param {
|
|
92
|
-
* @param {
|
|
79
|
+
* @param {Boolean} [options.extendPointers] Get the pointers from the node and merge with provided
|
|
80
|
+
* ones. Pointers with the same type will be overwritten
|
|
81
|
+
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you
|
|
82
|
+
* pass publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
83
|
+
* @param {Number|String|BigNumber} [options.fee] fee
|
|
84
|
+
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
85
|
+
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
86
|
+
* @param {Number|String|BigNumber} [options.nameTtl=50000] Name ttl represented in number of
|
|
87
|
+
* blocks (Max value is 50000 blocks)
|
|
88
|
+
* @param {Number|String|BigNumber} [options.clientTtl=84600] a suggestion as to how long any
|
|
89
|
+
* clients should cache this information
|
|
93
90
|
* @return {Promise<Object>}
|
|
94
91
|
* @throws Invalid pointer array error
|
|
95
92
|
* @example
|
|
@@ -99,22 +96,24 @@ async function revoke (name, options = {}) {
|
|
|
99
96
|
*
|
|
100
97
|
* await sdkInstance.aensUpdate(name, pointersArray, { nameTtl, ttl, fee, nonce, clientTtl })
|
|
101
98
|
* // or
|
|
102
|
-
* await nameObject.update(
|
|
99
|
+
* await nameObject.update(pointers, { nameTtl, ttl, fee, nonce, clientTtl })
|
|
103
100
|
*/
|
|
104
|
-
async function update (name, pointers =
|
|
101
|
+
async function update (name, pointers = {}, options = {}) {
|
|
105
102
|
ensureNameValid(name)
|
|
106
|
-
const opt =
|
|
107
|
-
|
|
103
|
+
const opt = { ...this.Ae.defaults, ...options }
|
|
104
|
+
const allPointers = {
|
|
105
|
+
...options.extendPointers && Object.fromEntries(
|
|
106
|
+
(await this.getName(name)).pointers.map(({ key, id }) => [key, id])
|
|
107
|
+
),
|
|
108
|
+
...pointers
|
|
109
|
+
}
|
|
108
110
|
|
|
109
|
-
|
|
110
|
-
...
|
|
111
|
-
|
|
112
|
-
].reduce((acc, el) => [...acc.filter(p => p.key !== el.key), el], [])
|
|
113
|
-
const nameUpdateTx = await this.nameUpdateTx(R.merge(opt, {
|
|
114
|
-
nameId: produceNameId(name),
|
|
111
|
+
const nameUpdateTx = await this.nameUpdateTx({
|
|
112
|
+
...opt,
|
|
113
|
+
nameId: name,
|
|
115
114
|
accountId: await this.address(opt),
|
|
116
|
-
pointers
|
|
117
|
-
})
|
|
115
|
+
pointers: Object.entries(allPointers).map(([key, id]) => ({ key, id }))
|
|
116
|
+
})
|
|
118
117
|
|
|
119
118
|
return this.send(nameUpdateTx, opt)
|
|
120
119
|
}
|
|
@@ -128,11 +127,11 @@ async function update (name, pointers = [], options = { extendPointers: false })
|
|
|
128
127
|
* @param {String} name AENS name
|
|
129
128
|
* @param {String} account Recipient account publick key
|
|
130
129
|
* @param {Object} [options={}]
|
|
131
|
-
* @param {
|
|
132
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
133
|
-
* @param {
|
|
134
|
-
* @param {
|
|
135
|
-
* @param {
|
|
130
|
+
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
131
|
+
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
132
|
+
* @param {Number|String|BigNumber} [options.fee] fee
|
|
133
|
+
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
134
|
+
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
136
135
|
* @return {Promise<Object>} Transaction result
|
|
137
136
|
* @example
|
|
138
137
|
* const name = 'test.chain'
|
|
@@ -145,13 +144,14 @@ async function update (name, pointers = [], options = { extendPointers: false })
|
|
|
145
144
|
*/
|
|
146
145
|
async function transfer (name, account, options = {}) {
|
|
147
146
|
ensureNameValid(name)
|
|
148
|
-
const opt =
|
|
147
|
+
const opt = { ...this.Ae.defaults, ...options }
|
|
149
148
|
|
|
150
|
-
const nameTransferTx = await this.nameTransferTx(
|
|
151
|
-
|
|
149
|
+
const nameTransferTx = await this.nameTransferTx({
|
|
150
|
+
...opt,
|
|
151
|
+
nameId: name,
|
|
152
152
|
accountId: await this.address(opt),
|
|
153
153
|
recipientId: account
|
|
154
|
-
})
|
|
154
|
+
})
|
|
155
155
|
|
|
156
156
|
return this.send(nameTransferTx, opt)
|
|
157
157
|
}
|
|
@@ -184,25 +184,27 @@ async function query (name, opt = {}) {
|
|
|
184
184
|
|
|
185
185
|
return Object.freeze(Object.assign(o, {
|
|
186
186
|
pointers: o.pointers || [],
|
|
187
|
-
update: async (pointers
|
|
187
|
+
update: async (pointers, options = {}) => {
|
|
188
188
|
return {
|
|
189
|
-
...(await this.aensUpdate(name, pointers,
|
|
189
|
+
...(await this.aensUpdate(name, pointers, { ...opt, ...options })),
|
|
190
190
|
...(await this.aensQuery(name))
|
|
191
191
|
}
|
|
192
192
|
},
|
|
193
193
|
transfer: async (account, options = {}) => {
|
|
194
194
|
return {
|
|
195
|
-
...(await this.aensTransfer(name, account,
|
|
195
|
+
...(await this.aensTransfer(name, account, { ...opt, ...options })),
|
|
196
196
|
...(await this.aensQuery(name))
|
|
197
197
|
}
|
|
198
198
|
},
|
|
199
|
-
revoke: async (options = {}) => this.aensRevoke(name,
|
|
199
|
+
revoke: async (options = {}) => this.aensRevoke(name, { ...opt, ...options }),
|
|
200
200
|
extendTtl: async (nameTtl = NAME_TTL, options = {}) => {
|
|
201
|
-
if (
|
|
201
|
+
if (typeof nameTtl !== 'number' || nameTtl > NAME_TTL || nameTtl <= 0) {
|
|
202
|
+
throw new ArgumentError('nameTtl', `a number between 1 and ${NAME_TTL} blocks`, nameTtl)
|
|
203
|
+
}
|
|
202
204
|
|
|
203
205
|
return {
|
|
204
|
-
...
|
|
205
|
-
...
|
|
206
|
+
...await this.aensUpdate(name, {}, { ...opt, ...options, nameTtl, extendPointers: true }),
|
|
207
|
+
...await this.aensQuery(name)
|
|
206
208
|
}
|
|
207
209
|
}
|
|
208
210
|
}))
|
|
@@ -218,8 +220,8 @@ async function query (name, opt = {}) {
|
|
|
218
220
|
* @param {String} name
|
|
219
221
|
* @param {Number} salt Salt from pre-claim, or 0 if it's a bid
|
|
220
222
|
* @param {Object} [options] options
|
|
221
|
-
* @param {String|Object} [options.onAccount]
|
|
222
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
223
|
+
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
224
|
+
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
223
225
|
* @param {Number|String|BigNumber} [options.fee] fee
|
|
224
226
|
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
225
227
|
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
@@ -233,18 +235,14 @@ async function query (name, opt = {}) {
|
|
|
233
235
|
*/
|
|
234
236
|
async function claim (name, salt, options) {
|
|
235
237
|
ensureNameValid(name)
|
|
236
|
-
const opt =
|
|
238
|
+
const opt = { ...this.Ae.defaults, ...options }
|
|
237
239
|
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
throw new Error(`the provided fee ${opt.nameFee} is not enough to execute the claim, required: ${minNameFee}`)
|
|
241
|
-
}
|
|
242
|
-
opt.nameFee = opt.nameFee !== this.Ae.defaults.nameFee ? opt.nameFee : minNameFee
|
|
243
|
-
const claimTx = await this.nameClaimTx(R.merge(opt, {
|
|
240
|
+
const claimTx = await this.nameClaimTx({
|
|
241
|
+
...opt,
|
|
244
242
|
accountId: await this.address(opt),
|
|
245
243
|
nameSalt: salt,
|
|
246
|
-
name
|
|
247
|
-
})
|
|
244
|
+
name
|
|
245
|
+
})
|
|
248
246
|
|
|
249
247
|
const result = await this.send(claimTx, opt)
|
|
250
248
|
if (!isAuctionName(name)) {
|
|
@@ -262,8 +260,8 @@ async function claim (name, salt, options) {
|
|
|
262
260
|
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
263
261
|
* @param {String} name
|
|
264
262
|
* @param {Object} [options={}]
|
|
265
|
-
* @param {String|Object} [options.onAccount]
|
|
266
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
263
|
+
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
264
|
+
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
267
265
|
* @param {Number|String|BigNumber} [options.fee] fee
|
|
268
266
|
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
269
267
|
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
@@ -282,15 +280,16 @@ async function claim (name, salt, options) {
|
|
|
282
280
|
*/
|
|
283
281
|
async function preclaim (name, options = {}) {
|
|
284
282
|
ensureNameValid(name)
|
|
285
|
-
const opt =
|
|
283
|
+
const opt = { ...this.Ae.defaults, ...options }
|
|
286
284
|
const _salt = salt()
|
|
287
285
|
const height = await this.height()
|
|
288
286
|
const commitmentId = commitmentHash(name, _salt)
|
|
289
287
|
|
|
290
|
-
const preclaimTx = await this.namePreclaimTx(
|
|
288
|
+
const preclaimTx = await this.namePreclaimTx({
|
|
289
|
+
...opt,
|
|
291
290
|
accountId: await this.address(opt),
|
|
292
291
|
commitmentId
|
|
293
|
-
})
|
|
292
|
+
})
|
|
294
293
|
|
|
295
294
|
const result = await this.send(preclaimTx, opt)
|
|
296
295
|
|
|
@@ -312,8 +311,8 @@ async function preclaim (name, options = {}) {
|
|
|
312
311
|
* @param {String} name Domain name
|
|
313
312
|
* @param {String|Number} nameFee Name fee (bid fee)
|
|
314
313
|
* @param {Object} [options={}]
|
|
315
|
-
* @param {String|Object} [options.onAccount]
|
|
316
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
314
|
+
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
315
|
+
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
317
316
|
* @param {Number|String|BigNumber} [options.fee] fee
|
|
318
317
|
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
319
318
|
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
@@ -324,7 +323,7 @@ async function preclaim (name, options = {}) {
|
|
|
324
323
|
*
|
|
325
324
|
* await sdkInstance.aensBid(name, 213109412839123, { ttl, fee, nonce })
|
|
326
325
|
*/
|
|
327
|
-
async function bid (name, nameFee
|
|
326
|
+
async function bid (name, nameFee, options = {}) {
|
|
328
327
|
return this.aensClaim(name, 0, { ...options, nameFee, vsn: 2 })
|
|
329
328
|
}
|
|
330
329
|
|
|
@@ -353,8 +352,7 @@ const Aens = Ae.compose({
|
|
|
353
352
|
Ae: {
|
|
354
353
|
defaults: {
|
|
355
354
|
clientTtl: CLIENT_TTL,
|
|
356
|
-
nameTtl: NAME_TTL
|
|
357
|
-
nameFee: NAME_FEE
|
|
355
|
+
nameTtl: NAME_TTL // aec_governance:name_claim_max_expiration() => 50000
|
|
358
356
|
}
|
|
359
357
|
}
|
|
360
358
|
}
|
package/src/ae/aepp.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* ISC License (ISC)
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2021 aeternity developers
|
|
4
4
|
*
|
|
5
5
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
6
6
|
* purpose with or without fee is hereby granted, provided that the above
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
import Ae from './'
|
|
26
26
|
import Aens from './aens'
|
|
27
|
-
import
|
|
27
|
+
import Contract from './contract'
|
|
28
28
|
import AeppRpc from '../utils/aepp-wallet-communication/rpc/aepp-rpc'
|
|
29
29
|
import Chain from '../chain/node'
|
|
30
30
|
import Tx from '../tx/tx'
|