@gibs/bridge-sdk 1.7.1 → 1.7.3

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 CHANGED
@@ -1,23 +1,487 @@
1
- # Bridge Sdk
1
+ # Bridge SDK
2
2
 
3
- tooling to help facilitate briding over omnibridges and apply a price to delivery
3
+ A comprehensive toolkit for facilitating cross-chain bridge operations across multiple blockchain networks. This SDK provides low-level building blocks for implementing bridge functionality in decentralized applications.
4
4
 
5
- these are low level tools so they will have to be put together carefully
5
+ ## 🎯 Use Cases
6
6
 
7
- they are also in beta stages of development so things may simply change version to version
7
+ ### Primary Use Cases
8
+ - **Cross-Chain Bridge Implementation**: Build applications that move tokens between different blockchain networks
9
+ - **Multi-Chain DApp Development**: Create applications that operate across PulseChain, Ethereum, Binance Smart Chain, and other supported networks
10
+ - **Bridge Provider Integration**: Integrate with multiple bridge providers (PulseChain native bridges, TokenSex, etc.)
11
+ - **Token Metadata Management**: Access standardized token information, logos, and network-specific addresses
12
+ - **Fee Calculation**: Calculate and manage bridge fees across different providers and networks
8
13
 
9
- to make things easier, versions are synced across packages
14
+ ### Target Applications
15
+ - Cross-chain DEX interfaces
16
+ - Bridge aggregator platforms
17
+ - Multi-chain portfolio management tools
18
+ - DeFi applications requiring cross-chain functionality
19
+ - Wallet applications with bridge features
20
+
21
+ ## 🔧 Core Functionality
22
+
23
+ ### Chain Management
24
+ - **Supported Networks**: PulseChain (0x171), Ethereum (0x1), Binance Smart Chain (0x38), and testnets
25
+ - **Chain Metadata**: Complete chain configurations including RPC URLs, native tokens, and visual assets
26
+ - **Chain Utilities**: Convert between chain IDs and human-readable chain keys
27
+
28
+ ### Token & Bridge Configuration
29
+ - **Token Types**: Standardized token metadata with cross-chain bridge information
30
+ - **Bridge Providers**: Support for multiple bridge providers with different fee structures
31
+ - **Asset Mapping**: Native asset addresses and wrapped token configurations across chains
32
+
33
+ ### Smart Contract Integration
34
+ - **ABIs**: Pre-configured contract ABIs for bridge operations
35
+ - **Contract Addresses**: Deployed contract addresses across supported networks
36
+ - **Type Safety**: Full TypeScript support with strongly typed contract interactions
37
+
38
+ ## 📦 Installation
10
39
 
11
- ## install
12
40
  ```sh
13
- npm i --save @gibs/bridge-sdk
41
+ npm install @gibs/bridge-sdk
42
+ # or
43
+ yarn add @gibs/bridge-sdk
14
44
  ```
15
45
 
16
- ## usage
46
+ ## 📖 API Examples
47
+
48
+ ### Types (`@gibs/bridge-sdk/types`)
49
+
50
+ ```typescript
51
+ import type {
52
+ Token,
53
+ BridgeKey,
54
+ TokenList,
55
+ TokenOut,
56
+ PerNetworkBridgeLink,
57
+ Extensions,
58
+ TokenMetadata,
59
+ VisualChain
60
+ } from '@gibs/bridge-sdk/types'
61
+
62
+ // Core token metadata
63
+ const tokenMetadata: TokenMetadata = {
64
+ name: "Wrapped Ethereum",
65
+ symbol: "WETH",
66
+ decimals: 18
67
+ }
68
+
69
+ // Bridge link information
70
+ const bridgeLink: PerNetworkBridgeLink = {
71
+ tokenAddress: "0x..." // Address on destination chain
72
+ }
73
+
74
+ // Token extensions for cross-chain info
75
+ const extensions: Extensions = {
76
+ wrapped: { address: "0x..." },
77
+ bridgeInfo: {
78
+ 369: { tokenAddress: "0x..." } // PulseChain mapping
79
+ }
80
+ }
81
+
82
+ // Complete token with bridge metadata
83
+ const token: Token = {
84
+ ...tokenMetadata,
85
+ address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
86
+ chainId: 1,
87
+ logoURI: "https://example.com/weth.png",
88
+ extensions
89
+ }
90
+
91
+ // Token for output (address can be null)
92
+ const tokenOut: TokenOut = {
93
+ ...tokenMetadata,
94
+ address: null, // Can be null for native tokens
95
+ chainId: 369,
96
+ logoURI: null
97
+ }
98
+
99
+ // Bridge route definition
100
+ const bridgeKey: BridgeKey = [
101
+ 'pulsechain', // Provider
102
+ '0x1', // From chain (Ethereum)
103
+ '0x171' // To chain (PulseChain)
104
+ ]
105
+
106
+ // Visual chain with logo info
107
+ const visualChain: VisualChain = {
108
+ id: 369,
109
+ name: 'PulseChain',
110
+ chainId: '0x171' as any,
111
+ logoURI: 'https://example.com/pls.png',
112
+ alt: 'PulseChain logo'
113
+ // ... other Chain properties
114
+ }
115
+ ```
116
+
117
+ ### Config (`@gibs/bridge-sdk/config`)
118
+
119
+ ```typescript
120
+ import {
121
+ Chains,
122
+ Provider,
123
+ toChain,
124
+ toChainKey,
125
+ pathways,
126
+ validBridgeKeys,
127
+ inferBridgeKey,
128
+ pathway,
129
+ isNative,
130
+ canChangeUnwrap,
131
+ defaultAssetIn
132
+ } from '@gibs/bridge-sdk/config'
133
+
134
+ // Chain enum usage
135
+ console.log(Chains.PLS) // "0x171"
136
+ console.log(Chains.ETH) // "0x1"
137
+
138
+ // Provider enum usage
139
+ console.log(Provider.PULSECHAIN) // "pulsechain"
140
+
141
+ // Convert numeric chain ID to hex
142
+ const chainHex = toChain(369) // "0x171"
143
+ const chainHex2 = toChain("369") // "0x171"
144
+
145
+ // Convert chain ID to human-readable key
146
+ const chainKey = toChainKey(369) // "PLS"
147
+
148
+ // Get all valid bridge routes for environment
149
+ const bridgeRoutes = validBridgeKeys(true) // Production routes
150
+ const testRoutes = validBridgeKeys(false) // Include testnets
151
+
152
+ // Find bridge provider for chain pair
153
+ const bridgeKey = inferBridgeKey({
154
+ fromChain: Chains.ETH,
155
+ toChain: Chains.PLS,
156
+ isProd: true
157
+ }) // Returns: ['pulsechain', '0x1', '0x171']
158
+
159
+ // Get pathway configuration for a bridge route
160
+ const pathwayConfig = pathway(['pulsechain', '0x1', '0x171'], true)
161
+ console.log(pathwayConfig?.from) // Bridge contract on Ethereum
162
+ console.log(pathwayConfig?.to) // Bridge contract on PulseChain
163
+
164
+ // Check if token is native to chain
165
+ const native = isNative(token, bridgeKey) // boolean
166
+
167
+ // Check if unwrapping is allowed
168
+ const canUnwrap = canChangeUnwrap(bridgeKey, token) // boolean
169
+
170
+ // Get default asset for bridge route
171
+ const defaultToken = defaultAssetIn(bridgeKey, true) // Default token address
172
+ ```
173
+
174
+ ```typescript
175
+ import {
176
+ nativeAssetOut,
177
+ nativeTokenSymbol,
178
+ nativeTokenName,
179
+ uniV2Routers
180
+ } from '@gibs/bridge-sdk/config'
181
+
182
+ // Get native wrapped token address for a chain
183
+ const wethAddress = nativeAssetOut[Chains.ETH] // "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
184
+ const wplsAddress = nativeAssetOut[Chains.PLS] // "0xA1077a294dDE1B09bB078844df40758a5D0f9a27"
185
+
186
+ // Get native token symbols and names
187
+ const ethSymbol = nativeTokenSymbol[Chains.ETH] // "ETH"
188
+ const plsName = nativeTokenName[Chains.PLS] // "Pulse"
189
+
190
+ // Get UniV2 router addresses for chain
191
+ const plsRouters = uniV2Routers[Chains.PLS] // Array of router addresses
192
+ ```
193
+
194
+ ### Settings (`@gibs/bridge-sdk/settings`)
195
+
196
+ ```typescript
197
+ import {
198
+ oneEther,
199
+ basisPoints,
200
+ bridgePathway,
201
+ amountToBridge,
202
+ bridgeCost,
203
+ estimatedAmountOut,
204
+ estimatedFee,
205
+ oneTokenInt,
206
+ assetOutKey,
207
+ assetOut
208
+ } from '@gibs/bridge-sdk/settings'
209
+
210
+ // Common constants
211
+ console.log(oneEther) // 1000000000000000000n (1e18)
212
+ console.log(basisPoints) // 10000n
213
+
214
+ // Calculate actual amount to bridge
215
+ const amount = amountToBridge({
216
+ amountIn: 1000000000000000000n, // 1 ETH
217
+ assetIn: token,
218
+ }) // Returns 1000000000000000000n or 0n if invalid
219
+
220
+ // Calculate bridge cost
221
+ const cost = bridgeCost({
222
+ bridgeKey: ['pulsechain', '0x1', '0x171'],
223
+ amountIn: oneEther,
224
+ // ... other parameters
225
+ })
226
+
227
+ // Estimate output amount after fees
228
+ const outputAmount = estimatedAmountOut({
229
+ amountIn: oneEther,
230
+ bridgeKey: ['pulsechain', '0x1', '0x171'],
231
+ // ... fee parameters
232
+ })
233
+
234
+ // Calculate fee amount
235
+ const feeAmount = estimatedFee({
236
+ amountIn: oneEther,
237
+ feeType: 'percent',
238
+ // ... other parameters
239
+ })
240
+
241
+ // Convert amount to "one token" representation
242
+ const oneToken = oneTokenInt({
243
+ decimals: 18,
244
+ amount: oneEther
245
+ }) // 1000000000000000000n
246
+
247
+ // Generate asset out key for caching
248
+ const cacheKey = assetOutKey({
249
+ bridgeKey: ['pulsechain', '0x1', '0x171'],
250
+ assetIn: token
251
+ }) // String key for asset lookup
252
+
253
+ // Get output asset configuration
254
+ const outputAsset = assetOut({
255
+ bridgeKey: ['pulsechain', '0x1', '0x171'],
256
+ assetIn: token,
257
+ // ... other parameters
258
+ })
259
+ ```
260
+
261
+ ### Chain Info (`@gibs/bridge-sdk/chain-info`)
262
+
263
+ ```typescript
264
+ import {
265
+ loadBridgeFees,
266
+ nativeSymbol,
267
+ tokenBridgeInfo,
268
+ fetchPriceCorrective,
269
+ minBridgeAmountIn,
270
+ chainMulticall
271
+ } from '@gibs/bridge-sdk/chain-info'
272
+
273
+ // Load bridge fees for a route
274
+ const fees = await loadBridgeFees({
275
+ pathway: pathwayConfig,
276
+ fromChainClient: ethClient,
277
+ toChainClient: plsClient
278
+ })
279
+
280
+ // Get native symbol for token, with unwrap logic
281
+ const symbol = nativeSymbol(token, false) // "WETH" or "ETH" if unwrapped
282
+
283
+ // Get token bridge information
284
+ const bridgeInfo = await tokenBridgeInfo({
285
+ bridgeKey: ['pulsechain', '0x1', '0x171'],
286
+ client: ethClient,
287
+ target: token.address,
288
+ // ... other parameters
289
+ })
17
290
 
18
- ```ts
19
- // global import
20
- import * as bridgeSDK from '@gibs/bridge-sdk'
21
- // or by file
291
+ // Fetch price corrective data
292
+ const priceData = fetchPriceCorrective({
293
+ bridgeKey: ['pulsechain', '0x1', '0x171'],
294
+ // ... other parameters
295
+ })
296
+
297
+ // Get minimum bridge amount
298
+ const minAmount = await minBridgeAmountIn({
299
+ bridgeKey: ['pulsechain', '0x1', '0x171'],
300
+ client: ethClient,
301
+ // ... other parameters
302
+ })
303
+
304
+ // Create multicall helper for chain
305
+ const multicall = chainMulticall(ethClient)
306
+ // Use for batched contract calls
307
+ ```
308
+
309
+ ### Image Links (`@gibs/bridge-sdk/image-links`)
310
+
311
+ ```typescript
312
+ import * as imageLinks from '@gibs/bridge-sdk/image-links'
313
+
314
+ // Configure image root URL
315
+ imageLinks.setImageRoot('https://cdn.example.com/images/')
316
+ const currentRoot = imageLinks.getImageRoot() // Current root URL
317
+
318
+ // Get network image URL
319
+ const networkImage = imageLinks.network(1) // Ethereum logo URL
320
+ const plsImage = imageLinks.network(369) // PulseChain logo URL
321
+
322
+ // Get single token image
323
+ const tokenImage = imageLinks.image({
324
+ chainId: 1,
325
+ address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
326
+ })
327
+
328
+ // Get token images for multiple sources
329
+ const tokenImages = imageLinks.images([
330
+ "1/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH on Ethereum
331
+ "369/0xA1077a294dDE1B09bB078844df40758a5D0f9a27" // WPLS on PulseChain
332
+ ])
333
+
334
+ // List available images in a directory
335
+ const availableImages = imageLinks.list('tokens/') // Array of image paths
336
+ ```
337
+
338
+ ### ABIs (`@gibs/bridge-sdk/abis`)
339
+
340
+ ```typescript
22
341
  import * as abis from '@gibs/bridge-sdk/abis'
342
+
343
+ // Bridge contract ABIs
344
+ const inputBridgeAbi = abis.inputBridge // Input bridge contract
345
+ const outputBridgeAbi = abis.outputBridge // Output bridge contract
346
+ const outputRouterAbi = abis.outputRouter // Output router contract
347
+
348
+ // Token contract ABIs
349
+ const erc677Abi = abis.erc677 // ERC677 token contract
350
+ const erc677ExtraAbi = abis.erc677ExtraInput // With extra input functions
351
+
352
+ // Router and fee ABIs
353
+ const nativeRouterAbi = abis.nativeRouter // Native token router
354
+ const feeManagerAbi = abis.feeManager // Fee management contract
355
+ const univ2RouterAbi = abis.univ2Router // UniswapV2 router
356
+
357
+ // Utility ABIs and types
358
+ const feeDeliveryStruct = abis.feeDeliveryStruct // Fee delivery struct ABI
359
+ const homeAmbAbi = abis.homeAmb // Home AMB contract
360
+ const pairAbi = abis.pair // Pair contract
361
+
362
+ // Use with viem contract calls
363
+ const contract = getContract({
364
+ address: bridgeAddress,
365
+ abi: inputBridgeAbi,
366
+ client: publicClient
367
+ })
368
+
369
+ const bridgeFunction = contract.read.someFunction()
370
+ ```
371
+
372
+ ### Fee Types (`@gibs/bridge-sdk/fee-type`)
373
+
374
+ ```typescript
375
+ import { FeeType, feeTypeValToKeyMap, type FeeTypeKeys } from '@gibs/bridge-sdk/fee-type'
376
+
377
+ // Fee type enum
378
+ console.log(FeeType.PERCENT) // "%"
379
+ console.log(FeeType.GAS_TIP) // "gas+%"
380
+ console.log(FeeType.FIXED) // "fixed"
381
+
382
+ // Fee type keys
383
+ const percentKey: FeeTypeKeys = 'PERCENT'
384
+ const gasTipKey: FeeTypeKeys = 'GAS_TIP'
385
+
386
+ // Convert fee type value back to key
387
+ const feeTypeKey = feeTypeValToKeyMap.get('%') // "PERCENT"
388
+ const gasKey = feeTypeValToKeyMap.get('gas+%') // "GAS_TIP"
389
+ ```
390
+
391
+ ### Chains (`@gibs/bridge-sdk/chains`)
392
+
393
+ ```typescript
394
+ import { chainsMetadata } from '@gibs/bridge-sdk/chains'
395
+ import { Chains } from '@gibs/bridge-sdk/config'
396
+
397
+ // Get complete chain configuration
398
+ const pulseChain = chainsMetadata[Chains.PLS]
399
+ console.log(pulseChain.name) // "PulseChain"
400
+ console.log(pulseChain.chainId) // "0x171"
401
+ console.log(pulseChain.logoURI) // Chain logo URL
402
+ console.log(pulseChain.rpcUrls.default.http[0]) // Default RPC URL
403
+
404
+ // Access native currency info
405
+ console.log(pulseChain.nativeCurrency.name) // "Pulse"
406
+ console.log(pulseChain.nativeCurrency.symbol) // "PLS"
407
+ console.log(pulseChain.nativeCurrency.decimals) // 18
408
+
409
+ // Access contract addresses
410
+ console.log(pulseChain.contracts?.multicall3?.address) // Multicall3 address
411
+ console.log(pulseChain.contracts?.ensRegistry?.address) // ENS registry if available
412
+ ```
413
+
414
+ ## 📋 API Reference
415
+
416
+ ### Exports
417
+
418
+ | Export Path | Description |
419
+ |-------------|-------------|
420
+ | `@gibs/bridge-sdk` | Main entry point with all exports |
421
+ | `@gibs/bridge-sdk/types` | TypeScript type definitions |
422
+ | `@gibs/bridge-sdk/config` | Chain IDs, providers, and core configuration |
423
+ | `@gibs/bridge-sdk/chains` | Chain metadata and network configurations |
424
+ | `@gibs/bridge-sdk/abis` | Smart contract ABIs |
425
+ | `@gibs/bridge-sdk/image-links` | Network and token image utilities |
426
+ | `@gibs/bridge-sdk/fee-type` | Fee calculation types and utilities |
427
+ | `@gibs/bridge-sdk/settings` | Bridge settings and configuration |
428
+ | `@gibs/bridge-sdk/chain-info` | Chain-specific bridge information |
429
+
430
+ ### Key Types
431
+
432
+ ```typescript
433
+ // Core chain identifier
434
+ enum Chains {
435
+ PLS = '0x171', // PulseChain
436
+ ETH = '0x1', // Ethereum
437
+ BNB = '0x38', // Binance Smart Chain
438
+ SEP = '0xaa36a7', // Sepolia Testnet
439
+ V4PLS = '0x3af' // PulseChain V4 Testnet
440
+ }
441
+
442
+ // Bridge providers
443
+ enum Provider {
444
+ PULSECHAIN = 'pulsechain',
445
+ TOKENSEX = 'tokensex'
446
+ }
447
+
448
+ // Bridge route: [Provider, FromChain, ToChain]
449
+ type BridgeKey = [Provider, Chains, Chains]
450
+
451
+ // Token with bridge metadata
452
+ interface Token {
453
+ name: string
454
+ symbol: string
455
+ decimals: number
456
+ address: string
457
+ chainId: number
458
+ logoURI: string | null
459
+ extensions?: {
460
+ wrapped?: { address: Hex }
461
+ bridgeInfo?: Record<number, PerNetworkBridgeLink>
462
+ }
463
+ }
23
464
  ```
465
+
466
+ ## ⚠️ Important Notes
467
+
468
+ - **Beta Stage**: This SDK is in active development. APIs may change between versions.
469
+ - **Version Sync**: All packages in this monorepo maintain synchronized versions.
470
+ - **Low-Level Tools**: These are building blocks that require careful integration.
471
+ - **Dependencies**: Built on top of `@gibs/common` utilities and `viem` for Ethereum interactions.
472
+
473
+ ## 🔗 Dependencies
474
+
475
+ - `@gibs/common`: Shared utilities for RPC clients, caching, and ERC20 operations
476
+ - `viem`: Type-safe Ethereum library for contract interactions
477
+ - `lodash`: Utility functions for data manipulation
478
+
479
+ ## 📝 Development Status
480
+
481
+ This package is actively maintained and used in production bridge applications. However, as it's in beta:
482
+
483
+ - APIs may change in minor version updates
484
+ - New bridge providers and chains are regularly added
485
+ - Breaking changes will be documented in release notes
486
+
487
+ For the most up-to-date information, check the package version and changelog.
@@ -1,4 +1,4 @@
1
- /** the abi for the bridge */
1
+ /** the abi for the input bridge */
2
2
  export declare const inputBridge: readonly [{
3
3
  readonly name: "minPerTx";
4
4
  readonly type: "function";
@@ -96,6 +96,7 @@ export declare const inputBridge: readonly [{
96
96
  }];
97
97
  readonly outputs: readonly [];
98
98
  }];
99
+ /** the abi for the input bridge with extra input for the sender origin (tokensex) */
99
100
  export declare const inputBridgeExtraInput: readonly [{
100
101
  readonly name: "relayTokensAndCall";
101
102
  readonly type: "function";
@@ -136,6 +137,7 @@ export declare const inputBridgeExtraInput: readonly [{
136
137
  }];
137
138
  readonly outputs: readonly [];
138
139
  }];
140
+ /** the abi for erc677 tokens */
139
141
  export declare const erc677: readonly [{
140
142
  readonly name: "transferAndCall";
141
143
  readonly type: "function";
@@ -149,6 +151,7 @@ export declare const erc677: readonly [{
149
151
  }];
150
152
  readonly outputs: readonly [];
151
153
  }];
154
+ /** the abi for erc677 tokens bridge with extra input for the sender origin (tokensex) */
152
155
  export declare const erc677ExtraInput: readonly [{
153
156
  readonly name: "transferAndCall";
154
157
  readonly type: "function";
@@ -165,6 +168,7 @@ export declare const erc677ExtraInput: readonly [{
165
168
  }];
166
169
  readonly outputs: readonly [];
167
170
  }];
171
+ /** the abi to read data from the output router */
168
172
  export declare const outputRouter: readonly [{
169
173
  readonly name: "onTokenBridged";
170
174
  readonly type: "function";
@@ -197,6 +201,7 @@ export declare const outputRouter: readonly [{
197
201
  readonly type: "address";
198
202
  }];
199
203
  }];
204
+ /** the abi for the output bridge */
200
205
  export declare const outputBridge: readonly [{
201
206
  readonly name: "bridgeContract";
202
207
  readonly type: "function";
@@ -206,6 +211,7 @@ export declare const outputBridge: readonly [{
206
211
  readonly type: "address";
207
212
  }];
208
213
  }];
214
+ /** the abi for the fee manager */
209
215
  export declare const feeManager: readonly [{
210
216
  readonly name: "HOME_TO_FOREIGN_FEE";
211
217
  readonly type: "function";
@@ -235,6 +241,7 @@ export declare const feeManager: readonly [{
235
241
  readonly type: "uint256";
236
242
  }];
237
243
  }];
244
+ /** the abi for the native router */
238
245
  export declare const nativeRouter: readonly [{
239
246
  readonly name: "wrapAndRelayTokens";
240
247
  readonly type: "function";
@@ -257,6 +264,7 @@ export declare const nativeRouter: readonly [{
257
264
  }];
258
265
  readonly outputs: readonly [];
259
266
  }];
267
+ /** the abi for the native router with extra input for the sender origin (tokensex) */
260
268
  export declare const nativeRouterExtraInput: readonly [{
261
269
  readonly name: "wrapAndRelayTokens";
262
270
  readonly type: "function";
@@ -285,6 +293,7 @@ export declare const nativeRouterExtraInput: readonly [{
285
293
  }];
286
294
  readonly outputs: readonly [];
287
295
  }];
296
+ /** the abi for the univ2 router */
288
297
  export declare const univ2Router: readonly [{
289
298
  readonly name: "getAmountsOut";
290
299
  readonly type: "function";
@@ -300,6 +309,7 @@ export declare const univ2Router: readonly [{
300
309
  readonly type: "uint256[]";
301
310
  }];
302
311
  }];
312
+ /** the abi for the fee delivery struct */
303
313
  export declare const feeDeliveryStruct: readonly [{
304
314
  readonly type: "tuple";
305
315
  readonly components: readonly [{
@@ -312,6 +322,7 @@ export declare const feeDeliveryStruct: readonly [{
312
322
  readonly type: "uint256";
313
323
  }];
314
324
  }];
325
+ /** the abi for the relay tokens direct */
315
326
  export declare const relayTokensDirect: readonly [{
316
327
  readonly name: "safeExecuteSignaturesWithAutoGasLimit";
317
328
  readonly type: "function";
@@ -325,6 +336,7 @@ export declare const relayTokensDirect: readonly [{
325
336
  }];
326
337
  readonly outputs: readonly [];
327
338
  }];
339
+ /** the abi for the home amb */
328
340
  export declare const homeAmb: readonly [{
329
341
  readonly name: "submitSignature";
330
342
  readonly type: "function";
@@ -338,6 +350,7 @@ export declare const homeAmb: readonly [{
338
350
  }];
339
351
  readonly outputs: readonly [];
340
352
  }];
353
+ /** the abi for the univ2 pair */
341
354
  export declare const pair: readonly [{
342
355
  readonly name: "getReserves";
343
356
  readonly type: "function";
package/dist/src/abis.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { parseAbi, parseAbiParameters } from 'viem';
2
- /** the abi for the bridge */
2
+ /** the abi for the input bridge */
3
3
  export const inputBridge = parseAbi([
4
4
  'function minPerTx(address token) external view returns(uint256)',
5
5
  'function foreignTokenAddress(address token) external view returns(address)',
@@ -10,45 +10,58 @@ export const inputBridge = parseAbi([
10
10
  'function relayTokensAndCall(address token, address _receiver, uint256 _value, bytes memory _data) external',
11
11
  'function relayTokens(address token, address _receiver, uint256 _value) external',
12
12
  ]);
13
+ /** the abi for the input bridge with extra input for the sender origin (tokensex) */
13
14
  export const inputBridgeExtraInput = parseAbi([
14
15
  'function relayTokensAndCall(address token, address _receiver, uint256 _value, bytes memory _data, address _senderOrigin) external',
15
16
  'function relayTokens(address token, address _receiver, uint256 _value, address _senderOrigin) external',
16
17
  ]);
18
+ /** the abi for erc677 tokens */
17
19
  export const erc677 = parseAbi([
18
20
  'function transferAndCall(address, uint256, bytes calldata) external',
19
21
  ]);
22
+ /** the abi for erc677 tokens bridge with extra input for the sender origin (tokensex) */
20
23
  export const erc677ExtraInput = parseAbi([
21
24
  'function transferAndCall(address, uint256, bytes calldata, address sender) external',
22
25
  ]);
26
+ /** the abi to read data from the output router */
23
27
  export const outputRouter = parseAbi([
24
28
  'function onTokenBridged(address _token, uint256 _value, bytes memory _data) external payable',
25
29
  'function WETH() external view returns(address)',
26
30
  'function bridge() external view returns(address)',
27
31
  ]);
32
+ /** the abi for the output bridge */
28
33
  export const outputBridge = parseAbi(['function bridgeContract() external view returns(address)']);
34
+ /** the abi for the fee manager */
29
35
  export const feeManager = parseAbi([
30
36
  'function HOME_TO_FOREIGN_FEE() public view returns(bytes32)',
31
37
  'function FOREIGN_TO_HOME_FEE() public view returns(bytes32)',
32
38
  'function getFee(bytes32, address) public view returns(uint256)',
33
39
  ]);
40
+ /** the abi for the native router */
34
41
  export const nativeRouter = parseAbi([
35
42
  'function wrapAndRelayTokens(address receiver) external payable',
36
43
  'function relayTokensAndCall(address receiver, bytes calldata data) external payable',
37
44
  ]);
45
+ /** the abi for the native router with extra input for the sender origin (tokensex) */
38
46
  export const nativeRouterExtraInput = parseAbi([
39
47
  'function wrapAndRelayTokens(address receiver, address sender) external payable',
40
48
  'function relayTokensAndCall(address receiver, bytes calldata data, address sender) external payable',
41
49
  ]);
50
+ /** the abi for the univ2 router */
42
51
  export const univ2Router = parseAbi([
43
52
  'function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns(uint256[] memory)',
44
53
  ]);
54
+ /** the abi for the fee delivery struct */
45
55
  export const feeDeliveryStruct = parseAbiParameters('(address, uint256, uint256, uint256)');
56
+ /** the abi for the relay tokens direct */
46
57
  export const relayTokensDirect = parseAbi([
47
58
  'function safeExecuteSignaturesWithAutoGasLimit(bytes calldata data, bytes calldata signatures) external',
48
59
  ]);
60
+ /** the abi for the home amb */
49
61
  export const homeAmb = parseAbi([
50
62
  'function submitSignature(bytes message, bytes signature) external',
51
63
  ]);
64
+ /** the abi for the univ2 pair */
52
65
  export const pair = parseAbi([
53
66
  'function getReserves() view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast)',
54
67
  ]);