@aeternity/aepp-sdk 13.1.0 → 13.2.1
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.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 +2162 -1566
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdkAepp.mjs.map +1 -1
- package/es/AeSdkBase.d.ts +10 -0
- package/es/AeSdkBase.mjs +27 -0
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkMethods.mjs.map +1 -1
- package/es/AeSdkWallet.d.ts +1 -1
- package/es/AeSdkWallet.mjs +53 -20
- package/es/AeSdkWallet.mjs.map +1 -1
- package/es/Middleware.mjs.map +1 -1
- package/es/MiddlewareSubscriber.mjs +3 -3
- package/es/MiddlewareSubscriber.mjs.map +1 -1
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +44 -2
- package/es/account/Base.mjs +95 -1
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Generalized.d.ts +3 -0
- package/es/account/Generalized.mjs +15 -0
- package/es/account/Generalized.mjs.map +1 -1
- package/es/account/Ledger.d.ts +3 -0
- package/es/account/Ledger.mjs +15 -0
- package/es/account/Ledger.mjs.map +1 -1
- package/es/account/LedgerFactory.mjs.map +1 -1
- package/es/account/Memory.d.ts +10 -0
- package/es/account/Memory.mjs +34 -0
- package/es/account/Memory.mjs.map +1 -1
- package/es/account/Rpc.d.ts +4 -0
- package/es/account/Rpc.mjs +29 -0
- package/es/account/Rpc.mjs.map +1 -1
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/types.d.ts +9 -0
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
- package/es/aepp-wallet-communication/schema.d.ts +1 -0
- package/es/aepp-wallet-communication/schema.mjs +20 -19
- package/es/aepp-wallet-communication/schema.mjs.map +1 -1
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
- package/es/apis/compiler/compiler.mjs.map +1 -1
- package/es/apis/middleware/middleware.mjs.map +1 -1
- package/es/apis/middleware/models/index.mjs +340 -124
- package/es/apis/middleware/models/index.mjs.map +1 -1
- package/es/apis/node/node.mjs.map +1 -1
- package/es/chain.mjs +1 -1
- package/es/chain.mjs.map +1 -1
- package/es/channel/Base.mjs.map +1 -1
- package/es/channel/Contract.mjs.map +1 -1
- package/es/channel/Spend.mjs.map +1 -1
- package/es/channel/handlers.mjs +2 -2
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/internal.mjs +6 -6
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Contract.mjs +1 -1
- package/es/contract/Contract.mjs.map +1 -1
- package/es/contract/compiler/Cli.mjs.map +1 -1
- package/es/contract/compiler/Http.mjs.map +1 -1
- package/es/contract/delegation-signature.d.ts +2 -1
- package/es/contract/delegation-signature.mjs +39 -8
- package/es/contract/delegation-signature.mjs.map +1 -1
- package/es/contract/ga.mjs.map +1 -1
- package/es/oracle.mjs.map +1 -1
- package/es/spend.d.ts +2 -1
- package/es/spend.mjs +4 -2
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/constants.mjs +26 -23
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/field-types/abi-version.mjs.map +1 -1
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
- package/es/tx/builder/field-types/ct-version.mjs.map +1 -1
- package/es/tx/builder/field-types/deposit.mjs.map +1 -1
- package/es/tx/builder/field-types/entry.mjs.map +1 -1
- package/es/tx/builder/field-types/fee.mjs.map +1 -1
- package/es/tx/builder/field-types/field.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
- package/es/tx/builder/field-types/index.d.ts +28 -150
- package/es/tx/builder/field-types/index.mjs +28 -56
- package/es/tx/builder/field-types/index.mjs.map +1 -1
- package/es/tx/builder/field-types/map.mjs.map +1 -1
- package/es/tx/builder/field-types/mptree.mjs +3 -3
- package/es/tx/builder/field-types/mptree.mjs.map +1 -1
- package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
- package/es/tx/builder/field-types/pointers.mjs.map +1 -1
- package/es/tx/builder/field-types/string.mjs.map +1 -1
- package/es/tx/builder/field-types/ttl.mjs.map +1 -1
- package/es/tx/builder/field-types/u-int.mjs +1 -1
- package/es/tx/builder/field-types/u-int.mjs.map +1 -1
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.mjs +11 -10
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/execution-cost.mjs.map +1 -1
- package/es/tx/transaction-signer.mjs.map +1 -1
- package/es/tx/validator.mjs.map +1 -1
- package/es/utils/amount-formatter.mjs +7 -7
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.mjs.map +1 -1
- package/es/utils/bignumber.mjs.map +1 -1
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/encoder-types.mjs +3 -3
- package/es/utils/encoder-types.mjs.map +1 -1
- package/es/utils/encoder.mjs.map +1 -1
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/hd-wallet.mjs.map +1 -1
- package/es/utils/keystore.mjs.map +1 -1
- package/es/utils/other.mjs.map +1 -1
- package/es/utils/semver-satisfies.mjs.map +1 -1
- package/es/utils/string.mjs.map +1 -1
- package/es/utils/typed-data.mjs +0 -1
- package/es/utils/typed-data.mjs.map +1 -1
- package/package.json +35 -35
- package/src/AeSdkBase.ts +36 -0
- package/src/AeSdkWallet.ts +36 -12
- package/src/account/Base.ts +84 -3
- package/src/account/Generalized.ts +15 -0
- package/src/account/Ledger.ts +15 -0
- package/src/account/Memory.ts +53 -1
- package/src/account/Rpc.ts +35 -0
- package/src/aepp-wallet-communication/rpc/types.ts +10 -0
- package/src/aepp-wallet-communication/schema.ts +1 -0
- package/src/chain.ts +1 -1
- package/src/contract/Contract.ts +1 -1
- package/src/contract/delegation-signature.ts +37 -11
- package/src/spend.ts +2 -2
- package/src/tx/builder/field-types/index.ts +28 -58
- package/src/tx/builder/field-types/u-int.ts +1 -1
- package/types-legacy/ts4.2/AeSdkBase.d.ts +10 -0
- package/types-legacy/ts4.2/AeSdkWallet.d.ts +1 -1
- package/types-legacy/ts4.2/account/Base.d.ts +44 -2
- package/types-legacy/ts4.2/account/Generalized.d.ts +3 -0
- package/types-legacy/ts4.2/account/Ledger.d.ts +3 -0
- package/types-legacy/ts4.2/account/Memory.d.ts +10 -0
- package/types-legacy/ts4.2/account/Rpc.d.ts +4 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +9 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +1 -0
- package/types-legacy/ts4.2/contract/delegation-signature.d.ts +2 -1
- package/types-legacy/ts4.2/spend.d.ts +2 -1
- package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +28 -153
- package/types-legacy/ts4.5/AeSdkBase.d.ts +10 -0
- package/types-legacy/ts4.5/AeSdkWallet.d.ts +1 -1
- package/types-legacy/ts4.5/account/Base.d.ts +44 -2
- package/types-legacy/ts4.5/account/Generalized.d.ts +3 -0
- package/types-legacy/ts4.5/account/Ledger.d.ts +3 -0
- package/types-legacy/ts4.5/account/Memory.d.ts +10 -0
- package/types-legacy/ts4.5/account/Rpc.d.ts +4 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +9 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +1 -0
- package/types-legacy/ts4.5/contract/delegation-signature.d.ts +2 -1
- package/types-legacy/ts4.5/spend.d.ts +2 -1
- package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +28 -153
|
@@ -3,6 +3,7 @@ import AccountBase from './account/Base';
|
|
|
3
3
|
import { Encoded } from './utils/encoder';
|
|
4
4
|
import CompilerBase from './contract/compiler/Base';
|
|
5
5
|
import AeSdkMethods, { OnAccount, AeSdkMethodsOptions } from './AeSdkMethods';
|
|
6
|
+
import { AensName } from './tx/builder/constants';
|
|
6
7
|
type NodeInfo = Awaited<ReturnType<Node['getNodeInfo']>> & {
|
|
7
8
|
name: string;
|
|
8
9
|
};
|
|
@@ -90,6 +91,15 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
90
91
|
signTypedData(data: Encoded.ContractBytearray, aci: Parameters<AccountBase['signTypedData']>[1], { onAccount, ...options }?: {
|
|
91
92
|
onAccount?: OnAccount;
|
|
92
93
|
} & Parameters<AccountBase['signTypedData']>[2]): Promise<Encoded.Signature>;
|
|
94
|
+
signDelegationToContract(contractAddress: Encoded.ContractAddress, { onAccount, ...options }?: {
|
|
95
|
+
onAccount?: OnAccount;
|
|
96
|
+
} & Parameters<AccountBase['signDelegationToContract']>[1]): Promise<Encoded.Signature>;
|
|
97
|
+
signNameDelegationToContract(contractAddress: Encoded.ContractAddress, name: AensName, { onAccount, ...options }?: {
|
|
98
|
+
onAccount?: OnAccount;
|
|
99
|
+
} & Parameters<AccountBase['signNameDelegationToContract']>[2]): Promise<Encoded.Signature>;
|
|
100
|
+
signOracleQueryDelegationToContract(contractAddress: Encoded.ContractAddress, oracleQueryId: Encoded.OracleQueryId, { onAccount, ...options }?: {
|
|
101
|
+
onAccount?: OnAccount;
|
|
102
|
+
} & Parameters<AccountBase['signOracleQueryDelegationToContract']>[2]): Promise<Encoded.Signature>;
|
|
93
103
|
_getOptions(callOptions?: AeSdkMethodsOptions): {
|
|
94
104
|
onNode: Node;
|
|
95
105
|
onAccount: AccountBase;
|
|
@@ -49,6 +49,7 @@ export default class AeSdkWallet extends AeSdk {
|
|
|
49
49
|
onDisconnect: OnDisconnect;
|
|
50
50
|
onAskAccounts: OnAskAccounts;
|
|
51
51
|
} & ConstructorParameters<typeof AeSdk>[0]);
|
|
52
|
+
_getAccountsForClient({ addressSubscription }: RpcClientsInfo): Accounts;
|
|
52
53
|
_pushAccountsToApps(): void;
|
|
53
54
|
selectAccount(address: Encoded.AccountAddress): void;
|
|
54
55
|
addAccount(account: AccountBase, options?: Parameters<AeSdk['addAccount']>[1]): void;
|
|
@@ -57,7 +58,6 @@ export default class AeSdkWallet extends AeSdk {
|
|
|
57
58
|
};
|
|
58
59
|
selectNode(name: string): Promise<void>;
|
|
59
60
|
_getClient(clientId: string): RpcClientsInfo;
|
|
60
|
-
_isRpcClientSubscribed(clientId: string): boolean;
|
|
61
61
|
_isRpcClientConnected(clientId: string): boolean;
|
|
62
62
|
_disconnectRpcClient(clientId: string): void;
|
|
63
63
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Encoded } from '../utils/encoder';
|
|
2
2
|
import Node from '../Node';
|
|
3
3
|
import CompilerBase from '../contract/compiler/Base';
|
|
4
|
-
import { Int } from '../tx/builder/constants';
|
|
4
|
+
import { AensName, Int } from '../tx/builder/constants';
|
|
5
5
|
import { AciValue, Domain } from '../utils/typed-data';
|
|
6
6
|
interface AuthData {
|
|
7
7
|
fee?: Int;
|
|
@@ -50,7 +50,49 @@ export default abstract class AccountBase {
|
|
|
50
50
|
* @param options - Options
|
|
51
51
|
* @returns Signature
|
|
52
52
|
*/
|
|
53
|
-
|
|
53
|
+
signTypedData(data: Encoded.ContractBytearray, aci: AciValue, options?: Domain & {
|
|
54
|
+
aeppOrigin?: string;
|
|
55
|
+
aeppRpcClientId?: string;
|
|
56
|
+
}): Promise<Encoded.Signature>;
|
|
57
|
+
/**
|
|
58
|
+
* Sign delegation of AENS, oracle operations to a contract
|
|
59
|
+
* @param contractAddress - Address of a contract to delegate permissions to
|
|
60
|
+
* @param options - Options
|
|
61
|
+
* @returns Signature
|
|
62
|
+
*/
|
|
63
|
+
signDelegationToContract(contractAddress: Encoded.ContractAddress, options?: {
|
|
64
|
+
networkId?: string;
|
|
65
|
+
aeppOrigin?: string;
|
|
66
|
+
aeppRpcClientId?: string;
|
|
67
|
+
}): Promise<Encoded.Signature>;
|
|
68
|
+
/**
|
|
69
|
+
* Sign delegation of an AENS name to a contract
|
|
70
|
+
* @param contractAddress - Address of a contract to delegate permissions to
|
|
71
|
+
* @param name - AENS name to manage by a contract
|
|
72
|
+
* @param options - Options
|
|
73
|
+
* @returns Signature
|
|
74
|
+
*/
|
|
75
|
+
signNameDelegationToContract(contractAddress: Encoded.ContractAddress, name: AensName, options?: {
|
|
76
|
+
networkId?: string;
|
|
77
|
+
aeppOrigin?: string;
|
|
78
|
+
aeppRpcClientId?: string;
|
|
79
|
+
}): Promise<Encoded.Signature>;
|
|
80
|
+
/**
|
|
81
|
+
* Sign delegation of oracle query to a contract
|
|
82
|
+
*
|
|
83
|
+
* Warning! Implementations needs to ensure that decoded oracle query id is not equal to decoded
|
|
84
|
+
* current account address unless https://github.com/aeternity/aesophia/issues/475 is fixed.
|
|
85
|
+
*
|
|
86
|
+
* Warning! Implementations needs to ensure that oracle query and contract exists unless
|
|
87
|
+
* https://github.com/aeternity/aesophia/issues/474 is fixed.
|
|
88
|
+
*
|
|
89
|
+
* @param contractAddress - Address of a contract to delegate permissions to
|
|
90
|
+
* @param oracleQueryId - Oracle query ID to reply by a contract
|
|
91
|
+
* @param options - Options
|
|
92
|
+
* @returns Signature
|
|
93
|
+
*/
|
|
94
|
+
signOracleQueryDelegationToContract(contractAddress: Encoded.ContractAddress, oracleQueryId: Encoded.OracleQueryId, options?: {
|
|
95
|
+
networkId?: string;
|
|
54
96
|
aeppOrigin?: string;
|
|
55
97
|
aeppRpcClientId?: string;
|
|
56
98
|
}): Promise<Encoded.Signature>;
|
|
@@ -13,5 +13,8 @@ export default class AccountGeneralized extends AccountBase {
|
|
|
13
13
|
sign(): Promise<Uint8Array>;
|
|
14
14
|
signMessage(): Promise<Uint8Array>;
|
|
15
15
|
signTypedData(): Promise<Encoded.Signature>;
|
|
16
|
+
signDelegationToContract(): Promise<Encoded.Signature>;
|
|
17
|
+
signNameDelegationToContract(): Promise<Encoded.Signature>;
|
|
18
|
+
signOracleQueryDelegationToContract(): Promise<Encoded.Signature>;
|
|
16
19
|
signTransaction(tx: Encoded.Transaction, { authData, onCompiler, onNode }: Parameters<AccountBase['signTransaction']>[1]): Promise<Encoded.Transaction>;
|
|
17
20
|
}
|
|
@@ -21,6 +21,9 @@ export default class AccountLedger extends AccountBase {
|
|
|
21
21
|
constructor(transport: Transport, index: number, address: Encoded.AccountAddress);
|
|
22
22
|
sign(): Promise<Uint8Array>;
|
|
23
23
|
signTypedData(): Promise<Encoded.Signature>;
|
|
24
|
+
signDelegationToContract(): Promise<Encoded.Signature>;
|
|
25
|
+
signNameDelegationToContract(): Promise<Encoded.Signature>;
|
|
26
|
+
signOracleQueryDelegationToContract(): Promise<Encoded.Signature>;
|
|
24
27
|
signTransaction(tx: Encoded.Transaction, { innerTx, networkId }?: {
|
|
25
28
|
innerTx?: boolean;
|
|
26
29
|
networkId?: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import AccountBase from './Base';
|
|
2
2
|
import { Encoded } from '../utils/encoder';
|
|
3
3
|
import { AciValue } from '../utils/typed-data';
|
|
4
|
+
import { AensName } from '../tx/builder/constants';
|
|
4
5
|
export declare function getBufferToSign(transaction: Encoded.Transaction, networkId: string, innerTx: boolean): Uint8Array;
|
|
5
6
|
/**
|
|
6
7
|
* In-memory account class
|
|
@@ -22,4 +23,13 @@ export default class AccountMemory extends AccountBase {
|
|
|
22
23
|
}): Promise<Encoded.Transaction>;
|
|
23
24
|
signMessage(message: string, options?: any): Promise<Uint8Array>;
|
|
24
25
|
signTypedData(data: Encoded.ContractBytearray, aci: AciValue, { name, version, networkId, contractAddress, ...options }?: Parameters<AccountBase['signTypedData']>[2]): Promise<Encoded.Signature>;
|
|
26
|
+
signDelegationToContract(contractAddress: Encoded.ContractAddress, { networkId }?: {
|
|
27
|
+
networkId?: string;
|
|
28
|
+
}): Promise<Encoded.Signature>;
|
|
29
|
+
signNameDelegationToContract(contractAddress: Encoded.ContractAddress, name: AensName, { networkId }?: {
|
|
30
|
+
networkId?: string;
|
|
31
|
+
}): Promise<Encoded.Signature>;
|
|
32
|
+
signOracleQueryDelegationToContract(contractAddress: Encoded.ContractAddress, oracleQueryId: Encoded.OracleQueryId, { networkId }?: {
|
|
33
|
+
networkId?: string;
|
|
34
|
+
}): Promise<Encoded.Signature>;
|
|
25
35
|
}
|
|
@@ -2,6 +2,7 @@ import AccountBase from './Base';
|
|
|
2
2
|
import { Encoded } from '../utils/encoder';
|
|
3
3
|
import RpcClient from '../aepp-wallet-communication/rpc/RpcClient';
|
|
4
4
|
import { AeppApi, WalletApi } from '../aepp-wallet-communication/rpc/types';
|
|
5
|
+
import { AensName } from '../tx/builder/constants';
|
|
5
6
|
/**
|
|
6
7
|
* Account provided by wallet
|
|
7
8
|
* @param params - Params
|
|
@@ -17,4 +18,7 @@ export default class AccountRpc extends AccountBase {
|
|
|
17
18
|
signTransaction(tx: Encoded.Transaction, { innerTx, networkId }?: Parameters<AccountBase['signTransaction']>[1]): Promise<Encoded.Transaction>;
|
|
18
19
|
signMessage(message: string): Promise<Uint8Array>;
|
|
19
20
|
signTypedData(data: Encoded.ContractBytearray, aci: Parameters<AccountBase['signTypedData']>[1], { name, version, contractAddress, networkId, }?: Parameters<AccountBase['signTypedData']>[2]): Promise<Encoded.Signature>;
|
|
21
|
+
signDelegationToContract(contractAddress: Encoded.ContractAddress): Promise<Encoded.Signature>;
|
|
22
|
+
signNameDelegationToContract(contractAddress: Encoded.ContractAddress, name: AensName): Promise<Encoded.Signature>;
|
|
23
|
+
signOracleQueryDelegationToContract(contractAddress: Encoded.ContractAddress, oracleQueryId: Encoded.OracleQueryId): Promise<Encoded.Signature>;
|
|
20
24
|
}
|
|
@@ -3,6 +3,7 @@ import { Domain, AciValue } from '../../utils/typed-data';
|
|
|
3
3
|
import { METHODS, SUBSCRIPTION_TYPES, WALLET_TYPE } from '../schema';
|
|
4
4
|
import { TransformNodeType } from '../../Node';
|
|
5
5
|
import { SignedTx } from '../../apis/node';
|
|
6
|
+
import { AensName } from '../../tx/builder/constants';
|
|
6
7
|
export interface WalletInfo {
|
|
7
8
|
id: string;
|
|
8
9
|
name: string;
|
|
@@ -87,6 +88,14 @@ export interface WalletApi {
|
|
|
87
88
|
}) => Promise<{
|
|
88
89
|
signature: Encoded.Signature;
|
|
89
90
|
}>;
|
|
91
|
+
[METHODS.signDelegationToContract]: (p: {
|
|
92
|
+
contractAddress: Encoded.ContractAddress;
|
|
93
|
+
name?: AensName;
|
|
94
|
+
oracleQueryId?: Encoded.OracleQueryId;
|
|
95
|
+
onAccount: Encoded.AccountAddress;
|
|
96
|
+
}) => Promise<{
|
|
97
|
+
signature: Encoded.Signature;
|
|
98
|
+
}>;
|
|
90
99
|
}
|
|
91
100
|
export interface AeppApi {
|
|
92
101
|
[METHODS.updateAddress]: (a: Accounts) => void;
|
|
@@ -32,6 +32,7 @@ export declare const enum METHODS {
|
|
|
32
32
|
sign = "transaction.sign",
|
|
33
33
|
signMessage = "message.sign",
|
|
34
34
|
signTypedData = "typedData.sign",
|
|
35
|
+
signDelegationToContract = "delegationToContract.sign",
|
|
35
36
|
subscribeAddress = "address.subscribe",
|
|
36
37
|
updateNetwork = "networkId.update",
|
|
37
38
|
closeConnection = "connection.close"
|
|
@@ -14,6 +14,7 @@ import Node from '../Node';
|
|
|
14
14
|
* @param options.onAccount - Account to use
|
|
15
15
|
* @param options.onNode - Node to use
|
|
16
16
|
* @returns Signature
|
|
17
|
+
* @deprecated use methods `sign*DelegationToContract` of Account instance instead
|
|
17
18
|
* @example
|
|
18
19
|
* ```js
|
|
19
20
|
* const aeSdk = new AeSdk({ ... })
|
|
@@ -36,7 +37,7 @@ import Node from '../Node';
|
|
|
36
37
|
* .createDelegationSignature(contractAddress, [oracleQueryId], { onAccount, omitAddress: true })
|
|
37
38
|
* ```
|
|
38
39
|
*/
|
|
39
|
-
export default function createDelegationSignature(contractAddress: Encoded.ContractAddress, ids: Array<Encoded.Any | AensName>, options: {
|
|
40
|
+
export default function createDelegationSignature(contractAddress: Encoded.ContractAddress, ids: Array<Encoded.Any | AensName>, { onAccount, omitAddress, ...options }: {
|
|
40
41
|
omitAddress?: boolean;
|
|
41
42
|
onAccount: AccountBase;
|
|
42
43
|
onNode: Node;
|
|
@@ -34,7 +34,8 @@ interface SpendOptions extends SpendOptionsType {
|
|
|
34
34
|
* console.log('Transaction mined at', blockHeight);
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
export declare function transferFunds(fraction: number | string,
|
|
37
|
+
export declare function transferFunds(fraction: number | string, // TODO: accept only number
|
|
38
|
+
recipientIdOrName: AensName | Encoded.AccountAddress, options: TransferFundsOptions): ReturnType<typeof sendTransaction>;
|
|
38
39
|
type TransferFundsOptionsType = BuildTxOptions<Tag.SpendTx, 'senderId' | 'recipientId' | 'amount'> & Parameters<typeof resolveName>[2] & {
|
|
39
40
|
onAccount: AccountBase;
|
|
40
41
|
} & SendTransactionOptions;
|
|
@@ -1,157 +1,32 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
serialize(value: boolean): Buffer;
|
|
31
|
-
deserialize(buffer: Buffer): boolean;
|
|
32
|
-
};
|
|
33
|
-
declare const coinAmount: {
|
|
34
|
-
serializeAettos(value: string | undefined, params: {}): string;
|
|
35
|
-
serialize(value: import("../constants").Int | undefined, params: {}, { denomination }: {
|
|
36
|
-
denomination?: import("../../..").AE_AMOUNT_FORMATS | undefined;
|
|
37
|
-
}): Buffer;
|
|
38
|
-
deserialize(value: Buffer): string;
|
|
39
|
-
};
|
|
40
|
-
declare const ctVersion: {
|
|
41
|
-
serialize(value: import("./ct-version").CtVersion | undefined, params: {}, { consensusProtocolVersion }: {
|
|
42
|
-
consensusProtocolVersion?: import("../constants").ConsensusProtocolVersion | undefined;
|
|
43
|
-
}): Buffer;
|
|
44
|
-
prepare(value: import("./ct-version").CtVersion | undefined, params: {}, options: {
|
|
45
|
-
consensusProtocolVersion?: import("../constants").ConsensusProtocolVersion | undefined;
|
|
46
|
-
onNode?: import("../../..").Node | undefined;
|
|
47
|
-
}): Promise<import("./ct-version").CtVersion | undefined>;
|
|
48
|
-
deserialize(buffer: Buffer): import("./ct-version").CtVersion;
|
|
49
|
-
};
|
|
50
|
-
declare const deposit: {
|
|
51
|
-
serialize(value: import("../constants").Int | undefined, options: {}, parameters: {
|
|
52
|
-
denomination?: import("../../..").AE_AMOUNT_FORMATS | undefined;
|
|
53
|
-
}): Buffer;
|
|
54
|
-
serializeAettos(value: string | undefined, params: {}): string;
|
|
55
|
-
deserialize(value: Buffer): string;
|
|
56
|
-
};
|
|
57
|
-
declare const encoded: typeof _encoded;
|
|
58
|
-
declare const entry: typeof _entry;
|
|
59
|
-
declare const enumeration: typeof _enumeration;
|
|
60
|
-
declare const fee: {
|
|
61
|
-
serializeAettos(_value: string | undefined, { rebuildTx, unpackTx, buildTx, _computingMinFee, _pickBiggerFee, }: {
|
|
62
|
-
rebuildTx: (params: any) => `tx_${string}`;
|
|
63
|
-
unpackTx: typeof import("..").unpackTx;
|
|
64
|
-
buildTx: typeof import("..").buildTx;
|
|
65
|
-
_computingMinFee?: import("bignumber.js").BigNumber | undefined;
|
|
66
|
-
_pickBiggerFee?: boolean | undefined;
|
|
67
|
-
}): string;
|
|
68
|
-
serialize(value: import("../constants").Int | undefined, params: {}, { denomination }: {
|
|
69
|
-
denomination?: import("../../..").AE_AMOUNT_FORMATS | undefined;
|
|
70
|
-
}): Buffer;
|
|
71
|
-
deserialize(value: Buffer): string;
|
|
72
|
-
};
|
|
73
|
-
declare const field: {
|
|
74
|
-
serialize(value: string): Buffer;
|
|
75
|
-
deserialize(value: Buffer): string;
|
|
76
|
-
};
|
|
77
|
-
declare const gasLimit: {
|
|
78
|
-
serialize(_value: number | undefined, { tag, rebuildTx, unpackTx, buildTx, _computingGasLimit, }: {
|
|
79
|
-
tag: import("../constants").Tag;
|
|
80
|
-
rebuildTx: (params: any) => any;
|
|
81
|
-
unpackTx: typeof import("..").unpackTx;
|
|
82
|
-
buildTx: typeof import("..").buildTx;
|
|
83
|
-
_computingGasLimit?: number | undefined;
|
|
84
|
-
}, { gasMax }: {
|
|
85
|
-
gasMax?: number | undefined;
|
|
86
|
-
}): Buffer;
|
|
87
|
-
deserialize(value: Buffer): number;
|
|
88
|
-
};
|
|
89
|
-
declare const gasPrice: {
|
|
90
|
-
serializeAettos(value?: string | undefined): string;
|
|
91
|
-
serialize(value: import("../constants").Int | undefined, params: {}, { denomination }: {
|
|
92
|
-
denomination?: import("../../..").AE_AMOUNT_FORMATS | undefined;
|
|
93
|
-
}): Buffer;
|
|
94
|
-
deserialize(value: Buffer): string;
|
|
95
|
-
};
|
|
96
|
-
declare const map: typeof _map;
|
|
97
|
-
declare const mptree: typeof _mptree;
|
|
98
|
-
declare const name: {
|
|
99
|
-
serialize(value: `${string}.chain`): Buffer;
|
|
100
|
-
deserialize(value: Buffer): `${string}.chain`;
|
|
101
|
-
};
|
|
102
|
-
declare const nameFee: {
|
|
103
|
-
serializeAettos(_value: string | undefined, txFields: {
|
|
104
|
-
name: `${string}.chain`;
|
|
105
|
-
}): string;
|
|
106
|
-
serialize(value: import("../constants").Int | undefined, txFields: {
|
|
107
|
-
name: `${string}.chain`;
|
|
108
|
-
}, parameters: {
|
|
109
|
-
denomination?: import("../../..").AE_AMOUNT_FORMATS | undefined;
|
|
110
|
-
}): Buffer;
|
|
111
|
-
deserialize(value: Buffer): string;
|
|
112
|
-
};
|
|
113
|
-
declare const nameId: {
|
|
114
|
-
serialize(value: `${string}.chain` | `nm_${string}`): Buffer;
|
|
115
|
-
deserialize: (value: Buffer) => `nm_${string}`;
|
|
116
|
-
};
|
|
117
|
-
declare const nonce: typeof _nonce;
|
|
118
|
-
declare const pointers: {
|
|
119
|
-
serialize(pointers: (import("../../../apis/node").NamePointer & {
|
|
120
|
-
id: `ch_${string}` | `ct_${string}` | `ok_${string}` | `ak_${string}` | `cm_${string}` | `nm_${string}`;
|
|
121
|
-
})[]): Buffer[][];
|
|
122
|
-
deserialize(pointers: [
|
|
123
|
-
key: Buffer,
|
|
124
|
-
id: Buffer
|
|
125
|
-
][]): (import("../../../apis/node").NamePointer & {
|
|
126
|
-
id: `ch_${string}` | `ct_${string}` | `ok_${string}` | `ak_${string}` | `cm_${string}` | `nm_${string}`;
|
|
127
|
-
})[];
|
|
128
|
-
};
|
|
129
|
-
declare const raw: {
|
|
130
|
-
serialize(buffer: Uint8Array): Buffer;
|
|
131
|
-
deserialize(buffer: Buffer): Buffer;
|
|
132
|
-
};
|
|
133
|
-
declare const shortUInt: {
|
|
134
|
-
serialize(value: number): Buffer;
|
|
135
|
-
deserialize(value: Buffer): number;
|
|
136
|
-
};
|
|
137
|
-
declare const shortUIntConst: typeof _shortUIntConst;
|
|
138
|
-
declare const string: {
|
|
139
|
-
serialize(string: string): Buffer;
|
|
140
|
-
deserialize(buffer: Buffer): string;
|
|
141
|
-
};
|
|
142
|
-
declare const ttl: {
|
|
143
|
-
serialize(value: number | undefined): Buffer;
|
|
144
|
-
prepare(value: number | undefined, params: {}, { onNode, absoluteTtl }: {
|
|
145
|
-
onNode?: import("../../..").Node | undefined;
|
|
146
|
-
absoluteTtl?: boolean | undefined;
|
|
147
|
-
}): Promise<number | undefined>;
|
|
148
|
-
deserialize(value: Buffer): number;
|
|
149
|
-
};
|
|
150
|
-
declare const uInt: {
|
|
151
|
-
serialize(value: import("../constants").Int): Buffer;
|
|
152
|
-
deserialize(value: Buffer): string;
|
|
153
|
-
};
|
|
154
|
-
declare const wrapped: typeof _wrapped;
|
|
2
|
+
import abiVersion from './abi-version';
|
|
3
|
+
import address from './address';
|
|
4
|
+
import array from './array';
|
|
5
|
+
import boolean from './boolean';
|
|
6
|
+
import coinAmount from './coin-amount';
|
|
7
|
+
import ctVersion from './ct-version';
|
|
8
|
+
import deposit from './deposit';
|
|
9
|
+
import encoded from './encoded';
|
|
10
|
+
import entry from './entry';
|
|
11
|
+
import enumeration from './enumeration';
|
|
12
|
+
import fee from './fee';
|
|
13
|
+
import field from './field';
|
|
14
|
+
import gasLimit from './gas-limit';
|
|
15
|
+
import gasPrice from './gas-price';
|
|
16
|
+
import map from './map';
|
|
17
|
+
import mptree from './mptree';
|
|
18
|
+
import name from './name';
|
|
19
|
+
import nameFee from './name-fee';
|
|
20
|
+
import nameId from './name-id';
|
|
21
|
+
import nonce from './nonce';
|
|
22
|
+
import pointers from './pointers';
|
|
23
|
+
import raw from './raw';
|
|
24
|
+
import shortUInt from './short-u-int';
|
|
25
|
+
import shortUIntConst from './short-u-int-const';
|
|
26
|
+
import string from './string';
|
|
27
|
+
import ttl from './ttl';
|
|
28
|
+
import uInt from './u-int';
|
|
29
|
+
import wrapped from './wrapped';
|
|
155
30
|
export type BinaryData = Buffer | Buffer[] | Buffer[][] | Array<[
|
|
156
31
|
Buffer,
|
|
157
32
|
Array<[
|
|
@@ -3,6 +3,7 @@ import AccountBase from './account/Base';
|
|
|
3
3
|
import { Encoded } from './utils/encoder';
|
|
4
4
|
import CompilerBase from './contract/compiler/Base';
|
|
5
5
|
import AeSdkMethods, { OnAccount, AeSdkMethodsOptions } from './AeSdkMethods';
|
|
6
|
+
import { AensName } from './tx/builder/constants';
|
|
6
7
|
type NodeInfo = Awaited<ReturnType<Node['getNodeInfo']>> & {
|
|
7
8
|
name: string;
|
|
8
9
|
};
|
|
@@ -90,6 +91,15 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
90
91
|
signTypedData(data: Encoded.ContractBytearray, aci: Parameters<AccountBase['signTypedData']>[1], { onAccount, ...options }?: {
|
|
91
92
|
onAccount?: OnAccount;
|
|
92
93
|
} & Parameters<AccountBase['signTypedData']>[2]): Promise<Encoded.Signature>;
|
|
94
|
+
signDelegationToContract(contractAddress: Encoded.ContractAddress, { onAccount, ...options }?: {
|
|
95
|
+
onAccount?: OnAccount;
|
|
96
|
+
} & Parameters<AccountBase['signDelegationToContract']>[1]): Promise<Encoded.Signature>;
|
|
97
|
+
signNameDelegationToContract(contractAddress: Encoded.ContractAddress, name: AensName, { onAccount, ...options }?: {
|
|
98
|
+
onAccount?: OnAccount;
|
|
99
|
+
} & Parameters<AccountBase['signNameDelegationToContract']>[2]): Promise<Encoded.Signature>;
|
|
100
|
+
signOracleQueryDelegationToContract(contractAddress: Encoded.ContractAddress, oracleQueryId: Encoded.OracleQueryId, { onAccount, ...options }?: {
|
|
101
|
+
onAccount?: OnAccount;
|
|
102
|
+
} & Parameters<AccountBase['signOracleQueryDelegationToContract']>[2]): Promise<Encoded.Signature>;
|
|
93
103
|
_getOptions(callOptions?: AeSdkMethodsOptions): {
|
|
94
104
|
onNode: Node;
|
|
95
105
|
onAccount: AccountBase;
|
|
@@ -49,6 +49,7 @@ export default class AeSdkWallet extends AeSdk {
|
|
|
49
49
|
onDisconnect: OnDisconnect;
|
|
50
50
|
onAskAccounts: OnAskAccounts;
|
|
51
51
|
} & ConstructorParameters<typeof AeSdk>[0]);
|
|
52
|
+
_getAccountsForClient({ addressSubscription }: RpcClientsInfo): Accounts;
|
|
52
53
|
_pushAccountsToApps(): void;
|
|
53
54
|
selectAccount(address: Encoded.AccountAddress): void;
|
|
54
55
|
addAccount(account: AccountBase, options?: Parameters<AeSdk['addAccount']>[1]): void;
|
|
@@ -57,7 +58,6 @@ export default class AeSdkWallet extends AeSdk {
|
|
|
57
58
|
};
|
|
58
59
|
selectNode(name: string): Promise<void>;
|
|
59
60
|
_getClient(clientId: string): RpcClientsInfo;
|
|
60
|
-
_isRpcClientSubscribed(clientId: string): boolean;
|
|
61
61
|
_isRpcClientConnected(clientId: string): boolean;
|
|
62
62
|
_disconnectRpcClient(clientId: string): void;
|
|
63
63
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Encoded } from '../utils/encoder';
|
|
2
2
|
import Node from '../Node';
|
|
3
3
|
import CompilerBase from '../contract/compiler/Base';
|
|
4
|
-
import { Int } from '../tx/builder/constants';
|
|
4
|
+
import { AensName, Int } from '../tx/builder/constants';
|
|
5
5
|
import { AciValue, Domain } from '../utils/typed-data';
|
|
6
6
|
interface AuthData {
|
|
7
7
|
fee?: Int;
|
|
@@ -50,7 +50,49 @@ export default abstract class AccountBase {
|
|
|
50
50
|
* @param options - Options
|
|
51
51
|
* @returns Signature
|
|
52
52
|
*/
|
|
53
|
-
|
|
53
|
+
signTypedData(data: Encoded.ContractBytearray, aci: AciValue, options?: Domain & {
|
|
54
|
+
aeppOrigin?: string;
|
|
55
|
+
aeppRpcClientId?: string;
|
|
56
|
+
}): Promise<Encoded.Signature>;
|
|
57
|
+
/**
|
|
58
|
+
* Sign delegation of AENS, oracle operations to a contract
|
|
59
|
+
* @param contractAddress - Address of a contract to delegate permissions to
|
|
60
|
+
* @param options - Options
|
|
61
|
+
* @returns Signature
|
|
62
|
+
*/
|
|
63
|
+
signDelegationToContract(contractAddress: Encoded.ContractAddress, options?: {
|
|
64
|
+
networkId?: string;
|
|
65
|
+
aeppOrigin?: string;
|
|
66
|
+
aeppRpcClientId?: string;
|
|
67
|
+
}): Promise<Encoded.Signature>;
|
|
68
|
+
/**
|
|
69
|
+
* Sign delegation of an AENS name to a contract
|
|
70
|
+
* @param contractAddress - Address of a contract to delegate permissions to
|
|
71
|
+
* @param name - AENS name to manage by a contract
|
|
72
|
+
* @param options - Options
|
|
73
|
+
* @returns Signature
|
|
74
|
+
*/
|
|
75
|
+
signNameDelegationToContract(contractAddress: Encoded.ContractAddress, name: AensName, options?: {
|
|
76
|
+
networkId?: string;
|
|
77
|
+
aeppOrigin?: string;
|
|
78
|
+
aeppRpcClientId?: string;
|
|
79
|
+
}): Promise<Encoded.Signature>;
|
|
80
|
+
/**
|
|
81
|
+
* Sign delegation of oracle query to a contract
|
|
82
|
+
*
|
|
83
|
+
* Warning! Implementations needs to ensure that decoded oracle query id is not equal to decoded
|
|
84
|
+
* current account address unless https://github.com/aeternity/aesophia/issues/475 is fixed.
|
|
85
|
+
*
|
|
86
|
+
* Warning! Implementations needs to ensure that oracle query and contract exists unless
|
|
87
|
+
* https://github.com/aeternity/aesophia/issues/474 is fixed.
|
|
88
|
+
*
|
|
89
|
+
* @param contractAddress - Address of a contract to delegate permissions to
|
|
90
|
+
* @param oracleQueryId - Oracle query ID to reply by a contract
|
|
91
|
+
* @param options - Options
|
|
92
|
+
* @returns Signature
|
|
93
|
+
*/
|
|
94
|
+
signOracleQueryDelegationToContract(contractAddress: Encoded.ContractAddress, oracleQueryId: Encoded.OracleQueryId, options?: {
|
|
95
|
+
networkId?: string;
|
|
54
96
|
aeppOrigin?: string;
|
|
55
97
|
aeppRpcClientId?: string;
|
|
56
98
|
}): Promise<Encoded.Signature>;
|
|
@@ -13,5 +13,8 @@ export default class AccountGeneralized extends AccountBase {
|
|
|
13
13
|
sign(): Promise<Uint8Array>;
|
|
14
14
|
signMessage(): Promise<Uint8Array>;
|
|
15
15
|
signTypedData(): Promise<Encoded.Signature>;
|
|
16
|
+
signDelegationToContract(): Promise<Encoded.Signature>;
|
|
17
|
+
signNameDelegationToContract(): Promise<Encoded.Signature>;
|
|
18
|
+
signOracleQueryDelegationToContract(): Promise<Encoded.Signature>;
|
|
16
19
|
signTransaction(tx: Encoded.Transaction, { authData, onCompiler, onNode }: Parameters<AccountBase['signTransaction']>[1]): Promise<Encoded.Transaction>;
|
|
17
20
|
}
|
|
@@ -21,6 +21,9 @@ export default class AccountLedger extends AccountBase {
|
|
|
21
21
|
constructor(transport: Transport, index: number, address: Encoded.AccountAddress);
|
|
22
22
|
sign(): Promise<Uint8Array>;
|
|
23
23
|
signTypedData(): Promise<Encoded.Signature>;
|
|
24
|
+
signDelegationToContract(): Promise<Encoded.Signature>;
|
|
25
|
+
signNameDelegationToContract(): Promise<Encoded.Signature>;
|
|
26
|
+
signOracleQueryDelegationToContract(): Promise<Encoded.Signature>;
|
|
24
27
|
signTransaction(tx: Encoded.Transaction, { innerTx, networkId }?: {
|
|
25
28
|
innerTx?: boolean;
|
|
26
29
|
networkId?: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import AccountBase from './Base';
|
|
2
2
|
import { Encoded } from '../utils/encoder';
|
|
3
3
|
import { AciValue } from '../utils/typed-data';
|
|
4
|
+
import { AensName } from '../tx/builder/constants';
|
|
4
5
|
export declare function getBufferToSign(transaction: Encoded.Transaction, networkId: string, innerTx: boolean): Uint8Array;
|
|
5
6
|
/**
|
|
6
7
|
* In-memory account class
|
|
@@ -22,4 +23,13 @@ export default class AccountMemory extends AccountBase {
|
|
|
22
23
|
}): Promise<Encoded.Transaction>;
|
|
23
24
|
signMessage(message: string, options?: any): Promise<Uint8Array>;
|
|
24
25
|
signTypedData(data: Encoded.ContractBytearray, aci: AciValue, { name, version, networkId, contractAddress, ...options }?: Parameters<AccountBase['signTypedData']>[2]): Promise<Encoded.Signature>;
|
|
26
|
+
signDelegationToContract(contractAddress: Encoded.ContractAddress, { networkId }?: {
|
|
27
|
+
networkId?: string;
|
|
28
|
+
}): Promise<Encoded.Signature>;
|
|
29
|
+
signNameDelegationToContract(contractAddress: Encoded.ContractAddress, name: AensName, { networkId }?: {
|
|
30
|
+
networkId?: string;
|
|
31
|
+
}): Promise<Encoded.Signature>;
|
|
32
|
+
signOracleQueryDelegationToContract(contractAddress: Encoded.ContractAddress, oracleQueryId: Encoded.OracleQueryId, { networkId }?: {
|
|
33
|
+
networkId?: string;
|
|
34
|
+
}): Promise<Encoded.Signature>;
|
|
25
35
|
}
|
|
@@ -2,6 +2,7 @@ import AccountBase from './Base';
|
|
|
2
2
|
import { Encoded } from '../utils/encoder';
|
|
3
3
|
import RpcClient from '../aepp-wallet-communication/rpc/RpcClient';
|
|
4
4
|
import { AeppApi, WalletApi } from '../aepp-wallet-communication/rpc/types';
|
|
5
|
+
import { AensName } from '../tx/builder/constants';
|
|
5
6
|
/**
|
|
6
7
|
* Account provided by wallet
|
|
7
8
|
* @param params - Params
|
|
@@ -17,4 +18,7 @@ export default class AccountRpc extends AccountBase {
|
|
|
17
18
|
signTransaction(tx: Encoded.Transaction, { innerTx, networkId }?: Parameters<AccountBase['signTransaction']>[1]): Promise<Encoded.Transaction>;
|
|
18
19
|
signMessage(message: string): Promise<Uint8Array>;
|
|
19
20
|
signTypedData(data: Encoded.ContractBytearray, aci: Parameters<AccountBase['signTypedData']>[1], { name, version, contractAddress, networkId, }?: Parameters<AccountBase['signTypedData']>[2]): Promise<Encoded.Signature>;
|
|
21
|
+
signDelegationToContract(contractAddress: Encoded.ContractAddress): Promise<Encoded.Signature>;
|
|
22
|
+
signNameDelegationToContract(contractAddress: Encoded.ContractAddress, name: AensName): Promise<Encoded.Signature>;
|
|
23
|
+
signOracleQueryDelegationToContract(contractAddress: Encoded.ContractAddress, oracleQueryId: Encoded.OracleQueryId): Promise<Encoded.Signature>;
|
|
20
24
|
}
|
|
@@ -3,6 +3,7 @@ import { Domain, AciValue } from '../../utils/typed-data';
|
|
|
3
3
|
import { METHODS, SUBSCRIPTION_TYPES, WALLET_TYPE } from '../schema';
|
|
4
4
|
import { TransformNodeType } from '../../Node';
|
|
5
5
|
import { SignedTx } from '../../apis/node';
|
|
6
|
+
import { AensName } from '../../tx/builder/constants';
|
|
6
7
|
export interface WalletInfo {
|
|
7
8
|
id: string;
|
|
8
9
|
name: string;
|
|
@@ -87,6 +88,14 @@ export interface WalletApi {
|
|
|
87
88
|
}) => Promise<{
|
|
88
89
|
signature: Encoded.Signature;
|
|
89
90
|
}>;
|
|
91
|
+
[METHODS.signDelegationToContract]: (p: {
|
|
92
|
+
contractAddress: Encoded.ContractAddress;
|
|
93
|
+
name?: AensName;
|
|
94
|
+
oracleQueryId?: Encoded.OracleQueryId;
|
|
95
|
+
onAccount: Encoded.AccountAddress;
|
|
96
|
+
}) => Promise<{
|
|
97
|
+
signature: Encoded.Signature;
|
|
98
|
+
}>;
|
|
90
99
|
}
|
|
91
100
|
export interface AeppApi {
|
|
92
101
|
[METHODS.updateAddress]: (a: Accounts) => void;
|
|
@@ -32,6 +32,7 @@ export declare const enum METHODS {
|
|
|
32
32
|
sign = "transaction.sign",
|
|
33
33
|
signMessage = "message.sign",
|
|
34
34
|
signTypedData = "typedData.sign",
|
|
35
|
+
signDelegationToContract = "delegationToContract.sign",
|
|
35
36
|
subscribeAddress = "address.subscribe",
|
|
36
37
|
updateNetwork = "networkId.update",
|
|
37
38
|
closeConnection = "connection.close"
|
|
@@ -14,6 +14,7 @@ import Node from '../Node';
|
|
|
14
14
|
* @param options.onAccount - Account to use
|
|
15
15
|
* @param options.onNode - Node to use
|
|
16
16
|
* @returns Signature
|
|
17
|
+
* @deprecated use methods `sign*DelegationToContract` of Account instance instead
|
|
17
18
|
* @example
|
|
18
19
|
* ```js
|
|
19
20
|
* const aeSdk = new AeSdk({ ... })
|
|
@@ -36,7 +37,7 @@ import Node from '../Node';
|
|
|
36
37
|
* .createDelegationSignature(contractAddress, [oracleQueryId], { onAccount, omitAddress: true })
|
|
37
38
|
* ```
|
|
38
39
|
*/
|
|
39
|
-
export default function createDelegationSignature(contractAddress: Encoded.ContractAddress, ids: Array<Encoded.Any | AensName>, options: {
|
|
40
|
+
export default function createDelegationSignature(contractAddress: Encoded.ContractAddress, ids: Array<Encoded.Any | AensName>, { onAccount, omitAddress, ...options }: {
|
|
40
41
|
omitAddress?: boolean;
|
|
41
42
|
onAccount: AccountBase;
|
|
42
43
|
onNode: Node;
|
|
@@ -34,7 +34,8 @@ interface SpendOptions extends SpendOptionsType {
|
|
|
34
34
|
* console.log('Transaction mined at', blockHeight);
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
export declare function transferFunds(fraction: number | string,
|
|
37
|
+
export declare function transferFunds(fraction: number | string, // TODO: accept only number
|
|
38
|
+
recipientIdOrName: AensName | Encoded.AccountAddress, options: TransferFundsOptions): ReturnType<typeof sendTransaction>;
|
|
38
39
|
type TransferFundsOptionsType = BuildTxOptions<Tag.SpendTx, 'senderId' | 'recipientId' | 'amount'> & Parameters<typeof resolveName>[2] & {
|
|
39
40
|
onAccount: AccountBase;
|
|
40
41
|
} & SendTransactionOptions;
|