@aeternity/aepp-sdk 13.0.0 → 13.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/README.md +4 -2
- package/bin/aesophia_cli +0 -0
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +1 -1
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +27068 -16862
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdkBase.d.ts +11 -3
- package/es/AeSdkBase.mjs +24 -3
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkMethods.d.ts +9 -14
- package/es/AeSdkMethods.mjs +20 -49
- package/es/AeSdkMethods.mjs.map +1 -1
- package/es/AeSdkWallet.mjs +28 -5
- package/es/AeSdkWallet.mjs.map +1 -1
- package/es/Middleware.d.ts +38 -0
- package/es/Middleware.mjs +90 -0
- package/es/Middleware.mjs.map +1 -0
- package/es/MiddlewareSubscriber.d.ts +30 -0
- package/es/MiddlewareSubscriber.mjs +198 -0
- package/es/MiddlewareSubscriber.mjs.map +1 -0
- package/es/Node.d.ts +1 -1
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +14 -2
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Generalized.d.ts +1 -0
- package/es/account/Generalized.mjs +5 -0
- package/es/account/Generalized.mjs.map +1 -1
- package/es/account/Ledger.d.ts +1 -0
- package/es/account/Ledger.mjs +5 -0
- package/es/account/Ledger.mjs.map +1 -1
- package/es/account/Memory.d.ts +2 -0
- package/es/account/Memory.mjs +18 -0
- package/es/account/Memory.mjs.map +1 -1
- package/es/account/Rpc.d.ts +1 -6
- package/es/account/Rpc.mjs +24 -10
- package/es/account/Rpc.mjs.map +1 -1
- package/es/aens.d.ts +1 -1
- package/es/aens.mjs +1 -1
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +5 -2
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/types.d.ts +10 -0
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
- package/es/aepp-wallet-communication/schema.d.ts +1 -8
- package/es/aepp-wallet-communication/schema.mjs +1 -14
- package/es/aepp-wallet-communication/schema.mjs.map +1 -1
- package/es/aepp-wallet-communication/wallet-detector.d.ts +1 -1
- package/es/aepp-wallet-communication/wallet-detector.mjs +0 -3
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
- package/es/apis/compiler/compiler.mjs +15 -1
- package/es/apis/compiler/compiler.mjs.map +1 -1
- package/es/apis/compiler/models/index.d.ts +1 -7
- package/es/apis/compiler/models/index.mjs.map +1 -1
- package/es/apis/compiler/models/mappers.d.ts +0 -1
- package/es/apis/compiler/models/mappers.mjs +0 -43
- package/es/apis/compiler/models/mappers.mjs.map +1 -1
- package/es/apis/middleware/index.d.ts +2 -0
- package/es/apis/middleware/index.mjs +3 -0
- package/es/apis/middleware/index.mjs.map +1 -0
- package/es/apis/middleware/middleware.d.ts +309 -0
- package/es/apis/middleware/middleware.mjs +1527 -0
- package/es/apis/middleware/middleware.mjs.map +1 -0
- package/es/apis/middleware/models/index.d.ts +1496 -0
- package/es/apis/middleware/models/index.mjs +364 -0
- package/es/apis/middleware/models/index.mjs.map +1 -0
- package/es/apis/middleware/models/mappers.d.ts +102 -0
- package/es/apis/middleware/models/mappers.mjs +3334 -0
- package/es/apis/middleware/models/mappers.mjs.map +1 -0
- package/es/apis/middleware/models/parameters.d.ts +43 -0
- package/es/apis/middleware/models/parameters.mjs +417 -0
- package/es/apis/middleware/models/parameters.mjs.map +1 -0
- package/es/chain.d.ts +2 -1
- package/es/chain.mjs +4 -2
- package/es/chain.mjs.map +1 -1
- package/es/channel/Base.d.ts +1 -1
- package/es/channel/Base.mjs +1 -4
- package/es/channel/Base.mjs.map +1 -1
- package/es/channel/internal.mjs +2 -0
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Contract.d.ts +1 -2
- package/es/contract/Contract.mjs +1 -1
- package/es/contract/Contract.mjs.map +1 -1
- package/es/contract/compiler/Base.d.ts +21 -0
- package/es/contract/compiler/Base.mjs.map +1 -1
- package/es/contract/compiler/Cli.d.ts +2 -0
- package/es/contract/compiler/Cli.mjs +24 -3
- package/es/contract/compiler/Cli.mjs.map +1 -1
- package/es/contract/compiler/Http.d.ts +2 -0
- package/es/contract/compiler/Http.mjs +22 -2
- package/es/contract/compiler/Http.mjs.map +1 -1
- package/es/contract/compiler/HttpNode.d.ts +1 -0
- package/es/contract/compiler/HttpNode.mjs +5 -0
- package/es/contract/compiler/HttpNode.mjs.map +1 -1
- package/es/deprecated.d.ts +14 -0
- package/es/deprecated.mjs +22 -0
- package/es/deprecated.mjs.map +1 -0
- package/es/index-browser.d.ts +20 -14
- package/es/index-browser.mjs +19 -15
- package/es/index-browser.mjs.map +1 -1
- package/es/tx/builder/constants.d.ts +0 -1
- package/es/tx/builder/constants.mjs +0 -1
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/field-types/coin-amount.d.ts +1 -1
- package/es/tx/builder/field-types/coin-amount.mjs +2 -1
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
- package/es/tx/builder/field-types/deposit.d.ts +1 -1
- package/es/tx/builder/field-types/entry.mjs +2 -1
- package/es/tx/builder/field-types/entry.mjs.map +1 -1
- package/es/tx/builder/field-types/index.d.ts +2 -2
- package/es/tx/builder/helpers.d.ts +8 -1
- package/es/tx/builder/helpers.mjs +53 -9
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +4 -2
- package/es/tx/builder/index.mjs +0 -1
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +9 -9
- package/es/tx/execution-cost.d.ts +17 -0
- package/es/tx/execution-cost.mjs +17 -0
- package/es/tx/execution-cost.mjs.map +1 -1
- package/es/tx/validator.mjs +6 -3
- package/es/tx/validator.mjs.map +1 -1
- package/es/utils/amount-formatter.d.ts +1 -2
- package/es/utils/amount-formatter.mjs +2 -2
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.mjs +6 -8
- package/es/utils/autorest.mjs.map +1 -1
- package/es/utils/crypto.d.ts +1 -0
- package/es/utils/crypto.mjs +12 -2
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/errors.d.ts +2 -2
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/other.d.ts +1 -0
- package/es/utils/other.mjs +5 -0
- package/es/utils/other.mjs.map +1 -1
- package/es/utils/typed-data.d.ts +45 -0
- package/es/utils/typed-data.mjs +71 -0
- package/es/utils/typed-data.mjs.map +1 -0
- package/package.json +23 -4
- package/src/AeSdkBase.ts +30 -5
- package/src/AeSdkMethods.ts +31 -50
- package/src/AeSdkWallet.ts +27 -5
- package/src/Middleware.ts +141 -0
- package/src/MiddlewareSubscriber.ts +207 -0
- package/src/Node.ts +1 -1
- package/src/account/Base.ts +20 -3
- package/src/account/Generalized.ts +5 -0
- package/src/account/Ledger.ts +5 -0
- package/src/account/Memory.ts +15 -0
- package/src/account/Rpc.ts +19 -7
- package/src/aens.ts +1 -1
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +11 -3
- package/src/aepp-wallet-communication/rpc/types.ts +11 -0
- package/src/aepp-wallet-communication/schema.ts +2 -17
- package/src/aepp-wallet-communication/wallet-detector.ts +1 -2
- package/src/apis/compiler/compiler.ts +8 -1
- package/src/apis/compiler/models/index.ts +1 -8
- package/src/apis/compiler/models/mappers.ts +0 -36
- package/src/apis/middleware/index.ts +2 -0
- package/src/apis/middleware/middleware.ts +1807 -0
- package/src/apis/middleware/models/index.ts +1747 -0
- package/src/apis/middleware/models/mappers.ts +3370 -0
- package/src/apis/middleware/models/parameters.ts +463 -0
- package/src/chain.ts +3 -2
- package/src/channel/Base.ts +5 -5
- package/src/channel/internal.ts +2 -0
- package/src/contract/Contract.ts +2 -1
- package/src/contract/compiler/Base.ts +26 -0
- package/src/contract/compiler/Cli.ts +27 -3
- package/src/contract/compiler/Http.ts +21 -2
- package/src/contract/compiler/HttpNode.ts +6 -0
- package/src/deprecated.ts +23 -0
- package/src/index-browser.ts +77 -15
- package/src/tx/builder/constants.ts +0 -1
- package/src/tx/builder/field-types/coin-amount.ts +2 -1
- package/src/tx/builder/field-types/entry.ts +1 -1
- package/src/tx/builder/helpers.ts +54 -9
- package/src/tx/builder/index.ts +6 -9
- package/src/tx/execution-cost.ts +17 -0
- package/src/tx/validator.ts +4 -2
- package/src/utils/amount-formatter.ts +1 -1
- package/src/utils/autorest.ts +5 -10
- package/src/utils/crypto.ts +12 -2
- package/src/utils/errors.ts +2 -2
- package/src/utils/other.ts +5 -0
- package/src/utils/typed-data.ts +95 -0
- package/types-legacy/ts4.2/AeSdkBase.d.ts +11 -3
- package/types-legacy/ts4.2/AeSdkMethods.d.ts +9 -14
- package/types-legacy/ts4.2/Middleware.d.ts +46 -0
- package/types-legacy/ts4.2/MiddlewareSubscriber.d.ts +30 -0
- package/types-legacy/ts4.2/Node.d.ts +1 -1
- package/types-legacy/ts4.2/account/Base.d.ts +14 -2
- package/types-legacy/ts4.2/account/Generalized.d.ts +1 -0
- package/types-legacy/ts4.2/account/Ledger.d.ts +1 -0
- package/types-legacy/ts4.2/account/Memory.d.ts +2 -0
- package/types-legacy/ts4.2/account/Rpc.d.ts +1 -6
- package/types-legacy/ts4.2/aens.d.ts +1 -1
- package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +10 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +1 -8
- package/types-legacy/ts4.2/aepp-wallet-communication/wallet-detector.d.ts +1 -1
- package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +1 -7
- package/types-legacy/ts4.2/apis/compiler/models/mappers.d.ts +0 -1
- package/types-legacy/ts4.2/apis/middleware/index.d.ts +2 -0
- package/types-legacy/ts4.2/apis/middleware/middleware.d.ts +309 -0
- package/types-legacy/ts4.2/apis/middleware/models/index.d.ts +1496 -0
- package/types-legacy/ts4.2/apis/middleware/models/mappers.d.ts +102 -0
- package/types-legacy/ts4.2/apis/middleware/models/parameters.d.ts +43 -0
- package/types-legacy/ts4.2/chain.d.ts +2 -1
- package/types-legacy/ts4.2/channel/Base.d.ts +1 -1
- package/types-legacy/ts4.2/contract/Contract.d.ts +1 -2
- package/types-legacy/ts4.2/contract/compiler/Base.d.ts +21 -0
- package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +2 -0
- package/types-legacy/ts4.2/contract/compiler/Http.d.ts +2 -0
- package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +1 -0
- package/types-legacy/ts4.2/deprecated.d.ts +14 -0
- package/types-legacy/ts4.2/index-browser.d.ts +20 -14
- package/types-legacy/ts4.2/tx/builder/constants.d.ts +0 -1
- package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +2 -2
- package/types-legacy/ts4.2/tx/builder/helpers.d.ts +8 -1
- package/types-legacy/ts4.2/tx/builder/index.d.ts +4 -2
- package/types-legacy/ts4.2/tx/builder/schema.d.ts +9 -9
- package/types-legacy/ts4.2/tx/execution-cost.d.ts +17 -0
- package/types-legacy/ts4.2/utils/amount-formatter.d.ts +1 -2
- package/types-legacy/ts4.2/utils/crypto.d.ts +1 -0
- package/types-legacy/ts4.2/utils/errors.d.ts +2 -2
- package/types-legacy/ts4.2/utils/other.d.ts +1 -0
- package/types-legacy/ts4.2/utils/typed-data.d.ts +60 -0
- package/types-legacy/ts4.5/AeSdkBase.d.ts +11 -3
- package/types-legacy/ts4.5/AeSdkMethods.d.ts +9 -14
- package/types-legacy/ts4.5/Middleware.d.ts +46 -0
- package/types-legacy/ts4.5/MiddlewareSubscriber.d.ts +30 -0
- package/types-legacy/ts4.5/Node.d.ts +1 -1
- package/types-legacy/ts4.5/account/Base.d.ts +14 -2
- package/types-legacy/ts4.5/account/Generalized.d.ts +1 -0
- package/types-legacy/ts4.5/account/Ledger.d.ts +1 -0
- package/types-legacy/ts4.5/account/Memory.d.ts +2 -0
- package/types-legacy/ts4.5/account/Rpc.d.ts +1 -6
- package/types-legacy/ts4.5/aens.d.ts +1 -1
- package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +10 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +1 -8
- package/types-legacy/ts4.5/aepp-wallet-communication/wallet-detector.d.ts +1 -1
- package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +1 -7
- package/types-legacy/ts4.5/apis/compiler/models/mappers.d.ts +0 -1
- package/types-legacy/ts4.5/apis/middleware/index.d.ts +2 -0
- package/types-legacy/ts4.5/apis/middleware/middleware.d.ts +309 -0
- package/types-legacy/ts4.5/apis/middleware/models/index.d.ts +1496 -0
- package/types-legacy/ts4.5/apis/middleware/models/mappers.d.ts +102 -0
- package/types-legacy/ts4.5/apis/middleware/models/parameters.d.ts +43 -0
- package/types-legacy/ts4.5/chain.d.ts +2 -1
- package/types-legacy/ts4.5/channel/Base.d.ts +1 -1
- package/types-legacy/ts4.5/contract/Contract.d.ts +1 -2
- package/types-legacy/ts4.5/contract/compiler/Base.d.ts +21 -0
- package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +2 -0
- package/types-legacy/ts4.5/contract/compiler/Http.d.ts +2 -0
- package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +1 -0
- package/types-legacy/ts4.5/deprecated.d.ts +14 -0
- package/types-legacy/ts4.5/index-browser.d.ts +20 -14
- package/types-legacy/ts4.5/tx/builder/constants.d.ts +0 -1
- package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +2 -2
- package/types-legacy/ts4.5/tx/builder/helpers.d.ts +8 -1
- package/types-legacy/ts4.5/tx/builder/index.d.ts +4 -2
- package/types-legacy/ts4.5/tx/builder/schema.d.ts +9 -9
- package/types-legacy/ts4.5/tx/execution-cost.d.ts +17 -0
- package/types-legacy/ts4.5/utils/amount-formatter.d.ts +1 -2
- package/types-legacy/ts4.5/utils/crypto.d.ts +1 -0
- package/types-legacy/ts4.5/utils/errors.d.ts +2 -2
- package/types-legacy/ts4.5/utils/other.d.ts +1 -0
- package/types-legacy/ts4.5/utils/typed-data.d.ts +60 -0
- package/es/typings/@aeternity__aepp-calldata/index.d.mjs +0 -2
- package/es/typings/@aeternity__aepp-calldata/index.d.mjs.map +0 -1
- package/src/typings/@aeternity__aepp-calldata/index.d.ts +0 -20
|
@@ -2,7 +2,7 @@ import Node from './Node';
|
|
|
2
2
|
import AccountBase from './account/Base';
|
|
3
3
|
import { Encoded } from './utils/encoder';
|
|
4
4
|
import CompilerBase from './contract/compiler/Base';
|
|
5
|
-
import AeSdkMethods, { OnAccount } from './AeSdkMethods';
|
|
5
|
+
import AeSdkMethods, { OnAccount, AeSdkMethodsOptions } from './AeSdkMethods';
|
|
6
6
|
type NodeInfo = Awaited<ReturnType<Node['getNodeInfo']>> & {
|
|
7
7
|
name: string;
|
|
8
8
|
};
|
|
@@ -19,7 +19,7 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
19
19
|
* @param options - Options
|
|
20
20
|
* @param options.nodes - Array of nodes
|
|
21
21
|
*/
|
|
22
|
-
constructor({ nodes, ...options }?:
|
|
22
|
+
constructor({ nodes, ...options }?: AeSdkMethodsOptions & {
|
|
23
23
|
nodes?: Array<{
|
|
24
24
|
name: string;
|
|
25
25
|
instance: Node;
|
|
@@ -72,6 +72,11 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
72
72
|
*/
|
|
73
73
|
getNodesInPool(): Promise<NodeInfo[]>;
|
|
74
74
|
addresses(): Encoded.AccountAddress[];
|
|
75
|
+
/**
|
|
76
|
+
* Resolves an account
|
|
77
|
+
* @param account - ak-address, instance of AccountBase, or keypair
|
|
78
|
+
*/
|
|
79
|
+
_resolveAccount(account?: OnAccount): AccountBase;
|
|
75
80
|
get address(): Encoded.AccountAddress;
|
|
76
81
|
sign(data: string | Uint8Array, { onAccount, ...options }?: {
|
|
77
82
|
onAccount?: OnAccount;
|
|
@@ -82,7 +87,10 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
82
87
|
signMessage(message: string, { onAccount, ...options }?: {
|
|
83
88
|
onAccount?: OnAccount;
|
|
84
89
|
} & Parameters<AccountBase['signMessage']>[1]): Promise<Uint8Array>;
|
|
85
|
-
|
|
90
|
+
signTypedData(data: Encoded.ContractBytearray, aci: Parameters<AccountBase['signTypedData']>[1], { onAccount, ...options }?: {
|
|
91
|
+
onAccount?: OnAccount;
|
|
92
|
+
} & Parameters<AccountBase['signTypedData']>[2]): Promise<Encoded.Signature>;
|
|
93
|
+
_getOptions(callOptions?: AeSdkMethodsOptions): {
|
|
86
94
|
onNode: Node;
|
|
87
95
|
onAccount: AccountBase;
|
|
88
96
|
onCompiler: CompilerBase;
|
|
@@ -10,8 +10,9 @@ import Node from './Node';
|
|
|
10
10
|
import { TxParamsAsync } from './tx/builder/schema.generated';
|
|
11
11
|
import AccountBase from './account/Base';
|
|
12
12
|
import { Encoded } from './utils/encoder';
|
|
13
|
+
import CompilerBase from './contract/compiler/Base';
|
|
13
14
|
export type OnAccount = Encoded.AccountAddress | AccountBase | undefined;
|
|
14
|
-
export declare function getValueOrErrorProxy<Value extends object>(valueCb: () => Value): Value
|
|
15
|
+
export declare function getValueOrErrorProxy<Value extends object | undefined>(valueCb: () => Value): NonNullable<Value>;
|
|
15
16
|
declare const methods: {
|
|
16
17
|
readonly createGeneralizedAccount: typeof contractGaMethods.createGeneralizedAccount;
|
|
17
18
|
readonly buildAuthTxHash: typeof contractGaMethods.buildAuthTxHash;
|
|
@@ -69,11 +70,7 @@ type GetMethodsOptions<Methods extends {
|
|
|
69
70
|
[Name in keyof Methods]: Methods[Name] extends (...args: infer Args) => any ? Args[Decrement<Args['length']>] : never;
|
|
70
71
|
};
|
|
71
72
|
type MethodsOptions = GetMethodsOptions<typeof methods>;
|
|
72
|
-
interface AeSdkMethodsOptions extends Partial<UnionToIntersection<MethodsOptions[keyof MethodsOptions]>> {
|
|
73
|
-
nodes?: Array<{
|
|
74
|
-
name: string;
|
|
75
|
-
instance: Node;
|
|
76
|
-
}>;
|
|
73
|
+
export interface AeSdkMethodsOptions extends Partial<UnionToIntersection<MethodsOptions[keyof MethodsOptions]>> {
|
|
77
74
|
}
|
|
78
75
|
/**
|
|
79
76
|
* AeSdkMethods is the composition of:
|
|
@@ -94,13 +91,10 @@ declare class AeSdkMethods {
|
|
|
94
91
|
* @param options - Options
|
|
95
92
|
*/
|
|
96
93
|
constructor(options?: AeSdkMethodsOptions);
|
|
97
|
-
|
|
98
|
-
* Resolves an account
|
|
99
|
-
* @param account - ak-address, instance of AccountBase, or keypair
|
|
100
|
-
*/
|
|
101
|
-
_resolveAccount(account?: OnAccount): AccountBase;
|
|
102
|
-
_getOptions(): AeSdkMethodsOptions & {
|
|
94
|
+
_getOptions(callOptions?: AeSdkMethodsOptions): AeSdkMethodsOptions & {
|
|
103
95
|
onAccount: AccountBase;
|
|
96
|
+
onCompiler: CompilerBase;
|
|
97
|
+
onNode: Node;
|
|
104
98
|
};
|
|
105
99
|
buildTx(options: TxParamsAsync): Promise<Encoded.Transaction>;
|
|
106
100
|
initializeContract<Methods extends ContractMethodsBase>(options?: Omit<Parameters<typeof Contract.initialize>[0], 'onNode'> & {
|
|
@@ -135,5 +129,6 @@ type TransformMethods<Methods extends {
|
|
|
135
129
|
};
|
|
136
130
|
interface AeSdkMethodsTransformed extends TransformMethods<typeof methods> {
|
|
137
131
|
}
|
|
138
|
-
|
|
139
|
-
|
|
132
|
+
type AeSdkMethodsTyped = AeSdkMethods & AeSdkMethodsTransformed;
|
|
133
|
+
declare const AeSdkMethodsTyped: new (options?: AeSdkMethodsOptions) => AeSdkMethodsTyped;
|
|
134
|
+
export default AeSdkMethodsTyped;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Middleware as MiddlewareApi, MiddlewareOptionalParams } from './apis/middleware';
|
|
2
|
+
import { Encoded } from './utils/encoder';
|
|
3
|
+
import { ConsensusProtocolVersion } from './tx/builder/constants';
|
|
4
|
+
declare const bigIntPropertyNames: readonly [
|
|
5
|
+
];
|
|
6
|
+
declare const numberPropertyNames: readonly [
|
|
7
|
+
];
|
|
8
|
+
type BigIntPropertyNames = typeof bigIntPropertyNames[number];
|
|
9
|
+
type NumberPropertyNames = typeof numberPropertyNames[number];
|
|
10
|
+
type PreserveOptional<NewType, OrigType> = OrigType extends undefined ? NewType | undefined : NewType;
|
|
11
|
+
export type TransformMiddlewareType<Type> = Type extends (...args: infer Args) => infer Ret ? (...args: TransformMiddlewareType<Args>) => TransformMiddlewareType<Ret> : Type extends [
|
|
12
|
+
infer Item,
|
|
13
|
+
...infer Rest
|
|
14
|
+
] ? [
|
|
15
|
+
TransformMiddlewareType<Item>,
|
|
16
|
+
...TransformMiddlewareType<Rest>
|
|
17
|
+
] : Type extends Array<infer Item> ? Array<TransformMiddlewareType<Item>> : Type extends Promise<infer T> ? Promise<TransformMiddlewareType<T>> : Type extends {
|
|
18
|
+
[P in any]: any;
|
|
19
|
+
} ? {
|
|
20
|
+
[Property in keyof Type]: Property extends BigIntPropertyNames ? PreserveOptional<bigint, Type[Property]> : Property extends NumberPropertyNames ? PreserveOptional<number, Type[Property]> : Property extends 'txHash' ? PreserveOptional<Encoded.TxHash, Type[Property]> : Property extends 'bytecode' ? PreserveOptional<Encoded.ContractBytearray, Type[Property]> : TransformMiddlewareType<Type[Property]>;
|
|
21
|
+
} : Type;
|
|
22
|
+
type MiddlewareTransformedApi = new (...args: ConstructorParameters<typeof MiddlewareApi>) => {
|
|
23
|
+
[Name in keyof InstanceType<typeof MiddlewareApi>]: Name extends 'pipeline' | 'sendRequest' | 'sendOperationRequest' ? MiddlewareApi[Name] : TransformMiddlewareType<MiddlewareApi[Name]>;
|
|
24
|
+
};
|
|
25
|
+
export interface MiddlewareInfo {
|
|
26
|
+
url: string;
|
|
27
|
+
nodeNetworkId: string;
|
|
28
|
+
version: string;
|
|
29
|
+
consensusProtocolVersion: ConsensusProtocolVersion;
|
|
30
|
+
}
|
|
31
|
+
declare const Middleware_base: MiddlewareTransformedApi;
|
|
32
|
+
export default class Middleware extends Middleware_base {
|
|
33
|
+
/**
|
|
34
|
+
* @param url - Url for middleware API
|
|
35
|
+
* @param options - Options
|
|
36
|
+
* @param options.ignoreVersion - Don't check node version
|
|
37
|
+
* @param options.retryCount - Amount of extra requests to do in case of failure
|
|
38
|
+
* @param options.retryOverallDelay - Time in ms to wait between all retries
|
|
39
|
+
*/
|
|
40
|
+
constructor(url: string, { ignoreVersion, retryCount, retryOverallDelay, ...options }?: MiddlewareOptionalParams & {
|
|
41
|
+
ignoreVersion?: boolean;
|
|
42
|
+
retryCount?: number;
|
|
43
|
+
retryOverallDelay?: number;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="ws" />
|
|
2
|
+
import WebSocket from 'isomorphic-ws';
|
|
3
|
+
import { BaseError } from './utils/errors';
|
|
4
|
+
import { Encoded } from './utils/encoder';
|
|
5
|
+
export declare class MiddlewareSubscriberError extends BaseError {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
export declare class MiddlewareSubscriberDisconnected extends MiddlewareSubscriberError {
|
|
9
|
+
readonly closeEvent: WebSocket.CloseEvent;
|
|
10
|
+
constructor(closeEvent: WebSocket.CloseEvent);
|
|
11
|
+
}
|
|
12
|
+
export default class MiddlewareSubscriber {
|
|
13
|
+
#private;
|
|
14
|
+
readonly url: string;
|
|
15
|
+
get webSocket(): WebSocket | undefined;
|
|
16
|
+
constructor(url: string);
|
|
17
|
+
reconnect(): Promise<void>;
|
|
18
|
+
subscribeKeyBlocks(cb: (p?: any, e?: Error) => void): () => void;
|
|
19
|
+
subscribeKeyBlocksNode(cb: (p?: any, e?: Error) => void): () => void;
|
|
20
|
+
subscribeKeyBlocksAll(cb: (p?: any, e?: Error) => void): () => void;
|
|
21
|
+
subscribeMicroBlocks(cb: (p?: any, e?: Error) => void): () => void;
|
|
22
|
+
subscribeMicroBlocksNode(cb: (p?: any, e?: Error) => void): () => void;
|
|
23
|
+
subscribeMicroBlocksAll(cb: (p?: any, e?: Error) => void): () => void;
|
|
24
|
+
subscribeTransactions(cb: (p?: any, e?: Error) => void): () => void;
|
|
25
|
+
subscribeTransactionsNode(cb: (p?: any, e?: Error) => void): () => void;
|
|
26
|
+
subscribeTransactionsAll(cb: (p?: any, e?: Error) => void): () => void;
|
|
27
|
+
subscribeObject(target: Encoded.KeyBlockHash | Encoded.Channel | Encoded.ContractAddress | Encoded.OracleAddress | Encoded.OracleQueryId | Encoded.AccountAddress | Encoded.Name | `${string}.chain`, cb: (p?: any, e?: Error) => void): () => void;
|
|
28
|
+
subscribeObjectNode(target: Encoded.KeyBlockHash | Encoded.Channel | Encoded.ContractAddress | Encoded.OracleAddress | Encoded.OracleQueryId | Encoded.AccountAddress | Encoded.Name | `${string}.chain`, cb: (p?: any, e?: Error) => void): () => void;
|
|
29
|
+
subscribeObjectAll(target: Encoded.KeyBlockHash | Encoded.Channel | Encoded.ContractAddress | Encoded.OracleAddress | Encoded.OracleQueryId | Encoded.AccountAddress | Encoded.Name | `${string}.chain`, cb: (p?: any, e?: Error) => void): () => void;
|
|
30
|
+
}
|
|
@@ -55,7 +55,7 @@ export type TransformNodeType<Type> = Type extends (...args: infer Args) => infe
|
|
|
55
55
|
type NodeTransformedApi = new (...args: ConstructorParameters<typeof NodeApi>) => {
|
|
56
56
|
[Name in keyof InstanceType<typeof NodeApi>]: Name extends 'pipeline' | 'sendRequest' | 'sendOperationRequest' ? NodeApi[Name] : TransformNodeType<NodeApi[Name]>;
|
|
57
57
|
};
|
|
58
|
-
|
|
58
|
+
interface NodeInfo {
|
|
59
59
|
url: string;
|
|
60
60
|
nodeNetworkId: string;
|
|
61
61
|
version: string;
|
|
@@ -2,6 +2,7 @@ import { Encoded } from '../utils/encoder';
|
|
|
2
2
|
import Node from '../Node';
|
|
3
3
|
import CompilerBase from '../contract/compiler/Base';
|
|
4
4
|
import { Int } from '../tx/builder/constants';
|
|
5
|
+
import { AciValue, Domain } from '../utils/typed-data';
|
|
5
6
|
interface AuthData {
|
|
6
7
|
fee?: Int;
|
|
7
8
|
gasLimit?: number;
|
|
@@ -36,17 +37,28 @@ export default abstract class AccountBase {
|
|
|
36
37
|
* Sign message
|
|
37
38
|
* @param message - Message to sign
|
|
38
39
|
* @param options - Options
|
|
39
|
-
* @returns Signature
|
|
40
|
+
* @returns Signature
|
|
40
41
|
*/
|
|
41
42
|
abstract signMessage(message: string, options?: {
|
|
42
43
|
aeppOrigin?: string;
|
|
43
44
|
aeppRpcClientId?: string;
|
|
44
45
|
}): Promise<Uint8Array>;
|
|
46
|
+
/**
|
|
47
|
+
* Sign typed data
|
|
48
|
+
* @param type - Type of data to sign
|
|
49
|
+
* @param data - Encoded data to sign
|
|
50
|
+
* @param options - Options
|
|
51
|
+
* @returns Signature
|
|
52
|
+
*/
|
|
53
|
+
abstract signTypedData(data: Encoded.ContractBytearray, aci: AciValue, options?: Domain & {
|
|
54
|
+
aeppOrigin?: string;
|
|
55
|
+
aeppRpcClientId?: string;
|
|
56
|
+
}): Promise<Encoded.Signature>;
|
|
45
57
|
/**
|
|
46
58
|
* Sign data blob
|
|
47
59
|
* @param data - Data blob to sign
|
|
48
60
|
* @param options - Options
|
|
49
|
-
* @returns
|
|
61
|
+
* @returns Signature
|
|
50
62
|
*/
|
|
51
63
|
abstract sign(data: string | Uint8Array, options?: any): Promise<Uint8Array>;
|
|
52
64
|
/**
|
|
@@ -12,5 +12,6 @@ export default class AccountGeneralized extends AccountBase {
|
|
|
12
12
|
constructor(address: Encoded.AccountAddress);
|
|
13
13
|
sign(): Promise<Uint8Array>;
|
|
14
14
|
signMessage(): Promise<Uint8Array>;
|
|
15
|
+
signTypedData(): Promise<Encoded.Signature>;
|
|
15
16
|
signTransaction(tx: Encoded.Transaction, { authData, onCompiler, onNode }: Parameters<AccountBase['signTransaction']>[1]): Promise<Encoded.Transaction>;
|
|
16
17
|
}
|
|
@@ -20,6 +20,7 @@ export default class AccountLedger extends AccountBase {
|
|
|
20
20
|
*/
|
|
21
21
|
constructor(transport: Transport, index: number, address: Encoded.AccountAddress);
|
|
22
22
|
sign(): Promise<Uint8Array>;
|
|
23
|
+
signTypedData(): Promise<Encoded.Signature>;
|
|
23
24
|
signTransaction(tx: Encoded.Transaction, { innerTx, networkId }?: {
|
|
24
25
|
innerTx?: boolean;
|
|
25
26
|
networkId?: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import AccountBase from './Base';
|
|
2
2
|
import { Encoded } from '../utils/encoder';
|
|
3
|
+
import { AciValue } from '../utils/typed-data';
|
|
3
4
|
export declare function getBufferToSign(transaction: Encoded.Transaction, networkId: string, innerTx: boolean): Uint8Array;
|
|
4
5
|
/**
|
|
5
6
|
* In-memory account class
|
|
@@ -20,4 +21,5 @@ export default class AccountMemory extends AccountBase {
|
|
|
20
21
|
networkId?: string;
|
|
21
22
|
}): Promise<Encoded.Transaction>;
|
|
22
23
|
signMessage(message: string, options?: any): Promise<Uint8Array>;
|
|
24
|
+
signTypedData(data: Encoded.ContractBytearray, aci: AciValue, { name, version, networkId, contractAddress, ...options }?: Parameters<AccountBase['signTypedData']>[2]): Promise<Encoded.Signature>;
|
|
23
25
|
}
|
|
@@ -14,12 +14,7 @@ export default class AccountRpc extends AccountBase {
|
|
|
14
14
|
readonly address: Encoded.AccountAddress;
|
|
15
15
|
constructor(rpcClient: RpcClient<WalletApi, AeppApi>, address: Encoded.AccountAddress);
|
|
16
16
|
sign(): Promise<Uint8Array>;
|
|
17
|
-
/**
|
|
18
|
-
* @returns Signed transaction
|
|
19
|
-
*/
|
|
20
17
|
signTransaction(tx: Encoded.Transaction, { innerTx, networkId }?: Parameters<AccountBase['signTransaction']>[1]): Promise<Encoded.Transaction>;
|
|
21
|
-
/**
|
|
22
|
-
* @returns Signed message
|
|
23
|
-
*/
|
|
24
18
|
signMessage(message: string): Promise<Uint8Array>;
|
|
19
|
+
signTypedData(data: Encoded.ContractBytearray, aci: Parameters<AccountBase['signTypedData']>[1], { name, version, contractAddress, networkId, }?: Parameters<AccountBase['signTypedData']>[2]): Promise<Encoded.Signature>;
|
|
25
20
|
}
|
|
@@ -211,7 +211,7 @@ interface AensPreclaimOptions extends BuildTxOptions<Tag.NamePreclaimTx, 'accoun
|
|
|
211
211
|
* @example
|
|
212
212
|
* ```js
|
|
213
213
|
* const name = 'test.chain'
|
|
214
|
-
* const bidFee = computeBidFee(name, startFee,
|
|
214
|
+
* const bidFee = computeBidFee(name, { startFee, increment: 0.42 })
|
|
215
215
|
*
|
|
216
216
|
* await sdkInstance.aensBid(name, 213109412839123, { ttl, fee, nonce })
|
|
217
217
|
* ```
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Encoded } from '../../utils/encoder';
|
|
2
|
+
import { Domain, AciValue } from '../../utils/typed-data';
|
|
2
3
|
import { METHODS, SUBSCRIPTION_TYPES, WALLET_TYPE } from '../schema';
|
|
3
4
|
import { TransformNodeType } from '../../Node';
|
|
4
5
|
import { SignedTx } from '../../apis/node';
|
|
@@ -60,6 +61,7 @@ export interface WalletApi {
|
|
|
60
61
|
* @see {@link https://github.com/aeternity/aepp-sdk-js/commit/153fd89a52c4eab39fcd659b356b36d32129c1ba}
|
|
61
62
|
*/
|
|
62
63
|
networkId: string;
|
|
64
|
+
innerTx?: boolean;
|
|
63
65
|
}) => Promise<{
|
|
64
66
|
/**
|
|
65
67
|
* @deprecated this is not a hash at all, will be removed later at the same time
|
|
@@ -77,6 +79,14 @@ export interface WalletApi {
|
|
|
77
79
|
}) => Promise<{
|
|
78
80
|
signature: string;
|
|
79
81
|
}>;
|
|
82
|
+
[METHODS.signTypedData]: (p: {
|
|
83
|
+
domain: Domain;
|
|
84
|
+
aci: AciValue;
|
|
85
|
+
data: Encoded.ContractBytearray;
|
|
86
|
+
onAccount: Encoded.AccountAddress;
|
|
87
|
+
}) => Promise<{
|
|
88
|
+
signature: Encoded.Signature;
|
|
89
|
+
}>;
|
|
80
90
|
}
|
|
81
91
|
export interface AeppApi {
|
|
82
92
|
[METHODS.updateAddress]: (a: Accounts) => void;
|
|
@@ -31,6 +31,7 @@ export declare const enum METHODS {
|
|
|
31
31
|
connect = "connection.open",
|
|
32
32
|
sign = "transaction.sign",
|
|
33
33
|
signMessage = "message.sign",
|
|
34
|
+
signTypedData = "typedData.sign",
|
|
34
35
|
subscribeAddress = "address.subscribe",
|
|
35
36
|
updateNetwork = "networkId.update",
|
|
36
37
|
closeConnection = "connection.close"
|
|
@@ -66,14 +67,6 @@ export declare class RpcInvalidTransactionError extends RpcError {
|
|
|
66
67
|
code: number;
|
|
67
68
|
constructor(data?: any);
|
|
68
69
|
}
|
|
69
|
-
/**
|
|
70
|
-
* @category exception
|
|
71
|
-
*/
|
|
72
|
-
export declare class RpcBroadcastError extends RpcError {
|
|
73
|
-
static code: number;
|
|
74
|
-
code: number;
|
|
75
|
-
constructor(data?: any);
|
|
76
|
-
}
|
|
77
70
|
/**
|
|
78
71
|
* @category exception
|
|
79
72
|
*/
|
|
@@ -9,12 +9,6 @@ export interface CompileOpts {
|
|
|
9
9
|
/** Name of contract source file - only used in error messages */
|
|
10
10
|
srcFile?: string;
|
|
11
11
|
}
|
|
12
|
-
export interface Aci {
|
|
13
|
-
/** Any object */
|
|
14
|
-
encodedAci: Record<string, unknown>;
|
|
15
|
-
externalEncodedAci?: Record<string, unknown>[];
|
|
16
|
-
interface: string;
|
|
17
|
-
}
|
|
18
12
|
export interface CompilerError {
|
|
19
13
|
type: string;
|
|
20
14
|
pos: ErrorPos;
|
|
@@ -127,7 +121,7 @@ export interface SophiaJsonData {
|
|
|
127
121
|
export interface GenerateACIOptionalParams extends coreClient.OperationOptions {
|
|
128
122
|
}
|
|
129
123
|
/** Contains response data for the generateACI operation. */
|
|
130
|
-
export type GenerateACIResponse =
|
|
124
|
+
export type GenerateACIResponse = Record<string, unknown>[];
|
|
131
125
|
/** Optional parameters. */
|
|
132
126
|
export interface CompileContractOptionalParams extends coreClient.OperationOptions {
|
|
133
127
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as coreClient from "@azure/core-client";
|
|
2
2
|
export declare const Contract: coreClient.CompositeMapper;
|
|
3
3
|
export declare const CompileOpts: coreClient.CompositeMapper;
|
|
4
|
-
export declare const Aci: coreClient.CompositeMapper;
|
|
5
4
|
export declare const CompilerError: coreClient.CompositeMapper;
|
|
6
5
|
export declare const ErrorPos: coreClient.CompositeMapper;
|
|
7
6
|
export declare const CompileResult: coreClient.CompositeMapper;
|