@tapforce/pod-bridge-sdk 1.1.12 → 1.1.14

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,7 +1,8 @@
1
1
  import { UnsignedTransaction, CertifiedLog, PodBridgeActionsClientConfig } from "../../libs/types/pod-bridge.types";
2
2
  export declare class PodToSourceChainActionClient {
3
3
  private readonly config;
4
- private readonly iface;
4
+ private readonly podIface;
5
+ private readonly sourceChainIface;
5
6
  constructor(config: PodBridgeActionsClientConfig);
6
7
  /**
7
8
  * Create unsigned transaction for depositing ERC20 tokens from POD to Bridged chain
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PodToSourceChainActionClient = void 0;
4
4
  const ethers_1 = require("ethers");
5
5
  const bridge_abi_1 = require("../../libs/abi/bridge.abi");
6
+ const convert_certified_log_helper_1 = require("../../libs/helpers/convert-certified-log.helper");
6
7
  class PodToSourceChainActionClient {
7
8
  constructor(config) {
8
9
  this.config = config;
9
- this.iface = new ethers_1.Interface(bridge_abi_1.POD_BRIDGE_ABI);
10
+ this.podIface = new ethers_1.Interface(bridge_abi_1.POD_BRIDGE_ABI);
11
+ this.sourceChainIface = new ethers_1.Interface(bridge_abi_1.SOURCE_CHAIN_BRIDGE_ABI);
10
12
  }
11
13
  /**
12
14
  * Create unsigned transaction for depositing ERC20 tokens from POD to Bridged chain
@@ -17,7 +19,7 @@ class PodToSourceChainActionClient {
17
19
  * @returns Unsigned transaction template with encoded deposit call
18
20
  */
19
21
  depositToken(args) {
20
- const data = this.iface.encodeFunctionData('deposit', [
22
+ const data = this.podIface.encodeFunctionData('deposit', [
21
23
  args.token,
22
24
  args.amount,
23
25
  args.destinationWalletAddress
@@ -37,7 +39,7 @@ class PodToSourceChainActionClient {
37
39
  * @returns Unsigned transaction template with encoded depositNative call
38
40
  */
39
41
  depositNative(args) {
40
- const data = this.iface.encodeFunctionData('depositNative', [args.destinationWalletAddress]);
42
+ const data = this.podIface.encodeFunctionData('depositNative', [args.destinationWalletAddress]);
41
43
  return {
42
44
  to: this.config.pod.contractAddress,
43
45
  data,
@@ -53,7 +55,8 @@ class PodToSourceChainActionClient {
53
55
  * @returns Unsigned transaction template with encoded claim call
54
56
  */
55
57
  claimWithCertificate(args) {
56
- const data = this.iface.encodeFunctionData('claim', [args.certifiedLog]);
58
+ // Use source chain interface which has the certificate-based claim function
59
+ const data = this.sourceChainIface.encodeFunctionData('claim', [args.certifiedLog]);
57
60
  return {
58
61
  to: this.config.sourceChain.contractAddress,
59
62
  data,
@@ -69,7 +72,8 @@ class PodToSourceChainActionClient {
69
72
  * @returns Unsigned transaction template with encoded claimNative call
70
73
  */
71
74
  claimNativeWithCertificate(args) {
72
- const data = this.iface.encodeFunctionData('claimNative', [args.certifiedLog]);
75
+ // Use source chain interface which has the certificate-based claimNative function
76
+ const data = this.sourceChainIface.encodeFunctionData('claimNative', [(0, convert_certified_log_helper_1.convertFFICertifiedLog)(args.certifiedLog)]);
73
77
  return {
74
78
  to: this.config.sourceChain.contractAddress,
75
79
  data,
@@ -16,8 +16,8 @@ class SourceChainTrackerService {
16
16
  this.config = config;
17
17
  this.chainId = null;
18
18
  this.provider = new ethers_1.ethers.JsonRpcProvider(config.rpcUrl);
19
- this.bridge = new ethers_1.Contract(config.contractAddress, bridge_abi_1.POD_BRIDGE_ABI, this.provider);
20
- this.iface = new ethers_1.Interface(bridge_abi_1.POD_BRIDGE_ABI);
19
+ this.bridge = new ethers_1.Contract(config.contractAddress, bridge_abi_1.SOURCE_CHAIN_BRIDGE_ABI, this.provider);
20
+ this.iface = new ethers_1.Interface(bridge_abi_1.SOURCE_CHAIN_BRIDGE_ABI);
21
21
  this.initChainId();
22
22
  }
23
23
  async initChainId() {
@@ -1 +1,12 @@
1
+ /**
2
+ * ABI for BridgeMintBurn contract on POD Chain
3
+ * - Deposits burn tokens
4
+ * - Claims use block number verification via precompiles
5
+ */
1
6
  export declare const POD_BRIDGE_ABI: string[];
7
+ /**
8
+ * ABI for BridgeDepositWithdraw contract on Source Chain (e.g., Sepolia)
9
+ * - Deposits lock tokens
10
+ * - Claims use POD certificates with attestations and merkle proofs
11
+ */
12
+ export declare const SOURCE_CHAIN_BRIDGE_ABI: string[];
@@ -1,31 +1,49 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.POD_BRIDGE_ABI = void 0;
4
- // Updated ABI with improved event signatures
3
+ exports.SOURCE_CHAIN_BRIDGE_ABI = exports.POD_BRIDGE_ABI = void 0;
4
+ /**
5
+ * ABI for BridgeMintBurn contract on POD Chain
6
+ * - Deposits burn tokens
7
+ * - Claims use block number verification via precompiles
8
+ */
5
9
  exports.POD_BRIDGE_ABI = [
6
- // Improved Deposit events with indexed from/to and additional data
10
+ // Events
7
11
  "event Deposit(uint256 indexed id, address indexed from, address indexed to, address token, uint256 amount, uint256 timestamp, uint256 blockNumber)",
8
12
  "event DepositNative(uint256 indexed id, address indexed from, address indexed to, uint256 amount, uint256 timestamp, uint256 blockNumber)",
9
- // Improved Claim events with indexed claimer/to
10
13
  "event Claim(uint256 indexed id, address indexed claimer, address indexed to, address mirrorToken, address token, uint256 amount, uint256 timestamp)",
11
14
  "event ClaimNative(uint256 indexed id, address indexed claimer, address indexed to, uint256 amount, uint256 timestamp)",
12
- // Action functions
15
+ "event BurnNative(address indexed from, uint256 amount)",
16
+ // Deposit functions
13
17
  "function deposit(address token, uint256 amount, address to) returns (uint256)",
14
18
  "function depositNative(address to) payable returns (uint256)",
15
- "function claim(tuple(tuple(address addr, bytes32[] topics, bytes data) log, tuple(bytes32 r, bytes32 s, uint8 v)[] sigs) certifiedLog)",
16
- "function claimNative(tuple(tuple(address addr, bytes32[] topics, bytes data) log, tuple(bytes32 r, bytes32 s, uint8 v)[] sigs) certifiedLog)",
19
+ // Claim functions (use block number verification)
17
20
  "function claim(uint256 id, address token, uint256 blockNumber)",
18
21
  "function claimNative(uint256 id, uint256 blockNumber)",
19
22
  // View functions
20
23
  "function processedRequests(bytes32) view returns (bool)",
21
24
  "function bridgeContract() view returns (address)",
22
- "function getSourceChainId() view returns (uint96)",
23
- "function getDestinationChainId() view returns (uint256)",
24
- "function getBridgeCounterpart() view returns (address)",
25
- // Batch status checks
26
- "function isRequestProcessed(uint256 id, address token, uint256 amount, address to) view returns (bool)",
25
+ "function SOURCE_CHAIN_ID() view returns (uint96)",
26
+ "function areRequestsProcessed(uint256[] ids, address[] tokens, uint256[] amounts, address[] tos) view returns (bool[])",
27
+ ];
28
+ /**
29
+ * ABI for BridgeDepositWithdraw contract on Source Chain (e.g., Sepolia)
30
+ * - Deposits lock tokens
31
+ * - Claims use POD certificates with attestations and merkle proofs
32
+ */
33
+ exports.SOURCE_CHAIN_BRIDGE_ABI = [
34
+ // Events
35
+ "event Deposit(uint256 indexed id, address indexed from, address indexed to, address token, uint256 amount, uint256 timestamp, uint256 blockNumber)",
36
+ "event DepositNative(uint256 indexed id, address indexed from, address indexed to, uint256 amount, uint256 timestamp, uint256 blockNumber)",
37
+ "event Claim(uint256 indexed id, address indexed claimer, address indexed to, address mirrorToken, address token, uint256 amount, uint256 timestamp)",
38
+ "event ClaimNative(uint256 indexed id, address indexed claimer, address indexed to, uint256 amount, uint256 timestamp)",
39
+ // Deposit functions
40
+ "function deposit(address token, uint256 amount, address to) returns (uint256)",
41
+ "function depositNative(address to) payable returns (uint256)",
42
+ // Claim functions (use PodECDSA.CertifiedLog with certificates)
43
+ "function claim(tuple(tuple(address addr, bytes32[] topics, bytes data) log, uint256 logIndex, tuple(tuple(bytes32 receiptRoot, bytes aggregateSignature, uint256[] sortedAttestationTimestamps) certifiedReceipt, bytes32 leaf, tuple(bytes32[] path) proof) certificate) certifiedLog)",
44
+ "function claimNative(tuple(tuple(address addr, bytes32[] topics, bytes data) log, uint256 logIndex, tuple(tuple(bytes32 receiptRoot, bytes aggregateSignature, uint256[] sortedAttestationTimestamps) certifiedReceipt, bytes32 leaf, tuple(bytes32[] path) proof) certificate) certifiedLog)",
45
+ // View functions
46
+ "function processedRequests(bytes32) view returns (bool)",
47
+ "function bridgeContract() view returns (address)",
27
48
  "function areRequestsProcessed(uint256[] ids, address[] tokens, uint256[] amounts, address[] tos) view returns (bool[])",
28
- // Finality checks (BridgeMintBurn only)
29
- "function canBeClaimed(uint256 blockNumber) view returns (bool)",
30
- "function canBeClaimedBatch(uint256[] blockNumbers) view returns (bool[])",
31
49
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapforce/pod-bridge-sdk",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
4
4
  "description": "SDK for interacting with Bridges between pod and other chains",
5
5
  "keywords": [
6
6
  "pod",