@orbinum/sdk 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -182,11 +182,11 @@ declare class SubstrateClient {
182
182
  */
183
183
  submitAndWatch(signedHex: string): ReturnType<PolkadotClient['submitAndWatch']>;
184
184
  /**
185
- * Submits a bare (unsigned) extrinsic hex and waits for finalization.
185
+ * Submits a bare (unsigned) extrinsic and waits for finalization.
186
186
  * Used for gasless private_transfer and unshield transactions.
187
- * The bare tx hex is produced by `tx.getBareTx()` from polkadot-api.
187
+ * The bare tx bytes are produced by `tx.getBareTx()` from polkadot-api.
188
188
  */
189
- submitUnsignedAndWatch(bareTxHex: string): Promise<TxFinalizedPayload>;
189
+ submitUnsignedAndWatch(bareTx: Uint8Array): Promise<TxFinalizedPayload>;
190
190
  /**
191
191
  * Convenience: wrap raw call bytes and sign+submit in one step.
192
192
  */
@@ -432,7 +432,7 @@ declare class EvmExplorer {
432
432
  getTransactionsByAddress(address: string, maxBlocks?: number): Promise<EvmTxSummary[]>;
433
433
  /**
434
434
  * Returns aggregated on-chain data for an EVM address: balance, nonce,
435
- * bytecode (truncated), and up to 50 recent logs from the last 5 000 blocks.
435
+ * bytecode (truncated), and up to 50 recent logs from the last 1 000 blocks.
436
436
  */
437
437
  getAddressInfo(address: string): Promise<EvmAddressInfo>;
438
438
  /** Returns the native token balance of `address`, formatted as a decimal string (no symbol). */
@@ -447,7 +447,7 @@ declare class EvmExplorer {
447
447
  */
448
448
  getTokenInfo(address: string): Promise<TokenInfo | null>;
449
449
  /**
450
- * Returns ERC-20 `Transfer` events for `address` from the last 5 000 blocks.
450
+ * Returns ERC-20 `Transfer` events for `address` from the last 1 000 blocks.
451
451
  * When `holderAddress` is provided, restricts results to transfers sent or received by that address.
452
452
  */
453
453
  getTokenTransfers(address: string, holderAddress?: string): Promise<TokenTransfer[]>;
package/dist/index.d.ts CHANGED
@@ -182,11 +182,11 @@ declare class SubstrateClient {
182
182
  */
183
183
  submitAndWatch(signedHex: string): ReturnType<PolkadotClient['submitAndWatch']>;
184
184
  /**
185
- * Submits a bare (unsigned) extrinsic hex and waits for finalization.
185
+ * Submits a bare (unsigned) extrinsic and waits for finalization.
186
186
  * Used for gasless private_transfer and unshield transactions.
187
- * The bare tx hex is produced by `tx.getBareTx()` from polkadot-api.
187
+ * The bare tx bytes are produced by `tx.getBareTx()` from polkadot-api.
188
188
  */
189
- submitUnsignedAndWatch(bareTxHex: string): Promise<TxFinalizedPayload>;
189
+ submitUnsignedAndWatch(bareTx: Uint8Array): Promise<TxFinalizedPayload>;
190
190
  /**
191
191
  * Convenience: wrap raw call bytes and sign+submit in one step.
192
192
  */
@@ -432,7 +432,7 @@ declare class EvmExplorer {
432
432
  getTransactionsByAddress(address: string, maxBlocks?: number): Promise<EvmTxSummary[]>;
433
433
  /**
434
434
  * Returns aggregated on-chain data for an EVM address: balance, nonce,
435
- * bytecode (truncated), and up to 50 recent logs from the last 5 000 blocks.
435
+ * bytecode (truncated), and up to 50 recent logs from the last 1 000 blocks.
436
436
  */
437
437
  getAddressInfo(address: string): Promise<EvmAddressInfo>;
438
438
  /** Returns the native token balance of `address`, formatted as a decimal string (no symbol). */
@@ -447,7 +447,7 @@ declare class EvmExplorer {
447
447
  */
448
448
  getTokenInfo(address: string): Promise<TokenInfo | null>;
449
449
  /**
450
- * Returns ERC-20 `Transfer` events for `address` from the last 5 000 blocks.
450
+ * Returns ERC-20 `Transfer` events for `address` from the last 1 000 blocks.
451
451
  * When `holderAddress` is provided, restricts results to transfers sent or received by that address.
452
452
  */
453
453
  getTokenTransfers(address: string, holderAddress?: string): Promise<TokenTransfer[]>;
package/dist/index.js CHANGED
@@ -369,12 +369,12 @@ var SubstrateClient = class _SubstrateClient {
369
369
  return this._papi.submitAndWatch(import_polkadot_api.Binary.fromHex(signedHex));
370
370
  }
371
371
  /**
372
- * Submits a bare (unsigned) extrinsic hex and waits for finalization.
372
+ * Submits a bare (unsigned) extrinsic and waits for finalization.
373
373
  * Used for gasless private_transfer and unshield transactions.
374
- * The bare tx hex is produced by `tx.getBareTx()` from polkadot-api.
374
+ * The bare tx bytes are produced by `tx.getBareTx()` from polkadot-api.
375
375
  */
376
- async submitUnsignedAndWatch(bareTxHex) {
377
- return this._papi.submit(import_polkadot_api.Binary.fromHex(bareTxHex));
376
+ async submitUnsignedAndWatch(bareTx) {
377
+ return this._papi.submit(bareTx);
378
378
  }
379
379
  /**
380
380
  * Convenience: wrap raw call bytes and sign+submit in one step.
@@ -765,6 +765,7 @@ function formatORB(raw, precision = 6) {
765
765
  }
766
766
 
767
767
  // src/evm-explorer/EvmExplorer.ts
768
+ var MAX_LOG_BLOCK_RANGE = 1e3;
768
769
  var EvmExplorer = class _EvmExplorer {
769
770
  /** @param evm - Underlying `EvmClient` used for all RPC calls. */
770
771
  constructor(evm) {
@@ -874,11 +875,11 @@ var EvmExplorer = class _EvmExplorer {
874
875
  // --- Address ---
875
876
  /**
876
877
  * Returns aggregated on-chain data for an EVM address: balance, nonce,
877
- * bytecode (truncated), and up to 50 recent logs from the last 5 000 blocks.
878
+ * bytecode (truncated), and up to 50 recent logs from the last 1 000 blocks.
878
879
  */
879
880
  async getAddressInfo(address) {
880
881
  const latest = await this.evm.getBlockNumber().catch(() => 0);
881
- const fromBlock = `0x${Math.max(0, latest - 5e3).toString(16)}`;
882
+ const fromBlock = `0x${Math.max(0, latest - MAX_LOG_BLOCK_RANGE).toString(16)}`;
882
883
  const [balance, nonce, code, logs] = await Promise.all([
883
884
  this.evm.request("eth_getBalance", [address, "latest"]).catch(() => null),
884
885
  this.evm.getTransactionCount(address).catch(() => 0),
@@ -957,13 +958,13 @@ var EvmExplorer = class _EvmExplorer {
957
958
  };
958
959
  }
959
960
  /**
960
- * Returns ERC-20 `Transfer` events for `address` from the last 5 000 blocks.
961
+ * Returns ERC-20 `Transfer` events for `address` from the last 1 000 blocks.
961
962
  * When `holderAddress` is provided, restricts results to transfers sent or received by that address.
962
963
  */
963
964
  async getTokenTransfers(address, holderAddress) {
964
965
  const TRANSFER = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef";
965
966
  const latest = await this.evm.getBlockNumber().catch(() => 0);
966
- const fromBlock = `0x${Math.max(0, latest - 5e3).toString(16)}`;
967
+ const fromBlock = `0x${Math.max(0, latest - MAX_LOG_BLOCK_RANGE).toString(16)}`;
967
968
  let logs;
968
969
  if (holderAddress) {
969
970
  const padded = `0x${holderAddress.replace(/^0x/, "").toLowerCase().padStart(64, "0")}`;
@@ -1398,8 +1399,8 @@ function callUnsafeTx(txEntry, ...args) {
1398
1399
  return txEntry(...args);
1399
1400
  }
1400
1401
  async function submitBareTx(tx, client) {
1401
- const bareTxHex = await tx.getBareTx();
1402
- const payload = await client.submitUnsignedAndWatch(bareTxHex);
1402
+ const bareTx = await tx.getBareTx();
1403
+ const payload = await client.submitUnsignedAndWatch(bareTx);
1403
1404
  return toTxResult(payload);
1404
1405
  }
1405
1406
  function resolveTx(unsafe, pallet, call) {
@@ -1821,7 +1822,7 @@ var ShieldedPoolModule = class {
1821
1822
  const tx = callUnsafeTx(entry, {
1822
1823
  asset_id: params.assetId,
1823
1824
  amount: params.amount,
1824
- commitment: import_polkadot_api2.Binary.fromHex(params.commitment),
1825
+ commitment: params.commitment,
1825
1826
  encrypted_memo: params.encryptedMemo
1826
1827
  });
1827
1828
  return toTxResult(
@@ -1848,13 +1849,13 @@ var ShieldedPoolModule = class {
1848
1849
  }
1849
1850
  const tx = callUnsafeTx(entry, {
1850
1851
  proof: params.proof,
1851
- merkle_root: import_polkadot_api2.Binary.fromHex(params.merkleRoot),
1852
- nullifier: import_polkadot_api2.Binary.fromHex(params.nullifier),
1852
+ merkle_root: params.merkleRoot,
1853
+ nullifier: params.nullifier,
1853
1854
  asset_id: params.assetId,
1854
1855
  amount: params.amount,
1855
1856
  recipient: recipientSs58,
1856
1857
  fee: params.fee ?? 0n,
1857
- change_commitment: import_polkadot_api2.Binary.fromHex(changeCommitment),
1858
+ change_commitment: changeCommitment,
1858
1859
  change_encrypted_memo: changeEncryptedMemo,
1859
1860
  relayer: void 0
1860
1861
  // Option<H160> — None for direct Substrate submissions
@@ -1873,8 +1874,8 @@ var ShieldedPoolModule = class {
1873
1874
  * Extrinsic: shieldedPool.privateTransfer(proof, merkleRoot, nullifiers, commitments, memos, assetId, fee)
1874
1875
  */
1875
1876
  async privateTransfer(params, signer, txOptions) {
1876
- const nullifiers = params.inputs.map((inp) => import_polkadot_api2.Binary.fromHex(inp.nullifier));
1877
- const commitments = params.outputs.map((out) => import_polkadot_api2.Binary.fromHex(out.commitment));
1877
+ const nullifiers = params.inputs.map((inp) => inp.nullifier);
1878
+ const commitments = params.outputs.map((out) => out.commitment);
1878
1879
  const memos = params.outputs.map((out, i) => {
1879
1880
  EncryptedMemo.validate(
1880
1881
  out.encryptedMemo,
@@ -1885,7 +1886,7 @@ var ShieldedPoolModule = class {
1885
1886
  const entry = resolveTx(this.substrate.unsafe, "ShieldedPool", "private_transfer");
1886
1887
  const tx = callUnsafeTx(entry, {
1887
1888
  proof: params.proof,
1888
- merkle_root: import_polkadot_api2.Binary.fromHex(params.merkleRoot),
1889
+ merkle_root: params.merkleRoot,
1889
1890
  nullifiers,
1890
1891
  commitments,
1891
1892
  encrypted_memos: memos,
@@ -1911,7 +1912,7 @@ var ShieldedPoolModule = class {
1911
1912
  return {
1912
1913
  assetId: item.assetId,
1913
1914
  amount: item.amount.toString(),
1914
- commitment: import_polkadot_api2.Binary.fromHex(item.commitment),
1915
+ commitment: item.commitment,
1915
1916
  encryptedMemo: item.encryptedMemo
1916
1917
  };
1917
1918
  });
@@ -1932,7 +1933,7 @@ var ShieldedPoolModule = class {
1932
1933
  EncryptedMemo.validate(params.encryptedMemo, "claimShieldedFees.encryptedMemo");
1933
1934
  const entry = resolveTx(this.substrate.unsafe, "ShieldedPool", "claim_shielded_fees");
1934
1935
  const tx = callUnsafeTx(entry, {
1935
- commitment: import_polkadot_api2.Binary.fromHex(params.commitment),
1936
+ commitment: params.commitment,
1936
1937
  amount: params.amount,
1937
1938
  asset_id: params.assetId,
1938
1939
  encrypted_memo: params.encryptedMemo,
package/dist/index.mjs CHANGED
@@ -242,12 +242,12 @@ var SubstrateClient = class _SubstrateClient {
242
242
  return this._papi.submitAndWatch(Binary.fromHex(signedHex));
243
243
  }
244
244
  /**
245
- * Submits a bare (unsigned) extrinsic hex and waits for finalization.
245
+ * Submits a bare (unsigned) extrinsic and waits for finalization.
246
246
  * Used for gasless private_transfer and unshield transactions.
247
- * The bare tx hex is produced by `tx.getBareTx()` from polkadot-api.
247
+ * The bare tx bytes are produced by `tx.getBareTx()` from polkadot-api.
248
248
  */
249
- async submitUnsignedAndWatch(bareTxHex) {
250
- return this._papi.submit(Binary.fromHex(bareTxHex));
249
+ async submitUnsignedAndWatch(bareTx) {
250
+ return this._papi.submit(bareTx);
251
251
  }
252
252
  /**
253
253
  * Convenience: wrap raw call bytes and sign+submit in one step.
@@ -638,6 +638,7 @@ function formatORB(raw, precision = 6) {
638
638
  }
639
639
 
640
640
  // src/evm-explorer/EvmExplorer.ts
641
+ var MAX_LOG_BLOCK_RANGE = 1e3;
641
642
  var EvmExplorer = class _EvmExplorer {
642
643
  /** @param evm - Underlying `EvmClient` used for all RPC calls. */
643
644
  constructor(evm) {
@@ -747,11 +748,11 @@ var EvmExplorer = class _EvmExplorer {
747
748
  // --- Address ---
748
749
  /**
749
750
  * Returns aggregated on-chain data for an EVM address: balance, nonce,
750
- * bytecode (truncated), and up to 50 recent logs from the last 5 000 blocks.
751
+ * bytecode (truncated), and up to 50 recent logs from the last 1 000 blocks.
751
752
  */
752
753
  async getAddressInfo(address) {
753
754
  const latest = await this.evm.getBlockNumber().catch(() => 0);
754
- const fromBlock = `0x${Math.max(0, latest - 5e3).toString(16)}`;
755
+ const fromBlock = `0x${Math.max(0, latest - MAX_LOG_BLOCK_RANGE).toString(16)}`;
755
756
  const [balance, nonce, code, logs] = await Promise.all([
756
757
  this.evm.request("eth_getBalance", [address, "latest"]).catch(() => null),
757
758
  this.evm.getTransactionCount(address).catch(() => 0),
@@ -830,13 +831,13 @@ var EvmExplorer = class _EvmExplorer {
830
831
  };
831
832
  }
832
833
  /**
833
- * Returns ERC-20 `Transfer` events for `address` from the last 5 000 blocks.
834
+ * Returns ERC-20 `Transfer` events for `address` from the last 1 000 blocks.
834
835
  * When `holderAddress` is provided, restricts results to transfers sent or received by that address.
835
836
  */
836
837
  async getTokenTransfers(address, holderAddress) {
837
838
  const TRANSFER = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef";
838
839
  const latest = await this.evm.getBlockNumber().catch(() => 0);
839
- const fromBlock = `0x${Math.max(0, latest - 5e3).toString(16)}`;
840
+ const fromBlock = `0x${Math.max(0, latest - MAX_LOG_BLOCK_RANGE).toString(16)}`;
840
841
  let logs;
841
842
  if (holderAddress) {
842
843
  const padded = `0x${holderAddress.replace(/^0x/, "").toLowerCase().padStart(64, "0")}`;
@@ -1238,7 +1239,7 @@ var IndexerClient = class {
1238
1239
  };
1239
1240
 
1240
1241
  // src/shielded-pool/pallet/ShieldedPoolModule.ts
1241
- import { Binary as Binary2 } from "polkadot-api";
1242
+ import "polkadot-api";
1242
1243
 
1243
1244
  // src/utils/tx.ts
1244
1245
  function formatDispatchError(err) {
@@ -1271,8 +1272,8 @@ function callUnsafeTx(txEntry, ...args) {
1271
1272
  return txEntry(...args);
1272
1273
  }
1273
1274
  async function submitBareTx(tx, client) {
1274
- const bareTxHex = await tx.getBareTx();
1275
- const payload = await client.submitUnsignedAndWatch(bareTxHex);
1275
+ const bareTx = await tx.getBareTx();
1276
+ const payload = await client.submitUnsignedAndWatch(bareTx);
1276
1277
  return toTxResult(payload);
1277
1278
  }
1278
1279
  function resolveTx(unsafe, pallet, call) {
@@ -1694,7 +1695,7 @@ var ShieldedPoolModule = class {
1694
1695
  const tx = callUnsafeTx(entry, {
1695
1696
  asset_id: params.assetId,
1696
1697
  amount: params.amount,
1697
- commitment: Binary2.fromHex(params.commitment),
1698
+ commitment: params.commitment,
1698
1699
  encrypted_memo: params.encryptedMemo
1699
1700
  });
1700
1701
  return toTxResult(
@@ -1721,13 +1722,13 @@ var ShieldedPoolModule = class {
1721
1722
  }
1722
1723
  const tx = callUnsafeTx(entry, {
1723
1724
  proof: params.proof,
1724
- merkle_root: Binary2.fromHex(params.merkleRoot),
1725
- nullifier: Binary2.fromHex(params.nullifier),
1725
+ merkle_root: params.merkleRoot,
1726
+ nullifier: params.nullifier,
1726
1727
  asset_id: params.assetId,
1727
1728
  amount: params.amount,
1728
1729
  recipient: recipientSs58,
1729
1730
  fee: params.fee ?? 0n,
1730
- change_commitment: Binary2.fromHex(changeCommitment),
1731
+ change_commitment: changeCommitment,
1731
1732
  change_encrypted_memo: changeEncryptedMemo,
1732
1733
  relayer: void 0
1733
1734
  // Option<H160> — None for direct Substrate submissions
@@ -1746,8 +1747,8 @@ var ShieldedPoolModule = class {
1746
1747
  * Extrinsic: shieldedPool.privateTransfer(proof, merkleRoot, nullifiers, commitments, memos, assetId, fee)
1747
1748
  */
1748
1749
  async privateTransfer(params, signer, txOptions) {
1749
- const nullifiers = params.inputs.map((inp) => Binary2.fromHex(inp.nullifier));
1750
- const commitments = params.outputs.map((out) => Binary2.fromHex(out.commitment));
1750
+ const nullifiers = params.inputs.map((inp) => inp.nullifier);
1751
+ const commitments = params.outputs.map((out) => out.commitment);
1751
1752
  const memos = params.outputs.map((out, i) => {
1752
1753
  EncryptedMemo.validate(
1753
1754
  out.encryptedMemo,
@@ -1758,7 +1759,7 @@ var ShieldedPoolModule = class {
1758
1759
  const entry = resolveTx(this.substrate.unsafe, "ShieldedPool", "private_transfer");
1759
1760
  const tx = callUnsafeTx(entry, {
1760
1761
  proof: params.proof,
1761
- merkle_root: Binary2.fromHex(params.merkleRoot),
1762
+ merkle_root: params.merkleRoot,
1762
1763
  nullifiers,
1763
1764
  commitments,
1764
1765
  encrypted_memos: memos,
@@ -1784,7 +1785,7 @@ var ShieldedPoolModule = class {
1784
1785
  return {
1785
1786
  assetId: item.assetId,
1786
1787
  amount: item.amount.toString(),
1787
- commitment: Binary2.fromHex(item.commitment),
1788
+ commitment: item.commitment,
1788
1789
  encryptedMemo: item.encryptedMemo
1789
1790
  };
1790
1791
  });
@@ -1805,7 +1806,7 @@ var ShieldedPoolModule = class {
1805
1806
  EncryptedMemo.validate(params.encryptedMemo, "claimShieldedFees.encryptedMemo");
1806
1807
  const entry = resolveTx(this.substrate.unsafe, "ShieldedPool", "claim_shielded_fees");
1807
1808
  const tx = callUnsafeTx(entry, {
1808
- commitment: Binary2.fromHex(params.commitment),
1809
+ commitment: params.commitment,
1809
1810
  amount: params.amount,
1810
1811
  asset_id: params.assetId,
1811
1812
  encrypted_memo: params.encryptedMemo,
@@ -1819,7 +1820,7 @@ var ShieldedPoolModule = class {
1819
1820
  };
1820
1821
 
1821
1822
  // src/account-mapping/AccountMappingModule.ts
1822
- import { Binary as Binary3 } from "polkadot-api";
1823
+ import { Binary as Binary2 } from "polkadot-api";
1823
1824
 
1824
1825
  // src/account-mapping/helpers.ts
1825
1826
  function mapRawScheme(raw) {
@@ -2089,7 +2090,7 @@ var AccountMappingModule = class {
2089
2090
  */
2090
2091
  async registerAlias(alias, signer) {
2091
2092
  const entry = resolveTx(this.substrate.unsafe, "accountMapping", "registerAlias");
2092
- const tx = callUnsafeTx(entry, Binary3.fromText(alias));
2093
+ const tx = callUnsafeTx(entry, Binary2.fromText(alias));
2093
2094
  return toTxResult(await tx.signAndSubmit(signer));
2094
2095
  }
2095
2096
  /**
@@ -2140,7 +2141,7 @@ var AccountMappingModule = class {
2140
2141
  */
2141
2142
  async setAccountMetadata(params, signer) {
2142
2143
  const entry = resolveTx(this.substrate.unsafe, "accountMapping", "setAccountMetadata");
2143
- const encode2 = (v) => v != null ? Binary3.fromText(v) : void 0;
2144
+ const encode2 = (v) => v != null ? Binary2.fromText(v) : void 0;
2144
2145
  const tx = callUnsafeTx(
2145
2146
  entry,
2146
2147
  encode2(params.displayName),
@@ -2173,7 +2174,7 @@ var AccountMappingModule = class {
2173
2174
  */
2174
2175
  async buyAlias(alias, signer) {
2175
2176
  const entry = resolveTx(this.substrate.unsafe, "accountMapping", "buyAlias");
2176
- const tx = callUnsafeTx(entry, Binary3.fromText(alias));
2177
+ const tx = callUnsafeTx(entry, Binary2.fromText(alias));
2177
2178
  return toTxResult(await tx.signAndSubmit(signer));
2178
2179
  }
2179
2180
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbinum/sdk",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "Official TypeScript SDK for Orbinum.",
5
5
  "author": "Orbinum",
6
6
  "license": "MIT",