@dashevo/evo-sdk 3.0.0-dev.5 → 3.0.0-dev.7
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/addresses/facade.d.ts +210 -0
- package/dist/addresses/facade.js +239 -0
- package/dist/dpns/facade.d.ts +2 -2
- package/dist/evo-sdk.module.js +1 -1
- package/dist/evo-sdk.module.js.map +1 -1
- package/dist/group/facade.d.ts +2 -2
- package/dist/identities/facade.d.ts +12 -12
- package/dist/sdk.d.ts +7 -2
- package/dist/sdk.js +13 -0
- package/dist/tokens/facade.d.ts +2 -2
- package/dist/voting/facade.d.ts +2 -4
- package/dist/wasm.d.ts +0 -1
- package/package.json +4 -5
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import * as wasm from '../wasm.js';
|
|
2
|
+
import type { EvoSDK } from '../sdk.js';
|
|
3
|
+
export declare class AddressesFacade {
|
|
4
|
+
private sdk;
|
|
5
|
+
constructor(sdk: EvoSDK);
|
|
6
|
+
/**
|
|
7
|
+
* Fetches information about a Platform address including its nonce and balance.
|
|
8
|
+
*
|
|
9
|
+
* @param address - The platform address to query (PlatformAddress, Uint8Array, or bech32m string)
|
|
10
|
+
* @returns PlatformAddressInfo containing address, nonce, and balance, or undefined if not found
|
|
11
|
+
*/
|
|
12
|
+
get(address: wasm.PlatformAddressLike): Promise<wasm.PlatformAddressInfo | undefined>;
|
|
13
|
+
/**
|
|
14
|
+
* Fetches information about a Platform address with proof.
|
|
15
|
+
*
|
|
16
|
+
* @param address - The platform address to query (PlatformAddress, Uint8Array, or bech32m string)
|
|
17
|
+
* @returns ProofMetadataResponse containing PlatformAddressInfo with proof information
|
|
18
|
+
*/
|
|
19
|
+
getWithProof(address: wasm.PlatformAddressLike): Promise<wasm.ProofMetadataResponseTyped<wasm.PlatformAddressInfo>>;
|
|
20
|
+
/**
|
|
21
|
+
* Fetches information about multiple Platform addresses.
|
|
22
|
+
*
|
|
23
|
+
* @param addresses - Array of platform addresses to query
|
|
24
|
+
* @returns Map of PlatformAddress to PlatformAddressInfo (or undefined for unfunded addresses)
|
|
25
|
+
*/
|
|
26
|
+
getMany(addresses: wasm.PlatformAddressLike[]): Promise<Map<wasm.PlatformAddress, wasm.PlatformAddressInfo | undefined>>;
|
|
27
|
+
/**
|
|
28
|
+
* Fetches information about multiple Platform addresses with proof.
|
|
29
|
+
*
|
|
30
|
+
* @param addresses - Array of platform addresses to query
|
|
31
|
+
* @returns ProofMetadataResponse containing Map of PlatformAddress to PlatformAddressInfo
|
|
32
|
+
*/
|
|
33
|
+
getManyWithProof(addresses: wasm.PlatformAddressLike[]): Promise<wasm.ProofMetadataResponseTyped<Map<wasm.PlatformAddress, wasm.PlatformAddressInfo | undefined>>>;
|
|
34
|
+
/**
|
|
35
|
+
* Transfers credits between Platform addresses.
|
|
36
|
+
*
|
|
37
|
+
* @param options - Transfer options including inputs, outputs, and signer
|
|
38
|
+
* @returns Promise resolving to transfer result with updated address information
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const recipientAddr = PlatformAddress.fromBech32m("tdashevo1...");
|
|
43
|
+
* const privateKey = PrivateKey.fromWIF("cPrivateKeyWif...");
|
|
44
|
+
*
|
|
45
|
+
* const signer = new PlatformAddressSigner();
|
|
46
|
+
* const senderAddr = signer.addKey(privateKey); // Derives P2PKH address from key
|
|
47
|
+
*
|
|
48
|
+
* const input = new PlatformAddressInput(senderAddr, 0n, 100000n);
|
|
49
|
+
* const output = new PlatformAddressOutput(recipientAddr, 90000n);
|
|
50
|
+
*
|
|
51
|
+
* const result = await sdk.addresses.transfer({
|
|
52
|
+
* inputs: [input],
|
|
53
|
+
* outputs: [output],
|
|
54
|
+
* signer
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
transfer(options: wasm.AddressFundsTransferOptions): Promise<Map<wasm.PlatformAddress, wasm.PlatformAddressInfo>>;
|
|
59
|
+
/**
|
|
60
|
+
* Top up an identity from Platform addresses.
|
|
61
|
+
*
|
|
62
|
+
* @param options - Top up options including identity ID, inputs, and signer
|
|
63
|
+
* @returns Promise resolving to result with updated address infos and new identity balance
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* const identityId = Identifier.from("...");
|
|
68
|
+
* const privateKey = PrivateKey.fromWIF("cPrivateKeyWif...");
|
|
69
|
+
*
|
|
70
|
+
* const signer = new PlatformAddressSigner();
|
|
71
|
+
* const sourceAddr = signer.addKey(privateKey); // Derives P2PKH address from key
|
|
72
|
+
*
|
|
73
|
+
* const input = new PlatformAddressInput(sourceAddr, 0n, 50000n);
|
|
74
|
+
*
|
|
75
|
+
* const result = await sdk.addresses.topUpIdentity({
|
|
76
|
+
* identityId,
|
|
77
|
+
* inputs: [input],
|
|
78
|
+
* signer
|
|
79
|
+
* });
|
|
80
|
+
*
|
|
81
|
+
* console.log('New identity balance:', result.newBalance);
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
topUpIdentity(options: wasm.IdentityTopUpFromAddressesOptions): Promise<wasm.IdentityTopUpFromAddressesResult>;
|
|
85
|
+
/**
|
|
86
|
+
* Withdraws Platform address credits to Dash Core.
|
|
87
|
+
*
|
|
88
|
+
* @param options - Withdrawal options including inputs, output script, pooling, and signer
|
|
89
|
+
* @returns Promise resolving to Map of PlatformAddress to PlatformAddressInfo
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const privateKey = PrivateKey.fromWIF("cPrivateKeyWif...");
|
|
94
|
+
*
|
|
95
|
+
* // Create Core output script for L1 destination
|
|
96
|
+
* const coreScript = CoreScript.newP2PKH(coreAddressHash);
|
|
97
|
+
*
|
|
98
|
+
* const signer = new PlatformAddressSigner();
|
|
99
|
+
* const platformAddr = signer.addKey(privateKey); // Derives P2PKH address from key
|
|
100
|
+
*
|
|
101
|
+
* const input = new PlatformAddressInput(platformAddr, 0n, 100000n);
|
|
102
|
+
*
|
|
103
|
+
* const result = await sdk.addresses.withdraw({
|
|
104
|
+
* inputs: [input],
|
|
105
|
+
* coreFeePerByte: 1,
|
|
106
|
+
* pooling: PoolingWasm.Standard,
|
|
107
|
+
* outputScript: coreScript,
|
|
108
|
+
* signer
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
withdraw(options: wasm.AddressFundsWithdrawOptions): Promise<Map<wasm.PlatformAddress, wasm.PlatformAddressInfo>>;
|
|
113
|
+
/**
|
|
114
|
+
* Transfer credits from an identity to Platform addresses.
|
|
115
|
+
*
|
|
116
|
+
* @param options - Transfer options including identity ID, outputs, and signer
|
|
117
|
+
* @returns Result with updated address information and new identity balance
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* const identityId = Identifier.from("...");
|
|
122
|
+
* const recipientAddr = PlatformAddress.fromBech32m("tdashevo1...");
|
|
123
|
+
* const privateKey = PrivateKey.fromWIF("cPrivateKeyWif..."); // Identity transfer key
|
|
124
|
+
*
|
|
125
|
+
* const output = new PlatformAddressOutput(recipientAddr, 100000n);
|
|
126
|
+
*
|
|
127
|
+
* // Create identity signer and add the transfer key
|
|
128
|
+
* const signer = new IdentitySigner();
|
|
129
|
+
* signer.addKey(privateKey);
|
|
130
|
+
*
|
|
131
|
+
* const result = await sdk.addresses.transferFromIdentity({
|
|
132
|
+
* identityId,
|
|
133
|
+
* outputs: [output],
|
|
134
|
+
* signer
|
|
135
|
+
* });
|
|
136
|
+
*
|
|
137
|
+
* console.log(`New identity balance: ${result.newBalance}`);
|
|
138
|
+
* console.log(`Updated addresses:`, result.addressInfos);
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
transferFromIdentity(options: wasm.IdentityTransferToAddressesOptions): Promise<wasm.IdentityTransferToAddressesResult>;
|
|
142
|
+
/**
|
|
143
|
+
* Fund Platform addresses from an asset lock.
|
|
144
|
+
*
|
|
145
|
+
* @param options - Funding options including asset lock proof, outputs, and signer
|
|
146
|
+
* @returns Promise resolving to Map of PlatformAddress to PlatformAddressInfo
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```typescript
|
|
150
|
+
* const assetLockPrivateKey = PrivateKey.fromWIF("cPrivateKeyWif...");
|
|
151
|
+
* const addressPrivateKey = PrivateKey.fromWIF("cPrivateKeyWif...");
|
|
152
|
+
*
|
|
153
|
+
* // Create asset lock proof from L1 transaction
|
|
154
|
+
* const assetLockProof = AssetLockProof.createInstantAssetLockProof(
|
|
155
|
+
* instantLockBytes,
|
|
156
|
+
* transactionBytes,
|
|
157
|
+
* outputIndex
|
|
158
|
+
* );
|
|
159
|
+
*
|
|
160
|
+
* const signer = new PlatformAddressSigner();
|
|
161
|
+
* const platformAddr = signer.addKey(addressPrivateKey); // Derives P2PKH address from key
|
|
162
|
+
*
|
|
163
|
+
* const output = new PlatformAddressOutput(platformAddr, 100000n);
|
|
164
|
+
*
|
|
165
|
+
* const result = await sdk.addresses.fundFromAssetLock({
|
|
166
|
+
* assetLockProof,
|
|
167
|
+
* assetLockPrivateKey,
|
|
168
|
+
* outputs: [output],
|
|
169
|
+
* signer
|
|
170
|
+
* });
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
fundFromAssetLock(options: wasm.AddressFundingFromAssetLockOptions): Promise<Map<wasm.PlatformAddress, wasm.PlatformAddressInfo>>;
|
|
174
|
+
/**
|
|
175
|
+
* Create an identity funded from Platform addresses.
|
|
176
|
+
*
|
|
177
|
+
* @param options - Creation options including identity, inputs, and signers
|
|
178
|
+
* @returns Promise resolving to result with created identity and updated address infos
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```typescript
|
|
182
|
+
* const addressPrivateKey = PrivateKey.fromWIF("cAddressPrivateKeyWif...");
|
|
183
|
+
* const identityPrivateKey = PrivateKey.fromWIF("cIdentityKeyWif...");
|
|
184
|
+
*
|
|
185
|
+
* // Create identity structure with public keys
|
|
186
|
+
* const identity = new Identity(Identifier.random());
|
|
187
|
+
* identity.addPublicKey(identityPublicKey);
|
|
188
|
+
*
|
|
189
|
+
* // Create signers
|
|
190
|
+
* const addressSigner = new PlatformAddressSigner();
|
|
191
|
+
* const sourceAddr = addressSigner.addKey(addressPrivateKey); // Derives P2PKH address from key
|
|
192
|
+
*
|
|
193
|
+
* const input = new PlatformAddressInput(sourceAddr, 0n, 100000n);
|
|
194
|
+
*
|
|
195
|
+
* const identitySigner = new IdentitySigner();
|
|
196
|
+
* identitySigner.addKey(identityPrivateKey);
|
|
197
|
+
*
|
|
198
|
+
* const result = await sdk.addresses.createIdentity({
|
|
199
|
+
* identity,
|
|
200
|
+
* inputs: [input],
|
|
201
|
+
* identitySigner,
|
|
202
|
+
* addressSigner
|
|
203
|
+
* });
|
|
204
|
+
*
|
|
205
|
+
* console.log('Created identity:', result.identity.id());
|
|
206
|
+
* console.log('Updated addresses:', result.addressInfos);
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
createIdentity(options: wasm.IdentityCreateFromAddressesOptions): Promise<wasm.IdentityCreateFromAddressesResult>;
|
|
210
|
+
}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
export class AddressesFacade {
|
|
2
|
+
constructor(sdk) {
|
|
3
|
+
this.sdk = sdk;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Fetches information about a Platform address including its nonce and balance.
|
|
7
|
+
*
|
|
8
|
+
* @param address - The platform address to query (PlatformAddress, Uint8Array, or bech32m string)
|
|
9
|
+
* @returns PlatformAddressInfo containing address, nonce, and balance, or undefined if not found
|
|
10
|
+
*/
|
|
11
|
+
async get(address) {
|
|
12
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
13
|
+
return w.getAddressInfo(address);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Fetches information about a Platform address with proof.
|
|
17
|
+
*
|
|
18
|
+
* @param address - The platform address to query (PlatformAddress, Uint8Array, or bech32m string)
|
|
19
|
+
* @returns ProofMetadataResponse containing PlatformAddressInfo with proof information
|
|
20
|
+
*/
|
|
21
|
+
async getWithProof(address) {
|
|
22
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
23
|
+
return w.getAddressInfoWithProofInfo(address);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Fetches information about multiple Platform addresses.
|
|
27
|
+
*
|
|
28
|
+
* @param addresses - Array of platform addresses to query
|
|
29
|
+
* @returns Map of PlatformAddress to PlatformAddressInfo (or undefined for unfunded addresses)
|
|
30
|
+
*/
|
|
31
|
+
async getMany(addresses) {
|
|
32
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
33
|
+
return w.getAddressesInfos(addresses);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Fetches information about multiple Platform addresses with proof.
|
|
37
|
+
*
|
|
38
|
+
* @param addresses - Array of platform addresses to query
|
|
39
|
+
* @returns ProofMetadataResponse containing Map of PlatformAddress to PlatformAddressInfo
|
|
40
|
+
*/
|
|
41
|
+
async getManyWithProof(addresses) {
|
|
42
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
43
|
+
return w.getAddressesInfosWithProofInfo(addresses);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Transfers credits between Platform addresses.
|
|
47
|
+
*
|
|
48
|
+
* @param options - Transfer options including inputs, outputs, and signer
|
|
49
|
+
* @returns Promise resolving to transfer result with updated address information
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const recipientAddr = PlatformAddress.fromBech32m("tdashevo1...");
|
|
54
|
+
* const privateKey = PrivateKey.fromWIF("cPrivateKeyWif...");
|
|
55
|
+
*
|
|
56
|
+
* const signer = new PlatformAddressSigner();
|
|
57
|
+
* const senderAddr = signer.addKey(privateKey); // Derives P2PKH address from key
|
|
58
|
+
*
|
|
59
|
+
* const input = new PlatformAddressInput(senderAddr, 0n, 100000n);
|
|
60
|
+
* const output = new PlatformAddressOutput(recipientAddr, 90000n);
|
|
61
|
+
*
|
|
62
|
+
* const result = await sdk.addresses.transfer({
|
|
63
|
+
* inputs: [input],
|
|
64
|
+
* outputs: [output],
|
|
65
|
+
* signer
|
|
66
|
+
* });
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
async transfer(options) {
|
|
70
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
71
|
+
return w.addressFundsTransfer(options);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Top up an identity from Platform addresses.
|
|
75
|
+
*
|
|
76
|
+
* @param options - Top up options including identity ID, inputs, and signer
|
|
77
|
+
* @returns Promise resolving to result with updated address infos and new identity balance
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* const identityId = Identifier.from("...");
|
|
82
|
+
* const privateKey = PrivateKey.fromWIF("cPrivateKeyWif...");
|
|
83
|
+
*
|
|
84
|
+
* const signer = new PlatformAddressSigner();
|
|
85
|
+
* const sourceAddr = signer.addKey(privateKey); // Derives P2PKH address from key
|
|
86
|
+
*
|
|
87
|
+
* const input = new PlatformAddressInput(sourceAddr, 0n, 50000n);
|
|
88
|
+
*
|
|
89
|
+
* const result = await sdk.addresses.topUpIdentity({
|
|
90
|
+
* identityId,
|
|
91
|
+
* inputs: [input],
|
|
92
|
+
* signer
|
|
93
|
+
* });
|
|
94
|
+
*
|
|
95
|
+
* console.log('New identity balance:', result.newBalance);
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
async topUpIdentity(options) {
|
|
99
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
100
|
+
return w.identityTopUpFromAddresses(options);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Withdraws Platform address credits to Dash Core.
|
|
104
|
+
*
|
|
105
|
+
* @param options - Withdrawal options including inputs, output script, pooling, and signer
|
|
106
|
+
* @returns Promise resolving to Map of PlatformAddress to PlatformAddressInfo
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* const privateKey = PrivateKey.fromWIF("cPrivateKeyWif...");
|
|
111
|
+
*
|
|
112
|
+
* // Create Core output script for L1 destination
|
|
113
|
+
* const coreScript = CoreScript.newP2PKH(coreAddressHash);
|
|
114
|
+
*
|
|
115
|
+
* const signer = new PlatformAddressSigner();
|
|
116
|
+
* const platformAddr = signer.addKey(privateKey); // Derives P2PKH address from key
|
|
117
|
+
*
|
|
118
|
+
* const input = new PlatformAddressInput(platformAddr, 0n, 100000n);
|
|
119
|
+
*
|
|
120
|
+
* const result = await sdk.addresses.withdraw({
|
|
121
|
+
* inputs: [input],
|
|
122
|
+
* coreFeePerByte: 1,
|
|
123
|
+
* pooling: PoolingWasm.Standard,
|
|
124
|
+
* outputScript: coreScript,
|
|
125
|
+
* signer
|
|
126
|
+
* });
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
async withdraw(options) {
|
|
130
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
131
|
+
return w.addressFundsWithdraw(options);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Transfer credits from an identity to Platform addresses.
|
|
135
|
+
*
|
|
136
|
+
* @param options - Transfer options including identity ID, outputs, and signer
|
|
137
|
+
* @returns Result with updated address information and new identity balance
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```typescript
|
|
141
|
+
* const identityId = Identifier.from("...");
|
|
142
|
+
* const recipientAddr = PlatformAddress.fromBech32m("tdashevo1...");
|
|
143
|
+
* const privateKey = PrivateKey.fromWIF("cPrivateKeyWif..."); // Identity transfer key
|
|
144
|
+
*
|
|
145
|
+
* const output = new PlatformAddressOutput(recipientAddr, 100000n);
|
|
146
|
+
*
|
|
147
|
+
* // Create identity signer and add the transfer key
|
|
148
|
+
* const signer = new IdentitySigner();
|
|
149
|
+
* signer.addKey(privateKey);
|
|
150
|
+
*
|
|
151
|
+
* const result = await sdk.addresses.transferFromIdentity({
|
|
152
|
+
* identityId,
|
|
153
|
+
* outputs: [output],
|
|
154
|
+
* signer
|
|
155
|
+
* });
|
|
156
|
+
*
|
|
157
|
+
* console.log(`New identity balance: ${result.newBalance}`);
|
|
158
|
+
* console.log(`Updated addresses:`, result.addressInfos);
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
async transferFromIdentity(options) {
|
|
162
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
163
|
+
return w.identityTransferToAddresses(options);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Fund Platform addresses from an asset lock.
|
|
167
|
+
*
|
|
168
|
+
* @param options - Funding options including asset lock proof, outputs, and signer
|
|
169
|
+
* @returns Promise resolving to Map of PlatformAddress to PlatformAddressInfo
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```typescript
|
|
173
|
+
* const assetLockPrivateKey = PrivateKey.fromWIF("cPrivateKeyWif...");
|
|
174
|
+
* const addressPrivateKey = PrivateKey.fromWIF("cPrivateKeyWif...");
|
|
175
|
+
*
|
|
176
|
+
* // Create asset lock proof from L1 transaction
|
|
177
|
+
* const assetLockProof = AssetLockProof.createInstantAssetLockProof(
|
|
178
|
+
* instantLockBytes,
|
|
179
|
+
* transactionBytes,
|
|
180
|
+
* outputIndex
|
|
181
|
+
* );
|
|
182
|
+
*
|
|
183
|
+
* const signer = new PlatformAddressSigner();
|
|
184
|
+
* const platformAddr = signer.addKey(addressPrivateKey); // Derives P2PKH address from key
|
|
185
|
+
*
|
|
186
|
+
* const output = new PlatformAddressOutput(platformAddr, 100000n);
|
|
187
|
+
*
|
|
188
|
+
* const result = await sdk.addresses.fundFromAssetLock({
|
|
189
|
+
* assetLockProof,
|
|
190
|
+
* assetLockPrivateKey,
|
|
191
|
+
* outputs: [output],
|
|
192
|
+
* signer
|
|
193
|
+
* });
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
async fundFromAssetLock(options) {
|
|
197
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
198
|
+
return w.addressFundingFromAssetLock(options);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Create an identity funded from Platform addresses.
|
|
202
|
+
*
|
|
203
|
+
* @param options - Creation options including identity, inputs, and signers
|
|
204
|
+
* @returns Promise resolving to result with created identity and updated address infos
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```typescript
|
|
208
|
+
* const addressPrivateKey = PrivateKey.fromWIF("cAddressPrivateKeyWif...");
|
|
209
|
+
* const identityPrivateKey = PrivateKey.fromWIF("cIdentityKeyWif...");
|
|
210
|
+
*
|
|
211
|
+
* // Create identity structure with public keys
|
|
212
|
+
* const identity = new Identity(Identifier.random());
|
|
213
|
+
* identity.addPublicKey(identityPublicKey);
|
|
214
|
+
*
|
|
215
|
+
* // Create signers
|
|
216
|
+
* const addressSigner = new PlatformAddressSigner();
|
|
217
|
+
* const sourceAddr = addressSigner.addKey(addressPrivateKey); // Derives P2PKH address from key
|
|
218
|
+
*
|
|
219
|
+
* const input = new PlatformAddressInput(sourceAddr, 0n, 100000n);
|
|
220
|
+
*
|
|
221
|
+
* const identitySigner = new IdentitySigner();
|
|
222
|
+
* identitySigner.addKey(identityPrivateKey);
|
|
223
|
+
*
|
|
224
|
+
* const result = await sdk.addresses.createIdentity({
|
|
225
|
+
* identity,
|
|
226
|
+
* inputs: [input],
|
|
227
|
+
* identitySigner,
|
|
228
|
+
* addressSigner
|
|
229
|
+
* });
|
|
230
|
+
*
|
|
231
|
+
* console.log('Created identity:', result.identity.id());
|
|
232
|
+
* console.log('Updated addresses:', result.addressInfos);
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
async createIdentity(options) {
|
|
236
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
237
|
+
return w.identityCreateFromAddresses(options);
|
|
238
|
+
}
|
|
239
|
+
}
|
package/dist/dpns/facade.d.ts
CHANGED
|
@@ -17,8 +17,8 @@ export declare class DpnsFacade {
|
|
|
17
17
|
}): Promise<wasm.RegisterDpnsNameResult>;
|
|
18
18
|
usernames(query: wasm.DpnsUsernamesQuery): Promise<string[]>;
|
|
19
19
|
username(identityId: wasm.IdentifierLike): Promise<string | undefined>;
|
|
20
|
-
usernamesWithProof(query: wasm.DpnsUsernamesQuery): Promise<wasm.
|
|
21
|
-
usernameWithProof(identityId: wasm.IdentifierLike): Promise<wasm.
|
|
20
|
+
usernamesWithProof(query: wasm.DpnsUsernamesQuery): Promise<wasm.ProofMetadataResponseTyped<Array<string>>>;
|
|
21
|
+
usernameWithProof(identityId: wasm.IdentifierLike): Promise<wasm.ProofMetadataResponseTyped<string | null>>;
|
|
22
22
|
getUsernameByName(username: string): Promise<wasm.DpnsUsernameInfo>;
|
|
23
23
|
getUsernameByNameWithProof(username: string): Promise<wasm.ProofMetadataResponseTyped<wasm.DpnsUsernameInfo>>;
|
|
24
24
|
}
|