@socket.tech/dl-common 1.0.3-test.3 → 1.0.3-test.5
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/utils/idUtils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface PacketDetails {
|
|
2
2
|
chainSlug: number;
|
|
3
3
|
capacitorAddr: string;
|
|
4
|
-
|
|
4
|
+
packetCount: string;
|
|
5
5
|
}
|
|
6
6
|
export interface MessageDetails {
|
|
7
7
|
chainSlug: number;
|
|
@@ -10,5 +10,5 @@ export interface MessageDetails {
|
|
|
10
10
|
}
|
|
11
11
|
export declare const unpackPacketId: (packetId: string) => PacketDetails;
|
|
12
12
|
export declare const unpackMessageId: (messageId: string) => MessageDetails;
|
|
13
|
-
export declare const packPacketId: (chainSlug: number, capacitorAddr: string,
|
|
13
|
+
export declare const packPacketId: (chainSlug: number, capacitorAddr: string, packetCount: string) => string;
|
|
14
14
|
export declare function encodePacketId(chainSlug: number, capacitorAddress: string, packetCount: number): string;
|
package/dist/utils/idUtils.js
CHANGED
|
@@ -9,11 +9,11 @@ const unpackPacketId = (packetId) => {
|
|
|
9
9
|
const slugLength = packetId.length - 58;
|
|
10
10
|
const chainSlug = parseInt(ethers_1.BigNumber.from(`0x${packetId.substring(2, 2 + slugLength)}`).toString());
|
|
11
11
|
const capacitorAddr = (0, address_1.toLowerCase)(`0x${packetId.substring(2 + slugLength, 40 + 2 + slugLength)}`);
|
|
12
|
-
const
|
|
12
|
+
const packetCount = ethers_1.BigNumber.from(`0x${packetId.substring(40 + 2 + slugLength)}`).toString();
|
|
13
13
|
return {
|
|
14
14
|
chainSlug,
|
|
15
15
|
capacitorAddr,
|
|
16
|
-
|
|
16
|
+
packetCount,
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
exports.unpackPacketId = unpackPacketId;
|
|
@@ -30,8 +30,8 @@ const unpackMessageId = (messageId) => {
|
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
32
|
exports.unpackMessageId = unpackMessageId;
|
|
33
|
-
const packPacketId = (chainSlug, capacitorAddr,
|
|
34
|
-
const nonce = ethers_1.BigNumber.from(
|
|
33
|
+
const packPacketId = (chainSlug, capacitorAddr, packetCount) => {
|
|
34
|
+
const nonce = ethers_1.BigNumber.from(packetCount).toHexString();
|
|
35
35
|
const nonceHex = nonce.length <= 16 ? (0, utils_1.hexZeroPad)(nonce, 8).substring(2) : nonce.substring(2);
|
|
36
36
|
const slug = ethers_1.BigNumber.from(chainSlug).toHexString();
|
|
37
37
|
const slugHex = slug.length <= 10 ? (0, utils_1.hexZeroPad)(slug, 4) : slug;
|