@tapforce/pod-bridge-sdk 2.0.1 → 2.2.1

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/README.md CHANGED
@@ -6,7 +6,7 @@ TypeScript SDK for bridging tokens between POD and EVM chains (e.g., ETH Mainnet
6
6
 
7
7
  ```
8
8
  ETH -> Pod: Deposit on ETH, AUTO-CLAIM on Pod (no claim TX needed)
9
- Pod -> ETH: Deposit on Pod, claim on ETH with proof from pod_getBridgeClaimProof RPC
9
+ Pod -> ETH: Withdraw on Pod, claim on ETH with proof from pod_getBridgeClaimProof RPC
10
10
  ```
11
11
 
12
12
  **Key points:**
@@ -17,7 +17,7 @@ Pod -> ETH: Deposit on Pod, claim on ETH with proof from pod_getBridgeClaimProof
17
17
 
18
18
  ## Features
19
19
 
20
- - **Bridge Deposits**: Deposit ERC20 or native tokens to the bridge
20
+ - **Bridge Deposits**: Deposit ERC20 or native tokens to the bridge (with optional CLOB integration)
21
21
  - **Claim with Proof**: Claim on ETH using `pod_getBridgeClaimProof` RPC
22
22
  - **Track Bridge Requests**: Query deposits sent/received by any address
23
23
  - **Claim Status Tracking**: Monitor claim status and finality
@@ -92,7 +92,7 @@ Deposits on ETH are automatically claimed on Pod after block finalization.
92
92
  ```typescript
93
93
  const client = new SourceChainToPodActionClient(actionConfig);
94
94
 
95
- // Create deposit transaction (with optional permit for gasless approval)
95
+ // Simple deposit (bridge only)
96
96
  const depositTx = client.deposit({
97
97
  token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC on ETH
98
98
  amount: ethers.parseUnits('1', 6), // 1 USDC (use ETH-side decimals)
@@ -101,6 +101,16 @@ const depositTx = client.deposit({
101
101
  // permit: '0x...' // Optional: ERC20 permit bytes
102
102
  });
103
103
 
104
+ // CLOB deposit — bridge and deposit to orderbook in one TX:
105
+ // const clobTx = client.deposit({
106
+ // token: '0xdAC17F958D2ee523a2206206994597C13D831ec7', // USDT on ETH
107
+ // amount: ethers.parseUnits('1', 6),
108
+ // destinationWalletAddress: '0x...',
109
+ // callContract: '0x000000000000000000000000000000000000C10B', // CLOB orderbook
110
+ // reserveBalance: ethers.parseUnits('0.5', 6), // Keep 0.5, forward 0.5 to CLOB
111
+ // from: '0x...',
112
+ // });
113
+
104
114
  // Don't forget to approve the bridge contract first for ERC20 tokens
105
115
  const tx = await signer.sendTransaction(depositTx);
106
116
  const receipt = await tx.wait();
@@ -110,7 +120,7 @@ const receipt = await tx.wait();
110
120
 
111
121
  ### Pod -> ETH (Claim with proof)
112
122
 
113
- Deposits on Pod require claiming on ETH with a proof from `pod_getBridgeClaimProof`.
123
+ Withdrawals on Pod require claiming on ETH with a proof from `pod_getBridgeClaimProof`.
114
124
 
115
125
  ```typescript
116
126
  import {
@@ -121,17 +131,18 @@ import {
121
131
 
122
132
  const client = new PodToSourceChainActionClient(actionConfig);
123
133
 
124
- // Step 1: Deposit on Pod
125
- const depositTx = client.deposit({
134
+ // Step 1: Withdraw on Pod (specify target chain ID)
135
+ const withdrawTx = client.withdraw({
126
136
  token: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', // Native token on Pod
127
- amount: ethers.parseUnits('1', 6), // Use ETH-side decimals (1 USDC = 1e6)
137
+ amount: ethers.parseUnits('1', 6), // Target chain units (1 USDC = 1e6)
128
138
  destinationWalletAddress: '0x...',
139
+ chainId: 1, // Target chain ID (e.g. 1 for ETH mainnet)
129
140
  from: '0x...',
130
141
  });
131
142
 
132
143
  // Pod requires EIP-1559 gas params (all zeros for free transactions)
133
144
  const tx = await podSigner.sendTransaction({
134
- ...depositTx,
145
+ ...withdrawTx,
135
146
  maxFeePerGas: 0n,
136
147
  maxPriorityFeePerGas: 0n,
137
148
  gasLimit: 0n,
@@ -143,7 +154,7 @@ const { proof, auxTxSuffix } = await getBridgeClaimProof(podProvider, tx.hash);
143
154
  // Step 3: Claim on ETH
144
155
  const claimData: ClaimProofData = {
145
156
  ethTokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC on ETH
146
- amount: ethers.parseUnits('1', 6), // Must match deposited amount
157
+ amount: ethers.parseUnits('1', 6), // Must match withdrawn amount
147
158
  to: '0x...',
148
159
  proof,
149
160
  auxTxSuffix,
@@ -192,21 +203,24 @@ deposit(args: {
192
203
  token: string;
193
204
  amount: string | bigint;
194
205
  destinationWalletAddress: string;
206
+ callContract?: string; // Contract to call on Pod after deposit (default: address(0))
207
+ reserveBalance?: string | bigint; // Amount to reserve when using callContract (default: 0)
195
208
  from?: string;
196
- permit?: string; // Optional ERC20 permit bytes (default: '0x')
209
+ permit?: string; // Optional ERC20 permit bytes (default: '0x')
197
210
  }): UnsignedTransaction
198
211
  ```
199
212
 
200
213
  ### PodToSourceChainActionClient
201
214
 
202
- For Pod -> ETH deposits and claims.
215
+ For Pod -> ETH withdrawals and claims.
203
216
 
204
217
  ```typescript
205
- // Deposit tokens on Pod
206
- deposit(args: {
207
- token: string; // Use 0xEeee...EEeE for native token
208
- amount: string | bigint; // Use ETH-side decimals
218
+ // Withdraw tokens on Pod
219
+ withdraw(args: {
220
+ token: string; // Use 0xEeee...EEeE for native token
221
+ amount: string | bigint; // Target chain units (e.g. 1e6 for USDC)
209
222
  destinationWalletAddress: string;
223
+ chainId: number | bigint; // Target chain ID for claiming
210
224
  from?: string;
211
225
  }): UnsignedTransaction
212
226
 
@@ -267,6 +281,9 @@ interface BridgeRequest {
267
281
  destination: string;
268
282
  token: string;
269
283
  amount: string;
284
+ callContract?: string; // Contract called after deposit (address(0) for simple bridge) — ETH only
285
+ reserveBalance?: string; // Amount reserved when using callContract ('0' for simple bridge) — ETH only
286
+ targetChainId?: number; // Target chain ID for claiming (Pod→ETH direction)
270
287
  chainId: number;
271
288
  blockNumber: number;
272
289
  timestamp: number; // Unix timestamp (seconds)
@@ -292,19 +309,19 @@ The bridge contracts emit different events per chain:
292
309
 
293
310
  ```solidity
294
311
  // ETH (Source Chain)
295
- event Deposit(uint256 indexed id, address indexed from, address indexed to, address token, uint256 amount);
312
+ event Deposit(uint256 indexed id, address indexed from, address indexed to, address token, uint256 amount, address callContract, uint256 reserveBalance);
296
313
  event Claim(bytes32 indexed txHash, address token, address mirrorToken, uint256 amount, address indexed to);
297
314
 
298
315
  // Pod
299
- event Deposit(bytes32 indexed id, address indexed from, address indexed to, address token, uint256 amount);
316
+ event Withdraw(bytes32 indexed id, address indexed from, address indexed to, address token, uint256 amount, uint256 chainId);
300
317
  ```
301
318
 
302
319
  ## ABIs
303
320
 
304
321
  The SDK exports separate ABIs for each chain:
305
322
 
306
- - `SOURCE_CHAIN_BRIDGE_ABI` - ETH bridge (deposit with permit, claim with proof)
307
- - `POD_BRIDGE_ABI` - Pod bridge (3-param deposit)
323
+ - `SOURCE_CHAIN_BRIDGE_ABI` - ETH bridge (6-param deposit with callContract/reserveBalance/permit, claim with proof)
324
+ - `POD_BRIDGE_ABI` - Pod bridge (withdraw with chainId, Withdraw events with bytes32 id)
308
325
  - `BRIDGE_ABI` - Alias for `SOURCE_CHAIN_BRIDGE_ABI`
309
326
 
310
327
  ## Pod-specific Notes
@@ -2,13 +2,13 @@ import { UnsignedTransaction, ClaimProofData, PodBridgeActionsClientConfig } fro
2
2
  /**
3
3
  * PodToSourceChainActionClient - Handles Pod -> ETH bridging
4
4
  *
5
- * - User deposits tokens on Pod
6
- * - Call pod_getBridgeClaimProof(depositTxHash) to get proof
5
+ * - User withdraws tokens on Pod (specifying target chainId)
6
+ * - Call pod_getBridgeClaimProof(withdrawTxHash) to get proof
7
7
  * - User claims on ETH with proof + auxTxSuffix
8
8
  *
9
9
  * Important notes:
10
- * - Token addresses on Pod and ETH are different (deposit AAAA on Pod, claim BBBB on ETH)
11
- * - For USDC-like tokens, use ETH-side decimals (e.g. parseUnits('1', 6) for USDC)
10
+ * - Token addresses on Pod and ETH are different (withdraw AAAA on Pod, claim BBBB on ETH)
11
+ * - Amount is in target chain units (e.g. parseUnits('1', 6) for USDC with 6 decimals)
12
12
  * - Pod system contract handles balance internally - do NOT set tx value
13
13
  */
14
14
  export declare class PodToSourceChainActionClient {
@@ -17,26 +17,38 @@ export declare class PodToSourceChainActionClient {
17
17
  private readonly sourceChainIface;
18
18
  constructor(config: PodBridgeActionsClientConfig);
19
19
  /**
20
- * Create unsigned transaction for depositing tokens from Pod to ETH
20
+ * Create unsigned transaction for withdrawing tokens from Pod to ETH
21
21
  *
22
- * After deposit:
23
- * - Call pod_getBridgeClaimProof(depositTxHash) on Pod RPC
22
+ * After withdraw:
23
+ * - Call pod_getBridgeClaimProof(withdrawTxHash) on Pod RPC
24
24
  * - Call claim() on ETH with the proof
25
25
  *
26
26
  * Note: Pod system contract handles balance deduction internally.
27
- * Do NOT set transaction value - even for native token (0xEeee...EEeE) deposits.
28
- * Use ETH-side decimals for amount (e.g. 1e6 for 1 USDC, not 1e18).
27
+ * Do NOT set transaction value - even for native token (0xEeee...EEeE) withdrawals.
28
+ * Amount is in target chain units (e.g. 1e6 for 1 USDC with 6 decimals).
29
29
  *
30
- * @param args.token Token address on Pod to deposit (use 0xEeee...EEeE for native)
31
- * @param args.amount Amount to deposit (in ETH-side decimals)
30
+ * @param args.token Token address on Pod to withdraw (use 0xEeee...EEeE for native)
31
+ * @param args.amount Amount to withdraw (in target chain decimals)
32
32
  * @param args.destinationWalletAddress Recipient address on ETH
33
+ * @param args.chainId Target chain ID where the claim will happen
33
34
  * @param args.from Optional sender address
34
- * @returns Unsigned transaction template with encoded deposit call
35
+ * @returns Unsigned transaction template with encoded withdraw call
36
+ */
37
+ withdraw(args: {
38
+ token: string;
39
+ amount: string | bigint;
40
+ destinationWalletAddress: string;
41
+ chainId: number | bigint;
42
+ from?: string;
43
+ }): UnsignedTransaction;
44
+ /**
45
+ * @deprecated Use withdraw() instead. deposit() on Pod has been renamed to withdraw().
35
46
  */
36
47
  deposit(args: {
37
48
  token: string;
38
49
  amount: string | bigint;
39
50
  destinationWalletAddress: string;
51
+ chainId: number | bigint;
40
52
  from?: string;
41
53
  }): UnsignedTransaction;
42
54
  /**
@@ -6,13 +6,13 @@ const bridge_abi_1 = require("../../libs/abi/bridge.abi");
6
6
  /**
7
7
  * PodToSourceChainActionClient - Handles Pod -> ETH bridging
8
8
  *
9
- * - User deposits tokens on Pod
10
- * - Call pod_getBridgeClaimProof(depositTxHash) to get proof
9
+ * - User withdraws tokens on Pod (specifying target chainId)
10
+ * - Call pod_getBridgeClaimProof(withdrawTxHash) to get proof
11
11
  * - User claims on ETH with proof + auxTxSuffix
12
12
  *
13
13
  * Important notes:
14
- * - Token addresses on Pod and ETH are different (deposit AAAA on Pod, claim BBBB on ETH)
15
- * - For USDC-like tokens, use ETH-side decimals (e.g. parseUnits('1', 6) for USDC)
14
+ * - Token addresses on Pod and ETH are different (withdraw AAAA on Pod, claim BBBB on ETH)
15
+ * - Amount is in target chain units (e.g. parseUnits('1', 6) for USDC with 6 decimals)
16
16
  * - Pod system contract handles balance internally - do NOT set tx value
17
17
  */
18
18
  class PodToSourceChainActionClient {
@@ -22,27 +22,29 @@ class PodToSourceChainActionClient {
22
22
  this.sourceChainIface = new ethers_1.Interface(bridge_abi_1.SOURCE_CHAIN_BRIDGE_ABI);
23
23
  }
24
24
  /**
25
- * Create unsigned transaction for depositing tokens from Pod to ETH
25
+ * Create unsigned transaction for withdrawing tokens from Pod to ETH
26
26
  *
27
- * After deposit:
28
- * - Call pod_getBridgeClaimProof(depositTxHash) on Pod RPC
27
+ * After withdraw:
28
+ * - Call pod_getBridgeClaimProof(withdrawTxHash) on Pod RPC
29
29
  * - Call claim() on ETH with the proof
30
30
  *
31
31
  * Note: Pod system contract handles balance deduction internally.
32
- * Do NOT set transaction value - even for native token (0xEeee...EEeE) deposits.
33
- * Use ETH-side decimals for amount (e.g. 1e6 for 1 USDC, not 1e18).
32
+ * Do NOT set transaction value - even for native token (0xEeee...EEeE) withdrawals.
33
+ * Amount is in target chain units (e.g. 1e6 for 1 USDC with 6 decimals).
34
34
  *
35
- * @param args.token Token address on Pod to deposit (use 0xEeee...EEeE for native)
36
- * @param args.amount Amount to deposit (in ETH-side decimals)
35
+ * @param args.token Token address on Pod to withdraw (use 0xEeee...EEeE for native)
36
+ * @param args.amount Amount to withdraw (in target chain decimals)
37
37
  * @param args.destinationWalletAddress Recipient address on ETH
38
+ * @param args.chainId Target chain ID where the claim will happen
38
39
  * @param args.from Optional sender address
39
- * @returns Unsigned transaction template with encoded deposit call
40
+ * @returns Unsigned transaction template with encoded withdraw call
40
41
  */
41
- deposit(args) {
42
- const data = this.podIface.encodeFunctionData('deposit', [
42
+ withdraw(args) {
43
+ const data = this.podIface.encodeFunctionData('withdraw', [
43
44
  args.token,
44
45
  args.amount,
45
- args.destinationWalletAddress
46
+ args.destinationWalletAddress,
47
+ args.chainId,
46
48
  ]);
47
49
  return {
48
50
  to: this.config.pod.contractAddress,
@@ -51,6 +53,12 @@ class PodToSourceChainActionClient {
51
53
  from: args?.from
52
54
  };
53
55
  }
56
+ /**
57
+ * @deprecated Use withdraw() instead. deposit() on Pod has been renamed to withdraw().
58
+ */
59
+ deposit(args) {
60
+ return this.withdraw(args);
61
+ }
54
62
  /**
55
63
  * Create unsigned transaction for claiming tokens on ETH (source chain)
56
64
  *
@@ -24,6 +24,10 @@ export declare class SourceChainToPodActionClient {
24
24
  * @param args.token Token address on source chain (ETH) to deposit
25
25
  * @param args.amount Amount to deposit (in token's smallest unit)
26
26
  * @param args.destinationWalletAddress Recipient address on Pod
27
+ * @param args.callContract Optional: contract to call on Pod after deposit (default: address(0) for simple bridge)
28
+ * @param args.reserveBalance Optional: amount to keep as reserve when using callContract (default: 0).
29
+ * When callContract is address(0), reserveBalance MUST be 0.
30
+ * When callContract is set, amount must exceed reserveBalance; contract must be whitelisted.
27
31
  * @param args.permit Optional permit bytes for gasless approval (default '0x')
28
32
  * @param args.from Optional sender address
29
33
  * @returns Unsigned transaction template with encoded deposit call
@@ -32,6 +36,8 @@ export declare class SourceChainToPodActionClient {
32
36
  token: string;
33
37
  amount: string | bigint;
34
38
  destinationWalletAddress: string;
39
+ callContract?: string;
40
+ reserveBalance?: string | bigint;
35
41
  permit?: string;
36
42
  from?: string;
37
43
  }): UnsignedTransaction;
@@ -29,6 +29,10 @@ class SourceChainToPodActionClient {
29
29
  * @param args.token Token address on source chain (ETH) to deposit
30
30
  * @param args.amount Amount to deposit (in token's smallest unit)
31
31
  * @param args.destinationWalletAddress Recipient address on Pod
32
+ * @param args.callContract Optional: contract to call on Pod after deposit (default: address(0) for simple bridge)
33
+ * @param args.reserveBalance Optional: amount to keep as reserve when using callContract (default: 0).
34
+ * When callContract is address(0), reserveBalance MUST be 0.
35
+ * When callContract is set, amount must exceed reserveBalance; contract must be whitelisted.
32
36
  * @param args.permit Optional permit bytes for gasless approval (default '0x')
33
37
  * @param args.from Optional sender address
34
38
  * @returns Unsigned transaction template with encoded deposit call
@@ -38,6 +42,8 @@ class SourceChainToPodActionClient {
38
42
  args.token,
39
43
  args.amount,
40
44
  args.destinationWalletAddress,
45
+ args.callContract ?? ethers_1.ZeroAddress,
46
+ args.reserveBalance ?? 0,
41
47
  args.permit ?? '0x',
42
48
  ]);
43
49
  return {
@@ -3,7 +3,7 @@ import { BridgeRequest, PodBridgeChainConfig } from '../../libs/types/pod-bridge
3
3
  * PodTrackerService - Handles tracking on the POD Chain
4
4
  *
5
5
  * Responsibilities:
6
- * - Fetch deposits made on POD (Pod -> ETH direction)
6
+ * - Fetch withdrawals made on POD (Pod -> ETH direction)
7
7
  *
8
8
  * Note: POD returns logs with blockNumber: null which ethers.js can't parse.
9
9
  * We use raw eth_getLogs RPC calls and parse logs manually.
@@ -17,16 +17,16 @@ export declare class PodTrackerService {
17
17
  private initChainId;
18
18
  ensureChainId(): Promise<void>;
19
19
  /**
20
- * Get deposits sent by an address on POD
20
+ * Get withdrawals sent by an address on POD
21
21
  */
22
22
  getDepositsSentBy(address: string): Promise<BridgeRequest[]>;
23
23
  /**
24
- * Get deposits received by an address on POD
24
+ * Get withdrawals received by an address on POD
25
25
  */
26
26
  getDepositsReceivedBy(address: string): Promise<BridgeRequest[]>;
27
27
  /**
28
- * Fetch deposits from POD using raw eth_getLogs RPC.
28
+ * Fetch withdrawals from POD using raw eth_getLogs RPC.
29
29
  * Pod returns logs with blockNumber: null, so we can't use ethers queryFilter.
30
30
  */
31
- private getDeposits;
31
+ private getWithdrawals;
32
32
  }
@@ -8,7 +8,7 @@ const bridge_abi_1 = require("../../libs/abi/bridge.abi");
8
8
  * PodTrackerService - Handles tracking on the POD Chain
9
9
  *
10
10
  * Responsibilities:
11
- * - Fetch deposits made on POD (Pod -> ETH direction)
11
+ * - Fetch withdrawals made on POD (Pod -> ETH direction)
12
12
  *
13
13
  * Note: POD returns logs with blockNumber: null which ethers.js can't parse.
14
14
  * We use raw eth_getLogs RPC calls and parse logs manually.
@@ -36,31 +36,32 @@ class PodTrackerService {
36
36
  }
37
37
  }
38
38
  /**
39
- * Get deposits sent by an address on POD
39
+ * Get withdrawals sent by an address on POD
40
40
  */
41
41
  async getDepositsSentBy(address) {
42
- // Filter by 'from' (second indexed param): Deposit(id, from, to, token, amount)
42
+ // Filter by 'from' (second indexed param): Withdraw(id, from, to, token, amount, chainId)
43
43
  const fromTopic = ethers_1.ethers.zeroPadValue(address, 32);
44
- return this.getDeposits([null, fromTopic, null]);
44
+ return this.getWithdrawals([null, fromTopic, null]);
45
45
  }
46
46
  /**
47
- * Get deposits received by an address on POD
47
+ * Get withdrawals received by an address on POD
48
48
  */
49
49
  async getDepositsReceivedBy(address) {
50
- // Filter by 'to' (third indexed param): Deposit(id, from, to, token, amount)
50
+ // Filter by 'to' (third indexed param): Withdraw(id, from, to, token, amount, chainId)
51
51
  const toTopic = ethers_1.ethers.zeroPadValue(address, 32);
52
- return this.getDeposits([null, null, toTopic]);
52
+ return this.getWithdrawals([null, null, toTopic]);
53
53
  }
54
54
  /**
55
- * Fetch deposits from POD using raw eth_getLogs RPC.
55
+ * Fetch withdrawals from POD using raw eth_getLogs RPC.
56
56
  * Pod returns logs with blockNumber: null, so we can't use ethers queryFilter.
57
57
  */
58
- async getDeposits(topicFilters) {
58
+ async getWithdrawals(topicFilters) {
59
59
  const deposits = [];
60
- // Deposit event topic
61
- const depositEventTopic = this.iface.getEvent('Deposit').topicHash;
62
- // Build topics array: [eventSig, ...filters]
63
- const topics = [depositEventTopic, ...topicFilters];
60
+ const withdrawTopic = this.iface.getEvent('Withdraw').topicHash;
61
+ const topics = [
62
+ withdrawTopic,
63
+ ...topicFilters,
64
+ ];
64
65
  // Use raw RPC to avoid ethers.js blockNumber validation
65
66
  const rpcProvider = this.provider;
66
67
  const rawLogs = await rpcProvider.send('eth_getLogs', [{
@@ -92,6 +93,7 @@ class PodTrackerService {
92
93
  destination: parsed.args.to,
93
94
  token: parsed.args.token,
94
95
  amount: parsed.args.amount.toString(),
96
+ targetChainId: Number(parsed.args.chainId),
95
97
  chainId: this.chainId,
96
98
  blockNumber: timestamp,
97
99
  timestamp,
@@ -56,7 +56,7 @@ class SourceChainTrackerService {
56
56
  const BLOCK_BATCH_SIZE = 10000;
57
57
  for (let start = startBlock; start <= currentBlock; start += BLOCK_BATCH_SIZE) {
58
58
  const end = Math.min(start + BLOCK_BATCH_SIZE - 1, currentBlock);
59
- // Event: Deposit(uint256 indexed id, address indexed from, address indexed to, address token, uint256 amount)
59
+ // Event: Deposit(uint256 indexed id, address indexed from, address indexed to, address token, uint256 amount, address callContract, uint256 reserveBalance)
60
60
  const depositFilter = this.bridge.filters.Deposit(...options.depositEventFilter);
61
61
  const depositLogs = await this.bridge.queryFilter(depositFilter, start, end);
62
62
  if (start + BLOCK_BATCH_SIZE <= currentBlock) {
@@ -80,6 +80,8 @@ class SourceChainTrackerService {
80
80
  destination: parsed.args.to,
81
81
  token: parsed.args.token,
82
82
  amount: parsed.args.amount.toString(),
83
+ callContract: parsed.args.callContract,
84
+ reserveBalance: parsed.args.reserveBalance.toString(),
83
85
  chainId: this.chainId,
84
86
  blockNumber: log.blockNumber,
85
87
  timestamp: block ? Number(block.timestamp) : 0
@@ -1,18 +1,17 @@
1
1
  /**
2
2
  * ABI for Bridge contract on Source Chain (ETH/Mainnet)
3
3
  *
4
- * ETH -> Pod: deposit on ETH (4-param with permit), auto-claim on Pod
5
- * Pod -> ETH: deposit on Pod, claim on ETH with proof from pod_getBridgeClaimProof RPC
4
+ * ETH -> Pod: deposit on ETH (6-param with callContract, reserveBalance, permit), auto-claim on Pod
5
+ * Pod -> ETH: withdraw on Pod, claim on ETH with proof from pod_getBridgeClaimProof RPC
6
6
  *
7
- * Note: Pod and ETH bridge contracts have DIFFERENT event signatures:
8
- * - ETH Deposit: uint256 indexed id (topic 0x71894900...)
9
- * - Pod Deposit: bytes32 indexed id (topic 0x980e6de4...)
7
+ * New deposit params (callContract, reserveBalance) enable depositing to CLOB orderbook in one TX.
8
+ * For simple bridge deposits: callContract=address(0), reserveBalance=0.
10
9
  */
11
10
  export declare const SOURCE_CHAIN_BRIDGE_ABI: string[];
12
11
  /**
13
12
  * ABI for Bridge system contract on Pod chain.
14
- * Pod uses bytes32 indexed id in Deposit events (different from ETH's uint256).
15
- * Pod deposit is 3-param (no permit).
13
+ * Pod uses bytes32 indexed id in Withdraw events.
14
+ * withdraw(token, amount, to, chainId) — chainId is the target chain for claiming.
16
15
  */
17
16
  export declare const POD_BRIDGE_ABI: string[];
18
17
  export declare const BRIDGE_ABI: string[];
@@ -4,19 +4,18 @@ exports.BRIDGE_ABI = exports.POD_BRIDGE_ABI = exports.SOURCE_CHAIN_BRIDGE_ABI =
4
4
  /**
5
5
  * ABI for Bridge contract on Source Chain (ETH/Mainnet)
6
6
  *
7
- * ETH -> Pod: deposit on ETH (4-param with permit), auto-claim on Pod
8
- * Pod -> ETH: deposit on Pod, claim on ETH with proof from pod_getBridgeClaimProof RPC
7
+ * ETH -> Pod: deposit on ETH (6-param with callContract, reserveBalance, permit), auto-claim on Pod
8
+ * Pod -> ETH: withdraw on Pod, claim on ETH with proof from pod_getBridgeClaimProof RPC
9
9
  *
10
- * Note: Pod and ETH bridge contracts have DIFFERENT event signatures:
11
- * - ETH Deposit: uint256 indexed id (topic 0x71894900...)
12
- * - Pod Deposit: bytes32 indexed id (topic 0x980e6de4...)
10
+ * New deposit params (callContract, reserveBalance) enable depositing to CLOB orderbook in one TX.
11
+ * For simple bridge deposits: callContract=address(0), reserveBalance=0.
13
12
  */
14
13
  exports.SOURCE_CHAIN_BRIDGE_ABI = [
15
14
  // Events
16
- "event Deposit(uint256 indexed id, address indexed from, address indexed to, address token, uint256 amount)",
15
+ "event Deposit(uint256 indexed id, address indexed from, address indexed to, address token, uint256 amount, address callContract, uint256 reserveBalance)",
17
16
  "event Claim(bytes32 indexed txHash, address token, address mirrorToken, uint256 amount, address indexed to)",
18
- // Deposit function (ERC20, with optional permit bytes)
19
- "function deposit(address token, uint256 amount, address to, bytes permit) returns (uint256)",
17
+ // Deposit function (6-param: token, amount, to, callContract, reserveBalance, permit)
18
+ "function deposit(address token, uint256 amount, address to, address callContract, uint256 reserveBalance, bytes permit) returns (uint256)",
20
19
  // Claim function with proof from pod_getBridgeClaimProof
21
20
  "function claim(address token, uint256 amount, address to, bytes proof, bytes auxTxSuffix)",
22
21
  // View functions
@@ -26,14 +25,14 @@ exports.SOURCE_CHAIN_BRIDGE_ABI = [
26
25
  ];
27
26
  /**
28
27
  * ABI for Bridge system contract on Pod chain.
29
- * Pod uses bytes32 indexed id in Deposit events (different from ETH's uint256).
30
- * Pod deposit is 3-param (no permit).
28
+ * Pod uses bytes32 indexed id in Withdraw events.
29
+ * withdraw(token, amount, to, chainId) — chainId is the target chain for claiming.
31
30
  */
32
31
  exports.POD_BRIDGE_ABI = [
33
32
  // Events
34
- "event Deposit(bytes32 indexed id, address indexed from, address indexed to, address token, uint256 amount)",
35
- // Deposit function (3-param, no permit)
36
- "function deposit(address token, uint256 amount, address to)",
33
+ "event Withdraw(bytes32 indexed id, address indexed from, address indexed to, address token, uint256 amount, uint256 chainId)",
34
+ // Withdraw function (4-param: token, amount, to, chainId)
35
+ "function withdraw(address token, uint256 amount, address to, uint256 chainId) returns (bytes32)",
37
36
  ];
38
37
  // Backward compatibility alias
39
38
  exports.BRIDGE_ABI = exports.SOURCE_CHAIN_BRIDGE_ABI;
@@ -34,6 +34,9 @@ export interface BridgeRequest {
34
34
  destination: string;
35
35
  token: string;
36
36
  amount: string;
37
+ callContract?: string;
38
+ reserveBalance?: string;
39
+ targetChainId?: number;
37
40
  chainId: number;
38
41
  blockNumber: number;
39
42
  timestamp: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapforce/pod-bridge-sdk",
3
- "version": "2.0.1",
3
+ "version": "2.2.1",
4
4
  "description": "SDK for interacting with Bridges between pod and other chains",
5
5
  "keywords": [
6
6
  "pod",