@orbinum/sdk 0.21.1 → 0.22.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/dist/index.js CHANGED
@@ -21,8 +21,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  AccountId: () => import_substrate_bindings3.AccountId,
24
- AccountMappingModule: () => AccountMappingModule,
25
- AccountMappingPrecompile: () => AccountMappingPrecompile,
26
24
  BABYJUB_SUBORDER: () => BABYJUB_SUBORDER,
27
25
  BN254_R: () => BN254_R,
28
26
  Blake2256: () => import_substrate_bindings3.Blake2256,
@@ -45,12 +43,10 @@ __export(index_exports, {
45
43
  PrivacyKeyManager: () => PrivacyKeyManager,
46
44
  PrivacyModule: () => PrivacyModule,
47
45
  RelayerStatusModule: () => RelayerStatusModule,
48
- SLIP0044_NAMESPACE: () => SLIP0044_NAMESPACE,
49
46
  SPENDING_KEY_VERIFYING_CONTRACT: () => SPENDING_KEY_VERIFYING_CONTRACT,
50
47
  SPENDING_KEY_WARNING: () => SPENDING_KEY_WARNING,
51
48
  ShieldedPoolModule: () => ShieldedPoolModule,
52
49
  ShieldedPoolPrecompile: () => ShieldedPoolPrecompile,
53
- SignatureScheme: () => SignatureScheme,
54
50
  Storage: () => import_substrate_bindings3.Storage,
55
51
  SubstrateClient: () => SubstrateClient,
56
52
  VaultLockedError: () => VaultLockedError,
@@ -107,7 +103,7 @@ __export(index_exports, {
107
103
  getPolkadotSigner: () => import_signer.getPolkadotSigner,
108
104
  getPolkadotSignerFromPjs: () => import_pjs_signer.getPolkadotSignerFromPjs,
109
105
  getPrecompileLabel: () => getPrecompileLabel,
110
- getSs58AddressInfo: () => import_polkadot_api5.getSs58AddressInfo,
106
+ getSs58AddressInfo: () => import_polkadot_api4.getSs58AddressInfo,
111
107
  hexToBigint: () => hexToBigint,
112
108
  hexToNumber: () => hexToNumber,
113
109
  implicitSubstrateToEvm: () => implicitSubstrateToEvm,
@@ -283,7 +279,7 @@ var SubstrateClient = class _SubstrateClient {
283
279
  }
284
280
  /**
285
281
  * Performs a raw JSON-RPC request. Use this for custom Orbinum RPCs
286
- * (shieldedPool_*, accountMapping_*, privacy_*, etc.).
282
+ * (shieldedPool_*, privacy_*, etc.).
287
283
  */
288
284
  async request(method, params = []) {
289
285
  return this._papi._request(method, params);
@@ -1864,389 +1860,6 @@ var ShieldedPoolModule = class {
1864
1860
  }
1865
1861
  };
1866
1862
 
1867
- // src/account-mapping/AccountMappingModule.ts
1868
- var import_polkadot_api3 = require("polkadot-api");
1869
-
1870
- // src/account-mapping/helpers.ts
1871
- function mapRawScheme(raw) {
1872
- if (raw === "Eip191" || raw === "eip191") return "Eip191";
1873
- if (raw === "Ed25519" || raw === "ed25519") return "Ed25519";
1874
- return raw;
1875
- }
1876
-
1877
- // src/account-mapping/AccountMappingModule.ts
1878
- var AccountMappingModule = class {
1879
- constructor(substrate) {
1880
- this.substrate = substrate;
1881
- }
1882
- substrate;
1883
- // ─── Address resolution ─────────────────────────────────────────────────────
1884
- /**
1885
- * Returns the explicitly mapped (or fallback) Substrate AccountId32 hex for
1886
- * an EVM address. `mapped` is set only when `map_account` was called.
1887
- * `fallback` is always the EeSuffix rule: `H160 ++ [0x00; 12]`.
1888
- */
1889
- async getAccountAddresses(accountId) {
1890
- try {
1891
- const raw = await this.substrate.request(
1892
- "accountMapping_getAccountAddresses",
1893
- [accountId]
1894
- );
1895
- return { mapped: raw.mapped ?? null, fallback: raw.fallback ?? null };
1896
- } catch {
1897
- return { mapped: null, fallback: null };
1898
- }
1899
- }
1900
- /**
1901
- * Returns the explicitly mapped Substrate AccountId32 hex for a given EVM
1902
- * address, or null if no explicit mapping exists.
1903
- */
1904
- async getMappedAccount(evmAddress) {
1905
- try {
1906
- return await this.substrate.request("accountMapping_getMappedAccount", [
1907
- normalizeEvmAddress(evmAddress)
1908
- ]);
1909
- } catch {
1910
- return null;
1911
- }
1912
- }
1913
- // ─── Alias queries ──────────────────────────────────────────────────────────
1914
- /**
1915
- * Resolves "@alias" to basic info (owner, optional EVM address, link count).
1916
- * Accepts the alias with or without the leading "@".
1917
- */
1918
- async resolveAlias(alias) {
1919
- try {
1920
- const raw = await this.substrate.request(
1921
- "accountMapping_resolveAlias",
1922
- [alias]
1923
- );
1924
- if (!raw) return null;
1925
- return {
1926
- owner: raw.substrate_account,
1927
- evmAddress: raw.evm_address ? normalizeEvmAddress(raw.evm_address) : null,
1928
- chainLinksCount: raw.chain_links_count
1929
- };
1930
- } catch {
1931
- return null;
1932
- }
1933
- }
1934
- /**
1935
- * Returns the alias registered for the given Substrate AccountId32 hex, or null.
1936
- */
1937
- async getAliasOf(accountId) {
1938
- try {
1939
- return await this.substrate.request("accountMapping_getAliasOf", [
1940
- accountId
1941
- ]);
1942
- } catch {
1943
- return null;
1944
- }
1945
- }
1946
- // ─── Full identity ──────────────────────────────────────────────────────────
1947
- /**
1948
- * Resolves "@alias" to its full identity: owner, EVM address, all public
1949
- * chain links, and profile metadata.
1950
- */
1951
- async resolveFullIdentity(alias) {
1952
- try {
1953
- const raw = await this.substrate.request(
1954
- "accountMapping_resolveFullIdentity",
1955
- [alias]
1956
- );
1957
- if (!raw) return null;
1958
- return {
1959
- owner: raw.owner,
1960
- evmAddress: raw.evm_address ? normalizeEvmAddress(raw.evm_address) : null,
1961
- chainLinks: raw.chain_links.map((l) => ({
1962
- chainId: l.chain_id,
1963
- address: l.address
1964
- })),
1965
- metadata: raw.metadata ? {
1966
- displayName: raw.metadata.display_name ?? null,
1967
- bio: raw.metadata.bio ?? null,
1968
- avatar: raw.metadata.avatar ?? null
1969
- } : null
1970
- };
1971
- } catch {
1972
- return null;
1973
- }
1974
- }
1975
- /**
1976
- * Returns the profile metadata for a given Substrate AccountId32 hex, or null.
1977
- */
1978
- async getAccountMetadata(accountId) {
1979
- try {
1980
- const raw = await this.substrate.request(
1981
- "accountMapping_getAccountMetadata",
1982
- [accountId]
1983
- );
1984
- if (!raw) return null;
1985
- return {
1986
- displayName: raw.display_name ?? null,
1987
- bio: raw.bio ?? null,
1988
- avatar: raw.avatar ?? null
1989
- };
1990
- } catch {
1991
- return null;
1992
- }
1993
- }
1994
- // ─── Chain links ────────────────────────────────────────────────────────────
1995
- /**
1996
- * Returns the owner AccountId32 hex of a verified multichain link, or null.
1997
- */
1998
- async getLinkOwner(chainId, address) {
1999
- try {
2000
- return await this.substrate.request("accountMapping_getLinkOwner", [
2001
- chainId,
2002
- address
2003
- ]);
2004
- } catch {
2005
- return null;
2006
- }
2007
- }
2008
- /**
2009
- * Returns all blockchain networks supported for verified cross-chain links.
2010
- */
2011
- async getSupportedChains() {
2012
- try {
2013
- const raw = await this.substrate.request(
2014
- "accountMapping_getSupportedChains",
2015
- []
2016
- );
2017
- return raw.map(([chainId, scheme]) => ({
2018
- chainId,
2019
- scheme: mapRawScheme(scheme)
2020
- }));
2021
- } catch {
2022
- return [];
2023
- }
2024
- }
2025
- // ─── Private links ──────────────────────────────────────────────────────────
2026
- /**
2027
- * Returns the private link commitments registered for an alias.
2028
- * Real addresses are never exposed. Returns null if the alias does not exist.
2029
- */
2030
- async getPrivateLinks(alias) {
2031
- try {
2032
- const raw = await this.substrate.request(
2033
- "accountMapping_getPrivateLinks",
2034
- [alias]
2035
- );
2036
- if (!raw) return null;
2037
- return raw.map((r) => ({ chainId: r.chain_id, commitment: r.commitment }));
2038
- } catch {
2039
- return null;
2040
- }
2041
- }
2042
- /**
2043
- * Returns true if the given commitment is registered as a private link for the alias.
2044
- */
2045
- async hasPrivateLink(alias, commitment) {
2046
- try {
2047
- return await this.substrate.request("accountMapping_hasPrivateLink", [
2048
- alias,
2049
- commitment
2050
- ]);
2051
- } catch {
2052
- return false;
2053
- }
2054
- }
2055
- // ─── Marketplace ────────────────────────────────────────────────────────────
2056
- /**
2057
- * Returns listing info if the alias is currently for sale, or null.
2058
- */
2059
- async getListingInfo(alias) {
2060
- try {
2061
- const raw = await this.substrate.request(
2062
- "accountMapping_getListingInfo",
2063
- [alias]
2064
- );
2065
- if (!raw) return null;
2066
- return {
2067
- price: BigInt(raw.price),
2068
- private: raw.private,
2069
- whitelistCount: raw.whitelist_count
2070
- };
2071
- } catch {
2072
- return null;
2073
- }
2074
- }
2075
- /**
2076
- * Returns the alias and its listing if the given account currently has an
2077
- * alias listed for sale. Returns null otherwise.
2078
- */
2079
- async getAccountListing(accountId) {
2080
- try {
2081
- const raw = await this.substrate.request(
2082
- "accountMapping_getAccountListing",
2083
- [accountId]
2084
- );
2085
- if (!raw) return null;
2086
- return {
2087
- alias: raw.alias,
2088
- listing: {
2089
- price: BigInt(raw.price),
2090
- private: raw.private,
2091
- whitelistCount: raw.whitelist_count
2092
- }
2093
- };
2094
- } catch {
2095
- return null;
2096
- }
2097
- }
2098
- /**
2099
- * Returns whether a specific buyer can purchase the given alias right now.
2100
- */
2101
- async canBuy(alias, buyerAccountId) {
2102
- try {
2103
- return await this.substrate.request("accountMapping_canBuy", [
2104
- alias,
2105
- buyerAccountId
2106
- ]);
2107
- } catch {
2108
- return false;
2109
- }
2110
- }
2111
- // ─── Extrinsics ─────────────────────────────────────────────────────────────
2112
- /**
2113
- * Creates an explicit EVM → Substrate account mapping.
2114
- * Stores an explicit `MappedAccounts` entry for the caller's H160.
2115
- * Extrinsic: accountMapping.mapAccount()
2116
- */
2117
- async mapAccount(signer) {
2118
- const entry = resolveTx(this.substrate.unsafe, "accountMapping", "mapAccount");
2119
- const tx = callUnsafeTx(entry);
2120
- return toTxResult(await tx.signAndSubmit(signer));
2121
- }
2122
- /**
2123
- * Removes the EVM → Substrate mapping for the caller.
2124
- * Extrinsic: accountMapping.unmapAccount()
2125
- */
2126
- async unmapAccount(signer) {
2127
- const entry = resolveTx(this.substrate.unsafe, "accountMapping", "unmapAccount");
2128
- const tx = callUnsafeTx(entry);
2129
- return toTxResult(await tx.signAndSubmit(signer));
2130
- }
2131
- /**
2132
- * Registers a unique @alias for the caller.
2133
- * Requires a deposit. The alias must be 3–32 ASCII lowercase alphanumeric chars + hyphens.
2134
- * Extrinsic: accountMapping.registerAlias(alias)
2135
- */
2136
- async registerAlias(alias, signer) {
2137
- const entry = resolveTx(this.substrate.unsafe, "accountMapping", "registerAlias");
2138
- const tx = callUnsafeTx(entry, import_polkadot_api3.Binary.fromText(alias));
2139
- return toTxResult(await tx.signAndSubmit(signer));
2140
- }
2141
- /**
2142
- * Releases the caller's alias and recovers the deposit.
2143
- * Extrinsic: accountMapping.releaseAlias()
2144
- */
2145
- async releaseAlias(signer) {
2146
- const entry = resolveTx(this.substrate.unsafe, "accountMapping", "releaseAlias");
2147
- const tx = callUnsafeTx(entry);
2148
- return toTxResult(await tx.signAndSubmit(signer));
2149
- }
2150
- /**
2151
- * Transfers the caller's alias to another account.
2152
- * Extrinsic: accountMapping.transferAlias(newOwner)
2153
- */
2154
- async transferAlias(newOwnerHex, signer) {
2155
- const entry = resolveTx(this.substrate.unsafe, "accountMapping", "transferAlias");
2156
- const tx = callUnsafeTx(entry, newOwnerHex);
2157
- return toTxResult(await tx.signAndSubmit(signer));
2158
- }
2159
- /**
2160
- * Adds a verified public link to an external-chain wallet.
2161
- *
2162
- * `params.signature` must be produced by the external wallet over the caller's
2163
- * AccountId32 bytes:
2164
- * - EIP-191 (EVM): sign(keccak256("\x19Ethereum Signed Message:\n32" + accountId32))
2165
- * - Ed25519 (Solana): sign(accountId32 bytes)
2166
- *
2167
- * Extrinsic: accountMapping.addChainLink(chainId, address, signature)
2168
- */
2169
- async addChainLink(params, signer) {
2170
- const entry = resolveTx(this.substrate.unsafe, "accountMapping", "addChainLink");
2171
- const tx = callUnsafeTx(entry, params.chainId, params.address, params.signature);
2172
- return toTxResult(await tx.signAndSubmit(signer));
2173
- }
2174
- /**
2175
- * Removes the external-chain link for the given chain ID.
2176
- * Extrinsic: accountMapping.removeChainLink(chainId)
2177
- */
2178
- async removeChainLink(chainId, signer) {
2179
- const entry = resolveTx(this.substrate.unsafe, "accountMapping", "removeChainLink");
2180
- const tx = callUnsafeTx(entry, chainId);
2181
- return toTxResult(await tx.signAndSubmit(signer));
2182
- }
2183
- /**
2184
- * Updates the caller's public profile metadata.
2185
- * Extrinsic: accountMapping.setAccountMetadata(displayName, bio, avatar)
2186
- */
2187
- async setAccountMetadata(params, signer) {
2188
- const entry = resolveTx(this.substrate.unsafe, "accountMapping", "setAccountMetadata");
2189
- const encode2 = (v) => v != null ? import_polkadot_api3.Binary.fromText(v) : void 0;
2190
- const tx = callUnsafeTx(
2191
- entry,
2192
- encode2(params.displayName),
2193
- encode2(params.bio),
2194
- encode2(params.avatar)
2195
- );
2196
- return toTxResult(await tx.signAndSubmit(signer));
2197
- }
2198
- /**
2199
- * Lists the caller's alias for sale on the alias marketplace.
2200
- * Extrinsic: accountMapping.putAliasOnSale(price, isPrivate)
2201
- */
2202
- async putAliasOnSale(params, signer) {
2203
- const entry = resolveTx(this.substrate.unsafe, "accountMapping", "putAliasOnSale");
2204
- const tx = callUnsafeTx(entry, params.price.toString(), params.isPrivate);
2205
- return toTxResult(await tx.signAndSubmit(signer));
2206
- }
2207
- /**
2208
- * Cancels an active alias sale listing.
2209
- * Extrinsic: accountMapping.cancelSale()
2210
- */
2211
- async cancelSale(signer) {
2212
- const entry = resolveTx(this.substrate.unsafe, "accountMapping", "cancelSale");
2213
- const tx = callUnsafeTx(entry);
2214
- return toTxResult(await tx.signAndSubmit(signer));
2215
- }
2216
- /**
2217
- * Purchases an alias listed for sale.
2218
- * Extrinsic: accountMapping.buyAlias(alias)
2219
- */
2220
- async buyAlias(alias, signer) {
2221
- const entry = resolveTx(this.substrate.unsafe, "accountMapping", "buyAlias");
2222
- const tx = callUnsafeTx(entry, import_polkadot_api3.Binary.fromText(alias));
2223
- return toTxResult(await tx.signAndSubmit(signer));
2224
- }
2225
- /**
2226
- * Dispatches an arbitrary call on behalf of a linked external-chain wallet.
2227
- *
2228
- * This is the "Universal Proxy" feature that allows EVM/Solana wallets to
2229
- * authorize on-chain actions without holding a Substrate private key.
2230
- *
2231
- * The relayer (who pays gas) calls this with the external wallet's signature
2232
- * over the encoded call payload and the owner's AccountId32.
2233
- *
2234
- * Extrinsic: accountMapping.dispatchAsLinkedAccount(owner, chainId, address, signature, call)
2235
- */
2236
- async dispatchAsLinkedAccount(params, signer) {
2237
- const entry = resolveTx(this.substrate.unsafe, "accountMapping", "dispatchAsLinkedAccount");
2238
- const tx = callUnsafeTx(
2239
- entry,
2240
- params.owner,
2241
- params.chainId,
2242
- params.address,
2243
- params.signature,
2244
- params.callData
2245
- );
2246
- return toTxResult(await tx.signAndSubmit(signer));
2247
- }
2248
- };
2249
-
2250
1863
  // src/rpc-v2/ChainModule.ts
2251
1864
  var ChainModule = class {
2252
1865
  constructor(substrate) {
@@ -2615,20 +2228,6 @@ function decodeUint(data, offset = 0) {
2615
2228
  }
2616
2229
  return result;
2617
2230
  }
2618
- function decodeAddress2(data, offset = 0) {
2619
- return "0x" + toHex(data.slice(offset + 12, offset + 32)).slice(2);
2620
- }
2621
- function decodeBool(data, offset = 0) {
2622
- return data[offset + 31] !== 0;
2623
- }
2624
- function decodeBytes(data, slotOffset = 0) {
2625
- const dataOffset = Number(decodeUint(data, slotOffset));
2626
- const length = Number(decodeUint(data, dataOffset));
2627
- return data.slice(dataOffset + 32, dataOffset + 32 + length);
2628
- }
2629
- function decodeString(data, slotOffset = 0) {
2630
- return new TextDecoder().decode(decodeBytes(data, slotOffset));
2631
- }
2632
2231
 
2633
2232
  // src/precompiles/addresses.ts
2634
2233
  var PRECOMPILE_ADDR = {
@@ -2644,48 +2243,8 @@ var PRECOMPILE_ADDR = {
2644
2243
  CURVE25519_ADD: "0x0000000000000000000000000000000000000402",
2645
2244
  CURVE25519_SCALAR_MUL: "0x0000000000000000000000000000000000000403",
2646
2245
  // ── Orbinum custom ───────────────────────────────────────────────────────
2647
- ACCOUNT_MAPPING: "0x0000000000000000000000000000000000000800",
2648
2246
  SHIELDED_POOL: "0x0000000000000000000000000000000000000801"
2649
2247
  };
2650
- var AM_SEL = {
2651
- // ── Read-only ─────────────────────────────────────────────────────────────
2652
- // resolveAlias(string) → 0xd03149ab
2653
- RESOLVE_ALIAS: new Uint8Array([208, 49, 73, 171]),
2654
- // getAliasOf(address) → 0x7a0ed62c
2655
- GET_ALIAS_OF: new Uint8Array([122, 14, 214, 44]),
2656
- // hasPrivateLink(string,bytes32) → 0x47e05c6c
2657
- HAS_PRIVATE_LINK: new Uint8Array([71, 224, 92, 108]),
2658
- // ── No-argument writes ────────────────────────────────────────────────────
2659
- // mapAccount() → 0xdca49d0e
2660
- MAP_ACCOUNT: new Uint8Array([220, 164, 157, 14]),
2661
- // unmapAccount() → 0x08f57367
2662
- UNMAP_ACCOUNT: new Uint8Array([8, 245, 115, 103]),
2663
- // releaseAlias() → 0x7fac359e
2664
- RELEASE_ALIAS: new Uint8Array([127, 172, 53, 158]),
2665
- // cancelSale() → 0x4d023ab9
2666
- CANCEL_SALE: new Uint8Array([77, 2, 58, 185]),
2667
- // ── Writes with arguments ─────────────────────────────────────────────────
2668
- // registerAlias(string) → 0x2f8839c3
2669
- REGISTER_ALIAS: new Uint8Array([47, 136, 57, 195]),
2670
- // transferAlias(address) → 0x5ac998e7
2671
- TRANSFER_ALIAS: new Uint8Array([90, 201, 152, 231]),
2672
- // buyAlias(string) → 0x1625df3a
2673
- BUY_ALIAS: new Uint8Array([22, 37, 223, 58]),
2674
- // putAliasOnSale(uint256,address[]) → 0x32091192
2675
- PUT_ALIAS_ON_SALE: new Uint8Array([50, 9, 17, 146]),
2676
- // removeChainLink(uint32) → 0x6f579c0c
2677
- REMOVE_CHAIN_LINK: new Uint8Array([111, 87, 156, 12]),
2678
- // addChainLink(uint32,bytes,bytes) → 0x5f3e837c
2679
- ADD_CHAIN_LINK: new Uint8Array([95, 62, 131, 124]),
2680
- // registerPrivateLink(uint32,bytes32) → 0xc04e98f4
2681
- REGISTER_PRIVATE_LINK: new Uint8Array([192, 78, 152, 244]),
2682
- // removePrivateLink(bytes32) → 0xdfd8b57e
2683
- REMOVE_PRIVATE_LINK: new Uint8Array([223, 216, 181, 126]),
2684
- // revealPrivateLink(bytes32,bytes,bytes32,bytes) → 0x4df1f33d
2685
- REVEAL_PRIVATE_LINK: new Uint8Array([77, 241, 243, 61]),
2686
- // setAccountMetadata(bytes,bytes,bytes) → 0x776cf9ff
2687
- SET_ACCOUNT_METADATA: new Uint8Array([119, 108, 249, 255])
2688
- };
2689
2248
  var SP_SEL = {
2690
2249
  // shield(uint32,bytes32,bytes) → 0x9feb22ea (payable, amount = msg.value)
2691
2250
  SHIELD: new Uint8Array([159, 235, 34, 234]),
@@ -2712,28 +2271,6 @@ var KNOWN_PRECOMPILES = {
2712
2271
  "0x0000000000000000000000000000000000000402": { name: "Curve25519Add", functions: {} },
2713
2272
  "0x0000000000000000000000000000000000000403": { name: "Curve25519ScalarMul", functions: {} },
2714
2273
  // ── Orbinum custom ───────────────────────────────────────────────────────
2715
- "0x0000000000000000000000000000000000000800": {
2716
- name: "AccountMapping",
2717
- functions: {
2718
- d03149ab: "resolveAlias(string)",
2719
- "7a0ed62c": "getAliasOf(address)",
2720
- "47e05c6c": "hasPrivateLink(string,bytes32)",
2721
- dca49d0e: "mapAccount()",
2722
- "08f57367": "unmapAccount()",
2723
- "7fac359e": "releaseAlias()",
2724
- "4d023ab9": "cancelSale()",
2725
- "2f8839c3": "registerAlias(string)",
2726
- "5ac998e7": "transferAlias(address)",
2727
- "1625df3a": "buyAlias(string)",
2728
- "32091192": "putAliasOnSale(uint256,address[])",
2729
- "6f579c0c": "removeChainLink(uint32)",
2730
- "5f3e837c": "addChainLink(uint32,bytes,bytes)",
2731
- c04e98f4: "registerPrivateLink(uint32,bytes32)",
2732
- dfd8b57e: "removePrivateLink(bytes32)",
2733
- "4df1f33d": "revealPrivateLink(bytes32,bytes,bytes32,bytes)",
2734
- "776cf9ff": "setAccountMetadata(bytes,bytes,bytes)"
2735
- }
2736
- },
2737
2274
  "0x0000000000000000000000000000000000000801": {
2738
2275
  name: "ShieldedPool",
2739
2276
  functions: {
@@ -2982,266 +2519,6 @@ var ShieldedPoolPrecompile = class {
2982
2519
  }
2983
2520
  };
2984
2521
 
2985
- // src/precompiles/AccountMappingPrecompile.ts
2986
- var AccountMappingPrecompile = class {
2987
- constructor(evm) {
2988
- this.evm = evm;
2989
- }
2990
- evm;
2991
- addr = PRECOMPILE_ADDR.ACCOUNT_MAPPING;
2992
- // ─── Read-only ─────────────────────────────────────────────────────────────
2993
- /**
2994
- * Resolves `@alias` to its owner EVM address (and optionally a secondary EVM address).
2995
- *
2996
- * Returns `(address owner, address evmAddress)` — two 32-byte ABI-encoded slots.
2997
- * `evmAddress` is zero-address (`0x000...0`) if the owner has no explicit EVM address.
2998
- */
2999
- async resolveAlias(alias) {
3000
- try {
3001
- const data = encodeHex(AM_SEL.RESOLVE_ALIAS, { type: "string", value: alias });
3002
- const raw = fromHex(await this.evm.call(this.addr, data));
3003
- if (raw.length < 64) return null;
3004
- const owner = decodeAddress2(raw, 0);
3005
- const evm = decodeAddress2(raw, 32);
3006
- const ZERO = "0x0000000000000000000000000000000000000000";
3007
- return {
3008
- owner,
3009
- evmAddress: evm === ZERO ? null : normalizeEvmAddress(evm)
3010
- };
3011
- } catch {
3012
- return null;
3013
- }
3014
- }
3015
- /**
3016
- * Returns the alias registered for the given EVM address, or null.
3017
- * The precompile ABI encodes the alias as `bytes` (UTF-8).
3018
- */
3019
- async getAliasOf(evmAddress) {
3020
- try {
3021
- const data = encodeHex(AM_SEL.GET_ALIAS_OF, {
3022
- type: "address",
3023
- value: normalizeEvmAddress(evmAddress)
3024
- });
3025
- const raw = fromHex(await this.evm.call(this.addr, data));
3026
- if (raw.length === 0) return null;
3027
- const alias = decodeString(raw, 0);
3028
- return alias.length > 0 ? alias : null;
3029
- } catch {
3030
- return null;
3031
- }
3032
- }
3033
- /**
3034
- * Returns true if the given Poseidon commitment is registered as a private
3035
- * link for the given alias.
3036
- */
3037
- async hasPrivateLink(alias, commitment) {
3038
- try {
3039
- const commitmentBytes = fromHex(ensureHexPrefix(commitment));
3040
- const data = encodeHex(
3041
- AM_SEL.HAS_PRIVATE_LINK,
3042
- { type: "string", value: alias },
3043
- { type: "bytes32", value: commitmentBytes }
3044
- );
3045
- const raw = fromHex(await this.evm.call(this.addr, data));
3046
- if (raw.length < 32) return false;
3047
- return decodeBool(raw, 0);
3048
- } catch {
3049
- return false;
3050
- }
3051
- }
3052
- // ─── No-arg writes ─────────────────────────────────────────────────────────
3053
- /**
3054
- * Creates an explicit EVM → Substrate account mapping for the signer's address.
3055
- * Extrinsic: `accountMapping.mapAccount()`
3056
- */
3057
- async mapAccount(signer) {
3058
- return signer({ to: this.addr, data: encodeHex(AM_SEL.MAP_ACCOUNT) });
3059
- }
3060
- /**
3061
- * Removes the EVM → Substrate mapping for the signer's address.
3062
- * Extrinsic: `accountMapping.unmapAccount()`
3063
- */
3064
- async unmapAccount(signer) {
3065
- return signer({ to: this.addr, data: encodeHex(AM_SEL.UNMAP_ACCOUNT) });
3066
- }
3067
- /**
3068
- * Releases the signer's registered alias, recovering the deposit.
3069
- * Extrinsic: `accountMapping.releaseAlias()`
3070
- */
3071
- async releaseAlias(signer) {
3072
- return signer({ to: this.addr, data: encodeHex(AM_SEL.RELEASE_ALIAS) });
3073
- }
3074
- /**
3075
- * Cancels an active alias sale listing.
3076
- * Extrinsic: `accountMapping.cancelSale()`
3077
- */
3078
- async cancelSale(signer) {
3079
- return signer({ to: this.addr, data: encodeHex(AM_SEL.CANCEL_SALE) });
3080
- }
3081
- // ─── Writes with arguments ─────────────────────────────────────────────────
3082
- /**
3083
- * Registers a unique @alias for the signer's account.
3084
- * Requires a deposit. The alias must be 3–32 ASCII lowercase alphanumeric chars + hyphens.
3085
- * Extrinsic: `accountMapping.registerAlias(alias)`
3086
- */
3087
- async registerAlias(alias, signer) {
3088
- const data = encodeHex(AM_SEL.REGISTER_ALIAS, { type: "string", value: alias });
3089
- return signer({ to: this.addr, data });
3090
- }
3091
- /**
3092
- * Transfers the signer's alias to a new EVM `owner` address.
3093
- * Extrinsic: `accountMapping.transferAlias(newOwner)`
3094
- */
3095
- async transferAlias(newOwnerEvmAddress, signer) {
3096
- const data = encodeHex(AM_SEL.TRANSFER_ALIAS, {
3097
- type: "address",
3098
- value: normalizeEvmAddress(newOwnerEvmAddress)
3099
- });
3100
- return signer({ to: this.addr, data });
3101
- }
3102
- /**
3103
- * Purchases an alias currently listed for sale.
3104
- * Extrinsic: `accountMapping.buyAlias(alias)`
3105
- */
3106
- async buyAlias(alias, signer) {
3107
- const data = encodeHex(AM_SEL.BUY_ALIAS, { type: "string", value: alias });
3108
- return signer({ to: this.addr, data });
3109
- }
3110
- /**
3111
- * Lists the signer's alias for sale on the alias marketplace.
3112
- *
3113
- * @param price Asking price in planck (ORB).
3114
- * @param allowedBuyers Whitelist of EVM addresses allowed to buy.
3115
- * Pass an empty array for a public (open) listing.
3116
- * Extrinsic: `accountMapping.putAliasOnSale(price, allowedBuyers)`
3117
- */
3118
- async putAliasOnSale(price, allowedBuyers, signer) {
3119
- const data = encodeHex(
3120
- AM_SEL.PUT_ALIAS_ON_SALE,
3121
- { type: "uint", value: price },
3122
- { type: "address[]", value: allowedBuyers.map(normalizeEvmAddress) }
3123
- );
3124
- return signer({ to: this.addr, data });
3125
- }
3126
- /**
3127
- * Removes the external-chain link for the given chain ID.
3128
- * Extrinsic: `accountMapping.removeChainLink(chainId)`
3129
- */
3130
- async removeChainLink(chainId, signer) {
3131
- const data = encodeHex(AM_SEL.REMOVE_CHAIN_LINK, { type: "uint", value: BigInt(chainId) });
3132
- return signer({ to: this.addr, data });
3133
- }
3134
- /**
3135
- * Adds a verified public link to an external-chain wallet.
3136
- *
3137
- * @param chainId Orbinum chain ID (use `SLIP0044_NAMESPACE | coinType` for SLIP-0044).
3138
- * @param externalAddr External wallet address bytes (20 bytes for EVM, 32 for Solana).
3139
- * @param signature Signature over the caller's AccountId32:
3140
- * - EIP-191 (EVM): 65 bytes over keccak256("\x19Ethereum Signed Message:\n32" + accountId32)
3141
- * - Ed25519 (Solana): 64 bytes over the raw accountId32 bytes
3142
- *
3143
- * Extrinsic: `accountMapping.addChainLink(chainId, address, signature)`
3144
- */
3145
- async addChainLink(chainId, externalAddr, signature, signer) {
3146
- const data = encodeHex(
3147
- AM_SEL.ADD_CHAIN_LINK,
3148
- { type: "uint", value: BigInt(chainId) },
3149
- { type: "bytes", value: externalAddr },
3150
- { type: "bytes", value: signature }
3151
- );
3152
- return signer({ to: this.addr, data });
3153
- }
3154
- /**
3155
- * Registers a private chain link — only the Poseidon commitment is stored.
3156
- * The real external address is never revealed on-chain.
3157
- *
3158
- * @param chainId External chain ID.
3159
- * @param commitment 0x-prefixed 32-byte Poseidon commitment hex.
3160
- *
3161
- * Extrinsic: `accountMapping.registerPrivateLink(chainId, commitment)`
3162
- */
3163
- async registerPrivateLink(chainId, commitment, signer) {
3164
- const commitmentBytes = fromHex(
3165
- commitment.startsWith("0x") ? commitment : "0x" + commitment
3166
- );
3167
- const data = encodeHex(
3168
- AM_SEL.REGISTER_PRIVATE_LINK,
3169
- { type: "uint", value: BigInt(chainId) },
3170
- { type: "bytes32", value: commitmentBytes }
3171
- );
3172
- return signer({ to: this.addr, data });
3173
- }
3174
- /**
3175
- * Removes a private link by its commitment.
3176
- * Extrinsic: `accountMapping.removePrivateLink(commitment)`
3177
- */
3178
- async removePrivateLink(commitment, signer) {
3179
- const commitmentBytes = fromHex(
3180
- commitment.startsWith("0x") ? commitment : "0x" + commitment
3181
- );
3182
- const data = encodeHex(AM_SEL.REMOVE_PRIVATE_LINK, {
3183
- type: "bytes32",
3184
- value: commitmentBytes
3185
- });
3186
- return signer({ to: this.addr, data });
3187
- }
3188
- /**
3189
- * Reveals a private link publicly by providing the real address and blinding.
3190
- * After this call the link becomes a public chain link.
3191
- *
3192
- * @param commitment 32-byte commitment hex.
3193
- * @param address External address bytes (the actual wallet address).
3194
- * @param blinding 32-byte blinding factor used when computing the commitment.
3195
- * @param signature Signature over the AccountId32 bytes (same rules as `addChainLink`).
3196
- *
3197
- * Extrinsic: `accountMapping.revealPrivateLink(commitment, address, blinding, signature)`
3198
- */
3199
- async revealPrivateLink(commitment, address, blinding, signature, signer) {
3200
- const commitmentBytes = fromHex(
3201
- commitment.startsWith("0x") ? commitment : "0x" + commitment
3202
- );
3203
- const blindingBytes = fromHex(blinding.startsWith("0x") ? blinding : "0x" + blinding);
3204
- const data = encodeHex(
3205
- AM_SEL.REVEAL_PRIVATE_LINK,
3206
- { type: "bytes32", value: commitmentBytes },
3207
- { type: "bytes", value: address },
3208
- { type: "bytes32", value: blindingBytes },
3209
- { type: "bytes", value: signature }
3210
- );
3211
- return signer({ to: this.addr, data });
3212
- }
3213
- /**
3214
- * Updates the signer's public profile metadata.
3215
- * Pass `null` for any field to leave it unchanged.
3216
- }
3217
- displayName: string | null,
3218
- bio: string | null,
3219
- avatar: string | null,
3220
- signer: EvmSigner
3221
- ): Promise<string> {
3222
- const enc = (v: string | null): Uint8Array =>
3223
- v != null ? new TextEncoder().encode(v) : new Uint8Array(0);
3224
- const data = encodeHex(
3225
- AM_SEL.SET_ACCOUNT_METADATA,
3226
- { type: 'bytes', value: enc(displayName) },
3227
- { type: 'bytes', value: enc(bio) },
3228
- { type: 'bytes', value: enc(avatar) }
3229
- );
3230
- return signer({ to: this.addr, data });
3231
- }
3232
-
3233
- // ─── Calldata builders (for custom signing / batching) ─────────────────────
3234
-
3235
- /** Returns the raw ABI-encoded calldata for `registerAlias`. */
3236
- buildRegisterAliasCalldata(alias) {
3237
- return encodeHex(AM_SEL.REGISTER_ALIAS, { type: "string", value: alias });
3238
- }
3239
- /** Returns the raw ABI-encoded calldata for `mapAccount`. */
3240
- buildMapAccountCalldata() {
3241
- return encodeHex(AM_SEL.MAP_ACCOUNT);
3242
- }
3243
- };
3244
-
3245
2522
  // src/precompiles/CryptoPrecompiles.ts
3246
2523
  var CryptoPrecompiles = class {
3247
2524
  constructor(evm) {
@@ -3369,8 +2646,6 @@ var OrbinumClient = class _OrbinumClient {
3369
2646
  evmExplorer;
3370
2647
  /** Shielded-pool extrinsics and Merkle tree queries (`shield`, `unshield`, `privateTransfer`, …). */
3371
2648
  shieldedPool;
3372
- /** Account-mapping extrinsics: aliases, chain links, metadata, marketplace, and identity. */
3373
- accountMapping;
3374
2649
  /** Typed access to `privacy_*` custom RPC endpoints. */
3375
2650
  privacy;
3376
2651
  /** Typed access to general chain state via `chain_*` custom RPC endpoints. */
@@ -3395,7 +2670,6 @@ var OrbinumClient = class _OrbinumClient {
3395
2670
  this.evm = evm;
3396
2671
  this.evmExplorer = evm ? new EvmExplorer(evm) : null;
3397
2672
  this.shieldedPool = new ShieldedPoolModule(substrate);
3398
- this.accountMapping = new AccountMappingModule(substrate);
3399
2673
  this.privacy = new PrivacyModule(substrate);
3400
2674
  this.chain = new ChainModule(substrate);
3401
2675
  this.zkVerifier = new ZkVerifierModule(substrate);
@@ -3403,7 +2677,6 @@ var OrbinumClient = class _OrbinumClient {
3403
2677
  this.relayerStatus = new RelayerStatusModule(substrate);
3404
2678
  this.precompiles = evm ? {
3405
2679
  shieldedPool: new ShieldedPoolPrecompile(evm),
3406
- accountMapping: new AccountMappingPrecompile(evm),
3407
2680
  crypto: new CryptoPrecompiles(evm)
3408
2681
  } : null;
3409
2682
  }
@@ -4226,9 +3499,9 @@ function randomBlinding() {
4226
3499
  }
4227
3500
 
4228
3501
  // src/privacy-keys/accountIdentity.ts
4229
- var import_polkadot_api4 = require("polkadot-api");
3502
+ var import_polkadot_api3 = require("polkadot-api");
4230
3503
  function canonicalAccountId(address) {
4231
- const info = (0, import_polkadot_api4.getSs58AddressInfo)(address);
3504
+ const info = (0, import_polkadot_api3.getSs58AddressInfo)(address);
4232
3505
  return info.isValid ? toHex(info.publicKey) : address.toLowerCase();
4233
3506
  }
4234
3507
 
@@ -4724,13 +3997,6 @@ async function generateFeeClaimProof(inputs, options = {}) {
4724
3997
  };
4725
3998
  }
4726
3999
 
4727
- // src/account-mapping/types/index.ts
4728
- var SignatureScheme = {
4729
- Eip191: "Eip191",
4730
- Ed25519: "Ed25519"
4731
- };
4732
- var SLIP0044_NAMESPACE = 2147483648;
4733
-
4734
4000
  // src/precompiles/decode.ts
4735
4001
  function decodePrecompileCalldata(address, input) {
4736
4002
  const info = KNOWN_PRECOMPILES[address.toLowerCase()];
@@ -4738,15 +4004,6 @@ function decodePrecompileCalldata(address, input) {
4738
4004
  const selector = input.slice(2, 10).toLowerCase();
4739
4005
  const fnSig = info.functions[selector];
4740
4006
  if (!fnSig) return null;
4741
- if (fnSig.startsWith("registerAlias")) {
4742
- try {
4743
- const data = fromHex(input.slice(10));
4744
- const alias = decodeString(data, 0);
4745
- return { fnSig, args: { alias } };
4746
- } catch {
4747
- return { fnSig, args: {} };
4748
- }
4749
- }
4750
4007
  if (fnSig.startsWith("shield(")) {
4751
4008
  try {
4752
4009
  const data = fromHex(input.slice(10));
@@ -4820,7 +4077,6 @@ function decodePrecompileCalldata(address, input) {
4820
4077
  var CircuitId = {
4821
4078
  Transfer: 1,
4822
4079
  Unshield: 2,
4823
- PrivateLink: 5,
4824
4080
  ValueProof: 6
4825
4081
  };
4826
4082
 
@@ -5077,84 +4333,6 @@ function mapExtrinsicArgs(section, method, args) {
5077
4333
  };
5078
4334
  }
5079
4335
  }
5080
- if (s === "accountmapping") {
5081
- const m_norm = m.replace(/_/g, "");
5082
- if (m_norm === "registeralias") {
5083
- return { alias: get(0, "alias") };
5084
- }
5085
- if (m_norm === "transferalias") {
5086
- return { new_owner: get(0, "new_owner") };
5087
- }
5088
- if (m_norm === "putaliasonsale") {
5089
- return {
5090
- price: get(0, "price"),
5091
- allowed_buyers: get(1, "allowed_buyers")
5092
- };
5093
- }
5094
- if (m_norm === "buyalias") {
5095
- return { alias: get(0, "alias") };
5096
- }
5097
- if (m_norm === "addchainlink") {
5098
- return {
5099
- chain_id: get(0, "chain_id"),
5100
- address: get(1, "address"),
5101
- signature: get(2, "signature")
5102
- };
5103
- }
5104
- if (m_norm === "removechainlink") {
5105
- return { chain_id: get(0, "chain_id") };
5106
- }
5107
- if (m_norm === "setaccountmetadata") {
5108
- return {
5109
- display_name: get(0, "display_name"),
5110
- bio: get(1, "bio"),
5111
- avatar: get(2, "avatar")
5112
- };
5113
- }
5114
- if (m_norm === "addsupportedchain") {
5115
- return {
5116
- chain_id: get(0, "chain_id"),
5117
- scheme: get(1, "scheme")
5118
- };
5119
- }
5120
- if (m_norm === "removesupportedchain") {
5121
- return { chain_id: get(0, "chain_id") };
5122
- }
5123
- if (m_norm === "dispatchaslinkedaccount") {
5124
- return {
5125
- owner: get(0, "owner"),
5126
- chain_id: get(1, "chain_id"),
5127
- address: get(2, "address"),
5128
- signature: get(3, "signature"),
5129
- call: get(4, "call")
5130
- };
5131
- }
5132
- if (m_norm === "registerprivatelink") {
5133
- return {
5134
- chain_id: get(0, "chain_id"),
5135
- commitment: get(1, "commitment")
5136
- };
5137
- }
5138
- if (m_norm === "removeprivatelink") {
5139
- return { commitment: get(0, "commitment") };
5140
- }
5141
- if (m_norm === "revealprivatelink") {
5142
- return {
5143
- commitment: get(0, "commitment"),
5144
- address: get(1, "address"),
5145
- blinding: get(2, "blinding"),
5146
- signature: get(3, "signature")
5147
- };
5148
- }
5149
- if (m_norm === "dispatchasprivatelink") {
5150
- return {
5151
- owner: get(0, "owner"),
5152
- commitment: get(1, "commitment"),
5153
- zk_proof: get(2, "zk_proof"),
5154
- call: get(3, "call")
5155
- };
5156
- }
5157
- }
5158
4336
  if (s === "zkverifier") {
5159
4337
  const m_norm = m.replace(/_/g, "");
5160
4338
  if (m_norm === "batchregisterverificationkeys") {
@@ -5256,106 +4434,6 @@ function mapZkEventData(method, data) {
5256
4434
  if (m_norm === "assetunverified") {
5257
4435
  return { asset_id: get(0, "asset_id") };
5258
4436
  }
5259
- if (m_norm === "accountmapped" || m_norm === "accountunmapped") {
5260
- return {
5261
- account: get(0, "account"),
5262
- address: get(1, "address")
5263
- };
5264
- }
5265
- if (m_norm === "aliasregistered") {
5266
- return {
5267
- account: get(0, "account"),
5268
- alias: get(1, "alias"),
5269
- evm_address: get(2, "evm_address")
5270
- };
5271
- }
5272
- if (m_norm === "aliasreleased") {
5273
- return {
5274
- account: get(0, "account"),
5275
- alias: get(1, "alias")
5276
- };
5277
- }
5278
- if (m_norm === "aliastransferred") {
5279
- return {
5280
- from: get(0, "from"),
5281
- to: get(1, "to"),
5282
- alias: get(2, "alias")
5283
- };
5284
- }
5285
- if (m_norm === "aliaslistedforsale") {
5286
- return {
5287
- seller: get(0, "seller"),
5288
- alias: get(1, "alias"),
5289
- price: get(2, "price"),
5290
- private: get(3, "private")
5291
- };
5292
- }
5293
- if (m_norm === "aliassalecancelled") {
5294
- return {
5295
- seller: get(0, "seller"),
5296
- alias: get(1, "alias")
5297
- };
5298
- }
5299
- if (m_norm === "aliassold") {
5300
- return {
5301
- seller: get(0, "seller"),
5302
- buyer: get(1, "buyer"),
5303
- alias: get(2, "alias"),
5304
- price: get(3, "price")
5305
- };
5306
- }
5307
- if (m_norm === "chainlinkadded") {
5308
- return {
5309
- account: get(0, "account"),
5310
- chain_id: get(1, "chain_id"),
5311
- address: get(2, "address")
5312
- };
5313
- }
5314
- if (m_norm === "chainlinkremoved") {
5315
- return {
5316
- account: get(0, "account"),
5317
- chain_id: get(1, "chain_id")
5318
- };
5319
- }
5320
- if (m_norm === "metadataupdated") {
5321
- return { account: get(0, "account") };
5322
- }
5323
- if (m_norm === "supportedchainadded") {
5324
- return {
5325
- chain_id: get(0, "chain_id"),
5326
- scheme: get(1, "scheme")
5327
- };
5328
- }
5329
- if (m_norm === "supportedchainremoved") {
5330
- return { chain_id: get(0, "chain_id") };
5331
- }
5332
- if (m_norm === "proxycallexecuted") {
5333
- return {
5334
- owner: get(0, "owner"),
5335
- chain_id: get(1, "chain_id"),
5336
- address: get(2, "address")
5337
- };
5338
- }
5339
- if (m_norm === "privatechainlinkadded" || m_norm === "privatechainlinkremoved") {
5340
- return {
5341
- account: get(0, "account"),
5342
- chain_id: get(1, "chain_id"),
5343
- commitment: get(2, "commitment")
5344
- };
5345
- }
5346
- if (m_norm === "privatechainlinkrevealed") {
5347
- return {
5348
- account: get(0, "account"),
5349
- chain_id: get(1, "chain_id"),
5350
- address: get(2, "address")
5351
- };
5352
- }
5353
- if (m_norm === "privatelinkdispatchexecuted") {
5354
- return {
5355
- owner: get(0, "owner"),
5356
- commitment: get(1, "commitment")
5357
- };
5358
- }
5359
4437
  if (m_norm === "verificationkeyregistered" || m_norm === "activeversionset" || m_norm === "verificationkeyremoved" || m_norm === "proofverified" || m_norm === "proofverificationfailed") {
5360
4438
  return {
5361
4439
  circuit_id: get(0, "circuit_id"),
@@ -5484,12 +4562,10 @@ var import_substrate_bindings3 = require("@polkadot-api/substrate-bindings");
5484
4562
  var import_base = require("@scure/base");
5485
4563
  var import_signer = require("polkadot-api/signer");
5486
4564
  var import_pjs_signer = require("polkadot-api/pjs-signer");
5487
- var import_polkadot_api5 = require("polkadot-api");
4565
+ var import_polkadot_api4 = require("polkadot-api");
5488
4566
  // Annotate the CommonJS export names for ESM import in node:
5489
4567
  0 && (module.exports = {
5490
4568
  AccountId,
5491
- AccountMappingModule,
5492
- AccountMappingPrecompile,
5493
4569
  BABYJUB_SUBORDER,
5494
4570
  BN254_R,
5495
4571
  Blake2256,
@@ -5512,12 +4588,10 @@ var import_polkadot_api5 = require("polkadot-api");
5512
4588
  PrivacyKeyManager,
5513
4589
  PrivacyModule,
5514
4590
  RelayerStatusModule,
5515
- SLIP0044_NAMESPACE,
5516
4591
  SPENDING_KEY_VERIFYING_CONTRACT,
5517
4592
  SPENDING_KEY_WARNING,
5518
4593
  ShieldedPoolModule,
5519
4594
  ShieldedPoolPrecompile,
5520
- SignatureScheme,
5521
4595
  Storage,
5522
4596
  SubstrateClient,
5523
4597
  VaultLockedError,