@aeternity/aepp-sdk 12.0.0 → 12.1.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/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.LICENSE.txt +0 -15
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +2 -1
- package/dist/aepp-sdk.browser.js.LICENSE.txt +1 -0
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +20764 -1
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdk.d.ts +7 -7
- package/es/AeSdk.mjs.map +1 -1
- package/es/AeSdkAepp.d.ts +4 -3
- package/es/AeSdkAepp.mjs +2 -1
- package/es/AeSdkAepp.mjs.map +1 -1
- package/es/AeSdkBase.d.ts +22 -21
- package/es/AeSdkBase.mjs +25 -21
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkWallet.d.ts +4 -3
- package/es/AeSdkWallet.mjs +5 -1
- package/es/AeSdkWallet.mjs.map +1 -1
- package/es/Node.d.ts +7 -10
- package/es/Node.mjs +63 -57
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +7 -4
- package/es/account/Base.mjs +3 -3
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Memory.d.ts +5 -4
- package/es/account/Memory.mjs +24 -2
- package/es/account/Memory.mjs.map +1 -1
- package/es/account/Rpc.d.ts +6 -6
- package/es/account/Rpc.mjs +3 -2
- package/es/account/Rpc.mjs.map +1 -1
- package/es/aens.d.ts +27 -14
- package/es/aens.mjs +27 -21
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/Browser.d.ts +2 -1
- package/es/aepp-wallet-communication/connection/Browser.mjs +5 -2
- package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +1 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +1 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +1 -0
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +5 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection-proxy.d.ts +1 -0
- package/es/aepp-wallet-communication/connection-proxy.mjs +1 -0
- package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +1 -0
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +5 -5
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/types.d.ts +8 -8
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
- package/es/aepp-wallet-communication/schema.d.ts +17 -2
- package/es/aepp-wallet-communication/schema.mjs +54 -17
- package/es/aepp-wallet-communication/schema.mjs.map +1 -1
- package/es/aepp-wallet-communication/wallet-detector.d.ts +2 -1
- package/es/aepp-wallet-communication/wallet-detector.mjs +2 -3
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
- package/es/apis/node/models/index.d.ts +6 -2
- package/es/apis/node/models/index.mjs.map +1 -1
- package/es/apis/node/models/mappers.mjs +4 -2
- package/es/apis/node/models/mappers.mjs.map +1 -1
- package/es/chain.d.ts +92 -64
- package/es/chain.mjs +190 -154
- package/es/chain.mjs.map +1 -1
- package/es/channel/handlers.d.ts +3 -3
- package/es/channel/handlers.mjs +42 -44
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/index.d.ts +43 -52
- package/es/channel/index.mjs +46 -49
- package/es/channel/index.mjs.map +1 -1
- package/es/channel/internal.d.ts +16 -15
- package/es/channel/internal.mjs +67 -62
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Compiler.d.ts +1 -0
- package/es/contract/Compiler.mjs +5 -4
- package/es/contract/Compiler.mjs.map +1 -1
- package/es/contract/aci.d.ts +17 -15
- package/es/contract/aci.mjs +58 -45
- package/es/contract/aci.mjs.map +1 -1
- package/es/contract/ga.d.ts +16 -15
- package/es/contract/ga.mjs +12 -7
- package/es/contract/ga.mjs.map +1 -1
- package/es/contract/methods.d.ts +9 -6
- package/es/contract/methods.mjs +9 -6
- package/es/contract/methods.mjs.map +1 -1
- package/es/deprecated/index.d.ts +143 -0
- package/es/deprecated/index.mjs +162 -0
- package/es/deprecated/index.mjs.map +1 -0
- package/es/deprecated/methods.d.ts +18 -0
- package/es/deprecated/methods.mjs +26 -0
- package/es/deprecated/methods.mjs.map +1 -0
- package/es/index.d.ts +4 -1
- package/es/index.mjs +4 -1
- package/es/index.mjs.map +1 -1
- package/es/oracle.d.ts +69 -62
- package/es/oracle.mjs +121 -103
- package/es/oracle.mjs.map +1 -1
- package/es/spend.d.ts +16 -15
- package/es/spend.mjs +19 -30
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/address.d.ts +25 -0
- package/es/tx/builder/address.mjs +45 -0
- package/es/tx/builder/address.mjs.map +1 -0
- package/es/tx/builder/constants.d.ts +55 -26
- package/es/tx/builder/constants.mjs +60 -38
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/field-types/coin-amount.d.ts +13 -0
- package/es/tx/builder/field-types/coin-amount.mjs +26 -0
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -0
- package/es/tx/builder/field-types/deposit.d.ts +15 -0
- package/es/tx/builder/field-types/deposit.mjs +19 -0
- package/es/tx/builder/field-types/deposit.mjs.map +1 -0
- package/es/tx/builder/field-types/fee.d.ts +25 -0
- package/es/tx/{min-fee.mjs → builder/field-types/fee.mjs} +62 -60
- package/es/tx/builder/field-types/fee.mjs.map +1 -0
- package/es/tx/builder/field-types/field.d.ts +6 -0
- package/es/tx/builder/field-types/field.mjs +15 -0
- package/es/tx/builder/field-types/field.mjs.map +1 -0
- package/es/tx/builder/field-types/gas-limit.d.ts +12 -0
- package/es/tx/builder/field-types/gas-limit.mjs +33 -0
- package/es/tx/builder/field-types/gas-limit.mjs.map +1 -0
- package/es/tx/builder/field-types/gas-price.d.ts +8 -0
- package/es/tx/builder/field-types/gas-price.mjs +18 -0
- package/es/tx/builder/field-types/gas-price.mjs.map +1 -0
- package/es/tx/builder/field-types/index.d.ts +70 -0
- package/es/tx/builder/field-types/index.mjs +25 -0
- package/es/tx/builder/field-types/index.mjs.map +1 -0
- package/es/tx/builder/field-types/name-fee.d.ts +20 -0
- package/es/tx/builder/field-types/name-fee.mjs +24 -0
- package/es/tx/builder/field-types/name-fee.mjs.map +1 -0
- package/es/tx/builder/field-types/name-id.d.ts +14 -0
- package/es/tx/builder/field-types/name-id.mjs +19 -0
- package/es/tx/builder/field-types/name-id.mjs.map +1 -0
- package/es/tx/builder/field-types/name.d.ts +13 -0
- package/es/tx/builder/field-types/name.mjs +18 -0
- package/es/tx/builder/field-types/name.mjs.map +1 -0
- package/es/tx/builder/field-types/short-u-int.d.ts +6 -0
- package/es/tx/builder/field-types/short-u-int.mjs +12 -0
- package/es/tx/builder/field-types/short-u-int.mjs.map +1 -0
- package/es/tx/builder/field-types/u-int.d.ts +8 -0
- package/es/tx/builder/field-types/u-int.mjs +14 -0
- package/es/tx/builder/field-types/u-int.mjs.map +1 -0
- package/es/tx/builder/helpers.d.ts +27 -33
- package/es/tx/builder/helpers.mjs +41 -47
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +25 -12
- package/es/tx/builder/index.mjs +74 -83
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +995 -144
- package/es/tx/builder/schema.mjs +121 -170
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/index.d.ts +28 -27
- package/es/tx/index.mjs +97 -117
- package/es/tx/index.mjs.map +1 -1
- package/es/tx/validator.d.ts +4 -3
- package/es/tx/validator.mjs +79 -92
- package/es/tx/validator.mjs.map +1 -1
- package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +1 -1
- package/es/typings/@aeternity__uuid/index.d.mjs.map +1 -1
- package/es/typings/bip32-path/index.d.mjs.map +1 -1
- package/es/typings/blakejs/index.d.mjs.map +1 -1
- package/es/typings/sha-js/index.d.mjs +2 -0
- package/es/typings/sha-js/index.d.mjs.map +1 -0
- package/es/typings/tweetnacl-auth/index.d.mjs.map +1 -1
- package/es/utils/amount-formatter.d.ts +9 -9
- package/es/utils/amount-formatter.mjs +17 -17
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.mjs +7 -7
- package/es/utils/autorest.mjs.map +1 -1
- package/es/utils/bignumber.mjs +2 -1
- package/es/utils/bignumber.mjs.map +1 -1
- package/es/utils/bytes.mjs +1 -1
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/crypto.d.ts +8 -23
- package/es/utils/crypto.mjs +15 -41
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/encoder-types.d.ts +61 -0
- package/es/utils/encoder-types.mjs +36 -0
- package/es/utils/encoder-types.mjs.map +1 -0
- package/es/utils/encoder.d.ts +6 -7
- package/es/utils/encoder.mjs +42 -26
- package/es/utils/encoder.mjs.map +1 -1
- package/es/utils/errors.d.ts +1 -11
- package/es/utils/errors.mjs +4 -20
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/hd-wallet.d.ts +18 -2
- package/es/utils/hd-wallet.mjs +64 -34
- package/es/utils/hd-wallet.mjs.map +1 -1
- package/es/utils/json-big.mjs +2 -2
- package/es/utils/json-big.mjs.map +1 -1
- package/es/utils/keystore.mjs +4 -2
- package/es/utils/keystore.mjs.map +1 -1
- package/es/utils/mptree.d.ts +2 -2
- package/es/utils/mptree.mjs +11 -6
- package/es/utils/mptree.mjs.map +1 -1
- package/es/utils/other.d.ts +8 -2
- package/es/utils/other.mjs +15 -3
- package/es/utils/other.mjs.map +1 -1
- package/es/utils/semver-satisfies.d.ts +1 -1
- package/es/utils/semver-satisfies.mjs +2 -2
- package/es/utils/semver-satisfies.mjs.map +1 -1
- package/es/utils/string.mjs.map +1 -1
- package/package.json +35 -33
- package/src/AeSdk.ts +30 -27
- package/src/AeSdkAepp.ts +93 -84
- package/src/AeSdkBase.ts +148 -130
- package/src/AeSdkWallet.ts +172 -156
- package/src/Node.ts +108 -102
- package/src/account/Base.ts +42 -32
- package/src/account/Memory.ts +45 -30
- package/src/account/Rpc.ts +32 -30
- package/src/aens.ts +124 -108
- package/src/aepp-wallet-communication/connection/Browser.ts +18 -15
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +22 -21
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +63 -52
- package/src/aepp-wallet-communication/connection-proxy.ts +8 -7
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +67 -61
- package/src/aepp-wallet-communication/rpc/types.ts +32 -32
- package/src/aepp-wallet-communication/schema.ts +117 -74
- package/src/aepp-wallet-communication/wallet-detector.ts +29 -28
- package/src/apis/node/code-model-v4.yaml +54 -20
- package/src/apis/node/models/index.ts +6 -2
- package/src/apis/node/models/mappers.ts +4 -2
- package/src/chain.ts +286 -228
- package/src/channel/handlers.ts +424 -372
- package/src/channel/index.ts +285 -251
- package/src/channel/internal.ts +248 -232
- package/src/contract/Compiler.ts +22 -21
- package/src/contract/aci.ts +267 -258
- package/src/contract/ga.ts +93 -72
- package/src/contract/methods.ts +32 -27
- package/src/deprecated/index.ts +170 -0
- package/src/deprecated/methods.ts +25 -0
- package/src/index.ts +37 -32
- package/src/oracle.ts +211 -189
- package/src/spend.ts +82 -70
- package/src/tx/builder/address.ts +50 -0
- package/src/tx/builder/constants.ts +82 -52
- package/src/tx/builder/field-types/coin-amount.ts +27 -0
- package/src/tx/builder/field-types/deposit.ts +21 -0
- package/src/tx/builder/field-types/fee.ts +143 -0
- package/src/tx/builder/field-types/field.ts +9 -0
- package/src/tx/builder/field-types/gas-limit.ts +41 -0
- package/src/tx/builder/field-types/gas-price.ts +16 -0
- package/src/tx/builder/field-types/index.ts +45 -0
- package/src/tx/builder/field-types/name-fee.ts +32 -0
- package/src/tx/builder/field-types/name-id.ts +20 -0
- package/src/tx/builder/field-types/name.ts +18 -0
- package/src/tx/builder/field-types/short-u-int.ts +11 -0
- package/src/tx/builder/field-types/u-int.ts +16 -0
- package/src/tx/builder/helpers.ts +112 -117
- package/src/tx/builder/index.ts +203 -197
- package/src/tx/builder/schema.ts +421 -465
- package/src/tx/index.ts +128 -135
- package/src/tx/validator.ts +165 -161
- package/src/typings/@aeternity__argon2-browser/index.d.ts +1 -1
- package/src/typings/@aeternity__uuid/index.d.ts +3 -1
- package/src/typings/bip32-path/index.d.ts +6 -6
- package/src/typings/blakejs/index.d.ts +4 -32
- package/src/typings/sha-js/index.d.ts +5 -0
- package/src/typings/tweetnacl-auth/index.d.ts +2 -2
- package/src/utils/amount-formatter.ts +41 -41
- package/src/utils/autorest.ts +57 -54
- package/src/utils/bignumber.ts +7 -6
- package/src/utils/bytes.ts +19 -19
- package/src/utils/crypto.ts +82 -94
- package/src/utils/encoder-types.ts +63 -0
- package/src/utils/encoder.ts +104 -56
- package/src/utils/errors.ts +246 -264
- package/src/utils/hd-wallet.ts +114 -82
- package/src/utils/json-big.ts +16 -15
- package/src/utils/keystore.ts +65 -62
- package/src/utils/mptree.ts +59 -56
- package/src/utils/other.ts +26 -18
- package/src/utils/semver-satisfies.ts +15 -11
- package/src/utils/string.ts +10 -10
- package/es/tx/builder/field-types.d.ts +0 -62
- package/es/tx/builder/field-types.mjs +0 -126
- package/es/tx/builder/field-types.mjs.map +0 -1
- package/es/tx/min-fee.d.ts +0 -20
- package/es/tx/min-fee.mjs.map +0 -1
- package/src/tx/builder/field-types.ts +0 -111
- package/src/tx/min-fee.ts +0 -136
package/src/utils/autorest.ts
CHANGED
|
@@ -1,90 +1,93 @@
|
|
|
1
|
-
import { RestError, PipelineResponse, PipelinePolicy } from '@azure/core-rest-pipeline'
|
|
2
|
-
import { AdditionalPolicyConfig } from '@azure/core-client'
|
|
3
|
-
import { pause } from './other'
|
|
4
|
-
import semverSatisfies from './semver-satisfies'
|
|
5
|
-
import { UnsupportedVersionError } from './errors'
|
|
1
|
+
import { RestError, PipelineResponse, PipelinePolicy } from '@azure/core-rest-pipeline';
|
|
2
|
+
import { AdditionalPolicyConfig } from '@azure/core-client';
|
|
3
|
+
import { pause } from './other';
|
|
4
|
+
import semverSatisfies from './semver-satisfies';
|
|
5
|
+
import { UnsupportedVersionError } from './errors';
|
|
6
6
|
|
|
7
7
|
export const genRequestQueuesPolicy = (): AdditionalPolicyConfig => {
|
|
8
|
-
const requestQueues = new Map<string, Promise<unknown>>()
|
|
8
|
+
const requestQueues = new Map<string, Promise<unknown>>();
|
|
9
9
|
|
|
10
10
|
return {
|
|
11
11
|
policy: {
|
|
12
12
|
name: 'request-queues',
|
|
13
|
-
async sendRequest
|
|
14
|
-
const key = request.headers.get('__queue')
|
|
15
|
-
request.headers.delete('__queue')
|
|
16
|
-
const getResponse = async (): Promise<PipelineResponse> =>
|
|
17
|
-
if (key == null) return
|
|
18
|
-
const req = (requestQueues.get(key) ?? Promise.resolve()).then(getResponse, getResponse)
|
|
13
|
+
async sendRequest(request, next) {
|
|
14
|
+
const key = request.headers.get('__queue');
|
|
15
|
+
request.headers.delete('__queue');
|
|
16
|
+
const getResponse = async (): Promise<PipelineResponse> => next(request);
|
|
17
|
+
if (key == null) return getResponse();
|
|
18
|
+
const req = (requestQueues.get(key) ?? Promise.resolve()).then(getResponse, getResponse);
|
|
19
19
|
// TODO: remove after fixing https://github.com/aeternity/aeternity/issues/3803
|
|
20
20
|
// gap to ensure that node won't reject the nonce
|
|
21
|
-
requestQueues.set(key, req.then(async () =>
|
|
22
|
-
return
|
|
23
|
-
}
|
|
21
|
+
requestQueues.set(key, req.then(async () => pause(750)));
|
|
22
|
+
return req;
|
|
23
|
+
},
|
|
24
24
|
},
|
|
25
|
-
position: 'perCall'
|
|
26
|
-
}
|
|
27
|
-
}
|
|
25
|
+
position: 'perCall',
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
28
|
|
|
29
29
|
export const genCombineGetRequestsPolicy = (): AdditionalPolicyConfig => {
|
|
30
|
-
const pendingGetRequests = new Map<string, Promise<PipelineResponse>>()
|
|
30
|
+
const pendingGetRequests = new Map<string, Promise<PipelineResponse>>();
|
|
31
31
|
|
|
32
32
|
return {
|
|
33
33
|
policy: {
|
|
34
34
|
name: 'combine-requests',
|
|
35
|
-
async sendRequest
|
|
36
|
-
if (request.method !== 'GET') return
|
|
37
|
-
const key = JSON.stringify([request.url, request.body])
|
|
38
|
-
const response = pendingGetRequests.get(key) ?? next(request)
|
|
39
|
-
pendingGetRequests.set(key, response)
|
|
35
|
+
async sendRequest(request, next) {
|
|
36
|
+
if (request.method !== 'GET') return next(request);
|
|
37
|
+
const key = JSON.stringify([request.url, request.body]);
|
|
38
|
+
const response = pendingGetRequests.get(key) ?? next(request);
|
|
39
|
+
pendingGetRequests.set(key, response);
|
|
40
40
|
try {
|
|
41
|
-
return await response
|
|
41
|
+
return await response;
|
|
42
42
|
} finally {
|
|
43
|
-
pendingGetRequests.delete(key)
|
|
43
|
+
pendingGetRequests.delete(key);
|
|
44
44
|
}
|
|
45
|
-
}
|
|
45
|
+
},
|
|
46
46
|
},
|
|
47
|
-
position: 'perCall'
|
|
48
|
-
}
|
|
49
|
-
}
|
|
47
|
+
position: 'perCall',
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
50
|
|
|
51
51
|
export const genErrorFormatterPolicy = (
|
|
52
|
-
getMessage: (b: any) => string
|
|
52
|
+
getMessage: (b: any) => string,
|
|
53
53
|
): AdditionalPolicyConfig => ({
|
|
54
54
|
policy: {
|
|
55
55
|
name: 'error-formatter',
|
|
56
|
-
async sendRequest
|
|
56
|
+
async sendRequest(request, next) {
|
|
57
57
|
try {
|
|
58
|
-
return await next(request)
|
|
58
|
+
return await next(request);
|
|
59
59
|
} catch (error) {
|
|
60
|
-
if (!(error instanceof RestError) || error.request == null) throw error
|
|
61
|
-
if (error.response?.bodyAsText == null) throw error
|
|
60
|
+
if (!(error instanceof RestError) || error.request == null) throw error;
|
|
61
|
+
if (error.response?.bodyAsText == null) throw error;
|
|
62
62
|
|
|
63
|
-
let body
|
|
63
|
+
let body;
|
|
64
64
|
try {
|
|
65
|
-
body = JSON.parse(error.response.bodyAsText)
|
|
65
|
+
body = JSON.parse(error.response.bodyAsText);
|
|
66
66
|
} catch (e) {
|
|
67
|
-
throw error
|
|
67
|
+
throw error;
|
|
68
68
|
}
|
|
69
|
-
error.message = `${new URL(error.request.url).pathname.slice(1)} error
|
|
70
|
-
const message = getMessage(body)
|
|
71
|
-
if (message !== '') error.message += `:${message}
|
|
72
|
-
throw error
|
|
69
|
+
error.message = `${new URL(error.request.url).pathname.slice(1)} error`;
|
|
70
|
+
const message = getMessage(body);
|
|
71
|
+
if (message !== '') error.message += `:${message}`;
|
|
72
|
+
throw error;
|
|
73
73
|
}
|
|
74
|
-
}
|
|
74
|
+
},
|
|
75
75
|
},
|
|
76
|
-
position: 'perCall'
|
|
77
|
-
})
|
|
76
|
+
position: 'perCall',
|
|
77
|
+
});
|
|
78
78
|
|
|
79
79
|
export const genVersionCheckPolicy = (
|
|
80
|
-
name: string,
|
|
81
|
-
|
|
80
|
+
name: string,
|
|
81
|
+
ignorePath: string,
|
|
82
|
+
versionPromise: Promise<string>,
|
|
83
|
+
geVersion: string,
|
|
84
|
+
ltVersion: string,
|
|
82
85
|
): PipelinePolicy => ({
|
|
83
86
|
name: 'version-check',
|
|
84
|
-
async sendRequest
|
|
85
|
-
if (new URL(request.url).pathname === ignorePath) return
|
|
86
|
-
const args = [await versionPromise, geVersion, ltVersion] as const
|
|
87
|
-
if (!semverSatisfies(...args)) throw new UnsupportedVersionError(name, ...args)
|
|
88
|
-
return
|
|
89
|
-
}
|
|
90
|
-
})
|
|
87
|
+
async sendRequest(request, next) {
|
|
88
|
+
if (new URL(request.url).pathname === ignorePath) return next(request);
|
|
89
|
+
const args = [await versionPromise, geVersion, ltVersion] as const;
|
|
90
|
+
if (!semverSatisfies(...args)) throw new UnsupportedVersionError(name, ...args);
|
|
91
|
+
return next(request);
|
|
92
|
+
},
|
|
93
|
+
});
|
package/src/utils/bignumber.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Big Number Helpers
|
|
3
3
|
*/
|
|
4
|
-
import BigNumber from 'bignumber.js'
|
|
4
|
+
import BigNumber from 'bignumber.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Check if value is BigNumber, Number, BigInt or number string representation
|
|
8
8
|
* @param number - number to check
|
|
9
9
|
*/
|
|
10
10
|
export const isBigNumber = (number: string | number | bigint | BigNumber): boolean => {
|
|
11
|
-
if (typeof number === 'bigint') return true
|
|
12
|
-
return ['number', 'object', 'string'].includes(typeof number)
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
if (typeof number === 'bigint') return true;
|
|
12
|
+
return ['number', 'object', 'string'].includes(typeof number)
|
|
13
|
+
// eslint-disable-next-line no-restricted-globals
|
|
14
|
+
&& (!isNaN(number as number) || Number.isInteger(number) || BigNumber.isBigNumber(number));
|
|
15
|
+
};
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* BigNumber ceil operation
|
|
18
19
|
*/
|
|
19
20
|
export const ceil = (bigNumber: BigNumber): BigNumber => bigNumber
|
|
20
|
-
.integerValue(BigNumber.ROUND_CEIL)
|
|
21
|
+
.integerValue(BigNumber.ROUND_CEIL);
|
package/src/utils/bytes.ts
CHANGED
|
@@ -14,20 +14,20 @@
|
|
|
14
14
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
15
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
16
16
|
*/
|
|
17
|
-
import BigNumber from 'bignumber.js'
|
|
18
|
-
import { NoSerializerFoundError, TypeError } from './errors'
|
|
19
|
-
import { isBase64, isHex } from './string'
|
|
17
|
+
import BigNumber from 'bignumber.js';
|
|
18
|
+
import { NoSerializerFoundError, TypeError } from './errors';
|
|
19
|
+
import { isBase64, isHex } from './string';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Convert bignumber to byte array
|
|
23
23
|
* @param x - bignumber instance
|
|
24
24
|
* @returns Buffer
|
|
25
25
|
*/
|
|
26
|
-
export function bigNumberToByteArray
|
|
27
|
-
if (!x.isInteger()) throw new TypeError(`Unexpected not integer value: ${x.toFixed()}`)
|
|
28
|
-
let hexString = x.toString(16)
|
|
29
|
-
if (hexString.length % 2 === 1) hexString =
|
|
30
|
-
return Buffer.from(hexString, 'hex')
|
|
26
|
+
export function bigNumberToByteArray(x: BigNumber): Buffer {
|
|
27
|
+
if (!x.isInteger()) throw new TypeError(`Unexpected not integer value: ${x.toFixed()}`);
|
|
28
|
+
let hexString = x.toString(16);
|
|
29
|
+
if (hexString.length % 2 === 1) hexString = `0${hexString}`;
|
|
30
|
+
return Buffer.from(hexString, 'hex');
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
@@ -36,20 +36,20 @@ export function bigNumberToByteArray (x: BigNumber): Buffer {
|
|
|
36
36
|
* @param big - enables force conversion to BigNumber
|
|
37
37
|
* @returns Buffer
|
|
38
38
|
*/
|
|
39
|
-
export function toBytes
|
|
39
|
+
export function toBytes(val?: null | string | number | BigNumber, big = false): Buffer {
|
|
40
40
|
// Encode a value to bytes.
|
|
41
41
|
// If the value is an int it will be encoded as bytes big endian
|
|
42
42
|
// Raises ValueError if the input is not an int or string
|
|
43
43
|
|
|
44
|
-
if (val === undefined || val === null) return Buffer.from([])
|
|
44
|
+
if (val === undefined || val === null) return Buffer.from([]);
|
|
45
45
|
if (Number.isInteger(val) || BigNumber.isBigNumber(val) || big) {
|
|
46
|
-
if (!BigNumber.isBigNumber(val)) val = new BigNumber(val)
|
|
47
|
-
return bigNumberToByteArray(val)
|
|
46
|
+
if (!BigNumber.isBigNumber(val)) val = new BigNumber(val);
|
|
47
|
+
return bigNumberToByteArray(val);
|
|
48
48
|
}
|
|
49
49
|
if (typeof val === 'string') {
|
|
50
|
-
return Buffer.from(val)
|
|
50
|
+
return Buffer.from(val);
|
|
51
51
|
}
|
|
52
|
-
throw new NoSerializerFoundError()
|
|
52
|
+
throw new NoSerializerFoundError();
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/**
|
|
@@ -60,13 +60,13 @@ export function toBytes (val?: null | string | number | BigNumber, big: boolean
|
|
|
60
60
|
* @param enc - Encoding of the input string.
|
|
61
61
|
* @returns Buffer containing the input data.
|
|
62
62
|
*/
|
|
63
|
-
export function str2buf
|
|
63
|
+
export function str2buf(str: string, enc?: BufferEncoding): Buffer {
|
|
64
64
|
return Buffer.from(
|
|
65
65
|
str,
|
|
66
|
-
enc ?? (isHex(str) ? 'hex' : undefined) ?? (isBase64(str) ? 'base64' : undefined)
|
|
67
|
-
)
|
|
66
|
+
enc ?? (isHex(str) ? 'hex' : undefined) ?? (isBase64(str) ? 'base64' : undefined),
|
|
67
|
+
);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
export const bytesToHex = (b: Uint8Array): string => Buffer.from(b).toString('hex')
|
|
70
|
+
export const bytesToHex = (b: Uint8Array): string => Buffer.from(b).toString('hex');
|
|
71
71
|
|
|
72
|
-
export const hexToBytes = (s: string): Uint8Array => Buffer.from(s, 'hex')
|
|
72
|
+
export const hexToBytes = (s: string): Uint8Array => Buffer.from(s, 'hex');
|
package/src/utils/crypto.ts
CHANGED
|
@@ -14,28 +14,27 @@
|
|
|
14
14
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
15
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
16
16
|
*/
|
|
17
|
-
import nacl, { SignKeyPair } from 'tweetnacl'
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const Ecb = aesjs.ModeOfOperation.ecb
|
|
17
|
+
import nacl, { SignKeyPair } from 'tweetnacl';
|
|
18
|
+
// js extension is required for mjs build, not importing the whole package to reduce bundle size
|
|
19
|
+
// eslint-disable-next-line import/extensions
|
|
20
|
+
import { blake2b } from 'blakejs/blake2b.js';
|
|
21
|
+
import { encode as varuintEncode } from 'varuint-bitcoin';
|
|
22
|
+
|
|
23
|
+
import { str2buf } from './bytes';
|
|
24
|
+
import { concatBuffers } from './other';
|
|
25
|
+
import {
|
|
26
|
+
decode, encode, Encoded, Encoding,
|
|
27
|
+
} from './encoder';
|
|
29
28
|
|
|
30
29
|
/**
|
|
31
30
|
* Generate address from secret key
|
|
32
31
|
* @param secret - Private key
|
|
33
32
|
* @returns Public key encoded as address
|
|
34
33
|
*/
|
|
35
|
-
export function getAddressFromPriv
|
|
36
|
-
const secretBuffer = typeof secret === 'string' ? str2buf(secret) : secret
|
|
37
|
-
const keys = nacl.sign.keyPair.fromSecretKey(secretBuffer)
|
|
38
|
-
return encode(keys.publicKey,
|
|
34
|
+
export function getAddressFromPriv(secret: string | Uint8Array): Encoded.AccountAddress {
|
|
35
|
+
const secretBuffer = typeof secret === 'string' ? str2buf(secret) : secret;
|
|
36
|
+
const keys = nacl.sign.keyPair.fromSecretKey(secretBuffer);
|
|
37
|
+
return encode(keys.publicKey, Encoding.AccountAddress);
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
/**
|
|
@@ -44,12 +43,15 @@ export function getAddressFromPriv (secret: string | Uint8Array): EncodedData<'a
|
|
|
44
43
|
* @param prefix - Transaction prefix. Default: 'ak'
|
|
45
44
|
* @returns is valid
|
|
46
45
|
*/
|
|
47
|
-
export function isAddressValid
|
|
46
|
+
export function isAddressValid(
|
|
47
|
+
address: string,
|
|
48
|
+
prefix: Encoding = Encoding.AccountAddress,
|
|
49
|
+
): boolean {
|
|
48
50
|
try {
|
|
49
|
-
decode(address as
|
|
50
|
-
return true
|
|
51
|
+
decode(address as Encoded.Generic<typeof prefix>);
|
|
52
|
+
return true;
|
|
51
53
|
} catch (e) {
|
|
52
|
-
return false
|
|
54
|
+
return false;
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
|
|
@@ -57,8 +59,8 @@ export function isAddressValid (address: string, prefix: EncodingType = 'ak'): b
|
|
|
57
59
|
* Generate a random salt (positive integer)
|
|
58
60
|
* @returns random salt
|
|
59
61
|
*/
|
|
60
|
-
export function
|
|
61
|
-
return Math.floor(Math.random() * Math.floor(Number.MAX_SAFE_INTEGER))
|
|
62
|
+
export function genSalt(): number {
|
|
63
|
+
return Math.floor(Math.random() * Math.floor(Number.MAX_SAFE_INTEGER));
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
/**
|
|
@@ -67,10 +69,10 @@ export function salt (): number {
|
|
|
67
69
|
* @param value - Value to encode
|
|
68
70
|
* @returns Encoded number
|
|
69
71
|
*/
|
|
70
|
-
export function encodeUnsigned
|
|
71
|
-
const binary = Buffer.allocUnsafe(4)
|
|
72
|
-
binary.writeUInt32BE(value)
|
|
73
|
-
return binary.slice(binary.findIndex(i => i !== 0))
|
|
72
|
+
export function encodeUnsigned(value: number): Buffer {
|
|
73
|
+
const binary = Buffer.allocUnsafe(4);
|
|
74
|
+
binary.writeUInt32BE(value);
|
|
75
|
+
return binary.slice(binary.findIndex((i) => i !== 0));
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
/**
|
|
@@ -78,21 +80,25 @@ export function encodeUnsigned (value: number): Buffer {
|
|
|
78
80
|
* @param input - Data to hash
|
|
79
81
|
* @returns Hash
|
|
80
82
|
*/
|
|
81
|
-
export function hash
|
|
82
|
-
return Buffer.from(blake2b(input, undefined, 32)) // 256 bits
|
|
83
|
+
export function hash(input: string | Uint8Array): Buffer {
|
|
84
|
+
return Buffer.from(blake2b(input, undefined, 32)); // 256 bits
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
// Todo Duplicated in tx builder. remove
|
|
86
88
|
/**
|
|
87
89
|
* Compute contract address
|
|
90
|
+
* @category contract
|
|
88
91
|
* @param owner - Address of contract owner
|
|
89
92
|
* @param nonce - Round when contract was created
|
|
90
93
|
* @returns Contract address
|
|
91
94
|
*/
|
|
92
|
-
export function encodeContractAddress
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
export function encodeContractAddress(
|
|
96
|
+
owner: Encoded.AccountAddress,
|
|
97
|
+
nonce: number,
|
|
98
|
+
): Encoded.ContractAddress {
|
|
99
|
+
const publicKey = decode(owner);
|
|
100
|
+
const binary = concatBuffers([publicKey, encodeUnsigned(nonce)]);
|
|
101
|
+
return encode(hash(binary), Encoding.ContractAddress);
|
|
96
102
|
}
|
|
97
103
|
|
|
98
104
|
// KEY-PAIR HELPERS
|
|
@@ -102,8 +108,8 @@ export function encodeContractAddress (owner: EncodedData<'ak'>, nonce: number):
|
|
|
102
108
|
* @param secret - secret key
|
|
103
109
|
* @returns Object with Private(privateKey) and Public(publicKey) keys
|
|
104
110
|
*/
|
|
105
|
-
export function generateKeyPairFromSecret
|
|
106
|
-
return nacl.sign.keyPair.fromSecretKey(secret)
|
|
111
|
+
export function generateKeyPairFromSecret(secret: Uint8Array): SignKeyPair {
|
|
112
|
+
return nacl.sign.keyPair.fromSecretKey(secret);
|
|
107
113
|
}
|
|
108
114
|
|
|
109
115
|
/**
|
|
@@ -111,52 +117,28 @@ export function generateKeyPairFromSecret (secret: Uint8Array): SignKeyPair {
|
|
|
111
117
|
* @param raw - Whether to return raw (binary) keys
|
|
112
118
|
* @returns Key pair
|
|
113
119
|
*/
|
|
114
|
-
export function generateKeyPair
|
|
115
|
-
export function generateKeyPair
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
export function generateKeyPair(raw: true): { publicKey: Buffer; secretKey: Buffer };
|
|
121
|
+
export function generateKeyPair(raw?: false): {
|
|
122
|
+
publicKey: Encoded.AccountAddress; secretKey: string;
|
|
123
|
+
};
|
|
124
|
+
export function generateKeyPair(raw = false): {
|
|
125
|
+
publicKey: Encoded.AccountAddress | Buffer;
|
|
126
|
+
secretKey: string | Buffer;
|
|
119
127
|
} {
|
|
120
|
-
const keyPair = nacl.sign.keyPair()
|
|
121
|
-
const publicBuffer = Buffer.from(keyPair.publicKey)
|
|
122
|
-
const secretBuffer = Buffer.from(keyPair.secretKey)
|
|
128
|
+
const keyPair = nacl.sign.keyPair();
|
|
129
|
+
const publicBuffer = Buffer.from(keyPair.publicKey);
|
|
130
|
+
const secretBuffer = Buffer.from(keyPair.secretKey);
|
|
123
131
|
|
|
124
132
|
if (raw) {
|
|
125
133
|
return {
|
|
126
134
|
publicKey: publicBuffer,
|
|
127
|
-
secretKey: secretBuffer
|
|
128
|
-
}
|
|
129
|
-
} else {
|
|
130
|
-
return {
|
|
131
|
-
publicKey: encode(publicBuffer, 'ak'),
|
|
132
|
-
secretKey: secretBuffer.toString('hex')
|
|
133
|
-
}
|
|
135
|
+
secretKey: secretBuffer,
|
|
136
|
+
};
|
|
134
137
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
* @param password - Password to encrypt with
|
|
140
|
-
* @param binaryData - Data to encrypt
|
|
141
|
-
* @returns Encrypted data
|
|
142
|
-
*/
|
|
143
|
-
export function encryptKey (password: string, binaryData: Uint8Array): Uint8Array {
|
|
144
|
-
const hashedPasswordBytes = sha256hash(password)
|
|
145
|
-
const aesEcb = new Ecb(hashedPasswordBytes)
|
|
146
|
-
return aesEcb.encrypt(binaryData)
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Decrypt given data using `password`
|
|
151
|
-
* @param password - Password to decrypt with
|
|
152
|
-
* @param encrypted - Data to decrypt
|
|
153
|
-
* @returns Decrypted data
|
|
154
|
-
*/
|
|
155
|
-
export function decryptKey (password: string, encrypted: Uint8Array): Uint8Array {
|
|
156
|
-
const encryptedBytes = Buffer.from(encrypted)
|
|
157
|
-
const hashedPasswordBytes = sha256hash(password)
|
|
158
|
-
const aesEcb = new Ecb(hashedPasswordBytes)
|
|
159
|
-
return aesEcb.decrypt(encryptedBytes)
|
|
138
|
+
return {
|
|
139
|
+
publicKey: encode(publicBuffer, Encoding.AccountAddress),
|
|
140
|
+
secretKey: secretBuffer.toString('hex'),
|
|
141
|
+
};
|
|
160
142
|
}
|
|
161
143
|
|
|
162
144
|
// SIGNATURES
|
|
@@ -167,8 +149,8 @@ export function decryptKey (password: string, encrypted: Uint8Array): Uint8Array
|
|
|
167
149
|
* @param privateKey - Key to sign with
|
|
168
150
|
* @returns Signature
|
|
169
151
|
*/
|
|
170
|
-
export function sign
|
|
171
|
-
return nacl.sign.detached(Buffer.from(data), Buffer.from(privateKey))
|
|
152
|
+
export function sign(data: string | Uint8Array, privateKey: string | Uint8Array): Uint8Array {
|
|
153
|
+
return nacl.sign.detached(Buffer.from(data), Buffer.from(privateKey));
|
|
172
154
|
}
|
|
173
155
|
|
|
174
156
|
/**
|
|
@@ -178,26 +160,31 @@ export function sign (data: string | Uint8Array, privateKey: string | Uint8Array
|
|
|
178
160
|
* @param publicKey - Key to verify against
|
|
179
161
|
* @returns Valid?
|
|
180
162
|
*/
|
|
181
|
-
export function verify
|
|
182
|
-
data: Uint8Array,
|
|
163
|
+
export function verify(
|
|
164
|
+
data: Uint8Array,
|
|
165
|
+
signature: Uint8Array,
|
|
166
|
+
publicKey: string | Uint8Array,
|
|
183
167
|
): boolean {
|
|
184
|
-
const publicKeyBuffer = typeof publicKey === 'string' ? str2buf(publicKey) : publicKey
|
|
185
|
-
return nacl.sign.detached.verify(data, signature, publicKeyBuffer)
|
|
168
|
+
const publicKeyBuffer = typeof publicKey === 'string' ? str2buf(publicKey) : publicKey;
|
|
169
|
+
return nacl.sign.detached.verify(data, signature, publicKeyBuffer);
|
|
186
170
|
}
|
|
187
171
|
|
|
188
|
-
export function messageToHash
|
|
189
|
-
const p = Buffer.from('aeternity Signed Message:\n', 'utf8')
|
|
190
|
-
const msg = Buffer.from(message, 'utf8')
|
|
191
|
-
return hash(concatBuffers([varuintEncode(p.length), p, varuintEncode(msg.length), msg]))
|
|
172
|
+
export function messageToHash(message: string): Buffer {
|
|
173
|
+
const p = Buffer.from('aeternity Signed Message:\n', 'utf8');
|
|
174
|
+
const msg = Buffer.from(message, 'utf8');
|
|
175
|
+
return hash(concatBuffers([varuintEncode(p.length), p, varuintEncode(msg.length), msg]));
|
|
192
176
|
}
|
|
193
177
|
|
|
194
|
-
export function signMessage
|
|
195
|
-
return sign(messageToHash(message), privateKey)
|
|
178
|
+
export function signMessage(message: string, privateKey: string | Buffer): Uint8Array {
|
|
179
|
+
return sign(messageToHash(message), privateKey);
|
|
196
180
|
}
|
|
197
181
|
|
|
198
|
-
export function verifyMessage
|
|
199
|
-
str: string,
|
|
200
|
-
|
|
182
|
+
export function verifyMessage(
|
|
183
|
+
str: string,
|
|
184
|
+
signature: Uint8Array,
|
|
185
|
+
publicKey: string | Uint8Array,
|
|
186
|
+
): boolean {
|
|
187
|
+
return verify(messageToHash(str), signature, publicKey);
|
|
201
188
|
}
|
|
202
189
|
|
|
203
190
|
/**
|
|
@@ -208,10 +195,11 @@ export function verifyMessage (
|
|
|
208
195
|
* @param publicKey - Public key to verify
|
|
209
196
|
* @returns Valid?
|
|
210
197
|
*/
|
|
211
|
-
export function isValidKeypair
|
|
212
|
-
privateKey: string | Uint8Array,
|
|
198
|
+
export function isValidKeypair(
|
|
199
|
+
privateKey: string | Uint8Array,
|
|
200
|
+
publicKey: string | Uint8Array,
|
|
213
201
|
): boolean {
|
|
214
|
-
const message = Buffer.from('TheMessage')
|
|
215
|
-
const signature = sign(message, privateKey)
|
|
216
|
-
return verify(message, signature, publicKey)
|
|
202
|
+
const message = Buffer.from('TheMessage');
|
|
203
|
+
const signature = sign(message, privateKey);
|
|
204
|
+
return verify(message, signature, publicKey);
|
|
217
205
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category transaction builder
|
|
3
|
+
* @see {@link https://github.com/aeternity/protocol/blob/master/node/api/api_encoding.md}
|
|
4
|
+
* @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L205-L230}
|
|
5
|
+
*/
|
|
6
|
+
export enum Encoding {
|
|
7
|
+
KeyBlockHash = 'kh',
|
|
8
|
+
MicroBlockHash = 'mh',
|
|
9
|
+
BlockPofHash = 'bf',
|
|
10
|
+
BlockTxHash = 'bx',
|
|
11
|
+
BlockStateHash = 'bs',
|
|
12
|
+
Channel = 'ch',
|
|
13
|
+
ContractAddress = 'ct',
|
|
14
|
+
ContractBytearray = 'cb',
|
|
15
|
+
ContractStoreKey = 'ck',
|
|
16
|
+
ContractStoreValue = 'cv',
|
|
17
|
+
Transaction = 'tx',
|
|
18
|
+
TxHash = 'th',
|
|
19
|
+
OracleAddress = 'ok',
|
|
20
|
+
OracleQuery = 'ov',
|
|
21
|
+
OracleQueryId = 'oq',
|
|
22
|
+
OracleResponse = 'or',
|
|
23
|
+
AccountAddress = 'ak',
|
|
24
|
+
Signature = 'sg',
|
|
25
|
+
Commitment = 'cm',
|
|
26
|
+
PeerPubkey = 'pp',
|
|
27
|
+
Name = 'nm',
|
|
28
|
+
State = 'st',
|
|
29
|
+
Poi = 'pi',
|
|
30
|
+
StateTrees = 'ss',
|
|
31
|
+
CallStateTree = 'cs',
|
|
32
|
+
Bytearray = 'ba',
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type KeyBlockHash = `${Encoding.KeyBlockHash}_${string}`;
|
|
36
|
+
export type MicroBlockHash = `${Encoding.MicroBlockHash}_${string}`;
|
|
37
|
+
export type BlockPofHash = `${Encoding.BlockPofHash}_${string}`;
|
|
38
|
+
export type BlockTxHash = `${Encoding.BlockTxHash}_${string}`;
|
|
39
|
+
export type BlockStateHash = `${Encoding.BlockStateHash}_${string}`;
|
|
40
|
+
export type Channel = `${Encoding.Channel}_${string}`;
|
|
41
|
+
export type ContractAddress = `${Encoding.ContractAddress}_${string}`;
|
|
42
|
+
export type ContractBytearray = `${Encoding.ContractBytearray}_${string}`;
|
|
43
|
+
export type ContractStoreKey = `${Encoding.ContractStoreKey}_${string}`;
|
|
44
|
+
export type ContractStoreValue = `${Encoding.ContractStoreValue}_${string}`;
|
|
45
|
+
export type Transaction = `${Encoding.Transaction}_${string}`;
|
|
46
|
+
export type TxHash = `${Encoding.TxHash}_${string}`;
|
|
47
|
+
export type OracleAddress = `${Encoding.OracleAddress}_${string}`;
|
|
48
|
+
export type OracleQuery = `${Encoding.OracleQuery}_${string}`;
|
|
49
|
+
export type OracleQueryId = `${Encoding.OracleQueryId}_${string}`;
|
|
50
|
+
export type OracleResponse = `${Encoding.OracleResponse}_${string}`;
|
|
51
|
+
export type AccountAddress = `${Encoding.AccountAddress}_${string}`;
|
|
52
|
+
export type Signature = `${Encoding.Signature}_${string}`;
|
|
53
|
+
export type Commitment = `${Encoding.Commitment}_${string}`;
|
|
54
|
+
export type PeerPubkey = `${Encoding.PeerPubkey}_${string}`;
|
|
55
|
+
export type Name = `${Encoding.Name}_${string}`;
|
|
56
|
+
export type State = `${Encoding.State}_${string}`;
|
|
57
|
+
export type Poi = `${Encoding.Poi}_${string}`;
|
|
58
|
+
export type StateTrees = `${Encoding.StateTrees}_${string}`;
|
|
59
|
+
export type CallStateTree = `${Encoding.CallStateTree}_${string}`;
|
|
60
|
+
export type Bytearray = `${Encoding.Bytearray}_${string}`;
|
|
61
|
+
|
|
62
|
+
export type Generic<Type extends Encoding> = `${Type}_${string}`;
|
|
63
|
+
export type Any = `${Encoding}_${string}`;
|