@layerzerolabs/chain-utils 0.2.89 → 0.2.91
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/package.json +16 -12
- package/dist/KHVGLVR5.cjs +0 -44
- package/dist/KHVGLVR5.cjs.map +0 -1
- package/dist/QMTEJOZE.cjs +0 -553
- package/dist/QMTEJOZE.cjs.map +0 -1
- package/dist/ZZHCL54L.cjs +0 -1347
- package/dist/ZZHCL54L.cjs.map +0 -1
- package/dist/addressParser.cjs +0 -45
- package/dist/addressParser.cjs.map +0 -1
- package/dist/addressParser.test.cjs +0 -19017
- package/dist/addressParser.test.cjs.map +0 -1
- package/dist/index.cjs +0 -46
- package/dist/index.cjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layerzerolabs/chain-utils",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.91",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
|
-
"require": "./dist/index.cjs",
|
|
10
9
|
"import": "./dist/index.js",
|
|
11
|
-
"default": "./dist/index.
|
|
10
|
+
"default": "./dist/index.js"
|
|
12
11
|
},
|
|
13
|
-
"main": "./dist/index.
|
|
12
|
+
"main": "./dist/index.js",
|
|
14
13
|
"module": "./dist/index.js",
|
|
15
14
|
"types": "./dist/index.d.ts",
|
|
16
15
|
"files": [
|
|
@@ -21,23 +20,28 @@
|
|
|
21
20
|
"@stellar/stellar-sdk": "^14.1.1",
|
|
22
21
|
"@ton/core": "^0.59.0",
|
|
23
22
|
"bs58": "^5.0.0",
|
|
24
|
-
"@layerzerolabs/
|
|
25
|
-
"@layerzerolabs/
|
|
26
|
-
"@layerzerolabs/
|
|
27
|
-
"@layerzerolabs/
|
|
28
|
-
"@layerzerolabs/
|
|
23
|
+
"@layerzerolabs/common-chain-model": "0.2.91",
|
|
24
|
+
"@layerzerolabs/address-utils-ton": "0.2.91",
|
|
25
|
+
"@layerzerolabs/static-chain-info": "0.2.91",
|
|
26
|
+
"@layerzerolabs/common-encoding-utils": "0.2.91",
|
|
27
|
+
"@layerzerolabs/layerzero-definitions": "0.2.91"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
30
|
"tsup": "^8.4.0",
|
|
32
31
|
"vitest": "^3.2.3",
|
|
33
|
-
"@layerzerolabs/tsup-configuration": "0.2.
|
|
34
|
-
"@layerzerolabs/typescript-configuration": "0.2.
|
|
35
|
-
"@layerzerolabs/typescript-utils": "0.2.
|
|
32
|
+
"@layerzerolabs/tsup-configuration": "0.2.91",
|
|
33
|
+
"@layerzerolabs/typescript-configuration": "0.2.91",
|
|
34
|
+
"@layerzerolabs/typescript-utils": "0.2.91"
|
|
36
35
|
},
|
|
37
36
|
"publishConfig": {
|
|
38
37
|
"access": "public",
|
|
39
38
|
"registry": "https://registry.npmjs.org/"
|
|
40
39
|
},
|
|
40
|
+
"externalRepoConfig": {
|
|
41
|
+
"targets": [
|
|
42
|
+
"console-pen-test"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
41
45
|
"scripts": {
|
|
42
46
|
"build": "tsup",
|
|
43
47
|
"lint": "eslint . --max-warnings 0 || (eslint . --fix --max-warnings 0 && false)",
|
package/dist/KHVGLVR5.cjs
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
10
|
-
var __esm = (fn, res) => function __init() {
|
|
11
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
12
|
-
};
|
|
13
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
14
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
-
};
|
|
16
|
-
var __copyProps = (to, from, except, desc) => {
|
|
17
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
-
for (let key of __getOwnPropNames(from))
|
|
19
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
-
}
|
|
22
|
-
return to;
|
|
23
|
-
};
|
|
24
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
-
mod
|
|
31
|
-
));
|
|
32
|
-
|
|
33
|
-
// ../../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.2_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.8.2_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js
|
|
34
|
-
var init_cjs_shims = __esm({
|
|
35
|
-
"../../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.2_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.8.2_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js"() {
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
exports.__commonJS = __commonJS;
|
|
40
|
-
exports.__name = __name;
|
|
41
|
-
exports.__toESM = __toESM;
|
|
42
|
-
exports.init_cjs_shims = init_cjs_shims;
|
|
43
|
-
//# sourceMappingURL=KHVGLVR5.cjs.map
|
|
44
|
-
//# sourceMappingURL=KHVGLVR5.cjs.map
|
package/dist/KHVGLVR5.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.2_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.8.2_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,cAAA,GAAA,KAAA,CAAA","file":"KHVGLVR5.cjs","sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n"]}
|
package/dist/QMTEJOZE.cjs
DELETED
|
@@ -1,553 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var KHVGLVR5_cjs = require('./KHVGLVR5.cjs');
|
|
4
|
-
var initia_js = require('@initia/initia.js');
|
|
5
|
-
var stellarSdk = require('@stellar/stellar-sdk');
|
|
6
|
-
var bs58 = require('bs58');
|
|
7
|
-
var addressUtilsTon = require('@layerzerolabs/address-utils-ton');
|
|
8
|
-
var commonChainModel = require('@layerzerolabs/common-chain-model');
|
|
9
|
-
var commonEncodingUtils = require('@layerzerolabs/common-encoding-utils');
|
|
10
|
-
var layerzeroDefinitions = require('@layerzerolabs/layerzero-definitions');
|
|
11
|
-
var staticChainInfo = require('@layerzerolabs/static-chain-info');
|
|
12
|
-
|
|
13
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
|
|
15
|
-
var bs58__default = /*#__PURE__*/_interopDefault(bs58);
|
|
16
|
-
|
|
17
|
-
// src/addressParser.ts
|
|
18
|
-
KHVGLVR5_cjs.init_cjs_shims();
|
|
19
|
-
var AddressEncoding = /* @__PURE__ */ (function(AddressEncoding2) {
|
|
20
|
-
AddressEncoding2["HEX"] = "hex";
|
|
21
|
-
AddressEncoding2["BASE58"] = "base58";
|
|
22
|
-
AddressEncoding2["TON"] = "ton";
|
|
23
|
-
AddressEncoding2["INITIA"] = "initia";
|
|
24
|
-
AddressEncoding2["STELLAR"] = "stellar";
|
|
25
|
-
return AddressEncoding2;
|
|
26
|
-
})({});
|
|
27
|
-
function addressParser(chainName) {
|
|
28
|
-
if (chainName === layerzeroDefinitions.ChainName.TON) return tonAddressParser(chainName);
|
|
29
|
-
if (chainName === layerzeroDefinitions.ChainName.SOLANA) return base58AddressParser(chainName);
|
|
30
|
-
if (chainName === layerzeroDefinitions.ChainName.INITIA) return initiaAddressParser(chainName);
|
|
31
|
-
if (chainName === layerzeroDefinitions.ChainName.STELLAR) return stellarAddressParser(chainName);
|
|
32
|
-
if (chainName === layerzeroDefinitions.ChainName.STARKNET) return starknetAddressParser(chainName);
|
|
33
|
-
if (chainName === layerzeroDefinitions.ChainName.CANTON) return cantonAddressParser(chainName);
|
|
34
|
-
return hexAddressParser(chainName);
|
|
35
|
-
}
|
|
36
|
-
KHVGLVR5_cjs.__name(addressParser, "addressParser");
|
|
37
|
-
(function(addressParser2) {
|
|
38
|
-
addressParser2.normalizedToUnpaddedString = (address) => {
|
|
39
|
-
return address.toString();
|
|
40
|
-
};
|
|
41
|
-
addressParser2.normalizedToBigInt = (address) => {
|
|
42
|
-
return BigInt(address);
|
|
43
|
-
};
|
|
44
|
-
addressParser2.parseNative = (nativeAddress) => {
|
|
45
|
-
return addressParser2(nativeAddress.chainName).parseNative(nativeAddress.nativeAddress);
|
|
46
|
-
};
|
|
47
|
-
})(addressParser || (addressParser = {}));
|
|
48
|
-
function assertNative(nativeAddress, expectedChainName) {
|
|
49
|
-
if (!addressParser(expectedChainName).validateNative(nativeAddress)) {
|
|
50
|
-
throw new Error('Cannot convert: "' + nativeAddress + '" - The native address does not match the expected format for the chain: ' + expectedChainName);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
KHVGLVR5_cjs.__name(assertNative, "assertNative");
|
|
54
|
-
var getAddress = /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
55
|
-
return typeof nativeAddress === "object" ? nativeAddress.nativeAddress : nativeAddress;
|
|
56
|
-
}, "getAddress");
|
|
57
|
-
var tonAddressParser = /* @__PURE__ */ KHVGLVR5_cjs.__name((chainName) => {
|
|
58
|
-
return {
|
|
59
|
-
validateNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
60
|
-
if (nativeAddress === void 0) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
try {
|
|
64
|
-
addressUtilsTon.parseTonAddress(nativeAddress);
|
|
65
|
-
return true;
|
|
66
|
-
} catch {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
}, "validateNative"),
|
|
70
|
-
normalizedToNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
71
|
-
if (address === void 0) return void 0;
|
|
72
|
-
const numericalValue = addressParser.normalizedToBigInt(address);
|
|
73
|
-
return {
|
|
74
|
-
// TODO: use Base64 native format instead of hex for TON addresses
|
|
75
|
-
nativeAddress: addressUtilsTon.bigintToAddress(numericalValue).toString(),
|
|
76
|
-
chainName
|
|
77
|
-
};
|
|
78
|
-
}, "normalizedToNative"),
|
|
79
|
-
normalizedToNativeString: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
80
|
-
if (address === void 0) return void 0;
|
|
81
|
-
return addressParser(chainName).normalizedToNative(address).nativeAddress;
|
|
82
|
-
}, "normalizedToNativeString"),
|
|
83
|
-
nativeToNormalized: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
84
|
-
if (nativeAddress === void 0) return void 0;
|
|
85
|
-
const address = getAddress(nativeAddress);
|
|
86
|
-
assertNative(address, chainName);
|
|
87
|
-
return commonChainModel.normalizeHex(addressUtilsTon.addressToHex(address));
|
|
88
|
-
}, "nativeToNormalized"),
|
|
89
|
-
nativeToBytes32Hex: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
90
|
-
if (nativeAddress === void 0) return void 0;
|
|
91
|
-
return commonEncodingUtils.hexZeroPad(addressParser(chainName).nativeToNormalized(nativeAddress), 32);
|
|
92
|
-
}, "nativeToBytes32Hex"),
|
|
93
|
-
nativeToBytes: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
94
|
-
if (nativeAddress === void 0) return void 0;
|
|
95
|
-
return commonEncodingUtils.hexToBytes(addressParser(chainName).nativeToBytes32Hex(nativeAddress));
|
|
96
|
-
}, "nativeToBytes"),
|
|
97
|
-
nativeToBytes32: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
98
|
-
if (nativeAddress === void 0) return void 0;
|
|
99
|
-
return commonEncodingUtils.hexToBytes(addressParser(chainName).nativeToBytes32Hex(nativeAddress));
|
|
100
|
-
}, "nativeToBytes32"),
|
|
101
|
-
normalizedToBytes32Hex: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
102
|
-
if (address === void 0) return void 0;
|
|
103
|
-
return commonEncodingUtils.hexZeroPad(address, 32);
|
|
104
|
-
}, "normalizedToBytes32Hex"),
|
|
105
|
-
normalizedToBytes32: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
106
|
-
if (address === void 0) return void 0;
|
|
107
|
-
return commonEncodingUtils.hexToBytes(addressParser(chainName).normalizedToBytes32Hex(address));
|
|
108
|
-
}, "normalizedToBytes32"),
|
|
109
|
-
bytes32ToNormalized: /* @__PURE__ */ KHVGLVR5_cjs.__name((bytes32Hex) => {
|
|
110
|
-
if (bytes32Hex === void 0) return void 0;
|
|
111
|
-
return commonChainModel.normalizeHex(bytes32Hex);
|
|
112
|
-
}, "bytes32ToNormalized"),
|
|
113
|
-
parseNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
114
|
-
assertNative(nativeAddress, chainName);
|
|
115
|
-
return addressParser(chainName).nativeToNormalized(nativeAddress);
|
|
116
|
-
}, "parseNative"),
|
|
117
|
-
parseNativeToUnpaddedHex: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
118
|
-
return addressParser(chainName).parseNative(nativeAddress);
|
|
119
|
-
}, "parseNativeToUnpaddedHex"),
|
|
120
|
-
tonToNormalized: /* @__PURE__ */ KHVGLVR5_cjs.__name((tonAddress) => {
|
|
121
|
-
return addressParser(chainName).parseNative(addressUtilsTon.addressToHex(tonAddress));
|
|
122
|
-
}, "tonToNormalized"),
|
|
123
|
-
encoding: "ton"
|
|
124
|
-
};
|
|
125
|
-
}, "tonAddressParser");
|
|
126
|
-
var initiaAddressParser = /* @__PURE__ */ KHVGLVR5_cjs.__name((chainName) => {
|
|
127
|
-
return {
|
|
128
|
-
validateNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
129
|
-
if (nativeAddress === void 0) {
|
|
130
|
-
return false;
|
|
131
|
-
}
|
|
132
|
-
try {
|
|
133
|
-
return commonEncodingUtils.isHexString(nativeAddress) || /^(init)1(['qpzry9x8gf2tvdw0s3jn54khce6mua7l]{38,66})$/.test(nativeAddress);
|
|
134
|
-
} catch {
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
}, "validateNative"),
|
|
138
|
-
normalizedToNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
139
|
-
if (address === void 0) {
|
|
140
|
-
return void 0;
|
|
141
|
-
}
|
|
142
|
-
return {
|
|
143
|
-
nativeAddress: initia_js.AccAddress.fromHex(address),
|
|
144
|
-
chainName
|
|
145
|
-
};
|
|
146
|
-
}, "normalizedToNative"),
|
|
147
|
-
normalizedToNativeString: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
148
|
-
if (address === void 0) return void 0;
|
|
149
|
-
return addressParser(chainName).normalizedToNative(address).nativeAddress;
|
|
150
|
-
}, "normalizedToNativeString"),
|
|
151
|
-
nativeToNormalized: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
152
|
-
if (nativeAddress === void 0) return void 0;
|
|
153
|
-
const address = getAddress(nativeAddress);
|
|
154
|
-
assertNative(address, chainName);
|
|
155
|
-
if (commonEncodingUtils.isHexString(address)) {
|
|
156
|
-
return commonChainModel.normalizeHex(address);
|
|
157
|
-
}
|
|
158
|
-
return commonChainModel.normalizeHex(initia_js.AccAddress.toHex(nativeAddress.toString()));
|
|
159
|
-
}, "nativeToNormalized"),
|
|
160
|
-
nativeToBytes32Hex: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
161
|
-
if (nativeAddress === void 0) return void 0;
|
|
162
|
-
return commonEncodingUtils.hexZeroPad(addressParser(chainName).nativeToNormalized(nativeAddress), 32);
|
|
163
|
-
}, "nativeToBytes32Hex"),
|
|
164
|
-
nativeToBytes: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
165
|
-
if (nativeAddress === void 0) return void 0;
|
|
166
|
-
return commonEncodingUtils.hexToBytes(addressParser(chainName).nativeToBytes32Hex(nativeAddress));
|
|
167
|
-
}, "nativeToBytes"),
|
|
168
|
-
nativeToBytes32: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
169
|
-
if (nativeAddress === void 0) return void 0;
|
|
170
|
-
return commonEncodingUtils.hexToBytes(addressParser(chainName).nativeToBytes32Hex(nativeAddress));
|
|
171
|
-
}, "nativeToBytes32"),
|
|
172
|
-
normalizedToBytes32Hex: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
173
|
-
if (address === void 0) return void 0;
|
|
174
|
-
return commonEncodingUtils.hexZeroPad(address, 32);
|
|
175
|
-
}, "normalizedToBytes32Hex"),
|
|
176
|
-
normalizedToBytes32: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
177
|
-
if (address === void 0) return void 0;
|
|
178
|
-
return commonEncodingUtils.hexToBytes(addressParser(chainName).normalizedToBytes32Hex(address));
|
|
179
|
-
}, "normalizedToBytes32"),
|
|
180
|
-
bytes32ToNormalized: /* @__PURE__ */ KHVGLVR5_cjs.__name((bytes32Hex) => {
|
|
181
|
-
if (bytes32Hex === void 0) return void 0;
|
|
182
|
-
return commonChainModel.normalizeHex(bytes32Hex);
|
|
183
|
-
}, "bytes32ToNormalized"),
|
|
184
|
-
parseNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
185
|
-
assertNative(nativeAddress, chainName);
|
|
186
|
-
return addressParser(chainName).nativeToNormalized(nativeAddress);
|
|
187
|
-
}, "parseNative"),
|
|
188
|
-
parseNativeToUnpaddedHex: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
189
|
-
return addressParser(chainName).parseNative(nativeAddress);
|
|
190
|
-
}, "parseNativeToUnpaddedHex"),
|
|
191
|
-
encoding: "initia"
|
|
192
|
-
};
|
|
193
|
-
}, "initiaAddressParser");
|
|
194
|
-
var base58AddressParser = /* @__PURE__ */ KHVGLVR5_cjs.__name((chainName) => {
|
|
195
|
-
return {
|
|
196
|
-
validateNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
197
|
-
if (nativeAddress === void 0) return false;
|
|
198
|
-
return commonEncodingUtils.isBase58(nativeAddress);
|
|
199
|
-
}, "validateNative"),
|
|
200
|
-
normalizedToNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
201
|
-
if (address === void 0) return void 0;
|
|
202
|
-
return {
|
|
203
|
-
nativeAddress: bs58__default.default.encode(commonEncodingUtils.hexToBytes(address)),
|
|
204
|
-
chainName
|
|
205
|
-
};
|
|
206
|
-
}, "normalizedToNative"),
|
|
207
|
-
normalizedToNativeString: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
208
|
-
if (address === void 0) return void 0;
|
|
209
|
-
return addressParser(chainName).normalizedToNative(address).nativeAddress;
|
|
210
|
-
}, "normalizedToNativeString"),
|
|
211
|
-
nativeToNormalized: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
212
|
-
if (nativeAddress === void 0) return void 0;
|
|
213
|
-
const address = getAddress(nativeAddress);
|
|
214
|
-
assertNative(address, chainName);
|
|
215
|
-
const hex = commonEncodingUtils.bytesToHexPrefixed(bs58__default.default.decode(address));
|
|
216
|
-
return commonChainModel.normalizeHex(hex);
|
|
217
|
-
}, "nativeToNormalized"),
|
|
218
|
-
nativeToBytes32Hex: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
219
|
-
if (nativeAddress === void 0) return void 0;
|
|
220
|
-
return commonEncodingUtils.hexZeroPad(addressParser(chainName).nativeToNormalized(nativeAddress), 32);
|
|
221
|
-
}, "nativeToBytes32Hex"),
|
|
222
|
-
nativeToBytes: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
223
|
-
if (nativeAddress === void 0) return void 0;
|
|
224
|
-
const address = getAddress(nativeAddress);
|
|
225
|
-
assertNative(address, chainName);
|
|
226
|
-
return bs58__default.default.decode(address);
|
|
227
|
-
}, "nativeToBytes"),
|
|
228
|
-
nativeToBytes32: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
229
|
-
if (nativeAddress === void 0) return void 0;
|
|
230
|
-
return commonEncodingUtils.hexToBytes(addressParser(chainName).nativeToBytes32Hex(nativeAddress));
|
|
231
|
-
}, "nativeToBytes32"),
|
|
232
|
-
normalizedToBytes32Hex: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
233
|
-
if (address === void 0) return void 0;
|
|
234
|
-
return commonEncodingUtils.hexZeroPad(address, 32);
|
|
235
|
-
}, "normalizedToBytes32Hex"),
|
|
236
|
-
normalizedToBytes32: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
237
|
-
if (address === void 0) return void 0;
|
|
238
|
-
return commonEncodingUtils.hexToBytes(addressParser(chainName).normalizedToBytes32Hex(address));
|
|
239
|
-
}, "normalizedToBytes32"),
|
|
240
|
-
bytes32ToNormalized: /* @__PURE__ */ KHVGLVR5_cjs.__name((bytes32Hex) => {
|
|
241
|
-
if (bytes32Hex === void 0) return void 0;
|
|
242
|
-
return commonChainModel.normalizeHex(bytes32Hex);
|
|
243
|
-
}, "bytes32ToNormalized"),
|
|
244
|
-
parseNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
245
|
-
assertNative(nativeAddress, chainName);
|
|
246
|
-
return addressParser(chainName).nativeToNormalized(nativeAddress);
|
|
247
|
-
}, "parseNative"),
|
|
248
|
-
parseNativeToUnpaddedHex: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
249
|
-
return addressParser(chainName).parseNative(nativeAddress);
|
|
250
|
-
}, "parseNativeToUnpaddedHex"),
|
|
251
|
-
encoding: "base58"
|
|
252
|
-
};
|
|
253
|
-
}, "base58AddressParser");
|
|
254
|
-
var hexAddressParser = /* @__PURE__ */ KHVGLVR5_cjs.__name((chainName) => {
|
|
255
|
-
return {
|
|
256
|
-
validateNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
257
|
-
if (nativeAddress === void 0) return false;
|
|
258
|
-
return commonEncodingUtils.isHexString(nativeAddress);
|
|
259
|
-
}, "validateNative"),
|
|
260
|
-
normalizedToNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
261
|
-
if (address === void 0) return void 0;
|
|
262
|
-
const nativeByteLength = staticChainInfo.StaticChainConfigs.getAddressSizeInBytes(chainName);
|
|
263
|
-
return {
|
|
264
|
-
// we could have EIP-55 here, but omitted for now
|
|
265
|
-
nativeAddress: commonEncodingUtils.hexZeroPad(address, nativeByteLength),
|
|
266
|
-
chainName
|
|
267
|
-
};
|
|
268
|
-
}, "normalizedToNative"),
|
|
269
|
-
normalizedToNativeString: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
270
|
-
if (address === void 0) return void 0;
|
|
271
|
-
const nativeByteLength = staticChainInfo.StaticChainConfigs.getAddressSizeInBytes(chainName);
|
|
272
|
-
return commonEncodingUtils.hexZeroPad(address, nativeByteLength);
|
|
273
|
-
}, "normalizedToNativeString"),
|
|
274
|
-
nativeToNormalized: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
275
|
-
if (nativeAddress === void 0) return void 0;
|
|
276
|
-
const address = getAddress(nativeAddress);
|
|
277
|
-
assertNative(address, chainName);
|
|
278
|
-
return commonChainModel.normalizeHex(address);
|
|
279
|
-
}, "nativeToNormalized"),
|
|
280
|
-
nativeToBytes: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
281
|
-
if (nativeAddress === void 0) return void 0;
|
|
282
|
-
const address = getAddress(nativeAddress);
|
|
283
|
-
assertNative(address, chainName);
|
|
284
|
-
return commonEncodingUtils.hexToBytes(address);
|
|
285
|
-
}, "nativeToBytes"),
|
|
286
|
-
nativeToBytes32Hex: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
287
|
-
if (nativeAddress === void 0) return void 0;
|
|
288
|
-
const address = getAddress(nativeAddress);
|
|
289
|
-
assertNative(address, chainName);
|
|
290
|
-
return commonEncodingUtils.hexZeroPad(address, 32);
|
|
291
|
-
}, "nativeToBytes32Hex"),
|
|
292
|
-
nativeToBytes32: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
293
|
-
if (nativeAddress === void 0) return void 0;
|
|
294
|
-
return commonEncodingUtils.hexToBytes(addressParser(chainName).nativeToBytes32Hex(nativeAddress));
|
|
295
|
-
}, "nativeToBytes32"),
|
|
296
|
-
normalizedToBytes32Hex: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
297
|
-
if (address === void 0) return void 0;
|
|
298
|
-
return commonEncodingUtils.hexZeroPad(address, 32);
|
|
299
|
-
}, "normalizedToBytes32Hex"),
|
|
300
|
-
normalizedToBytes32: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
301
|
-
if (address === void 0) return void 0;
|
|
302
|
-
return commonEncodingUtils.hexToBytes(addressParser(chainName).normalizedToBytes32Hex(address));
|
|
303
|
-
}, "normalizedToBytes32"),
|
|
304
|
-
bytes32ToNormalized: /* @__PURE__ */ KHVGLVR5_cjs.__name((bytes32Hex) => {
|
|
305
|
-
if (bytes32Hex === void 0) return void 0;
|
|
306
|
-
return commonChainModel.normalizeHex(bytes32Hex);
|
|
307
|
-
}, "bytes32ToNormalized"),
|
|
308
|
-
parseNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
309
|
-
if (chainName === layerzeroDefinitions.ChainName.TRON && nativeAddress) {
|
|
310
|
-
nativeAddress = nativeAddress.startsWith("41") ? `0x${nativeAddress.slice(2)}` : nativeAddress;
|
|
311
|
-
}
|
|
312
|
-
assertNative(nativeAddress, chainName);
|
|
313
|
-
return addressParser(chainName).nativeToNormalized(nativeAddress);
|
|
314
|
-
}, "parseNative"),
|
|
315
|
-
parseNativeToUnpaddedHex: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
316
|
-
return addressParser(chainName).parseNative(nativeAddress);
|
|
317
|
-
}, "parseNativeToUnpaddedHex"),
|
|
318
|
-
encoding: "hex"
|
|
319
|
-
};
|
|
320
|
-
}, "hexAddressParser");
|
|
321
|
-
var BYTES32_HEX_LENGTH = 64;
|
|
322
|
-
var hexToStellarNative = /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
323
|
-
if (!address || !address.startsWith("0x") || !commonEncodingUtils.isHexString(address)) return address;
|
|
324
|
-
const hexPayload = address.slice(2);
|
|
325
|
-
if (hexPayload.length !== BYTES32_HEX_LENGTH) {
|
|
326
|
-
throw new Error(`Stellar hex address must be exactly 32 bytes (${BYTES32_HEX_LENGTH} hex chars), got ${hexPayload.length}: ${address}`);
|
|
327
|
-
}
|
|
328
|
-
const raw = Buffer.from(hexPayload, "hex");
|
|
329
|
-
return stellarSdk.StrKey.encodeContract(raw);
|
|
330
|
-
}, "hexToStellarNative");
|
|
331
|
-
var stellarAddressParser = /* @__PURE__ */ KHVGLVR5_cjs.__name((chainName) => {
|
|
332
|
-
const isValidStellarAddress = /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
333
|
-
if (!address) return false;
|
|
334
|
-
return stellarSdk.StrKey.isValidEd25519PublicKey(address) || stellarSdk.StrKey.isValidContract(address) || stellarSdk.StrKey.isValidMed25519PublicKey(address) || stellarSdk.StrKey.isValidLiquidityPool(address) || stellarSdk.StrKey.isValidClaimableBalance(address) || stellarSdk.StrKey.isValidSignedPayload(address);
|
|
335
|
-
}, "isValidStellarAddress");
|
|
336
|
-
const stellarTextEncoder = new TextEncoder();
|
|
337
|
-
const stellarAsciiToNormalized = /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
338
|
-
const bytes = stellarTextEncoder.encode(address);
|
|
339
|
-
return commonChainModel.normalizeHex(commonEncodingUtils.bytesToHexPrefixed(bytes));
|
|
340
|
-
}, "stellarAsciiToNormalized");
|
|
341
|
-
const stellarTextDecoder = new TextDecoder();
|
|
342
|
-
const normalizedToStellarAscii = /* @__PURE__ */ KHVGLVR5_cjs.__name((normalizedHex) => {
|
|
343
|
-
const bytes = commonEncodingUtils.hexToBytes(normalizedHex);
|
|
344
|
-
return stellarTextDecoder.decode(bytes);
|
|
345
|
-
}, "normalizedToStellarAscii");
|
|
346
|
-
return {
|
|
347
|
-
validateNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
348
|
-
if (nativeAddress === void 0) return false;
|
|
349
|
-
return isValidStellarAddress(nativeAddress);
|
|
350
|
-
}, "validateNative"),
|
|
351
|
-
normalizedToNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
352
|
-
if (address === void 0) return void 0;
|
|
353
|
-
const stellarAddress = normalizedToStellarAscii(address);
|
|
354
|
-
return {
|
|
355
|
-
nativeAddress: stellarAddress,
|
|
356
|
-
chainName
|
|
357
|
-
};
|
|
358
|
-
}, "normalizedToNative"),
|
|
359
|
-
normalizedToNativeString: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
360
|
-
if (address === void 0) return void 0;
|
|
361
|
-
return normalizedToStellarAscii(address);
|
|
362
|
-
}, "normalizedToNativeString"),
|
|
363
|
-
nativeToNormalized: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
364
|
-
if (nativeAddress === void 0) return void 0;
|
|
365
|
-
const address = getAddress(nativeAddress);
|
|
366
|
-
assertNative(address, chainName);
|
|
367
|
-
return stellarAsciiToNormalized(address);
|
|
368
|
-
}, "nativeToNormalized"),
|
|
369
|
-
nativeToBytes32Hex: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
370
|
-
if (nativeAddress === void 0) return void 0;
|
|
371
|
-
const address = getAddress(nativeAddress);
|
|
372
|
-
assertNative(address, chainName);
|
|
373
|
-
let rawBytes;
|
|
374
|
-
if (stellarSdk.StrKey.isValidEd25519PublicKey(address)) {
|
|
375
|
-
rawBytes = stellarSdk.StrKey.decodeEd25519PublicKey(address);
|
|
376
|
-
} else if (stellarSdk.StrKey.isValidContract(address)) {
|
|
377
|
-
rawBytes = stellarSdk.StrKey.decodeContract(address);
|
|
378
|
-
} else if (stellarSdk.StrKey.isValidLiquidityPool(address)) {
|
|
379
|
-
rawBytes = stellarSdk.StrKey.decodeLiquidityPool(address);
|
|
380
|
-
} else if (stellarSdk.StrKey.isValidClaimableBalance(address)) {
|
|
381
|
-
const fullBytes = stellarSdk.StrKey.decodeClaimableBalance(address);
|
|
382
|
-
rawBytes = fullBytes.subarray(1);
|
|
383
|
-
} else if (stellarSdk.StrKey.isValidMed25519PublicKey(address)) {
|
|
384
|
-
throw new Error("nativeToBytes32 is not supported for Stellar muxed addresses (M...)");
|
|
385
|
-
} else if (stellarSdk.StrKey.isValidSignedPayload(address)) {
|
|
386
|
-
throw new Error("nativeToBytes32 is not supported for Stellar signed payload addresses (P...)");
|
|
387
|
-
} else {
|
|
388
|
-
throw new Error(`Unknown Stellar address type: ${address}`);
|
|
389
|
-
}
|
|
390
|
-
return commonEncodingUtils.bytesToHexPrefixed(rawBytes);
|
|
391
|
-
}, "nativeToBytes32Hex"),
|
|
392
|
-
nativeToBytes: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
393
|
-
if (nativeAddress === void 0) return void 0;
|
|
394
|
-
const address = getAddress(nativeAddress);
|
|
395
|
-
assertNative(address, chainName);
|
|
396
|
-
return stellarTextEncoder.encode(address);
|
|
397
|
-
}, "nativeToBytes"),
|
|
398
|
-
nativeToBytes32: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
399
|
-
if (nativeAddress === void 0) return void 0;
|
|
400
|
-
const hex = addressParser(chainName).nativeToBytes32Hex(nativeAddress);
|
|
401
|
-
return commonEncodingUtils.hexToBytes(hex);
|
|
402
|
-
}, "nativeToBytes32"),
|
|
403
|
-
normalizedToBytes32Hex: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
404
|
-
if (address === void 0) return void 0;
|
|
405
|
-
return addressParser(chainName).nativeToBytes32Hex(addressParser(chainName).normalizedToNativeString(address));
|
|
406
|
-
}, "normalizedToBytes32Hex"),
|
|
407
|
-
normalizedToBytes32: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
408
|
-
if (address === void 0) return void 0;
|
|
409
|
-
return commonEncodingUtils.hexToBytes(addressParser(chainName).normalizedToBytes32Hex(address));
|
|
410
|
-
}, "normalizedToBytes32"),
|
|
411
|
-
bytes32ToNormalized: /* @__PURE__ */ KHVGLVR5_cjs.__name((bytes32Hex) => {
|
|
412
|
-
if (bytes32Hex === void 0) return void 0;
|
|
413
|
-
return stellarAsciiToNormalized(stellarSdk.StrKey.encodeContract(Buffer.from(commonEncodingUtils.hexToBytes(bytes32Hex))));
|
|
414
|
-
}, "bytes32ToNormalized"),
|
|
415
|
-
parseNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
416
|
-
nativeAddress = hexToStellarNative(nativeAddress);
|
|
417
|
-
assertNative(nativeAddress, chainName);
|
|
418
|
-
return addressParser(chainName).nativeToNormalized(nativeAddress);
|
|
419
|
-
}, "parseNative"),
|
|
420
|
-
parseNativeToUnpaddedHex: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
421
|
-
nativeAddress = hexToStellarNative(nativeAddress);
|
|
422
|
-
assertNative(nativeAddress, chainName);
|
|
423
|
-
const normalized = addressParser(chainName).nativeToNormalized(nativeAddress);
|
|
424
|
-
return normalized;
|
|
425
|
-
}, "parseNativeToUnpaddedHex"),
|
|
426
|
-
encoding: "stellar"
|
|
427
|
-
};
|
|
428
|
-
}, "stellarAddressParser");
|
|
429
|
-
var CANTON_PARTY_ID_REGEX = /^(.+)::([0-9a-fA-F]+)$/;
|
|
430
|
-
var CANTON_FINGERPRINT_HEX_LENGTH = 68;
|
|
431
|
-
var CANTON_CONTRACT_ID_HEX_LENGTH = 138;
|
|
432
|
-
var CANTON_TYPE_CONTRACT = "00";
|
|
433
|
-
var CANTON_TYPE_PARTY = "01";
|
|
434
|
-
var matchCantonPartyId = /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
435
|
-
const match = CANTON_PARTY_ID_REGEX.exec(nativeAddress);
|
|
436
|
-
if (!match) return null;
|
|
437
|
-
const [, hint, fingerprint] = match;
|
|
438
|
-
return {
|
|
439
|
-
hint,
|
|
440
|
-
fingerprint
|
|
441
|
-
};
|
|
442
|
-
}, "matchCantonPartyId");
|
|
443
|
-
var cantonAddressParser = /* @__PURE__ */ KHVGLVR5_cjs.__name((chainName) => {
|
|
444
|
-
const base = hexAddressParser(chainName);
|
|
445
|
-
const extractCantonAddress = /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
446
|
-
const party = matchCantonPartyId(nativeAddress);
|
|
447
|
-
if (party) {
|
|
448
|
-
const hintHex = Buffer.from(party.hint, "utf-8").toString("hex");
|
|
449
|
-
return `0x${party.fingerprint}${hintHex}`;
|
|
450
|
-
}
|
|
451
|
-
const hex = nativeAddress.startsWith("0x") ? nativeAddress : `0x${nativeAddress}`;
|
|
452
|
-
return hex.toLowerCase();
|
|
453
|
-
}, "extractCantonAddress");
|
|
454
|
-
const normalizeCantonAddress = /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
455
|
-
const party = matchCantonPartyId(nativeAddress);
|
|
456
|
-
if (party) {
|
|
457
|
-
const hintHex = Buffer.from(party.hint, "utf-8").toString("hex");
|
|
458
|
-
return commonChainModel.normalizeHex(`0x${party.fingerprint}${hintHex}${CANTON_TYPE_PARTY}`);
|
|
459
|
-
}
|
|
460
|
-
const bare = nativeAddress.startsWith("0x") ? nativeAddress.slice(2) : nativeAddress;
|
|
461
|
-
return commonChainModel.normalizeHex(`0x${bare}${CANTON_TYPE_CONTRACT}`);
|
|
462
|
-
}, "normalizeCantonAddress");
|
|
463
|
-
const reconstructCantonAddress = /* @__PURE__ */ KHVGLVR5_cjs.__name((hex) => {
|
|
464
|
-
const body = hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
465
|
-
const typeByte = body.slice(-2);
|
|
466
|
-
const payload = body.slice(0, -2);
|
|
467
|
-
if (typeByte === CANTON_TYPE_PARTY) {
|
|
468
|
-
const fingerprint = payload.slice(0, CANTON_FINGERPRINT_HEX_LENGTH);
|
|
469
|
-
const hintHex = payload.slice(CANTON_FINGERPRINT_HEX_LENGTH);
|
|
470
|
-
const hint = Buffer.from(hintHex, "hex").toString("utf-8");
|
|
471
|
-
return `${hint}::${fingerprint}`;
|
|
472
|
-
}
|
|
473
|
-
if (typeByte === CANTON_TYPE_CONTRACT) {
|
|
474
|
-
return payload.padStart(CANTON_CONTRACT_ID_HEX_LENGTH, "0");
|
|
475
|
-
}
|
|
476
|
-
throw new Error(`Cannot reconstruct Canton address from normalized hex: ${hex}`);
|
|
477
|
-
}, "reconstructCantonAddress");
|
|
478
|
-
return {
|
|
479
|
-
...base,
|
|
480
|
-
validateNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
481
|
-
if (nativeAddress === void 0) return false;
|
|
482
|
-
return commonEncodingUtils.isHexString(nativeAddress) || matchCantonPartyId(nativeAddress) !== null;
|
|
483
|
-
}, "validateNative"),
|
|
484
|
-
normalizedToNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
485
|
-
if (address === void 0) return void 0;
|
|
486
|
-
return {
|
|
487
|
-
nativeAddress: reconstructCantonAddress(address),
|
|
488
|
-
chainName
|
|
489
|
-
};
|
|
490
|
-
}, "normalizedToNative"),
|
|
491
|
-
normalizedToNativeString: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
492
|
-
if (address === void 0) return void 0;
|
|
493
|
-
return reconstructCantonAddress(address);
|
|
494
|
-
}, "normalizedToNativeString"),
|
|
495
|
-
nativeToNormalized: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
496
|
-
if (nativeAddress === void 0) return void 0;
|
|
497
|
-
return normalizeCantonAddress(nativeAddress);
|
|
498
|
-
}, "nativeToNormalized"),
|
|
499
|
-
nativeToBytes: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
500
|
-
if (nativeAddress === void 0) return void 0;
|
|
501
|
-
const address = extractCantonAddress(nativeAddress);
|
|
502
|
-
return commonEncodingUtils.hexToBytes(address);
|
|
503
|
-
}, "nativeToBytes"),
|
|
504
|
-
nativeToBytes32Hex: /* @__PURE__ */ KHVGLVR5_cjs.__name((_nativeAddress) => {
|
|
505
|
-
return void 0;
|
|
506
|
-
}, "nativeToBytes32Hex"),
|
|
507
|
-
parseNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
508
|
-
if (nativeAddress === void 0) return void 0;
|
|
509
|
-
return normalizeCantonAddress(nativeAddress);
|
|
510
|
-
}, "parseNative"),
|
|
511
|
-
parseNativeToUnpaddedHex: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
512
|
-
return addressParser(chainName).parseNative(nativeAddress);
|
|
513
|
-
}, "parseNativeToUnpaddedHex")
|
|
514
|
-
};
|
|
515
|
-
}, "cantonAddressParser");
|
|
516
|
-
var starknetAddressParser = /* @__PURE__ */ KHVGLVR5_cjs.__name((chainName) => {
|
|
517
|
-
return {
|
|
518
|
-
...hexAddressParser(chainName),
|
|
519
|
-
validateNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
520
|
-
if (nativeAddress === void 0) return false;
|
|
521
|
-
return commonEncodingUtils.isHexString(nativeAddress);
|
|
522
|
-
}, "validateNative"),
|
|
523
|
-
parseNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((nativeAddress) => {
|
|
524
|
-
if (nativeAddress === void 0) return void 0;
|
|
525
|
-
nativeAddress = `0x${BigInt(nativeAddress).toString(16)}`;
|
|
526
|
-
assertNative(nativeAddress, chainName);
|
|
527
|
-
return addressParser(chainName).nativeToNormalized(nativeAddress);
|
|
528
|
-
}, "parseNative"),
|
|
529
|
-
normalizedToNative: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
530
|
-
if (address === void 0) return void 0;
|
|
531
|
-
return {
|
|
532
|
-
nativeAddress: address,
|
|
533
|
-
chainName
|
|
534
|
-
};
|
|
535
|
-
}, "normalizedToNative"),
|
|
536
|
-
normalizedToNativeString: /* @__PURE__ */ KHVGLVR5_cjs.__name((address) => {
|
|
537
|
-
if (address === void 0) return void 0;
|
|
538
|
-
return address;
|
|
539
|
-
}, "normalizedToNativeString")
|
|
540
|
-
};
|
|
541
|
-
}, "starknetAddressParser");
|
|
542
|
-
|
|
543
|
-
exports.AddressEncoding = AddressEncoding;
|
|
544
|
-
exports.addressParser = addressParser;
|
|
545
|
-
exports.base58AddressParser = base58AddressParser;
|
|
546
|
-
exports.cantonAddressParser = cantonAddressParser;
|
|
547
|
-
exports.hexAddressParser = hexAddressParser;
|
|
548
|
-
exports.initiaAddressParser = initiaAddressParser;
|
|
549
|
-
exports.starknetAddressParser = starknetAddressParser;
|
|
550
|
-
exports.stellarAddressParser = stellarAddressParser;
|
|
551
|
-
exports.tonAddressParser = tonAddressParser;
|
|
552
|
-
//# sourceMappingURL=QMTEJOZE.cjs.map
|
|
553
|
-
//# sourceMappingURL=QMTEJOZE.cjs.map
|