@layerzerolabs/lz-initia-sdk-v2 3.0.88 → 3.0.90-aptos-301.2
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/CHANGELOG.md +0 -28
- package/deployments/initia-sandbox-local/oft_common.json +1 -1
- package/dist/index.cjs +42 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +30 -30
- package/dist/index.d.ts +30 -30
- package/dist/index.mjs +38 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -11
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import initia from '@initia/initia.js';
|
|
2
2
|
import { TransactionRequest, Provider } from '@layerzerolabs/lz-core';
|
|
3
3
|
import { InitiaProvider } from '@layerzerolabs/lz-corekit-initia';
|
|
4
4
|
import { Stage } from '@layerzerolabs/lz-definitions';
|
|
@@ -85,38 +85,38 @@ interface InitiaBuildTxRequestOptions {
|
|
|
85
85
|
/**
|
|
86
86
|
* Builds a transaction.
|
|
87
87
|
*
|
|
88
|
-
* @param {
|
|
88
|
+
* @param {initia.Wallet} nativeSigner - The nativeSigner or the address of the sender.
|
|
89
89
|
* @param {InitiaBuildTxRequest} buildTxRequest - The transaction request to build.
|
|
90
90
|
* @returns {Promise<TransactionRequest>} A promise that resolves to the built transaction request.
|
|
91
91
|
* @throws {Error} If the gas price is invalid.
|
|
92
92
|
*/
|
|
93
|
-
declare function buildTransaction(nativeSigner: Wallet | AccAddress, buildTxRequest: InitiaBuildTxRequest): Promise<TransactionRequest>;
|
|
93
|
+
declare function buildTransaction(nativeSigner: initia.Wallet | initia.AccAddress, buildTxRequest: InitiaBuildTxRequest): Promise<TransactionRequest>;
|
|
94
94
|
/**
|
|
95
95
|
* Builds a transaction.
|
|
96
96
|
*
|
|
97
|
-
* @param {
|
|
97
|
+
* @param {initia.Wallet} nativeSigner - The nativeSigner or the address of the sender.
|
|
98
98
|
* @param {InitiaBuildTxRequest} buildTxRequest - The transaction request to build.
|
|
99
99
|
* @returns {Promise<TransactionRequest>} A promise that resolves to the built transaction request.
|
|
100
100
|
* @throws {Error} If the gas price is invalid.
|
|
101
101
|
*/
|
|
102
|
-
declare function buildInitiaMultisigTransaction(nativeSigner: Wallet | AccAddress, multisigAddress: string, buildTxRequest: InitiaBuildTxRequest): Promise<TransactionRequest>;
|
|
102
|
+
declare function buildInitiaMultisigTransaction(nativeSigner: initia.Wallet | initia.AccAddress, multisigAddress: string, buildTxRequest: InitiaBuildTxRequest): Promise<TransactionRequest>;
|
|
103
103
|
/**
|
|
104
104
|
* Converts a payload to a MsgExecute object for the Initia blockchain.
|
|
105
105
|
*
|
|
106
106
|
* @param {string} sender - The address of the sender.
|
|
107
107
|
* @param {InputEntryFunctionData} payload - The payload of the transaction.
|
|
108
|
-
* @returns {
|
|
108
|
+
* @returns {initia.Msg} The MsgExecute object.
|
|
109
109
|
*/
|
|
110
|
-
declare function convertPayloadToMsgExecute(sender: string, payload: InputEntryFunctionData): Msg;
|
|
111
|
-
declare function convertPayloadToMultisigMsgExecute(sender: string, multisigAddress: string, payload: InputEntryFunctionData): Msg;
|
|
110
|
+
declare function convertPayloadToMsgExecute(sender: string, payload: InputEntryFunctionData): initia.Msg;
|
|
111
|
+
declare function convertPayloadToMultisigMsgExecute(sender: string, multisigAddress: string, payload: InputEntryFunctionData): initia.Msg;
|
|
112
112
|
/**
|
|
113
113
|
* Converts a payload to a MsgScript object for the Initia blockchain.
|
|
114
114
|
*
|
|
115
115
|
* @param {string} sender - The address of the sender.
|
|
116
116
|
* @param {InputEntryFunctionData} payload - The payload of the transaction.
|
|
117
|
-
* @returns {
|
|
117
|
+
* @returns {initia.Msg} The MsgScript object.
|
|
118
118
|
*/
|
|
119
|
-
declare function convertPayloadToMsgScript(sender: string, payload: InputEntryFunctionData): Msg;
|
|
119
|
+
declare function convertPayloadToMsgScript(sender: string, payload: InputEntryFunctionData): initia.Msg;
|
|
120
120
|
/**
|
|
121
121
|
* Converts payload arguments to a list of strings.
|
|
122
122
|
*
|
|
@@ -166,12 +166,12 @@ declare function getSDKFromProvider(provider: Provider, stage?: Stage): SDK;
|
|
|
166
166
|
* The SDK class provides methods to interact with the Initia.
|
|
167
167
|
* For usage, please check [README.md](../README.md).
|
|
168
168
|
*
|
|
169
|
-
* @implements {MoveSdkImpl<
|
|
169
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
170
170
|
*/
|
|
171
|
-
declare class SDK implements MoveSdkImpl<MnemonicKey> {
|
|
171
|
+
declare class SDK implements MoveSdkImpl<initia.MnemonicKey> {
|
|
172
172
|
stage: Stage;
|
|
173
173
|
provider: InitiaProvider;
|
|
174
|
-
LayerzeroModule: LayerZeroModulesSdk<MnemonicKey>;
|
|
174
|
+
LayerzeroModule: LayerZeroModulesSdk<initia.MnemonicKey>;
|
|
175
175
|
accounts: AccountsOption;
|
|
176
176
|
/**
|
|
177
177
|
* Creates an instance of the SDK.
|
|
@@ -182,12 +182,12 @@ declare class SDK implements MoveSdkImpl<MnemonicKey> {
|
|
|
182
182
|
/**
|
|
183
183
|
* Gets the Initia native client.
|
|
184
184
|
*
|
|
185
|
-
* @returns {
|
|
185
|
+
* @returns {initia.LCDClient} The Initia native client.
|
|
186
186
|
*/
|
|
187
|
-
getLCDClient(): LCDClient;
|
|
187
|
+
getLCDClient(): initia.LCDClient;
|
|
188
188
|
/**
|
|
189
189
|
* Executes a view function.
|
|
190
|
-
* @implements {MoveSdkImpl<
|
|
190
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
191
191
|
*
|
|
192
192
|
* @param {Object} args - The arguments for the view function.
|
|
193
193
|
* @param {MoveFunction} args.functionName - The name of the function.
|
|
@@ -204,20 +204,20 @@ declare class SDK implements MoveSdkImpl<MnemonicKey> {
|
|
|
204
204
|
}): Promise<MoveValue[]>;
|
|
205
205
|
/**
|
|
206
206
|
* Normalizes the given signer.
|
|
207
|
-
* @implements {MoveSdkImpl<
|
|
207
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
208
208
|
*
|
|
209
|
-
* @param {
|
|
210
|
-
* @returns {
|
|
209
|
+
* @param {initia.MnemonicKey | PrivateKey | MnemonicAndPath} signer - The signer to normalize.
|
|
210
|
+
* @returns {initia.MnemonicKey} The normalized signer.
|
|
211
211
|
*/
|
|
212
|
-
normalizeSigner(signer: MnemonicKey | PrivateKey | MnemonicAndPath): MnemonicKey;
|
|
212
|
+
normalizeSigner(signer: initia.MnemonicKey | PrivateKey | MnemonicAndPath): initia.MnemonicKey;
|
|
213
213
|
/**
|
|
214
214
|
* Converts the given account to an address.
|
|
215
|
-
* @implements {MoveSdkImpl<
|
|
215
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
216
216
|
*
|
|
217
|
-
* @param {
|
|
217
|
+
* @param {initia.MnemonicKey} account - The account to convert.
|
|
218
218
|
* @returns {string} The address of the account.
|
|
219
219
|
*/
|
|
220
|
-
accountToAddress(account: MnemonicKey): string;
|
|
220
|
+
accountToAddress(account: initia.MnemonicKey): string;
|
|
221
221
|
/**
|
|
222
222
|
* Converts an address to a Bech32 address.
|
|
223
223
|
* For more details about Bech32 addresses, see https://thebitcoinmanual.com/articles/btc-bech32-address/.
|
|
@@ -242,9 +242,9 @@ declare class SDK implements MoveSdkImpl<MnemonicKey> {
|
|
|
242
242
|
handleError(e: unknown): unknown;
|
|
243
243
|
/**
|
|
244
244
|
* Sends a transaction and waits for confirmation.
|
|
245
|
-
* @implements {MoveSdkImpl<
|
|
245
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
246
246
|
*
|
|
247
|
-
* @param {
|
|
247
|
+
* @param {initia.MnemonicKey | PrivateKey | MnemonicAndPath} sender - The sender of the transaction.
|
|
248
248
|
* @param {MoveFunction} func - The function to call.
|
|
249
249
|
* @param {EntryFunctionArgumentTypes[]} args - The arguments for the function.
|
|
250
250
|
* @param {string[]} [argTypes] - The types of the arguments for the function.
|
|
@@ -252,10 +252,10 @@ declare class SDK implements MoveSdkImpl<MnemonicKey> {
|
|
|
252
252
|
* @param {string[]} [typeArguments] - The type arguments.
|
|
253
253
|
* @returns {Promise<TransactionResponse>} The transaction response.
|
|
254
254
|
*/
|
|
255
|
-
sendAndConfirmTransaction(sender: MnemonicKey | PrivateKey | MnemonicAndPath, func: MoveFunction, args: EntryFunctionArgumentTypes[], argTypes?: string[], gasOptions?: GasOptions, typeArguments?: string[]): Promise<TransactionResponse>;
|
|
255
|
+
sendAndConfirmTransaction(sender: initia.MnemonicKey | PrivateKey | MnemonicAndPath, func: MoveFunction, args: EntryFunctionArgumentTypes[], argTypes?: string[], gasOptions?: GasOptions, typeArguments?: string[]): Promise<TransactionResponse>;
|
|
256
256
|
/**
|
|
257
257
|
* Gets an account resource.
|
|
258
|
-
* @implements {MoveSdkImpl<
|
|
258
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
259
259
|
*
|
|
260
260
|
* @param {Object} args - The arguments for getting the account resource.
|
|
261
261
|
* @param {string | Uint8Array} args.accountAddress - The account address.
|
|
@@ -271,7 +271,7 @@ declare class SDK implements MoveSdkImpl<MnemonicKey> {
|
|
|
271
271
|
}): Promise<T>;
|
|
272
272
|
/**
|
|
273
273
|
* Gets a table item.
|
|
274
|
-
* @implements {MoveSdkImpl<
|
|
274
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
275
275
|
*
|
|
276
276
|
* @param {Object} args - The arguments for getting the table item.
|
|
277
277
|
* @param {string} args.handle - The table handle.
|
|
@@ -287,7 +287,7 @@ declare class SDK implements MoveSdkImpl<MnemonicKey> {
|
|
|
287
287
|
}): Promise<T>;
|
|
288
288
|
/**
|
|
289
289
|
* Normalizes the given address.
|
|
290
|
-
* @implements {MoveSdkImpl<
|
|
290
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
291
291
|
*
|
|
292
292
|
* @param {string} address - The address to normalize.
|
|
293
293
|
* @returns {string} The normalized address.
|
|
@@ -295,7 +295,7 @@ declare class SDK implements MoveSdkImpl<MnemonicKey> {
|
|
|
295
295
|
normalizeAddress(address: string): string;
|
|
296
296
|
/**
|
|
297
297
|
* Checks if the SDK supports coins.
|
|
298
|
-
* @implements {MoveSdkImpl<
|
|
298
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
299
299
|
*
|
|
300
300
|
* @returns {boolean} True if the SDK supports coins, false otherwise.
|
|
301
301
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import initia from '@initia/initia.js';
|
|
2
2
|
import { TransactionRequest, Provider } from '@layerzerolabs/lz-core';
|
|
3
3
|
import { InitiaProvider } from '@layerzerolabs/lz-corekit-initia';
|
|
4
4
|
import { Stage } from '@layerzerolabs/lz-definitions';
|
|
@@ -85,38 +85,38 @@ interface InitiaBuildTxRequestOptions {
|
|
|
85
85
|
/**
|
|
86
86
|
* Builds a transaction.
|
|
87
87
|
*
|
|
88
|
-
* @param {
|
|
88
|
+
* @param {initia.Wallet} nativeSigner - The nativeSigner or the address of the sender.
|
|
89
89
|
* @param {InitiaBuildTxRequest} buildTxRequest - The transaction request to build.
|
|
90
90
|
* @returns {Promise<TransactionRequest>} A promise that resolves to the built transaction request.
|
|
91
91
|
* @throws {Error} If the gas price is invalid.
|
|
92
92
|
*/
|
|
93
|
-
declare function buildTransaction(nativeSigner: Wallet | AccAddress, buildTxRequest: InitiaBuildTxRequest): Promise<TransactionRequest>;
|
|
93
|
+
declare function buildTransaction(nativeSigner: initia.Wallet | initia.AccAddress, buildTxRequest: InitiaBuildTxRequest): Promise<TransactionRequest>;
|
|
94
94
|
/**
|
|
95
95
|
* Builds a transaction.
|
|
96
96
|
*
|
|
97
|
-
* @param {
|
|
97
|
+
* @param {initia.Wallet} nativeSigner - The nativeSigner or the address of the sender.
|
|
98
98
|
* @param {InitiaBuildTxRequest} buildTxRequest - The transaction request to build.
|
|
99
99
|
* @returns {Promise<TransactionRequest>} A promise that resolves to the built transaction request.
|
|
100
100
|
* @throws {Error} If the gas price is invalid.
|
|
101
101
|
*/
|
|
102
|
-
declare function buildInitiaMultisigTransaction(nativeSigner: Wallet | AccAddress, multisigAddress: string, buildTxRequest: InitiaBuildTxRequest): Promise<TransactionRequest>;
|
|
102
|
+
declare function buildInitiaMultisigTransaction(nativeSigner: initia.Wallet | initia.AccAddress, multisigAddress: string, buildTxRequest: InitiaBuildTxRequest): Promise<TransactionRequest>;
|
|
103
103
|
/**
|
|
104
104
|
* Converts a payload to a MsgExecute object for the Initia blockchain.
|
|
105
105
|
*
|
|
106
106
|
* @param {string} sender - The address of the sender.
|
|
107
107
|
* @param {InputEntryFunctionData} payload - The payload of the transaction.
|
|
108
|
-
* @returns {
|
|
108
|
+
* @returns {initia.Msg} The MsgExecute object.
|
|
109
109
|
*/
|
|
110
|
-
declare function convertPayloadToMsgExecute(sender: string, payload: InputEntryFunctionData): Msg;
|
|
111
|
-
declare function convertPayloadToMultisigMsgExecute(sender: string, multisigAddress: string, payload: InputEntryFunctionData): Msg;
|
|
110
|
+
declare function convertPayloadToMsgExecute(sender: string, payload: InputEntryFunctionData): initia.Msg;
|
|
111
|
+
declare function convertPayloadToMultisigMsgExecute(sender: string, multisigAddress: string, payload: InputEntryFunctionData): initia.Msg;
|
|
112
112
|
/**
|
|
113
113
|
* Converts a payload to a MsgScript object for the Initia blockchain.
|
|
114
114
|
*
|
|
115
115
|
* @param {string} sender - The address of the sender.
|
|
116
116
|
* @param {InputEntryFunctionData} payload - The payload of the transaction.
|
|
117
|
-
* @returns {
|
|
117
|
+
* @returns {initia.Msg} The MsgScript object.
|
|
118
118
|
*/
|
|
119
|
-
declare function convertPayloadToMsgScript(sender: string, payload: InputEntryFunctionData): Msg;
|
|
119
|
+
declare function convertPayloadToMsgScript(sender: string, payload: InputEntryFunctionData): initia.Msg;
|
|
120
120
|
/**
|
|
121
121
|
* Converts payload arguments to a list of strings.
|
|
122
122
|
*
|
|
@@ -166,12 +166,12 @@ declare function getSDKFromProvider(provider: Provider, stage?: Stage): SDK;
|
|
|
166
166
|
* The SDK class provides methods to interact with the Initia.
|
|
167
167
|
* For usage, please check [README.md](../README.md).
|
|
168
168
|
*
|
|
169
|
-
* @implements {MoveSdkImpl<
|
|
169
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
170
170
|
*/
|
|
171
|
-
declare class SDK implements MoveSdkImpl<MnemonicKey> {
|
|
171
|
+
declare class SDK implements MoveSdkImpl<initia.MnemonicKey> {
|
|
172
172
|
stage: Stage;
|
|
173
173
|
provider: InitiaProvider;
|
|
174
|
-
LayerzeroModule: LayerZeroModulesSdk<MnemonicKey>;
|
|
174
|
+
LayerzeroModule: LayerZeroModulesSdk<initia.MnemonicKey>;
|
|
175
175
|
accounts: AccountsOption;
|
|
176
176
|
/**
|
|
177
177
|
* Creates an instance of the SDK.
|
|
@@ -182,12 +182,12 @@ declare class SDK implements MoveSdkImpl<MnemonicKey> {
|
|
|
182
182
|
/**
|
|
183
183
|
* Gets the Initia native client.
|
|
184
184
|
*
|
|
185
|
-
* @returns {
|
|
185
|
+
* @returns {initia.LCDClient} The Initia native client.
|
|
186
186
|
*/
|
|
187
|
-
getLCDClient(): LCDClient;
|
|
187
|
+
getLCDClient(): initia.LCDClient;
|
|
188
188
|
/**
|
|
189
189
|
* Executes a view function.
|
|
190
|
-
* @implements {MoveSdkImpl<
|
|
190
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
191
191
|
*
|
|
192
192
|
* @param {Object} args - The arguments for the view function.
|
|
193
193
|
* @param {MoveFunction} args.functionName - The name of the function.
|
|
@@ -204,20 +204,20 @@ declare class SDK implements MoveSdkImpl<MnemonicKey> {
|
|
|
204
204
|
}): Promise<MoveValue[]>;
|
|
205
205
|
/**
|
|
206
206
|
* Normalizes the given signer.
|
|
207
|
-
* @implements {MoveSdkImpl<
|
|
207
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
208
208
|
*
|
|
209
|
-
* @param {
|
|
210
|
-
* @returns {
|
|
209
|
+
* @param {initia.MnemonicKey | PrivateKey | MnemonicAndPath} signer - The signer to normalize.
|
|
210
|
+
* @returns {initia.MnemonicKey} The normalized signer.
|
|
211
211
|
*/
|
|
212
|
-
normalizeSigner(signer: MnemonicKey | PrivateKey | MnemonicAndPath): MnemonicKey;
|
|
212
|
+
normalizeSigner(signer: initia.MnemonicKey | PrivateKey | MnemonicAndPath): initia.MnemonicKey;
|
|
213
213
|
/**
|
|
214
214
|
* Converts the given account to an address.
|
|
215
|
-
* @implements {MoveSdkImpl<
|
|
215
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
216
216
|
*
|
|
217
|
-
* @param {
|
|
217
|
+
* @param {initia.MnemonicKey} account - The account to convert.
|
|
218
218
|
* @returns {string} The address of the account.
|
|
219
219
|
*/
|
|
220
|
-
accountToAddress(account: MnemonicKey): string;
|
|
220
|
+
accountToAddress(account: initia.MnemonicKey): string;
|
|
221
221
|
/**
|
|
222
222
|
* Converts an address to a Bech32 address.
|
|
223
223
|
* For more details about Bech32 addresses, see https://thebitcoinmanual.com/articles/btc-bech32-address/.
|
|
@@ -242,9 +242,9 @@ declare class SDK implements MoveSdkImpl<MnemonicKey> {
|
|
|
242
242
|
handleError(e: unknown): unknown;
|
|
243
243
|
/**
|
|
244
244
|
* Sends a transaction and waits for confirmation.
|
|
245
|
-
* @implements {MoveSdkImpl<
|
|
245
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
246
246
|
*
|
|
247
|
-
* @param {
|
|
247
|
+
* @param {initia.MnemonicKey | PrivateKey | MnemonicAndPath} sender - The sender of the transaction.
|
|
248
248
|
* @param {MoveFunction} func - The function to call.
|
|
249
249
|
* @param {EntryFunctionArgumentTypes[]} args - The arguments for the function.
|
|
250
250
|
* @param {string[]} [argTypes] - The types of the arguments for the function.
|
|
@@ -252,10 +252,10 @@ declare class SDK implements MoveSdkImpl<MnemonicKey> {
|
|
|
252
252
|
* @param {string[]} [typeArguments] - The type arguments.
|
|
253
253
|
* @returns {Promise<TransactionResponse>} The transaction response.
|
|
254
254
|
*/
|
|
255
|
-
sendAndConfirmTransaction(sender: MnemonicKey | PrivateKey | MnemonicAndPath, func: MoveFunction, args: EntryFunctionArgumentTypes[], argTypes?: string[], gasOptions?: GasOptions, typeArguments?: string[]): Promise<TransactionResponse>;
|
|
255
|
+
sendAndConfirmTransaction(sender: initia.MnemonicKey | PrivateKey | MnemonicAndPath, func: MoveFunction, args: EntryFunctionArgumentTypes[], argTypes?: string[], gasOptions?: GasOptions, typeArguments?: string[]): Promise<TransactionResponse>;
|
|
256
256
|
/**
|
|
257
257
|
* Gets an account resource.
|
|
258
|
-
* @implements {MoveSdkImpl<
|
|
258
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
259
259
|
*
|
|
260
260
|
* @param {Object} args - The arguments for getting the account resource.
|
|
261
261
|
* @param {string | Uint8Array} args.accountAddress - The account address.
|
|
@@ -271,7 +271,7 @@ declare class SDK implements MoveSdkImpl<MnemonicKey> {
|
|
|
271
271
|
}): Promise<T>;
|
|
272
272
|
/**
|
|
273
273
|
* Gets a table item.
|
|
274
|
-
* @implements {MoveSdkImpl<
|
|
274
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
275
275
|
*
|
|
276
276
|
* @param {Object} args - The arguments for getting the table item.
|
|
277
277
|
* @param {string} args.handle - The table handle.
|
|
@@ -287,7 +287,7 @@ declare class SDK implements MoveSdkImpl<MnemonicKey> {
|
|
|
287
287
|
}): Promise<T>;
|
|
288
288
|
/**
|
|
289
289
|
* Normalizes the given address.
|
|
290
|
-
* @implements {MoveSdkImpl<
|
|
290
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
291
291
|
*
|
|
292
292
|
* @param {string} address - The address to normalize.
|
|
293
293
|
* @returns {string} The normalized address.
|
|
@@ -295,7 +295,7 @@ declare class SDK implements MoveSdkImpl<MnemonicKey> {
|
|
|
295
295
|
normalizeAddress(address: string): string;
|
|
296
296
|
/**
|
|
297
297
|
* Checks if the SDK supports coins.
|
|
298
|
-
* @implements {MoveSdkImpl<
|
|
298
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
299
299
|
*
|
|
300
300
|
* @returns {boolean} True if the SDK supports coins, false otherwise.
|
|
301
301
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import initia from '@initia/initia.js';
|
|
2
2
|
import { InitiaSigner } from '@layerzerolabs/lz-corekit-initia';
|
|
3
3
|
import { Stage } from '@layerzerolabs/lz-definitions';
|
|
4
4
|
import { LayerZeroModulesSdk } from '@layerzerolabs/lz-movevm-sdk-v2';
|
|
@@ -82,7 +82,7 @@ var DEPLOY_TO_OBJECT = {
|
|
|
82
82
|
[Stage.SANDBOX]: "0xd01d8dfbfb8bf0a5f27621895a6c26c8d2b13203"
|
|
83
83
|
};
|
|
84
84
|
async function buildTransaction(nativeSigner, buildTxRequest) {
|
|
85
|
-
const sender = nativeSigner instanceof Wallet ? nativeSigner.key.accAddress.toString() : nativeSigner.toString();
|
|
85
|
+
const sender = nativeSigner instanceof initia.Wallet ? nativeSigner.key.accAddress.toString() : nativeSigner.toString();
|
|
86
86
|
let msg;
|
|
87
87
|
if (buildTxRequest.payload.function.split("::").length === 3) {
|
|
88
88
|
msg = convertPayloadToMsgExecute(sender, buildTxRequest.payload);
|
|
@@ -110,7 +110,7 @@ async function buildTransaction(nativeSigner, buildTxRequest) {
|
|
|
110
110
|
return Promise.resolve(TransactionRequest.from(createOptions));
|
|
111
111
|
}
|
|
112
112
|
async function buildInitiaMultisigTransaction(nativeSigner, multisigAddress, buildTxRequest) {
|
|
113
|
-
const sender = nativeSigner instanceof Wallet ? nativeSigner.key.accAddress.toString() : nativeSigner.toString();
|
|
113
|
+
const sender = nativeSigner instanceof initia.Wallet ? nativeSigner.key.accAddress.toString() : nativeSigner.toString();
|
|
114
114
|
let msg;
|
|
115
115
|
if (buildTxRequest.payload.function.split("::").length === 3) {
|
|
116
116
|
msg = convertPayloadToMultisigMsgExecute(sender, multisigAddress, buildTxRequest.payload);
|
|
@@ -143,7 +143,7 @@ function convertPayloadToMsgExecute(sender, payload) {
|
|
|
143
143
|
const moduleName = functionStructs[1];
|
|
144
144
|
const functionName = functionStructs[2];
|
|
145
145
|
const args = covertPayloadArgs(payload.functionArgumentTypes ?? [], payload.functionArguments);
|
|
146
|
-
const msg = new MsgExecute(
|
|
146
|
+
const msg = new initia.MsgExecute(
|
|
147
147
|
sender,
|
|
148
148
|
// sender address
|
|
149
149
|
moduleAddress,
|
|
@@ -169,7 +169,7 @@ function convertPayloadToMultisigMsgExecute(sender, multisigAddress, payload) {
|
|
|
169
169
|
}
|
|
170
170
|
return value;
|
|
171
171
|
}
|
|
172
|
-
const msgCreateProposal = new MsgExecuteJSON(
|
|
172
|
+
const msgCreateProposal = new initia.MsgExecuteJSON(
|
|
173
173
|
sender,
|
|
174
174
|
"0x1",
|
|
175
175
|
"multisig_v2",
|
|
@@ -196,7 +196,7 @@ function convertPayloadToMultisigMsgExecute(sender, multisigAddress, payload) {
|
|
|
196
196
|
}
|
|
197
197
|
function convertPayloadToMsgScript(sender, payload) {
|
|
198
198
|
const args = covertPayloadArgs(payload.functionArgumentTypes ?? [], payload.functionArguments);
|
|
199
|
-
const msg = new MsgScript(
|
|
199
|
+
const msg = new initia.MsgScript(
|
|
200
200
|
sender,
|
|
201
201
|
// sender address
|
|
202
202
|
Buffer.from(payload.function, "hex").toString("base64"),
|
|
@@ -216,27 +216,27 @@ function covertPayloadArgs(functionArgumentTypes, functionArguments) {
|
|
|
216
216
|
function convertArg(argsType, arg) {
|
|
217
217
|
switch (argsType) {
|
|
218
218
|
case "bool":
|
|
219
|
-
return bcs.bool().serialize(arg).toBase64();
|
|
219
|
+
return initia.bcs.bool().serialize(arg).toBase64();
|
|
220
220
|
case "u256":
|
|
221
|
-
return bcs.u256().serialize(arg).toBase64();
|
|
221
|
+
return initia.bcs.u256().serialize(arg).toBase64();
|
|
222
222
|
case "u128":
|
|
223
|
-
return bcs.u128().serialize(arg).toBase64();
|
|
223
|
+
return initia.bcs.u128().serialize(arg).toBase64();
|
|
224
224
|
case "u64":
|
|
225
|
-
return bcs.u64().serialize(arg).toBase64();
|
|
225
|
+
return initia.bcs.u64().serialize(arg).toBase64();
|
|
226
226
|
case "u32":
|
|
227
|
-
return bcs.u32().serialize(arg).toBase64();
|
|
227
|
+
return initia.bcs.u32().serialize(arg).toBase64();
|
|
228
228
|
case "u16":
|
|
229
|
-
return bcs.u16().serialize(arg).toBase64();
|
|
229
|
+
return initia.bcs.u16().serialize(arg).toBase64();
|
|
230
230
|
case "u8":
|
|
231
|
-
return bcs.u8().serialize(arg).toBase64();
|
|
231
|
+
return initia.bcs.u8().serialize(arg).toBase64();
|
|
232
232
|
case "address":
|
|
233
|
-
return bcs.address().serialize(arg).toBase64();
|
|
233
|
+
return initia.bcs.address().serialize(arg).toBase64();
|
|
234
234
|
case "vector<u8>":
|
|
235
|
-
return bcs.vector(bcs.u8()).serialize(arg).toBase64();
|
|
235
|
+
return initia.bcs.vector(initia.bcs.u8()).serialize(arg).toBase64();
|
|
236
236
|
case "vector<address>":
|
|
237
|
-
return bcs.vector(bcs.address()).serialize(arg).toBase64();
|
|
237
|
+
return initia.bcs.vector(initia.bcs.address()).serialize(arg).toBase64();
|
|
238
238
|
case "vector<vector<u8>>":
|
|
239
|
-
return bcs.vector(bcs.vector(bcs.u8())).serialize(arg).toBase64();
|
|
239
|
+
return initia.bcs.vector(initia.bcs.vector(initia.bcs.u8())).serialize(arg).toBase64();
|
|
240
240
|
default:
|
|
241
241
|
throw new Error(`Invalid type argsType: ${argsType.toString()}`);
|
|
242
242
|
}
|
|
@@ -281,14 +281,14 @@ var SDK = class {
|
|
|
281
281
|
/**
|
|
282
282
|
* Gets the Initia native client.
|
|
283
283
|
*
|
|
284
|
-
* @returns {
|
|
284
|
+
* @returns {initia.LCDClient} The Initia native client.
|
|
285
285
|
*/
|
|
286
286
|
getLCDClient() {
|
|
287
287
|
return this.provider.native;
|
|
288
288
|
}
|
|
289
289
|
/**
|
|
290
290
|
* Executes a view function.
|
|
291
|
-
* @implements {MoveSdkImpl<
|
|
291
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
292
292
|
*
|
|
293
293
|
* @param {Object} args - The arguments for the view function.
|
|
294
294
|
* @param {MoveFunction} args.functionName - The name of the function.
|
|
@@ -315,34 +315,34 @@ var SDK = class {
|
|
|
315
315
|
}
|
|
316
316
|
/**
|
|
317
317
|
* Normalizes the given signer.
|
|
318
|
-
* @implements {MoveSdkImpl<
|
|
318
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
319
319
|
*
|
|
320
|
-
* @param {
|
|
321
|
-
* @returns {
|
|
320
|
+
* @param {initia.MnemonicKey | PrivateKey | MnemonicAndPath} signer - The signer to normalize.
|
|
321
|
+
* @returns {initia.MnemonicKey} The normalized signer.
|
|
322
322
|
*/
|
|
323
323
|
normalizeSigner(signer) {
|
|
324
|
-
if (signer instanceof MnemonicKey) {
|
|
324
|
+
if (signer instanceof initia.MnemonicKey) {
|
|
325
325
|
return signer;
|
|
326
326
|
} else if (isMnemonicAndPath(signer)) {
|
|
327
327
|
const { mnemonic, path } = signer;
|
|
328
328
|
const [_, coinType, account, __, index] = path.match(/\d+/g)?.map(Number) ?? [];
|
|
329
|
-
return new MnemonicKey({
|
|
329
|
+
return new initia.MnemonicKey({
|
|
330
330
|
mnemonic,
|
|
331
331
|
coinType,
|
|
332
332
|
account,
|
|
333
333
|
index,
|
|
334
|
-
eth: coinType === INIT_COIN_TYPE
|
|
334
|
+
eth: coinType === initia.INIT_COIN_TYPE
|
|
335
335
|
});
|
|
336
336
|
} else if (isPrivateKey(signer)) {
|
|
337
|
-
return MnemonicKey.fromHex(signer);
|
|
337
|
+
return initia.MnemonicKey.fromHex(signer);
|
|
338
338
|
}
|
|
339
339
|
throw new Error(`Invalid signer`);
|
|
340
340
|
}
|
|
341
341
|
/**
|
|
342
342
|
* Converts the given account to an address.
|
|
343
|
-
* @implements {MoveSdkImpl<
|
|
343
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
344
344
|
*
|
|
345
|
-
* @param {
|
|
345
|
+
* @param {initia.MnemonicKey} account - The account to convert.
|
|
346
346
|
* @returns {string} The address of the account.
|
|
347
347
|
*/
|
|
348
348
|
accountToAddress(account) {
|
|
@@ -359,10 +359,10 @@ var SDK = class {
|
|
|
359
359
|
if (anyAddress instanceof Uint8Array) {
|
|
360
360
|
anyAddress = Buffer.from(anyAddress).toString("hex");
|
|
361
361
|
}
|
|
362
|
-
if (AccAddress.validate(anyAddress)) {
|
|
362
|
+
if (initia.AccAddress.validate(anyAddress)) {
|
|
363
363
|
return anyAddress;
|
|
364
364
|
}
|
|
365
|
-
return AccAddress.fromHex(anyAddress);
|
|
365
|
+
return initia.AccAddress.fromHex(anyAddress);
|
|
366
366
|
}
|
|
367
367
|
/**
|
|
368
368
|
* Converts an address to a hexadecimal string.
|
|
@@ -374,8 +374,8 @@ var SDK = class {
|
|
|
374
374
|
if (anyAddress instanceof Uint8Array) {
|
|
375
375
|
anyAddress = Buffer.from(anyAddress).toString("hex");
|
|
376
376
|
}
|
|
377
|
-
if (AccAddress.validate(anyAddress)) {
|
|
378
|
-
return AccAddress.toHex(anyAddress);
|
|
377
|
+
if (initia.AccAddress.validate(anyAddress)) {
|
|
378
|
+
return initia.AccAddress.toHex(anyAddress);
|
|
379
379
|
}
|
|
380
380
|
return anyAddress;
|
|
381
381
|
}
|
|
@@ -404,9 +404,9 @@ var SDK = class {
|
|
|
404
404
|
}
|
|
405
405
|
/**
|
|
406
406
|
* Sends a transaction and waits for confirmation.
|
|
407
|
-
* @implements {MoveSdkImpl<
|
|
407
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
408
408
|
*
|
|
409
|
-
* @param {
|
|
409
|
+
* @param {initia.MnemonicKey | PrivateKey | MnemonicAndPath} sender - The sender of the transaction.
|
|
410
410
|
* @param {MoveFunction} func - The function to call.
|
|
411
411
|
* @param {EntryFunctionArgumentTypes[]} args - The arguments for the function.
|
|
412
412
|
* @param {string[]} [argTypes] - The types of the arguments for the function.
|
|
@@ -448,7 +448,7 @@ var SDK = class {
|
|
|
448
448
|
}
|
|
449
449
|
/**
|
|
450
450
|
* Gets an account resource.
|
|
451
|
-
* @implements {MoveSdkImpl<
|
|
451
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
452
452
|
*
|
|
453
453
|
* @param {Object} args - The arguments for getting the account resource.
|
|
454
454
|
* @param {string | Uint8Array} args.accountAddress - The account address.
|
|
@@ -471,7 +471,7 @@ var SDK = class {
|
|
|
471
471
|
}
|
|
472
472
|
/**
|
|
473
473
|
* Gets a table item.
|
|
474
|
-
* @implements {MoveSdkImpl<
|
|
474
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
475
475
|
*
|
|
476
476
|
* @param {Object} args - The arguments for getting the table item.
|
|
477
477
|
* @param {string} args.handle - The table handle.
|
|
@@ -498,7 +498,7 @@ var SDK = class {
|
|
|
498
498
|
}
|
|
499
499
|
/**
|
|
500
500
|
* Normalizes the given address.
|
|
501
|
-
* @implements {MoveSdkImpl<
|
|
501
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
502
502
|
*
|
|
503
503
|
* @param {string} address - The address to normalize.
|
|
504
504
|
* @returns {string} The normalized address.
|
|
@@ -508,7 +508,7 @@ var SDK = class {
|
|
|
508
508
|
}
|
|
509
509
|
/**
|
|
510
510
|
* Checks if the SDK supports coins.
|
|
511
|
-
* @implements {MoveSdkImpl<
|
|
511
|
+
* @implements {MoveSdkImpl<initia.MnemonicKey>}
|
|
512
512
|
*
|
|
513
513
|
* @returns {boolean} True if the SDK supports coins, false otherwise.
|
|
514
514
|
*/
|