@tapforce/pod-bridge-sdk 1.1.7 → 1.1.8

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.
@@ -1,5 +1,5 @@
1
1
  import { UnsignedTransaction, CertifiedLog, PodBridgeActionsClientConfig } from "../../libs/types/pod-bridge.types";
2
- export declare class PodToBridgedActionClient {
2
+ export declare class PodToSourceChainActionClient {
3
3
  private readonly config;
4
4
  private readonly iface;
5
5
  constructor(config: PodBridgeActionsClientConfig);
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PodToBridgedActionClient = void 0;
3
+ exports.PodToSourceChainActionClient = void 0;
4
4
  const ethers_1 = require("ethers");
5
5
  const bridge_abi_1 = require("../../libs/abi/bridge.abi");
6
- class PodToBridgedActionClient {
6
+ class PodToSourceChainActionClient {
7
7
  constructor(config) {
8
8
  this.config = config;
9
9
  this.iface = new ethers_1.Interface(bridge_abi_1.POD_BRIDGE_ABI);
@@ -55,7 +55,7 @@ class PodToBridgedActionClient {
55
55
  claimWithCertificate(args) {
56
56
  const data = this.iface.encodeFunctionData('claim', [args.certifiedLog]);
57
57
  return {
58
- to: this.config.bridged.contractAddress,
58
+ to: this.config.sourceChain.contractAddress,
59
59
  data,
60
60
  value: '0',
61
61
  from: args === null || args === void 0 ? void 0 : args.from
@@ -71,11 +71,11 @@ class PodToBridgedActionClient {
71
71
  claimNativeWithCertificate(args) {
72
72
  const data = this.iface.encodeFunctionData('claimNative', [args.certifiedLog]);
73
73
  return {
74
- to: this.config.bridged.contractAddress,
74
+ to: this.config.sourceChain.contractAddress,
75
75
  data,
76
76
  value: '0',
77
77
  from: args === null || args === void 0 ? void 0 : args.from
78
78
  };
79
79
  }
80
80
  }
81
- exports.PodToBridgedActionClient = PodToBridgedActionClient;
81
+ exports.PodToSourceChainActionClient = PodToSourceChainActionClient;
@@ -1,5 +1,5 @@
1
1
  import { UnsignedTransaction, PodBridgeActionsClientConfig } from "../../libs/types/pod-bridge.types";
2
- export declare class BridgedToPodActionClient {
2
+ export declare class SourceChainToPodActionClient {
3
3
  private readonly config;
4
4
  private readonly iface;
5
5
  constructor(config: PodBridgeActionsClientConfig);
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BridgedToPodActionClient = void 0;
3
+ exports.SourceChainToPodActionClient = void 0;
4
4
  const ethers_1 = require("ethers");
5
5
  const bridge_abi_1 = require("../../libs/abi/bridge.abi");
6
- class BridgedToPodActionClient {
6
+ class SourceChainToPodActionClient {
7
7
  constructor(config) {
8
8
  this.config = config;
9
9
  this.iface = new ethers_1.Interface(bridge_abi_1.POD_BRIDGE_ABI);
@@ -24,7 +24,7 @@ class BridgedToPodActionClient {
24
24
  args.destinationWalletAddress
25
25
  ]);
26
26
  return {
27
- to: this.config.bridged.contractAddress,
27
+ to: this.config.sourceChain.contractAddress,
28
28
  data,
29
29
  value: '0',
30
30
  from: args === null || args === void 0 ? void 0 : args.from
@@ -41,7 +41,7 @@ class BridgedToPodActionClient {
41
41
  depositNative(args) {
42
42
  const data = this.iface.encodeFunctionData('depositNative', [args.destinationWalletAddress]);
43
43
  return {
44
- to: this.config.bridged.contractAddress,
44
+ to: this.config.sourceChain.contractAddress,
45
45
  data,
46
46
  value: args.amount.toString(),
47
47
  from: args === null || args === void 0 ? void 0 : args.from
@@ -89,4 +89,4 @@ class BridgedToPodActionClient {
89
89
  };
90
90
  }
91
91
  }
92
- exports.BridgedToPodActionClient = BridgedToPodActionClient;
92
+ exports.SourceChainToPodActionClient = SourceChainToPodActionClient;
@@ -8,10 +8,10 @@ class PodBridgeTrackerClient {
8
8
  constructor(config) {
9
9
  this.config = config;
10
10
  // Initialize providers
11
- this.bridgedProvider = new ethers_1.ethers.JsonRpcProvider(config.bridged.rpcUrl);
11
+ this.bridgedProvider = new ethers_1.ethers.JsonRpcProvider(config.sourceChain.rpcUrl);
12
12
  this.podProvider = new ethers_1.ethers.JsonRpcProvider(config.pod.rpcUrl);
13
13
  // Initialize contract instances
14
- this.bridgedBridge = new ethers_1.Contract(config.bridged.contractAddress, bridge_abi_1.POD_BRIDGE_ABI, this.bridgedProvider);
14
+ this.bridgedBridge = new ethers_1.Contract(config.sourceChain.contractAddress, bridge_abi_1.POD_BRIDGE_ABI, this.bridgedProvider);
15
15
  this.podBridge = new ethers_1.Contract(config.pod.contractAddress, bridge_abi_1.POD_BRIDGE_ABI, this.podProvider);
16
16
  // Interface for parsing logs
17
17
  this.iface = new ethers_1.Interface(bridge_abi_1.POD_BRIDGE_ABI);
@@ -24,7 +24,7 @@ class PodBridgeTrackerClient {
24
24
  */
25
25
  async getDepositsSentBy(address, fromBlock) {
26
26
  var _a;
27
- const startBlock = (_a = fromBlock !== null && fromBlock !== void 0 ? fromBlock : this.config.bridged.deploymentBlock) !== null && _a !== void 0 ? _a : 0;
27
+ const startBlock = (_a = fromBlock !== null && fromBlock !== void 0 ? fromBlock : this.config.sourceChain.deploymentBlock) !== null && _a !== void 0 ? _a : 0;
28
28
  const deposits = [];
29
29
  const currentBlock = await this.bridgedProvider.getBlockNumber();
30
30
  const BLOCK_BATCH_SIZE = 10000;
@@ -67,7 +67,10 @@ class PodBridgeTrackerClient {
67
67
  token: parsed.args.token,
68
68
  amount: parsed.args.amount.toString(),
69
69
  isClaimed: false,
70
- isClaimable: false
70
+ isClaimable: false,
71
+ claimedTxHash: null,
72
+ claimedAt: null,
73
+ claimedBy: null
71
74
  });
72
75
  }
73
76
  }
@@ -88,7 +91,10 @@ class PodBridgeTrackerClient {
88
91
  token: ethers_1.ethers.ZeroAddress, // Native token
89
92
  amount: parsed.args.amount.toString(),
90
93
  isClaimed: false,
91
- isClaimable: false
94
+ isClaimable: false,
95
+ claimedTxHash: null,
96
+ claimedAt: null,
97
+ claimedBy: null
92
98
  });
93
99
  }
94
100
  }
@@ -105,7 +111,7 @@ class PodBridgeTrackerClient {
105
111
  */
106
112
  async getDepositsReceivedBy(address, fromBlock) {
107
113
  var _a;
108
- const startBlock = (_a = fromBlock !== null && fromBlock !== void 0 ? fromBlock : this.config.bridged.deploymentBlock) !== null && _a !== void 0 ? _a : 0;
114
+ const startBlock = (_a = fromBlock !== null && fromBlock !== void 0 ? fromBlock : this.config.sourceChain.deploymentBlock) !== null && _a !== void 0 ? _a : 0;
109
115
  const deposits = [];
110
116
  const currentBlock = await this.bridgedProvider.getBlockNumber();
111
117
  const BLOCK_BATCH_SIZE = 10000;
@@ -145,7 +151,10 @@ class PodBridgeTrackerClient {
145
151
  token: parsed.args.token,
146
152
  amount: parsed.args.amount.toString(),
147
153
  isClaimed: false,
148
- isClaimable: false
154
+ isClaimable: false,
155
+ claimedTxHash: null,
156
+ claimedAt: null,
157
+ claimedBy: null
149
158
  });
150
159
  }
151
160
  }
@@ -166,7 +175,10 @@ class PodBridgeTrackerClient {
166
175
  token: ethers_1.ethers.ZeroAddress,
167
176
  amount: parsed.args.amount.toString(),
168
177
  isClaimed: false,
169
- isClaimable: false
178
+ isClaimable: false,
179
+ claimedTxHash: null,
180
+ claimedAt: null,
181
+ claimedBy: null
170
182
  });
171
183
  }
172
184
  }
@@ -280,7 +292,7 @@ class PodBridgeTrackerClient {
280
292
  }
281
293
  // Get current block to check finalization
282
294
  const currentBlock = await this.bridgedProvider.getBlockNumber();
283
- const finalizedBlock = currentBlock - 15; // ~15 minutes on Sepolia
295
+ const finalizedBlock = currentBlock - 64; // 2 epoch (32 x 2 blocks) ~15 minutes on Sepolia
284
296
  // Update deposit status
285
297
  for (const deposit of deposits) {
286
298
  const claimInfo = claimedMap.get(deposit.requestId);
@@ -299,7 +311,7 @@ class PodBridgeTrackerClient {
299
311
  // Fallback: Still calculate isClaimable based on finalization even if claim check fails
300
312
  try {
301
313
  const currentBlock = await this.bridgedProvider.getBlockNumber();
302
- const finalizedBlock = currentBlock - 15;
314
+ const finalizedBlock = currentBlock - 64; // 2 epoch (32 x 2 blocks) ~15 minutes on Sepolia
303
315
  for (const deposit of deposits) {
304
316
  deposit.isClaimable = deposit.blockNumber <= finalizedBlock && !deposit.isClaimed;
305
317
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { PodToBridgedActionClient } from './clients/action/pod-to-bridged-client';
2
- export { BridgedToPodActionClient } from './clients/action/bridged-to-pod-client';
1
+ export { PodToSourceChainActionClient } from './clients/action/pod-to-source-chain-client';
2
+ export { SourceChainToPodActionClient } from './clients/action/source-chain-to-pod-client';
3
3
  export { PodBridgeTrackerClient } from './clients/tracker/client';
4
4
  export { POD_BRIDGE_ABI } from './libs/abi/bridge.abi';
5
- export { PodBridgeConfig, BridgeRequest, BridgeRequestWithType, DepositType, UnsignedTransaction, CertifiedLog, PodAttestation, PodMetadata, PodTransactionReceipt, } from './libs/types/pod-bridge.types';
5
+ export { PodBridgeConfig, BridgeRequest, BridgeRequestWithType, DepositType, UnsignedTransaction, CertifiedLog, PodAttestation, PodMetadata, PodTransactionReceipt, PodBridgeActionsClientConfig, PodBridgeChainConfig } from './libs/types/pod-bridge.types';
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DepositType = exports.POD_BRIDGE_ABI = exports.PodBridgeTrackerClient = exports.BridgedToPodActionClient = exports.PodToBridgedActionClient = void 0;
4
- var pod_to_bridged_client_1 = require("./clients/action/pod-to-bridged-client");
5
- Object.defineProperty(exports, "PodToBridgedActionClient", { enumerable: true, get: function () { return pod_to_bridged_client_1.PodToBridgedActionClient; } });
6
- var bridged_to_pod_client_1 = require("./clients/action/bridged-to-pod-client");
7
- Object.defineProperty(exports, "BridgedToPodActionClient", { enumerable: true, get: function () { return bridged_to_pod_client_1.BridgedToPodActionClient; } });
3
+ exports.DepositType = exports.POD_BRIDGE_ABI = exports.PodBridgeTrackerClient = exports.SourceChainToPodActionClient = exports.PodToSourceChainActionClient = void 0;
4
+ var pod_to_source_chain_client_1 = require("./clients/action/pod-to-source-chain-client");
5
+ Object.defineProperty(exports, "PodToSourceChainActionClient", { enumerable: true, get: function () { return pod_to_source_chain_client_1.PodToSourceChainActionClient; } });
6
+ var source_chain_to_pod_client_1 = require("./clients/action/source-chain-to-pod-client");
7
+ Object.defineProperty(exports, "SourceChainToPodActionClient", { enumerable: true, get: function () { return source_chain_to_pod_client_1.SourceChainToPodActionClient; } });
8
8
  var client_1 = require("./clients/tracker/client");
9
9
  Object.defineProperty(exports, "PodBridgeTrackerClient", { enumerable: true, get: function () { return client_1.PodBridgeTrackerClient; } });
10
10
  var bridge_abi_1 = require("./libs/abi/bridge.abi");
@@ -9,11 +9,11 @@ export interface PodBridgeChainConfig {
9
9
  * * pod: Configuration for the POD chain. BridgeMintBurn contract address
10
10
  */
11
11
  export interface PodBridgeConfig {
12
- bridged: PodBridgeChainConfig;
12
+ sourceChain: PodBridgeChainConfig;
13
13
  pod: PodBridgeChainConfig;
14
14
  }
15
15
  export interface PodBridgeActionsClientConfig {
16
- bridged: {
16
+ sourceChain: {
17
17
  contractAddress: string;
18
18
  };
19
19
  pod: {
@@ -31,9 +31,9 @@ export interface BridgeRequest {
31
31
  amount: string;
32
32
  isClaimed: boolean;
33
33
  isClaimable: boolean;
34
- claimedTxHash?: string;
35
- claimedAt?: number;
36
- claimedBy?: string;
34
+ claimedTxHash: string | null;
35
+ claimedAt: number | null;
36
+ claimedBy: string | null;
37
37
  }
38
38
  export declare enum DepositType {
39
39
  SENT = "sent",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapforce/pod-bridge-sdk",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "SDK for interacting with Bridges between pod and other chains",
5
5
  "keywords": [
6
6
  "pod",