@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.
- package/dist/clients/action/{pod-to-bridged-client.d.ts → pod-to-source-chain-client.d.ts} +1 -1
- package/dist/clients/action/{pod-to-bridged-client.js → pod-to-source-chain-client.js} +5 -5
- package/dist/clients/action/{bridged-to-pod-client.d.ts → source-chain-to-pod-client.d.ts} +1 -1
- package/dist/clients/action/{bridged-to-pod-client.js → source-chain-to-pod-client.js} +5 -5
- package/dist/clients/tracker/client.js +22 -10
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/libs/types/pod-bridge.types.d.ts +5 -5
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnsignedTransaction, CertifiedLog, PodBridgeActionsClientConfig } from "../../libs/types/pod-bridge.types";
|
|
2
|
-
export declare class
|
|
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.
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
81
|
+
exports.PodToSourceChainActionClient = PodToSourceChainActionClient;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnsignedTransaction, PodBridgeActionsClientConfig } from "../../libs/types/pod-bridge.types";
|
|
2
|
-
export declare class
|
|
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.
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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 -
|
|
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 {
|
|
2
|
-
export {
|
|
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.
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
var
|
|
7
|
-
Object.defineProperty(exports, "
|
|
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
|
-
|
|
12
|
+
sourceChain: PodBridgeChainConfig;
|
|
13
13
|
pod: PodBridgeChainConfig;
|
|
14
14
|
}
|
|
15
15
|
export interface PodBridgeActionsClientConfig {
|
|
16
|
-
|
|
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
|
|
35
|
-
claimedAt
|
|
36
|
-
claimedBy
|
|
34
|
+
claimedTxHash: string | null;
|
|
35
|
+
claimedAt: number | null;
|
|
36
|
+
claimedBy: string | null;
|
|
37
37
|
}
|
|
38
38
|
export declare enum DepositType {
|
|
39
39
|
SENT = "sent",
|