@layerzerolabs/lz-initia-sdk-v2 3.0.82 → 3.0.84-aptos-301.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -14
- package/deployments/initia-sandbox-local/blocked_msglib.json +2 -2
- package/deployments/initia-sandbox-local/counter.json +2 -2
- package/deployments/initia-sandbox-local/deployer.json +1 -1
- package/deployments/initia-sandbox-local/dvn.json +2 -2
- package/deployments/initia-sandbox-local/dvn_fee_lib_0.json +1 -1
- package/deployments/initia-sandbox-local/dvn_fee_lib_router_0.json +1 -1
- package/deployments/initia-sandbox-local/dvn_fee_lib_router_1.json +1 -1
- package/deployments/initia-sandbox-local/endpoint_v2.json +2 -2
- package/deployments/initia-sandbox-local/endpoint_v2_common.json +2 -2
- package/deployments/initia-sandbox-local/executor.json +1 -1
- package/deployments/initia-sandbox-local/executor_fee_lib_0.json +2 -2
- package/deployments/initia-sandbox-local/executor_fee_lib_router_0.json +1 -1
- package/deployments/initia-sandbox-local/executor_fee_lib_router_1.json +1 -1
- package/deployments/initia-sandbox-local/layerzero_views.json +1 -1
- package/deployments/initia-sandbox-local/msglib_types.json +2 -2
- package/deployments/initia-sandbox-local/oft-TokenOne.json +2 -2
- package/deployments/initia-sandbox-local/oft-TokenThree.json +2 -2
- package/deployments/initia-sandbox-local/oft-TokenTwo.json +2 -2
- package/deployments/initia-sandbox-local/oft_common.json +1 -1
- package/deployments/initia-sandbox-local/price_feed_module_0.json +2 -2
- package/deployments/initia-sandbox-local/price_feed_router_0.json +1 -1
- package/deployments/initia-sandbox-local/price_feed_router_1.json +1 -1
- package/deployments/initia-sandbox-local/router_node_0.json +2 -2
- package/deployments/initia-sandbox-local/router_node_1.json +2 -2
- package/deployments/initia-sandbox-local/simple_msglib.json +2 -2
- package/deployments/initia-sandbox-local/treasury.json +2 -2
- package/deployments/initia-sandbox-local/uln_302.json +2 -2
- package/deployments/initia-sandbox-local/worker_common.json +2 -2
- package/dist/index.cjs +38 -43
- 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 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
# @layerzerolabs/lz-initia-sdk-v2
|
|
2
2
|
|
|
3
|
-
## 3.0.82
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- e0e402e: animechain
|
|
8
|
-
- Updated dependencies [e0e402e]
|
|
9
|
-
- @layerzerolabs/lz-corekit-initia@3.0.82
|
|
10
|
-
- @layerzerolabs/lz-core@3.0.82
|
|
11
|
-
- @layerzerolabs/lz-definitions@3.0.82
|
|
12
|
-
- @layerzerolabs/lz-utilities@3.0.82
|
|
13
|
-
- @layerzerolabs/lz-movevm-sdk-v2@3.0.82
|
|
14
|
-
- @layerzerolabs/lz-v2-utilities@3.0.82
|
|
15
|
-
- @layerzerolabs/move-definitions@3.0.82
|
|
16
|
-
|
|
17
3
|
## 3.0.81
|
|
18
4
|
|
|
19
5
|
### Patch Changes
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"compatibleVersions": [
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
|
-
"bytecodeHash": "
|
|
11
|
-
"transactionHash": "
|
|
10
|
+
"bytecodeHash": "b3dbdaddf644ceda422b92f48af644e59c011a959d953b57abb82d71d72c34c7",
|
|
11
|
+
"transactionHash": "01B1F5D07718ADDAB2D07F28F2A312289840615EB51044852E2098AC70B55C94"
|
|
12
12
|
}
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"compatibleVersions": [
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
|
-
"bytecodeHash": "
|
|
11
|
-
"transactionHash": "
|
|
10
|
+
"bytecodeHash": "83f0d12e2d4b6fce6e462eb7759fcb66c603bd38b0ff0b5411ea32a0b1a1ac04",
|
|
11
|
+
"transactionHash": "56BF14A2B4D944AE3A41C2668186105FDC8A91F48B53CF28D9B9519B49431D35"
|
|
12
12
|
}
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
10
|
"bytecodeHash": "2e80dd53080937deb8706e1f6123e9b474a08dade4ae3f5168ee19e963782503",
|
|
11
|
-
"transactionHash": "
|
|
11
|
+
"transactionHash": "7B30E965EEC9C4802296B8E4BD0A38EE32CDD35019E3E6E91B17078C7FEE9AA7"
|
|
12
12
|
}
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"compatibleVersions": [
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
|
-
"bytecodeHash": "
|
|
11
|
-
"transactionHash": "
|
|
10
|
+
"bytecodeHash": "2cf5247e87d0758eacadc45e7ce3d9617163250ce6bc59015c87f4be72850262",
|
|
11
|
+
"transactionHash": "05CACF8F3D780A388F02F1FDEDDE5FC7907703F906668626B7204F865599ED31"
|
|
12
12
|
}
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
10
|
"bytecodeHash": "ffe30857c60854f4fd77ed7c11c2485946d380906e589d08c0f3b8c8bf4ff989",
|
|
11
|
-
"transactionHash": "
|
|
11
|
+
"transactionHash": "6A8E71A0FFE5268B28525247577C65CE1CDB81DB168B8770EB5F707AE674F7C2"
|
|
12
12
|
}
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
10
|
"bytecodeHash": "b21315acdaf7ac01d1489974048ca1d7b5ab740ab4fa245d82bfd37c7d8cd2ca",
|
|
11
|
-
"transactionHash": "
|
|
11
|
+
"transactionHash": "FFA90AB68D812A24DF9E0ECE7F085508F1D9D3EDD0B581CD8A83720531661B9A"
|
|
12
12
|
}
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
10
|
"bytecodeHash": "83284745e1776e78f230891cb40bf613e0a94724dc04806cc72f8bf92a87898d",
|
|
11
|
-
"transactionHash": "
|
|
11
|
+
"transactionHash": "2540F41E4F4F5F1827BAC3243E9EE81DF2EA93441BFE317FF8A3B5A95B6E4240"
|
|
12
12
|
}
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"compatibleVersions": [
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
|
-
"bytecodeHash": "
|
|
11
|
-
"transactionHash": "
|
|
10
|
+
"bytecodeHash": "53e95a5a7e8f744ececd1833bf3505c8ed6ae69682f4827f694eb89117742df1",
|
|
11
|
+
"transactionHash": "C319DF9E98CEE1F5639638187DA0315F4B29EF4BF7AB1E9B40472BAC94259D24"
|
|
12
12
|
}
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"compatibleVersions": [
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
|
-
"bytecodeHash": "
|
|
11
|
-
"transactionHash": "
|
|
10
|
+
"bytecodeHash": "0af199c7ad7644681996ab7c59846d5a086751111446e19f52117f24388e4b2a",
|
|
11
|
+
"transactionHash": "C1E3D175DA74FE7BB03732D276C803780F2C44180E38ED81FA3879173A778C01"
|
|
12
12
|
}
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
10
|
"bytecodeHash": "9234e111ab738401da6b8281592a828c71797e61cac57278f347c942cef7c279",
|
|
11
|
-
"transactionHash": "
|
|
11
|
+
"transactionHash": "E923EC7D564D4573DA56A073506FA5EE77E29F777A417063E869CA08DFEDBA45"
|
|
12
12
|
}
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"compatibleVersions": [
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
|
-
"bytecodeHash": "
|
|
11
|
-
"transactionHash": "
|
|
10
|
+
"bytecodeHash": "32c5bcf116298779b7044d1b851a53cb05c0c7e75ff9a1c6b17644a96e251a23",
|
|
11
|
+
"transactionHash": "F90D5212A751C1D5B3BFE5BC5001D04F2A6E09BEA1A02B22094B75D6AF0FCF4E"
|
|
12
12
|
}
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
10
|
"bytecodeHash": "437fef7999a55489912e418b5701f8bc9b09e94839a3b4dd2956416d840de4e2",
|
|
11
|
-
"transactionHash": "
|
|
11
|
+
"transactionHash": "042536538074933DBF776B7F173D3B3182578348A3F4B0F9B794258A5436573D"
|
|
12
12
|
}
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
10
|
"bytecodeHash": "7541bddacd7627b9cbb1ca09ed08d441a2c8dc74e4210014f8705dbd5605c0bf",
|
|
11
|
-
"transactionHash": "
|
|
11
|
+
"transactionHash": "75BBAC5CBB6F4D8EBC535BFC7BB1DF53D1E00F564FA53BC07CA61742264AEF2F"
|
|
12
12
|
}
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
10
|
"bytecodeHash": "a2d586ad36d415b22b59431fe141d2e1e9109f09f00a38aa5c666f7c436663d0",
|
|
11
|
-
"transactionHash": "
|
|
11
|
+
"transactionHash": "9A222BC676D7C1F7C65ED5C341BF0D2E1E7C646B89CE67E0542E30CBF6FB5D77"
|
|
12
12
|
}
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"compatibleVersions": [
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
|
-
"bytecodeHash": "
|
|
11
|
-
"transactionHash": "
|
|
10
|
+
"bytecodeHash": "b59e6e545d003f2eee26addb3c5880ac672480ec3b41e5105f67a9ada8d06902",
|
|
11
|
+
"transactionHash": "6A59448BC4E0C235F889C59982F8DC66BFB8DDE3AFFBC777DDF292D0EF32D7BF"
|
|
12
12
|
}
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"compatibleVersions": [
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
|
-
"bytecodeHash": "
|
|
11
|
-
"transactionHash": "
|
|
10
|
+
"bytecodeHash": "71b6f31f6efefa380f1fb646177e16ebb6087b4576917851e2c951d32820a068",
|
|
11
|
+
"transactionHash": "1BF6801661E9F0817FBCE7452040FFDDF54C77BEF7B28D26B218BC0FADDCBC2E"
|
|
12
12
|
}
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"compatibleVersions": [
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
|
-
"bytecodeHash": "
|
|
11
|
-
"transactionHash": "
|
|
10
|
+
"bytecodeHash": "c984479d27cbc9c6d93b693af43c4beb54c324412f4ea3bb6e2edb925c6174ef",
|
|
11
|
+
"transactionHash": "171A3ED1E294B7F4983638F0B3C495410B0047E7EE26297770F8759767638CA4"
|
|
12
12
|
}
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"compatibleVersions": [
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
|
-
"bytecodeHash": "
|
|
11
|
-
"transactionHash": "
|
|
10
|
+
"bytecodeHash": "bb9c843cdda2102a8e2408d3fe397411eb506028ef7b96f5e4dd7e96f3f943fd",
|
|
11
|
+
"transactionHash": "781496CBB634908CDE98B00F2572B61A73CC2822F0E960793B28AEA57ED8AF9A"
|
|
12
12
|
}
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
10
|
"bytecodeHash": "809ed28d2fbc631bea2e0f92ed84c1f05ac0e1950c7ed46a18276dfbb3b8275a",
|
|
11
|
-
"transactionHash": "
|
|
11
|
+
"transactionHash": "1302458E6A17660ABE76A0C7F8A46576B899E47AB2DF0BC45BB918C70AD7EC9C"
|
|
12
12
|
}
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"compatibleVersions": [
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
|
-
"bytecodeHash": "
|
|
11
|
-
"transactionHash": "
|
|
10
|
+
"bytecodeHash": "6034c5763de64a019ef2af9e574e877b1b6e8a7fd53421e0603be86a56608bea",
|
|
11
|
+
"transactionHash": "1F162E8A037D4F6ABC2005928E14485481000CB0A340C456863D59869DCC4318"
|
|
12
12
|
}
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
10
|
"bytecodeHash": "0bf5306d892875a80d2fe264dd0007c5dac7d1152677d89f2097d0604e958d6b",
|
|
11
|
-
"transactionHash": "
|
|
11
|
+
"transactionHash": "5D871DD9DA624AFFACAE13BCA6FC1C66BF218E0846698EFE567F531B6867EDB4"
|
|
12
12
|
}
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
10
|
"bytecodeHash": "6d9487e27295d6c41cbbf7ef61e876714045b4882a364c3d6c4128e29356f58b",
|
|
11
|
-
"transactionHash": "
|
|
11
|
+
"transactionHash": "6A5F773C57639217F3A2B978E8AB3459F8C679A95DC7D28E7DBED7A68E8E37F9"
|
|
12
12
|
}
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"compatibleVersions": [
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
|
-
"bytecodeHash": "
|
|
11
|
-
"transactionHash": "
|
|
10
|
+
"bytecodeHash": "536de01a653fa4fc0572479cc20e7dfbb74072b77630abcef5fa195f94f1aeed",
|
|
11
|
+
"transactionHash": "3357B6C1BC26E563EDD599F87F56BA60EF68EB6A00170B969606BDC0DAA9F42D"
|
|
12
12
|
}
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"compatibleVersions": [
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
|
-
"bytecodeHash": "
|
|
11
|
-
"transactionHash": "
|
|
10
|
+
"bytecodeHash": "c3ef167b7f049452d299c2a0a90486337ae7b9c14fa3d30b141314737d7570ad",
|
|
11
|
+
"transactionHash": "1957E3E3FF8C346731CC000BC44590E1B40ADD535832D8107400ED287A94D707"
|
|
12
12
|
}
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"compatibleVersions": [
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
|
-
"bytecodeHash": "
|
|
11
|
-
"transactionHash": "
|
|
10
|
+
"bytecodeHash": "279de0e3e4450dd5bfec7ae483ded94ffe5eee91efdb62b932f201e7010665ae",
|
|
11
|
+
"transactionHash": "E0F53694109EA05062DCEE22A4EAB24528AC240CB7801B20E3A2213382E95767"
|
|
12
12
|
}
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"compatibleVersions": [
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
|
-
"bytecodeHash": "
|
|
11
|
-
"transactionHash": "
|
|
10
|
+
"bytecodeHash": "3965ab0b2ed4b78bb62503b9e710f2ea84ba6a88d87498e1efba081030282d17",
|
|
11
|
+
"transactionHash": "3E7473862EEC00C25A77DDFC5AFCFEDA754C6A023FEDFDDD8842F71564188426"
|
|
12
12
|
}
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"compatibleVersions": [
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
|
-
"bytecodeHash": "
|
|
11
|
-
"transactionHash": "
|
|
10
|
+
"bytecodeHash": "659e322fd66030df5cfb2ede9b328907832ac669866b7055987dd61d6f406a3d",
|
|
11
|
+
"transactionHash": "A8D2139BFB9A7CCA3A0D566E3569B75079016DB03A5ACEF28D32A394530654BF"
|
|
12
12
|
}
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"compatibleVersions": [
|
|
8
8
|
"v2"
|
|
9
9
|
],
|
|
10
|
-
"bytecodeHash": "
|
|
11
|
-
"transactionHash": "
|
|
10
|
+
"bytecodeHash": "a8677a9d118e75eacd07cd2b9548378c6196443b8cc7f3ee77624081503fe3e7",
|
|
11
|
+
"transactionHash": "D3CBD7B69AE9B6A5EA971C70E2EA797801F6C13CFAD384631A5D6944BBB90085"
|
|
12
12
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var initia_js = require('@initia/initia.js');
|
|
4
4
|
var lzCorekitInitia = require('@layerzerolabs/lz-corekit-initia');
|
|
5
5
|
var lzDefinitions = require('@layerzerolabs/lz-definitions');
|
|
6
6
|
var lzMovevmSdkV2 = require('@layerzerolabs/lz-movevm-sdk-v2');
|
|
7
7
|
var moveDefinitions = require('@layerzerolabs/move-definitions');
|
|
8
8
|
var lzCore = require('@layerzerolabs/lz-core');
|
|
9
9
|
|
|
10
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
|
|
12
|
-
var initia__default = /*#__PURE__*/_interopDefault(initia);
|
|
13
|
-
|
|
14
10
|
// src/index.ts
|
|
15
11
|
var ENDPOINT_V2_ADDRESS = {
|
|
16
12
|
[lzDefinitions.Stage.MAINNET]: "0x81d2b534893db8745ab2b0c092ec5f88d554d54825f98fd9e8c83f9b113ee77e",
|
|
@@ -88,7 +84,7 @@ var DEPLOY_TO_OBJECT = {
|
|
|
88
84
|
[lzDefinitions.Stage.SANDBOX]: "0xd01d8dfbfb8bf0a5f27621895a6c26c8d2b13203"
|
|
89
85
|
};
|
|
90
86
|
async function buildTransaction(nativeSigner, buildTxRequest) {
|
|
91
|
-
const sender = nativeSigner instanceof
|
|
87
|
+
const sender = nativeSigner instanceof initia_js.Wallet ? nativeSigner.key.accAddress.toString() : nativeSigner.toString();
|
|
92
88
|
let msg;
|
|
93
89
|
if (buildTxRequest.payload.function.split("::").length === 3) {
|
|
94
90
|
msg = convertPayloadToMsgExecute(sender, buildTxRequest.payload);
|
|
@@ -116,7 +112,7 @@ async function buildTransaction(nativeSigner, buildTxRequest) {
|
|
|
116
112
|
return Promise.resolve(lzCore.TransactionRequest.from(createOptions));
|
|
117
113
|
}
|
|
118
114
|
async function buildInitiaMultisigTransaction(nativeSigner, multisigAddress, buildTxRequest) {
|
|
119
|
-
const sender = nativeSigner instanceof
|
|
115
|
+
const sender = nativeSigner instanceof initia_js.Wallet ? nativeSigner.key.accAddress.toString() : nativeSigner.toString();
|
|
120
116
|
let msg;
|
|
121
117
|
if (buildTxRequest.payload.function.split("::").length === 3) {
|
|
122
118
|
msg = convertPayloadToMultisigMsgExecute(sender, multisigAddress, buildTxRequest.payload);
|
|
@@ -149,7 +145,7 @@ function convertPayloadToMsgExecute(sender, payload) {
|
|
|
149
145
|
const moduleName = functionStructs[1];
|
|
150
146
|
const functionName = functionStructs[2];
|
|
151
147
|
const args = covertPayloadArgs(payload.functionArgumentTypes ?? [], payload.functionArguments);
|
|
152
|
-
const msg = new
|
|
148
|
+
const msg = new initia_js.MsgExecute(
|
|
153
149
|
sender,
|
|
154
150
|
// sender address
|
|
155
151
|
moduleAddress,
|
|
@@ -175,7 +171,7 @@ function convertPayloadToMultisigMsgExecute(sender, multisigAddress, payload) {
|
|
|
175
171
|
}
|
|
176
172
|
return value;
|
|
177
173
|
}
|
|
178
|
-
const msgCreateProposal = new
|
|
174
|
+
const msgCreateProposal = new initia_js.MsgExecuteJSON(
|
|
179
175
|
sender,
|
|
180
176
|
"0x1",
|
|
181
177
|
"multisig_v2",
|
|
@@ -202,7 +198,7 @@ function convertPayloadToMultisigMsgExecute(sender, multisigAddress, payload) {
|
|
|
202
198
|
}
|
|
203
199
|
function convertPayloadToMsgScript(sender, payload) {
|
|
204
200
|
const args = covertPayloadArgs(payload.functionArgumentTypes ?? [], payload.functionArguments);
|
|
205
|
-
const msg = new
|
|
201
|
+
const msg = new initia_js.MsgScript(
|
|
206
202
|
sender,
|
|
207
203
|
// sender address
|
|
208
204
|
Buffer.from(payload.function, "hex").toString("base64"),
|
|
@@ -222,27 +218,27 @@ function covertPayloadArgs(functionArgumentTypes, functionArguments) {
|
|
|
222
218
|
function convertArg(argsType, arg) {
|
|
223
219
|
switch (argsType) {
|
|
224
220
|
case "bool":
|
|
225
|
-
return
|
|
221
|
+
return initia_js.bcs.bool().serialize(arg).toBase64();
|
|
226
222
|
case "u256":
|
|
227
|
-
return
|
|
223
|
+
return initia_js.bcs.u256().serialize(arg).toBase64();
|
|
228
224
|
case "u128":
|
|
229
|
-
return
|
|
225
|
+
return initia_js.bcs.u128().serialize(arg).toBase64();
|
|
230
226
|
case "u64":
|
|
231
|
-
return
|
|
227
|
+
return initia_js.bcs.u64().serialize(arg).toBase64();
|
|
232
228
|
case "u32":
|
|
233
|
-
return
|
|
229
|
+
return initia_js.bcs.u32().serialize(arg).toBase64();
|
|
234
230
|
case "u16":
|
|
235
|
-
return
|
|
231
|
+
return initia_js.bcs.u16().serialize(arg).toBase64();
|
|
236
232
|
case "u8":
|
|
237
|
-
return
|
|
233
|
+
return initia_js.bcs.u8().serialize(arg).toBase64();
|
|
238
234
|
case "address":
|
|
239
|
-
return
|
|
235
|
+
return initia_js.bcs.address().serialize(arg).toBase64();
|
|
240
236
|
case "vector<u8>":
|
|
241
|
-
return
|
|
237
|
+
return initia_js.bcs.vector(initia_js.bcs.u8()).serialize(arg).toBase64();
|
|
242
238
|
case "vector<address>":
|
|
243
|
-
return
|
|
239
|
+
return initia_js.bcs.vector(initia_js.bcs.address()).serialize(arg).toBase64();
|
|
244
240
|
case "vector<vector<u8>>":
|
|
245
|
-
return
|
|
241
|
+
return initia_js.bcs.vector(initia_js.bcs.vector(initia_js.bcs.u8())).serialize(arg).toBase64();
|
|
246
242
|
default:
|
|
247
243
|
throw new Error(`Invalid type argsType: ${argsType.toString()}`);
|
|
248
244
|
}
|
|
@@ -287,14 +283,14 @@ var SDK = class {
|
|
|
287
283
|
/**
|
|
288
284
|
* Gets the Initia native client.
|
|
289
285
|
*
|
|
290
|
-
* @returns {
|
|
286
|
+
* @returns {LCDClient} The Initia native client.
|
|
291
287
|
*/
|
|
292
288
|
getLCDClient() {
|
|
293
289
|
return this.provider.native;
|
|
294
290
|
}
|
|
295
291
|
/**
|
|
296
292
|
* Executes a view function.
|
|
297
|
-
* @implements {MoveSdkImpl<
|
|
293
|
+
* @implements {MoveSdkImpl<MnemonicKey>}
|
|
298
294
|
*
|
|
299
295
|
* @param {Object} args - The arguments for the view function.
|
|
300
296
|
* @param {MoveFunction} args.functionName - The name of the function.
|
|
@@ -321,34 +317,33 @@ var SDK = class {
|
|
|
321
317
|
}
|
|
322
318
|
/**
|
|
323
319
|
* Normalizes the given signer.
|
|
324
|
-
* @implements {MoveSdkImpl<
|
|
320
|
+
* @implements {MoveSdkImpl<MnemonicKey>}
|
|
325
321
|
*
|
|
326
|
-
* @param {
|
|
327
|
-
* @returns {
|
|
322
|
+
* @param {MnemonicKey | PrivateKey | MnemonicAndPath} signer - The signer to normalize.
|
|
323
|
+
* @returns {MnemonicKey} The normalized signer.
|
|
328
324
|
*/
|
|
329
325
|
normalizeSigner(signer) {
|
|
330
|
-
if (signer instanceof
|
|
326
|
+
if (signer instanceof initia_js.MnemonicKey) {
|
|
331
327
|
return signer;
|
|
332
328
|
} else if (moveDefinitions.isMnemonicAndPath(signer)) {
|
|
333
329
|
const { mnemonic, path } = signer;
|
|
334
330
|
const [_, coinType, account, __, index] = path.match(/\d+/g)?.map(Number) ?? [];
|
|
335
|
-
return new
|
|
331
|
+
return new initia_js.MnemonicKey({
|
|
336
332
|
mnemonic,
|
|
337
333
|
coinType,
|
|
338
334
|
account,
|
|
339
|
-
index
|
|
340
|
-
eth: coinType === initia__default.default.INIT_COIN_TYPE
|
|
335
|
+
index
|
|
341
336
|
});
|
|
342
337
|
} else if (moveDefinitions.isPrivateKey(signer)) {
|
|
343
|
-
return
|
|
338
|
+
return initia_js.MnemonicKey.fromHex(signer);
|
|
344
339
|
}
|
|
345
340
|
throw new Error(`Invalid signer`);
|
|
346
341
|
}
|
|
347
342
|
/**
|
|
348
343
|
* Converts the given account to an address.
|
|
349
|
-
* @implements {MoveSdkImpl<
|
|
344
|
+
* @implements {MoveSdkImpl<MnemonicKey>}
|
|
350
345
|
*
|
|
351
|
-
* @param {
|
|
346
|
+
* @param {MnemonicKey} account - The account to convert.
|
|
352
347
|
* @returns {string} The address of the account.
|
|
353
348
|
*/
|
|
354
349
|
accountToAddress(account) {
|
|
@@ -365,10 +360,10 @@ var SDK = class {
|
|
|
365
360
|
if (anyAddress instanceof Uint8Array) {
|
|
366
361
|
anyAddress = Buffer.from(anyAddress).toString("hex");
|
|
367
362
|
}
|
|
368
|
-
if (
|
|
363
|
+
if (initia_js.AccAddress.validate(anyAddress)) {
|
|
369
364
|
return anyAddress;
|
|
370
365
|
}
|
|
371
|
-
return
|
|
366
|
+
return initia_js.AccAddress.fromHex(anyAddress);
|
|
372
367
|
}
|
|
373
368
|
/**
|
|
374
369
|
* Converts an address to a hexadecimal string.
|
|
@@ -380,8 +375,8 @@ var SDK = class {
|
|
|
380
375
|
if (anyAddress instanceof Uint8Array) {
|
|
381
376
|
anyAddress = Buffer.from(anyAddress).toString("hex");
|
|
382
377
|
}
|
|
383
|
-
if (
|
|
384
|
-
return
|
|
378
|
+
if (initia_js.AccAddress.validate(anyAddress)) {
|
|
379
|
+
return initia_js.AccAddress.toHex(anyAddress);
|
|
385
380
|
}
|
|
386
381
|
return anyAddress;
|
|
387
382
|
}
|
|
@@ -410,9 +405,9 @@ var SDK = class {
|
|
|
410
405
|
}
|
|
411
406
|
/**
|
|
412
407
|
* Sends a transaction and waits for confirmation.
|
|
413
|
-
* @implements {MoveSdkImpl<
|
|
408
|
+
* @implements {MoveSdkImpl<MnemonicKey>}
|
|
414
409
|
*
|
|
415
|
-
* @param {
|
|
410
|
+
* @param {MnemonicKey | PrivateKey | MnemonicAndPath} sender - The sender of the transaction.
|
|
416
411
|
* @param {MoveFunction} func - The function to call.
|
|
417
412
|
* @param {EntryFunctionArgumentTypes[]} args - The arguments for the function.
|
|
418
413
|
* @param {string[]} [argTypes] - The types of the arguments for the function.
|
|
@@ -454,7 +449,7 @@ var SDK = class {
|
|
|
454
449
|
}
|
|
455
450
|
/**
|
|
456
451
|
* Gets an account resource.
|
|
457
|
-
* @implements {MoveSdkImpl<
|
|
452
|
+
* @implements {MoveSdkImpl<MnemonicKey>}
|
|
458
453
|
*
|
|
459
454
|
* @param {Object} args - The arguments for getting the account resource.
|
|
460
455
|
* @param {string | Uint8Array} args.accountAddress - The account address.
|
|
@@ -477,7 +472,7 @@ var SDK = class {
|
|
|
477
472
|
}
|
|
478
473
|
/**
|
|
479
474
|
* Gets a table item.
|
|
480
|
-
* @implements {MoveSdkImpl<
|
|
475
|
+
* @implements {MoveSdkImpl<MnemonicKey>}
|
|
481
476
|
*
|
|
482
477
|
* @param {Object} args - The arguments for getting the table item.
|
|
483
478
|
* @param {string} args.handle - The table handle.
|
|
@@ -504,7 +499,7 @@ var SDK = class {
|
|
|
504
499
|
}
|
|
505
500
|
/**
|
|
506
501
|
* Normalizes the given address.
|
|
507
|
-
* @implements {MoveSdkImpl<
|
|
502
|
+
* @implements {MoveSdkImpl<MnemonicKey>}
|
|
508
503
|
*
|
|
509
504
|
* @param {string} address - The address to normalize.
|
|
510
505
|
* @returns {string} The normalized address.
|
|
@@ -514,7 +509,7 @@ var SDK = class {
|
|
|
514
509
|
}
|
|
515
510
|
/**
|
|
516
511
|
* Checks if the SDK supports coins.
|
|
517
|
-
* @implements {MoveSdkImpl<
|
|
512
|
+
* @implements {MoveSdkImpl<MnemonicKey>}
|
|
518
513
|
*
|
|
519
514
|
* @returns {boolean} True if the SDK supports coins, false otherwise.
|
|
520
515
|
*/
|