@gibs/bridge-sdk 1.7.2 → 1.9.0
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 +476 -12
- package/dist/src/abis.d.ts +15 -0
- package/dist/src/abis.js +1 -0
- package/dist/src/chain-info.d.ts +1 -1
- package/dist/src/chains.js +1 -1
- package/dist/src/config.d.ts +28 -5
- package/dist/src/config.js +71 -17
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -3
- package/src/abis.ts +1 -0
- package/src/chain-info.ts +2 -2
- package/src/chains.ts +1 -1
- package/src/config.ts +104 -17
package/dist/src/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAddress, zeroAddress } from "viem";
|
|
1
|
+
import { getAddress, keccak256, stringToHex, zeroAddress } from "viem";
|
|
2
2
|
import _ from 'lodash';
|
|
3
3
|
/**
|
|
4
4
|
* Add here your chain id as hex, be sure to add your chain in the chainsMetadata object too
|
|
@@ -27,12 +27,15 @@ export const toChain = (chainId) => `0x${Number(chainId).toString(16)}`;
|
|
|
27
27
|
* @returns the chain key
|
|
28
28
|
*/
|
|
29
29
|
export const toChainKey = (chainId) => chainIdToKey.get(toChain(chainId));
|
|
30
|
-
/** The provider of an omnibridge */
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
// /** The provider of an omnibridge */
|
|
31
|
+
// export enum Provider {
|
|
32
|
+
// PULSECHAIN = 'pulsechain',
|
|
33
|
+
// TOKENSEX = 'tokensex',
|
|
34
|
+
// }
|
|
35
|
+
export const Providers = {
|
|
36
|
+
PULSECHAIN: 'pulsechain',
|
|
37
|
+
TOKENSEX: 'tokensex',
|
|
38
|
+
};
|
|
36
39
|
/** A map of chains to native asset out addresses */
|
|
37
40
|
export const nativeAssetOut = {
|
|
38
41
|
[Chains.ETH]: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
@@ -83,7 +86,7 @@ const pulsechainPLSETHSettings = {
|
|
|
83
86
|
nativeRouter: '0xE66877Cfe4CEc10ffBbBB3092B7001321AB5809D',
|
|
84
87
|
};
|
|
85
88
|
export const pathways = {
|
|
86
|
-
[
|
|
89
|
+
[Providers.PULSECHAIN]: {
|
|
87
90
|
[Chains.PLS]: {
|
|
88
91
|
[Chains.ETH]: {
|
|
89
92
|
from: '0x4fD0aaa7506f3d9cB8274bdB946Ec42A1b8751Ef',
|
|
@@ -127,7 +130,7 @@ export const pathways = {
|
|
|
127
130
|
},
|
|
128
131
|
},
|
|
129
132
|
},
|
|
130
|
-
[
|
|
133
|
+
[Providers.TOKENSEX]: {
|
|
131
134
|
[Chains.PLS]: {
|
|
132
135
|
[Chains.BNB]: {
|
|
133
136
|
from: '0xf1DFc63e10fF01b8c3d307529b47AefaD2154C0e',
|
|
@@ -161,7 +164,7 @@ export const pathways = {
|
|
|
161
164
|
},
|
|
162
165
|
};
|
|
163
166
|
export const testnetPathways = {
|
|
164
|
-
[
|
|
167
|
+
[Providers.TOKENSEX]: {
|
|
165
168
|
// plsv4 to bnb home omnibridge: 0xfd0c07C376D27EA0E9fA64Ac5D2481439e36CF9C
|
|
166
169
|
// [Chains.BNB]: {
|
|
167
170
|
// [Chains.V4PLS]: {
|
|
@@ -184,7 +187,7 @@ export const testnetPathways = {
|
|
|
184
187
|
// },
|
|
185
188
|
// },
|
|
186
189
|
},
|
|
187
|
-
[
|
|
190
|
+
[Providers.PULSECHAIN]: {
|
|
188
191
|
[Chains.V4PLS]: {
|
|
189
192
|
[Chains.SEP]: {
|
|
190
193
|
from: '0x6B08a50865aDeCe6e3869D9AfbB316d0a0436B6c',
|
|
@@ -217,15 +220,15 @@ export const testnetPathways = {
|
|
|
217
220
|
};
|
|
218
221
|
/** The mainnet bridge keys */
|
|
219
222
|
const mainnetBridgeKeys = [
|
|
220
|
-
[
|
|
221
|
-
[
|
|
222
|
-
[
|
|
223
|
-
[
|
|
223
|
+
[Providers.PULSECHAIN, Chains.PLS, Chains.ETH],
|
|
224
|
+
[Providers.PULSECHAIN, Chains.ETH, Chains.PLS],
|
|
225
|
+
[Providers.TOKENSEX, Chains.PLS, Chains.BNB],
|
|
226
|
+
[Providers.TOKENSEX, Chains.BNB, Chains.PLS],
|
|
224
227
|
];
|
|
225
228
|
/** The testnet bridge keys */
|
|
226
229
|
const testnetBridgeKeys = [
|
|
227
|
-
[
|
|
228
|
-
[
|
|
230
|
+
[Providers.PULSECHAIN, Chains.SEP, Chains.V4PLS],
|
|
231
|
+
[Providers.PULSECHAIN, Chains.V4PLS, Chains.SEP],
|
|
229
232
|
];
|
|
230
233
|
/** Returns the valid bridge keys for the given is prod */
|
|
231
234
|
export const validBridgeKeys = (isProd) => [
|
|
@@ -330,3 +333,54 @@ export const isUnwrappable = (bridgeKey, assetIn) => {
|
|
|
330
333
|
export const canChangeUnwrap = (bridgeKey, assetIn) => {
|
|
331
334
|
return !!assetIn && isUnwrappable(bridgeKey, assetIn);
|
|
332
335
|
};
|
|
336
|
+
export const chains = {
|
|
337
|
+
ethereum: 1,
|
|
338
|
+
bsc: 56,
|
|
339
|
+
pulsechain: 369,
|
|
340
|
+
pulsechainV4: 943,
|
|
341
|
+
sepolia: 11155111,
|
|
342
|
+
};
|
|
343
|
+
export const chainIds = Object.values(chains);
|
|
344
|
+
// provider -> home -> foreign
|
|
345
|
+
export const bridgeConfigs = {
|
|
346
|
+
[Providers.PULSECHAIN]: {
|
|
347
|
+
[chains.pulsechain]: {
|
|
348
|
+
[chains.ethereum]: [{
|
|
349
|
+
pair: 'mainnet',
|
|
350
|
+
key: 'erc20',
|
|
351
|
+
home: '0x4fD0aaa7506f3d9cB8274bdB946Ec42A1b8751Ef',
|
|
352
|
+
foreign: '0x1715a3e4a142d8b698131108995174f37aeba10d',
|
|
353
|
+
}, {
|
|
354
|
+
pair: 'mainnet',
|
|
355
|
+
key: 'native',
|
|
356
|
+
home: '0x0e18d0d556b652794EF12Bf68B2dC857EF5f3996',
|
|
357
|
+
foreign: '0xe20E337DB2a00b1C37139c873B92a0AAd3F468bF',
|
|
358
|
+
}],
|
|
359
|
+
},
|
|
360
|
+
[chains.pulsechainV4]: {
|
|
361
|
+
[chains.sepolia]: [{
|
|
362
|
+
pair: 'v4',
|
|
363
|
+
key: 'erc20',
|
|
364
|
+
home: '0x6B08a50865aDeCe6e3869D9AfbB316d0a0436B6c',
|
|
365
|
+
foreign: '0x546e37DAA15cdb82fd1a717E5dEEa4AF08D4349A',
|
|
366
|
+
}, {
|
|
367
|
+
pair: 'v4',
|
|
368
|
+
key: 'native',
|
|
369
|
+
home: '0x81c10846F40fA2B173FC47958D0a892529983F50',
|
|
370
|
+
foreign: '0x5e238ef968467cf443ef5ecb683b76c5a04a0421',
|
|
371
|
+
}],
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
[Providers.TOKENSEX]: {
|
|
375
|
+
[chains.pulsechain]: {
|
|
376
|
+
[chains.bsc]: [{
|
|
377
|
+
pair: 'bsctokensex',
|
|
378
|
+
key: 'erc20',
|
|
379
|
+
home: '0xf1DFc63e10fF01b8c3d307529b47AefaD2154C0e',
|
|
380
|
+
foreign: '0xb4005881e81a6ecd2c1f75d58e8e41f28d59c6b1',
|
|
381
|
+
}],
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
};
|
|
385
|
+
export const HOME_TO_FOREIGN_FEE = keccak256(stringToHex("homeToForeignFee"));
|
|
386
|
+
export const FOREIGN_TO_HOME_FEE = keccak256(stringToHex("foreignToHomeFee"));
|