@orbinum/sdk 0.7.1 → 0.7.3
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 +31 -7
- package/dist/index.d.ts +31 -7
- package/dist/index.js +20 -19
- package/dist/index.mjs +25 -24
- package/package.json +1 -1
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
|
|
185
|
+
* Submits a bare (unsigned) extrinsic and waits for finalization.
|
|
186
186
|
* Used for gasless private_transfer and unshield transactions.
|
|
187
|
-
* The bare tx
|
|
187
|
+
* The bare tx bytes are produced by `tx.getBareTx()` from polkadot-api.
|
|
188
188
|
*/
|
|
189
|
-
submitUnsignedAndWatch(
|
|
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
|
|
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
|
|
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[]>;
|
|
@@ -494,7 +494,13 @@ interface ShieldedCommitment {
|
|
|
494
494
|
blockNumber: number;
|
|
495
495
|
extrinsicIndex: number | null;
|
|
496
496
|
leafIndex: number;
|
|
497
|
-
/**
|
|
497
|
+
/**
|
|
498
|
+
* Asset ID as decimal string.
|
|
499
|
+
* For `source: 'shield'` and `source: 'unshield'` this reflects the real asset.
|
|
500
|
+
* For `source: 'transfer'` it is always `"0"` — the chain intentionally omits the asset ID
|
|
501
|
+
* from `CommitmentsInserted` events to prevent graph correlation across assets.
|
|
502
|
+
* The true asset is recoverable only by decrypting `encryptedMemo`.
|
|
503
|
+
*/
|
|
498
504
|
assetId: string;
|
|
499
505
|
/** Origin of the commitment: direct shield, output of private transfer, or change from unshield. */
|
|
500
506
|
source: 'shield' | 'transfer' | 'unshield';
|
|
@@ -519,6 +525,18 @@ interface PrivateTransferTimestamp {
|
|
|
519
525
|
/** Blake2-256 hash of the raw extrinsic, 0x-prefixed. Null if the extrinsic was not decoded. */
|
|
520
526
|
hash: string | null;
|
|
521
527
|
timestampMs: number | null;
|
|
528
|
+
/**
|
|
529
|
+
* Subset of the queried nullifiers that were spent in this specific extrinsic.
|
|
530
|
+
* Returned by `getTransfersByNullifiers`. Use to identify which input vault notes
|
|
531
|
+
* belong to this transfer for local reconstruction.
|
|
532
|
+
*/
|
|
533
|
+
matchedNullifiers?: string[];
|
|
534
|
+
/**
|
|
535
|
+
* Subset of the queried commitments that were inserted in this specific extrinsic.
|
|
536
|
+
* Returned by `getTransfersByCommitments`. Use to identify which output vault notes
|
|
537
|
+
* (change notes or received notes) belong to this transfer.
|
|
538
|
+
*/
|
|
539
|
+
matchedCommitments?: string[];
|
|
522
540
|
}
|
|
523
541
|
/** An unshield event stored by the indexer. */
|
|
524
542
|
interface Unshield {
|
|
@@ -691,7 +709,13 @@ type ShieldedAddressEvent = ({
|
|
|
691
709
|
interface StealthScanHint {
|
|
692
710
|
leafIndex: number;
|
|
693
711
|
commitmentHex: string;
|
|
694
|
-
/**
|
|
712
|
+
/**
|
|
713
|
+
* Asset ID as decimal string.
|
|
714
|
+
* For shield-origin commitments this is the real asset ID.
|
|
715
|
+
* For transfer-origin commitments this is always `"0"` — the chain does not emit the asset ID
|
|
716
|
+
* in `CommitmentsInserted` events by design (privacy: prevents cross-asset graph correlation).
|
|
717
|
+
* Recover the true asset by decrypting `encryptedMemo`.
|
|
718
|
+
*/
|
|
695
719
|
assetId: string;
|
|
696
720
|
/** Ephemeral public key (last 32 bytes of encrypted_memo), 0x-prefixed. null if memo absent. */
|
|
697
721
|
ephPkHex: string | null;
|
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
|
|
185
|
+
* Submits a bare (unsigned) extrinsic and waits for finalization.
|
|
186
186
|
* Used for gasless private_transfer and unshield transactions.
|
|
187
|
-
* The bare tx
|
|
187
|
+
* The bare tx bytes are produced by `tx.getBareTx()` from polkadot-api.
|
|
188
188
|
*/
|
|
189
|
-
submitUnsignedAndWatch(
|
|
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
|
|
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
|
|
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[]>;
|
|
@@ -494,7 +494,13 @@ interface ShieldedCommitment {
|
|
|
494
494
|
blockNumber: number;
|
|
495
495
|
extrinsicIndex: number | null;
|
|
496
496
|
leafIndex: number;
|
|
497
|
-
/**
|
|
497
|
+
/**
|
|
498
|
+
* Asset ID as decimal string.
|
|
499
|
+
* For `source: 'shield'` and `source: 'unshield'` this reflects the real asset.
|
|
500
|
+
* For `source: 'transfer'` it is always `"0"` — the chain intentionally omits the asset ID
|
|
501
|
+
* from `CommitmentsInserted` events to prevent graph correlation across assets.
|
|
502
|
+
* The true asset is recoverable only by decrypting `encryptedMemo`.
|
|
503
|
+
*/
|
|
498
504
|
assetId: string;
|
|
499
505
|
/** Origin of the commitment: direct shield, output of private transfer, or change from unshield. */
|
|
500
506
|
source: 'shield' | 'transfer' | 'unshield';
|
|
@@ -519,6 +525,18 @@ interface PrivateTransferTimestamp {
|
|
|
519
525
|
/** Blake2-256 hash of the raw extrinsic, 0x-prefixed. Null if the extrinsic was not decoded. */
|
|
520
526
|
hash: string | null;
|
|
521
527
|
timestampMs: number | null;
|
|
528
|
+
/**
|
|
529
|
+
* Subset of the queried nullifiers that were spent in this specific extrinsic.
|
|
530
|
+
* Returned by `getTransfersByNullifiers`. Use to identify which input vault notes
|
|
531
|
+
* belong to this transfer for local reconstruction.
|
|
532
|
+
*/
|
|
533
|
+
matchedNullifiers?: string[];
|
|
534
|
+
/**
|
|
535
|
+
* Subset of the queried commitments that were inserted in this specific extrinsic.
|
|
536
|
+
* Returned by `getTransfersByCommitments`. Use to identify which output vault notes
|
|
537
|
+
* (change notes or received notes) belong to this transfer.
|
|
538
|
+
*/
|
|
539
|
+
matchedCommitments?: string[];
|
|
522
540
|
}
|
|
523
541
|
/** An unshield event stored by the indexer. */
|
|
524
542
|
interface Unshield {
|
|
@@ -691,7 +709,13 @@ type ShieldedAddressEvent = ({
|
|
|
691
709
|
interface StealthScanHint {
|
|
692
710
|
leafIndex: number;
|
|
693
711
|
commitmentHex: string;
|
|
694
|
-
/**
|
|
712
|
+
/**
|
|
713
|
+
* Asset ID as decimal string.
|
|
714
|
+
* For shield-origin commitments this is the real asset ID.
|
|
715
|
+
* For transfer-origin commitments this is always `"0"` — the chain does not emit the asset ID
|
|
716
|
+
* in `CommitmentsInserted` events by design (privacy: prevents cross-asset graph correlation).
|
|
717
|
+
* Recover the true asset by decrypting `encryptedMemo`.
|
|
718
|
+
*/
|
|
695
719
|
assetId: string;
|
|
696
720
|
/** Ephemeral public key (last 32 bytes of encrypted_memo), 0x-prefixed. null if memo absent. */
|
|
697
721
|
ephPkHex: string | null;
|
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
|
|
372
|
+
* Submits a bare (unsigned) extrinsic and waits for finalization.
|
|
373
373
|
* Used for gasless private_transfer and unshield transactions.
|
|
374
|
-
* The bare tx
|
|
374
|
+
* The bare tx bytes are produced by `tx.getBareTx()` from polkadot-api.
|
|
375
375
|
*/
|
|
376
|
-
async submitUnsignedAndWatch(
|
|
377
|
-
return this._papi.submit(
|
|
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
|
|
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 -
|
|
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
|
|
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 -
|
|
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
|
|
1402
|
-
const payload = await client.submitUnsignedAndWatch(
|
|
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:
|
|
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:
|
|
1852
|
-
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:
|
|
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) =>
|
|
1877
|
-
const commitments = params.outputs.map((out) =>
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
245
|
+
* Submits a bare (unsigned) extrinsic and waits for finalization.
|
|
246
246
|
* Used for gasless private_transfer and unshield transactions.
|
|
247
|
-
* The bare tx
|
|
247
|
+
* The bare tx bytes are produced by `tx.getBareTx()` from polkadot-api.
|
|
248
248
|
*/
|
|
249
|
-
async submitUnsignedAndWatch(
|
|
250
|
-
return this._papi.submit(
|
|
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
|
|
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 -
|
|
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
|
|
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 -
|
|
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
|
|
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
|
|
1275
|
-
const payload = await client.submitUnsignedAndWatch(
|
|
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:
|
|
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:
|
|
1725
|
-
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:
|
|
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) =>
|
|
1750
|
-
const commitments = params.outputs.map((out) =>
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
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,
|
|
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 ?
|
|
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,
|
|
2177
|
+
const tx = callUnsafeTx(entry, Binary2.fromText(alias));
|
|
2177
2178
|
return toTxResult(await tx.signAndSubmit(signer));
|
|
2178
2179
|
}
|
|
2179
2180
|
/**
|