@katanaperps/katana-perps-sdk 1.0.0-alpha.14 → 1.0.0-alpha.16

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.
@@ -0,0 +1,318 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ {
5
+ "internalType": "address",
6
+ "name": "exchange_",
7
+ "type": "address"
8
+ },
9
+ {
10
+ "internalType": "address",
11
+ "name": "exchangeManagedAccountDepositAdapter_",
12
+ "type": "address"
13
+ }
14
+ ],
15
+ "stateMutability": "nonpayable",
16
+ "type": "constructor"
17
+ },
18
+ {
19
+ "inputs": [
20
+ {
21
+ "internalType": "address",
22
+ "name": "owner",
23
+ "type": "address"
24
+ }
25
+ ],
26
+ "name": "OwnableInvalidOwner",
27
+ "type": "error"
28
+ },
29
+ {
30
+ "inputs": [
31
+ {
32
+ "internalType": "address",
33
+ "name": "account",
34
+ "type": "address"
35
+ }
36
+ ],
37
+ "name": "OwnableUnauthorizedAccount",
38
+ "type": "error"
39
+ },
40
+ {
41
+ "anonymous": false,
42
+ "inputs": [
43
+ {
44
+ "indexed": false,
45
+ "internalType": "address",
46
+ "name": "depositorWallet",
47
+ "type": "address"
48
+ },
49
+ {
50
+ "indexed": false,
51
+ "internalType": "uint256",
52
+ "name": "quantity",
53
+ "type": "uint256"
54
+ },
55
+ {
56
+ "indexed": false,
57
+ "internalType": "bytes",
58
+ "name": "errorData",
59
+ "type": "bytes"
60
+ }
61
+ ],
62
+ "name": "ComposeFailed",
63
+ "type": "event"
64
+ },
65
+ {
66
+ "anonymous": false,
67
+ "inputs": [
68
+ {
69
+ "indexed": false,
70
+ "internalType": "uint32",
71
+ "name": "sourceEndpointId",
72
+ "type": "uint32"
73
+ },
74
+ {
75
+ "indexed": false,
76
+ "internalType": "address",
77
+ "name": "destinationWallet",
78
+ "type": "address"
79
+ },
80
+ {
81
+ "indexed": false,
82
+ "internalType": "uint256",
83
+ "name": "quantity",
84
+ "type": "uint256"
85
+ }
86
+ ],
87
+ "name": "ComposeSucceeded",
88
+ "type": "event"
89
+ },
90
+ {
91
+ "anonymous": false,
92
+ "inputs": [
93
+ {
94
+ "indexed": true,
95
+ "internalType": "address",
96
+ "name": "previousOwner",
97
+ "type": "address"
98
+ },
99
+ {
100
+ "indexed": true,
101
+ "internalType": "address",
102
+ "name": "newOwner",
103
+ "type": "address"
104
+ }
105
+ ],
106
+ "name": "OwnershipTransferStarted",
107
+ "type": "event"
108
+ },
109
+ {
110
+ "anonymous": false,
111
+ "inputs": [
112
+ {
113
+ "indexed": true,
114
+ "internalType": "address",
115
+ "name": "previousOwner",
116
+ "type": "address"
117
+ },
118
+ {
119
+ "indexed": true,
120
+ "internalType": "address",
121
+ "name": "newOwner",
122
+ "type": "address"
123
+ }
124
+ ],
125
+ "name": "OwnershipTransferred",
126
+ "type": "event"
127
+ },
128
+ {
129
+ "anonymous": false,
130
+ "inputs": [
131
+ {
132
+ "indexed": false,
133
+ "internalType": "address",
134
+ "name": "depositorWallet",
135
+ "type": "address"
136
+ },
137
+ {
138
+ "indexed": false,
139
+ "internalType": "uint256",
140
+ "name": "quantity",
141
+ "type": "uint256"
142
+ },
143
+ {
144
+ "indexed": false,
145
+ "internalType": "bytes",
146
+ "name": "payload",
147
+ "type": "bytes"
148
+ },
149
+ {
150
+ "indexed": false,
151
+ "internalType": "bytes",
152
+ "name": "errorData",
153
+ "type": "bytes"
154
+ }
155
+ ],
156
+ "name": "WithdrawQuoteAssetFailed",
157
+ "type": "event"
158
+ },
159
+ {
160
+ "inputs": [],
161
+ "name": "acceptOwnership",
162
+ "outputs": [],
163
+ "stateMutability": "nonpayable",
164
+ "type": "function"
165
+ },
166
+ {
167
+ "inputs": [
168
+ {
169
+ "internalType": "uint256",
170
+ "name": "quoteAssetQuantityInAssetUnits",
171
+ "type": "uint256"
172
+ },
173
+ {
174
+ "internalType": "bytes",
175
+ "name": "payload",
176
+ "type": "bytes"
177
+ }
178
+ ],
179
+ "name": "deposit",
180
+ "outputs": [],
181
+ "stateMutability": "nonpayable",
182
+ "type": "function"
183
+ },
184
+ {
185
+ "inputs": [],
186
+ "name": "exchange",
187
+ "outputs": [
188
+ {
189
+ "internalType": "contract IExchange",
190
+ "name": "",
191
+ "type": "address"
192
+ }
193
+ ],
194
+ "stateMutability": "view",
195
+ "type": "function"
196
+ },
197
+ {
198
+ "inputs": [],
199
+ "name": "exchangeManagedAccountDepositAdapter",
200
+ "outputs": [
201
+ {
202
+ "internalType": "contract IExchangeManagedAccountDepositAdapter",
203
+ "name": "",
204
+ "type": "address"
205
+ }
206
+ ],
207
+ "stateMutability": "view",
208
+ "type": "function"
209
+ },
210
+ {
211
+ "inputs": [],
212
+ "name": "isDepositEnabled",
213
+ "outputs": [
214
+ {
215
+ "internalType": "bool",
216
+ "name": "",
217
+ "type": "bool"
218
+ }
219
+ ],
220
+ "stateMutability": "view",
221
+ "type": "function"
222
+ },
223
+ {
224
+ "inputs": [],
225
+ "name": "owner",
226
+ "outputs": [
227
+ {
228
+ "internalType": "address",
229
+ "name": "",
230
+ "type": "address"
231
+ }
232
+ ],
233
+ "stateMutability": "view",
234
+ "type": "function"
235
+ },
236
+ {
237
+ "inputs": [],
238
+ "name": "pendingOwner",
239
+ "outputs": [
240
+ {
241
+ "internalType": "address",
242
+ "name": "",
243
+ "type": "address"
244
+ }
245
+ ],
246
+ "stateMutability": "view",
247
+ "type": "function"
248
+ },
249
+ {
250
+ "inputs": [],
251
+ "name": "quoteAsset",
252
+ "outputs": [
253
+ {
254
+ "internalType": "contract IERC20",
255
+ "name": "",
256
+ "type": "address"
257
+ }
258
+ ],
259
+ "stateMutability": "view",
260
+ "type": "function"
261
+ },
262
+ {
263
+ "inputs": [],
264
+ "name": "renounceOwnership",
265
+ "outputs": [],
266
+ "stateMutability": "nonpayable",
267
+ "type": "function"
268
+ },
269
+ {
270
+ "inputs": [
271
+ {
272
+ "internalType": "bool",
273
+ "name": "isEnabled",
274
+ "type": "bool"
275
+ }
276
+ ],
277
+ "name": "setDepositEnabled",
278
+ "outputs": [],
279
+ "stateMutability": "nonpayable",
280
+ "type": "function"
281
+ },
282
+ {
283
+ "inputs": [
284
+ {
285
+ "internalType": "address",
286
+ "name": "newOwner",
287
+ "type": "address"
288
+ }
289
+ ],
290
+ "name": "transferOwnership",
291
+ "outputs": [],
292
+ "stateMutability": "nonpayable",
293
+ "type": "function"
294
+ },
295
+ {
296
+ "inputs": [
297
+ {
298
+ "internalType": "address",
299
+ "name": "",
300
+ "type": "address"
301
+ },
302
+ {
303
+ "internalType": "uint256",
304
+ "name": "",
305
+ "type": "uint256"
306
+ },
307
+ {
308
+ "internalType": "bytes",
309
+ "name": "",
310
+ "type": "bytes"
311
+ }
312
+ ],
313
+ "name": "withdrawQuoteAsset",
314
+ "outputs": [],
315
+ "stateMutability": "view",
316
+ "type": "function"
317
+ }
318
+ ]
@@ -22,6 +22,7 @@ export type DepositToWalletBridgePayloadParameters = {
22
22
  };
23
23
  export type DepositBaseParameters = {
24
24
  exchangeLayerZeroAdapterAddress?: string;
25
+ exchangeLocalDepositAdapterAddress?: string;
25
26
  minimumForwardQuantityMultiplierInPips: bigint;
26
27
  quantityInAssetUnits: bigint;
27
28
  sourceBridgeTarget: BridgeTarget;
@@ -111,7 +112,13 @@ export declare function depositViaForwarder(parameters: AddManagedAccountParamet
111
112
  }, sourceSigner: ethers.Signer, sandbox: boolean, extraRequestParams?: Pick<TransactionRequest, 'nonce'>,
112
113
  /** Let software wallet show estimate to the user. Even on expected TX failure. */
113
114
  ignoreEstimateError?: boolean): Promise<string>;
114
- export declare function encodeDepositBridgeAdapterPayload(sourceConfig: ReturnType<typeof getBridgeTargetConfig>, parameters: AddManagedAccountParameters | DepositToManagedAccountParameters | DepositToWalletParameters): EncodedDepositBridgeAdapterPayload;
115
+ /**
116
+ * Deposit funds locally on Katana
117
+ */
118
+ export declare function depositLocally(parameters: AddManagedAccountParameters | DepositToManagedAccountParameters | DepositToWalletParameters, signer: ethers.Signer, sandbox: boolean, extraRequestParams?: Pick<TransactionRequest, 'nonce'>,
119
+ /** Let software wallet show estimate to the user. Even on expected TX failure. */
120
+ ignoreEstimateError?: boolean): Promise<string>;
121
+ export declare function encodeDepositBridgeAdapterPayload(sourceConfig: ReturnType<typeof getBridgeTargetConfig>, parameters: Pick<AddManagedAccountParameters, 'bridgePayloadType' | 'fixedIncomeVaultProviderAddress' | 'managerWallet' | 'addManagedAccountPayload'> | Pick<DepositToManagedAccountParameters, 'bridgePayloadType' | 'depositorWallet' | 'fixedIncomeVaultProviderAddress' | 'managerWallet'> | Pick<DepositToWalletParameters, 'bridgePayloadType' | 'depositorWallet'>): EncodedDepositBridgeAdapterPayload;
115
122
  export declare function encodeFixedIncomeVaultConfigurationFields(configurationFields: FixedIncomeVaultConfigurationFields): string;
116
123
  /**
117
124
  * Estimate native gas fee needed to deposit USDC cross-chain into the Exchange
@@ -1 +1 @@
1
- {"version":3,"file":"deposit.d.ts","sourceRoot":"","sources":["../../src/bridge/deposit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AASzD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EACL,qBAAqB,EAGtB,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,oBAAY,+BAA+B;IACzC,iBAAiB,IAAA;IACjB,uBAAuB,IAAA;IACvB,eAAe,IAAA;CAChB;AAED,MAAM,MAAM,wCAAwC,GAAG;IACrD,+BAA+B,EAAE,MAAM,CAAC;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,8CAA8C,GAAG;IAC3D,eAAe,EAAE,MAAM,CAAC;IACxB,+BAA+B,EAAE,MAAM,CAAC;IACxC,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,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AAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC;CAC9B,EACD,OAAO,EAAE,OAAO,GACf,OAAO,CAAC;IACT,MAAM,EAAE,MAAM,CAAC;IACf,6BAA6B,EAAE,MAAM,CAAC;CACvC,CAAC,CAMD;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EACN,2BAA2B,GAC3B,iCAAiC,GACjC,yBAAyB,UAqB9B"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDestinationWallet = exports.estimateDepositFees = exports.encodeFixedIncomeVaultConfigurationFields = exports.encodeDepositBridgeAdapterPayload = exports.depositViaForwarder = exports.depositViaVaultComposerSync = exports.depositViaBridge = exports.decodeDepositBridgeAdapterPayload = exports.decodeDepositBridgeAdapterPayloadType = exports.depositBridgeAdapterPayloadLengths = exports.fixedIncomeVaultConfigurationFieldsLength = exports.DepositBridgeAdapterPayloadType = void 0;
3
+ exports.getDestinationWallet = exports.estimateDepositFees = exports.encodeFixedIncomeVaultConfigurationFields = exports.encodeDepositBridgeAdapterPayload = exports.depositLocally = exports.depositViaForwarder = exports.depositViaVaultComposerSync = exports.depositViaBridge = exports.decodeDepositBridgeAdapterPayload = exports.decodeDepositBridgeAdapterPayloadType = exports.depositBridgeAdapterPayloadLengths = exports.fixedIncomeVaultConfigurationFieldsLength = exports.DepositBridgeAdapterPayloadType = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
6
6
  const ethers_1 = require("ethers");
@@ -120,9 +120,10 @@ ignoreEstimateError) {
120
120
  }
121
121
  const response = await vaultComposerSync.depositAndSend.send(parameters.quantityInAssetUnits, sendParam, sourceWallet, // Refund address - extra gas (if any) is returned to this address
122
122
  {
123
+ ...extraRequestParams,
123
124
  from: sourceWallet,
124
125
  gasLimit,
125
- value: gasFee,
126
+ value: gasFee, // Native gas to pay for the cross chain message fee
126
127
  });
127
128
  return response.hash;
128
129
  }
@@ -145,8 +146,7 @@ ignoreEstimateError) {
145
146
  const estimatedGasLimit = await oft.send.estimateGas(sendParam, { nativeFee: gasFee, lzTokenFee: 0 }, sourceWallet, // Refund address - extra gas (if any) is returned to this address
146
147
  {
147
148
  ...extraRequestParams,
148
- from: sourceWallet,
149
- // Native gas to pay for the cross chain message fee
149
+ from: sourceWallet, // Native gas to pay for the cross chain message fee
150
150
  value: gasFee,
151
151
  });
152
152
  // Add 20% buffer for safety
@@ -175,6 +175,7 @@ ignoreEstimateError) {
175
175
  }
176
176
  const response = await oft.send(sendParam, { nativeFee: gasFee, lzTokenFee: 0 }, sourceWallet, // Refund address - extra gas (if any) is returned to this address
177
177
  {
178
+ ...extraRequestParams,
178
179
  from: sourceWallet,
179
180
  gasLimit,
180
181
  value: gasFee,
@@ -182,6 +183,55 @@ ignoreEstimateError) {
182
183
  return response.hash;
183
184
  }
184
185
  exports.depositViaForwarder = depositViaForwarder;
186
+ /**
187
+ * Deposit funds locally on Katana
188
+ */
189
+ async function depositLocally(parameters, signer, sandbox, extraRequestParams,
190
+ /** Let software wallet show estimate to the user. Even on expected TX failure. */
191
+ ignoreEstimateError) {
192
+ const sourceConfig = (0, utils_1.getBridgeTargetConfig)(request_1.BridgeTarget.KATANA_KATANA, sandbox);
193
+ const exchangeLocalDepositAdapterAddress = await (0, utils_1.loadExchangeLocalDepositAddressFromApiIfNeeded)(parameters.exchangeLocalDepositAdapterAddress);
194
+ let gasLimit = config_1.BridgeConfig.settings.depositSourceChainGasLimit;
195
+ const localDepositAdapter = index_1.ExchangeLocalDepositAdapter_v1__factory.connect(exchangeLocalDepositAdapterAddress, signer);
196
+ const wallet = await signer.getAddress();
197
+ try {
198
+ // Estimate gas
199
+ const estimatedGasLimit = await localDepositAdapter.deposit.estimateGas(parameters.quantityInAssetUnits, encodeDepositBridgeAdapterPayload(sourceConfig, parameters), {
200
+ ...extraRequestParams,
201
+ from: wallet,
202
+ });
203
+ // Add 20% buffer for safety
204
+ gasLimit = Number(new bignumber_js_1.default(estimatedGasLimit.toString())
205
+ .times(new bignumber_js_1.default(1.2))
206
+ .toFixed(0));
207
+ }
208
+ catch (error) {
209
+ // ethers.js will perform the estimation at the block gas limit, which is much higher than the
210
+ // gas actually needed by the tx. If the wallet does not have the funds to cover the tx at this
211
+ // high gas limit then the RPC will throw an INSUFFICIENT_FUNDS error; however the wallet may
212
+ // still have enough funds to successfully bridge at the actual gas limit. In this case simply
213
+ // fall through and use the configured default gas limit. The wallet software in use should
214
+ // still show if that limit is insufficient, which is only an issue for blockchains with
215
+ // variable gas costs such as Arbitrum One
216
+ if (error?.code === 'INSUFFICIENT_FUNDS') {
217
+ console.log('[depositViaForwarder] Insufficient funds - continue with default gas');
218
+ }
219
+ else if (ignoreEstimateError) {
220
+ // TODO: In latest contract it throws 'CALL_EXCEPTION' instead of 'INSUFFICIENT_FUNDS'
221
+ console.log('[depositViaForwarder] Estimate failed - continue with default gas', error);
222
+ }
223
+ else {
224
+ throw error;
225
+ }
226
+ }
227
+ const response = await localDepositAdapter.deposit(parameters.quantityInAssetUnits, encodeDepositBridgeAdapterPayload(sourceConfig, parameters), {
228
+ ...extraRequestParams,
229
+ gasLimit,
230
+ from: wallet,
231
+ });
232
+ return response.hash;
233
+ }
234
+ exports.depositLocally = depositLocally;
185
235
  function encodeDepositBridgeAdapterPayload(sourceConfig, parameters) {
186
236
  if (parameters.bridgePayloadType ===
187
237
  DepositBridgeAdapterPayloadType.addManagedAccount) {
@@ -130,5 +130,6 @@ export declare function getBridgeTargetConfig<T extends BridgeTarget, S extends
130
130
  }[T];
131
131
  export declare function bridgeTargetForLayerZeroEndpointId(layerZeroEndpointId: number, sandbox: boolean): "stargate.arbitrum" | "stargate.aurora" | "stargate.avalanche" | "stargate.base" | "stargate.berachain" | "stargate.ethereum" | "stargate.optimism" | "stargate.rari" | "stargate.scroll" | "stargate.taiko" | null;
132
132
  export declare function loadExchangeLayerZeroAddressFromApiIfNeeded(exchangeLayerZeroAdapterAddress?: string): Promise<string>;
133
+ export declare function loadExchangeLocalDepositAddressFromApiIfNeeded(exchangeLocalDepositAdapterAddress?: string): Promise<string>;
133
134
  export declare function loadStargateBridgeForwarderContractAddressFromApiIfNeeded(stargateBridgeForwarderContractAddress?: string): Promise<string>;
134
135
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/bridge/utils.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,eAAO,MAAM,iCAAiC,mFAI5C,CAAC;AAEH,MAAM,MAAM,iCAAiC,GAC3C,CAAC,OAAO,iCAAiC,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,wBAAgB,kCAAkC,CAChD,mBAAmB,EAAE,MAAM,GAC1B,mBAAmB,IAAI,iCAAiC,CAI1D;AAED,eAAO,MAAM,iCAAiC,mBAI5C,CAAC;AAEH,MAAM,MAAM,iCAAiC,GAC3C,CAAC,OAAO,iCAAiC,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,wBAAgB,kCAAkC,CAChD,mBAAmB,EAAE,MAAM,GAC1B,mBAAmB,IAAI,iCAAiC,CAI1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,CAAC,SAAS,YAAY,EACtB,CAAC,SAAS,IAAI,GAAG,KAAK,EACtB,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAY5B;AAED,wBAAgB,kCAAkC,CAChD,mBAAmB,EAAE,MAAM,EAC3B,OAAO,EAAE,OAAO,uNAYjB;AAED,wBAAsB,2CAA2C,CAC/D,+BAA+B,CAAC,EAAE,MAAM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,CAAC,CAQjB;AAED,wBAAsB,yDAAyD,CAC7E,sCAAsC,CAAC,EAAE,MAAM,GAC9C,OAAO,CAAC,MAAM,CAAC,CAQjB"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadStargateBridgeForwarderContractAddressFromApiIfNeeded = exports.loadExchangeLayerZeroAddressFromApiIfNeeded = exports.bridgeTargetForLayerZeroEndpointId = exports.getBridgeTargetConfig = exports.isBridgeTestnetLayerZeroEndpointId = exports.BridgeTestnetLayerZeroEndpointIds = exports.isBridgeMainnetLayerZeroEndpointId = exports.BridgeMainnetLayerZeroEndpointIds = void 0;
4
- const ethers_1 = require("ethers");
3
+ exports.loadStargateBridgeForwarderContractAddressFromApiIfNeeded = exports.loadExchangeLocalDepositAddressFromApiIfNeeded = exports.loadExchangeLayerZeroAddressFromApiIfNeeded = exports.bridgeTargetForLayerZeroEndpointId = exports.getBridgeTargetConfig = exports.isBridgeTestnetLayerZeroEndpointId = exports.BridgeTestnetLayerZeroEndpointIds = exports.isBridgeMainnetLayerZeroEndpointId = exports.BridgeMainnetLayerZeroEndpointIds = void 0;
5
4
  const config_1 = require("#bridge/config");
5
+ const public_1 = require("#client/rest/public");
6
6
  exports.BridgeMainnetLayerZeroEndpointIds = Object.values(config_1.BridgeConfigByLayerZeroEndpointId.mainnet).map((value) => {
7
7
  return value.layerZeroEndpointId;
8
8
  });
@@ -52,15 +52,26 @@ async function loadExchangeLayerZeroAddressFromApiIfNeeded(exchangeLayerZeroAdap
52
52
  if (exchangeLayerZeroAdapterAddress) {
53
53
  return exchangeLayerZeroAdapterAddress;
54
54
  }
55
- // No bridge adapters currently supported
56
- return ethers_1.ethers.ZeroAddress;
55
+ const [exchangeResponse] = await (0, public_1.loadExchangeResponseFromApiIfNeeded)();
56
+ return exchangeResponse.bridgeAdapters
57
+ .stargateBridgeAdapterV1KatanaContractAddress;
57
58
  }
58
59
  exports.loadExchangeLayerZeroAddressFromApiIfNeeded = loadExchangeLayerZeroAddressFromApiIfNeeded;
60
+ async function loadExchangeLocalDepositAddressFromApiIfNeeded(exchangeLocalDepositAdapterAddress) {
61
+ if (exchangeLocalDepositAdapterAddress) {
62
+ return exchangeLocalDepositAdapterAddress;
63
+ }
64
+ const [exchangeResponse] = await (0, public_1.loadExchangeResponseFromApiIfNeeded)();
65
+ return exchangeResponse.bridgeAdapters
66
+ .localDepositAdapterV1KatanaContractAddress;
67
+ }
68
+ exports.loadExchangeLocalDepositAddressFromApiIfNeeded = loadExchangeLocalDepositAddressFromApiIfNeeded;
59
69
  async function loadStargateBridgeForwarderContractAddressFromApiIfNeeded(stargateBridgeForwarderContractAddress) {
60
70
  if (stargateBridgeForwarderContractAddress) {
61
71
  return stargateBridgeForwarderContractAddress;
62
72
  }
63
- // No bridge adapters currently supported
64
- return ethers_1.ethers.ZeroAddress;
73
+ const [exchangeResponse] = await (0, public_1.loadExchangeResponseFromApiIfNeeded)();
74
+ return exchangeResponse.bridgeAdapters
75
+ .stargateBridgeForwarderV1EthereumContractAddress;
65
76
  }
66
77
  exports.loadStargateBridgeForwarderContractAddressFromApiIfNeeded = loadStargateBridgeForwarderContractAddressFromApiIfNeeded;