@tapforce/pod-bridge-sdk 1.1.12 → 1.1.13
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/clients/action/pod-to-source-chain-client.d.ts +2 -1
- package/dist/clients/action/pod-to-source-chain-client.js +8 -5
- package/dist/clients/tracker/source-chain-tracker.service.js +2 -2
- package/dist/libs/abi/bridge.abi.d.ts +11 -0
- package/dist/libs/abi/bridge.abi.js +33 -15
- package/package.json +1 -1
|
@@ -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
|
|
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
|
|
@@ -6,7 +6,8 @@ const bridge_abi_1 = require("../../libs/abi/bridge.abi");
|
|
|
6
6
|
class PodToSourceChainActionClient {
|
|
7
7
|
constructor(config) {
|
|
8
8
|
this.config = config;
|
|
9
|
-
this.
|
|
9
|
+
this.podIface = new ethers_1.Interface(bridge_abi_1.POD_BRIDGE_ABI);
|
|
10
|
+
this.sourceChainIface = new ethers_1.Interface(bridge_abi_1.SOURCE_CHAIN_BRIDGE_ABI);
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* Create unsigned transaction for depositing ERC20 tokens from POD to Bridged chain
|
|
@@ -17,7 +18,7 @@ class PodToSourceChainActionClient {
|
|
|
17
18
|
* @returns Unsigned transaction template with encoded deposit call
|
|
18
19
|
*/
|
|
19
20
|
depositToken(args) {
|
|
20
|
-
const data = this.
|
|
21
|
+
const data = this.podIface.encodeFunctionData('deposit', [
|
|
21
22
|
args.token,
|
|
22
23
|
args.amount,
|
|
23
24
|
args.destinationWalletAddress
|
|
@@ -37,7 +38,7 @@ class PodToSourceChainActionClient {
|
|
|
37
38
|
* @returns Unsigned transaction template with encoded depositNative call
|
|
38
39
|
*/
|
|
39
40
|
depositNative(args) {
|
|
40
|
-
const data = this.
|
|
41
|
+
const data = this.podIface.encodeFunctionData('depositNative', [args.destinationWalletAddress]);
|
|
41
42
|
return {
|
|
42
43
|
to: this.config.pod.contractAddress,
|
|
43
44
|
data,
|
|
@@ -53,7 +54,8 @@ class PodToSourceChainActionClient {
|
|
|
53
54
|
* @returns Unsigned transaction template with encoded claim call
|
|
54
55
|
*/
|
|
55
56
|
claimWithCertificate(args) {
|
|
56
|
-
|
|
57
|
+
// Use source chain interface which has the certificate-based claim function
|
|
58
|
+
const data = this.sourceChainIface.encodeFunctionData('claim', [args.certifiedLog]);
|
|
57
59
|
return {
|
|
58
60
|
to: this.config.sourceChain.contractAddress,
|
|
59
61
|
data,
|
|
@@ -69,7 +71,8 @@ class PodToSourceChainActionClient {
|
|
|
69
71
|
* @returns Unsigned transaction template with encoded claimNative call
|
|
70
72
|
*/
|
|
71
73
|
claimNativeWithCertificate(args) {
|
|
72
|
-
|
|
74
|
+
// Use source chain interface which has the certificate-based claimNative function
|
|
75
|
+
const data = this.sourceChainIface.encodeFunctionData('claimNative', [args.certifiedLog]);
|
|
73
76
|
return {
|
|
74
77
|
to: this.config.sourceChain.contractAddress,
|
|
75
78
|
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.
|
|
20
|
-
this.iface = new ethers_1.Interface(bridge_abi_1.
|
|
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
|
-
|
|
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
|
-
//
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
23
|
-
"function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
];
|