@katanaperps/katana-perps-sdk 1.0.0-alpha.2 → 1.0.0-alpha.21

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.
Files changed (66) hide show
  1. package/dist/abis/ExchangeLayerZeroAdapter_v1.json +60 -25
  2. package/dist/abis/ExchangeLocalDepositAdapter_v1.json +318 -0
  3. package/dist/abis/FixedIncomeVaultProviderStateAggregator_v1.json +229 -0
  4. package/dist/abis/FixedIncomeVaultProvider_v1.json +2640 -0
  5. package/dist/abis/IVaultComposerSync.json +537 -0
  6. package/dist/abis/KatanaPerpsStargateForwarder_v1.json +108 -14
  7. package/dist/bridge/config.d.ts +29 -25
  8. package/dist/bridge/config.d.ts.map +1 -1
  9. package/dist/bridge/config.js +24 -21
  10. package/dist/bridge/deposit.d.ts +30 -3
  11. package/dist/bridge/deposit.d.ts.map +1 -1
  12. package/dist/bridge/deposit.js +156 -28
  13. package/dist/bridge/utils.d.ts +17 -15
  14. package/dist/bridge/utils.d.ts.map +1 -1
  15. package/dist/bridge/utils.js +17 -6
  16. package/dist/bridge/withdraw.d.ts.map +1 -1
  17. package/dist/bridge/withdraw.js +1 -2
  18. package/dist/client/rest/authenticated.d.ts +17 -2
  19. package/dist/client/rest/authenticated.d.ts.map +1 -1
  20. package/dist/client/rest/authenticated.js +37 -14
  21. package/dist/typechain-types/ExchangeLayerZeroAdapter_v1.d.ts +23 -28
  22. package/dist/typechain-types/ExchangeLayerZeroAdapter_v1.d.ts.map +1 -1
  23. package/dist/typechain-types/ExchangeLocalDepositAdapter_v1.d.ts +210 -0
  24. package/dist/typechain-types/ExchangeLocalDepositAdapter_v1.d.ts.map +1 -0
  25. package/dist/typechain-types/ExchangeLocalDepositAdapter_v1.js +2 -0
  26. package/dist/typechain-types/FixedIncomeVaultProviderStateAggregator_v1.d.ts +13 -13
  27. package/dist/typechain-types/FixedIncomeVaultProviderStateAggregator_v1.d.ts.map +1 -1
  28. package/dist/typechain-types/FixedIncomeVaultProvider_v1.d.ts +50 -78
  29. package/dist/typechain-types/FixedIncomeVaultProvider_v1.d.ts.map +1 -1
  30. package/dist/typechain-types/IVaultComposerSync.d.ts +247 -0
  31. package/dist/typechain-types/IVaultComposerSync.d.ts.map +1 -0
  32. package/dist/typechain-types/IVaultComposerSync.js +2 -0
  33. package/dist/typechain-types/KatanaPerpsStargateForwarder_v1.d.ts +29 -5
  34. package/dist/typechain-types/KatanaPerpsStargateForwarder_v1.d.ts.map +1 -1
  35. package/dist/typechain-types/factories/ExchangeLayerZeroAdapter_v1__factory.d.ts +46 -20
  36. package/dist/typechain-types/factories/ExchangeLayerZeroAdapter_v1__factory.d.ts.map +1 -1
  37. package/dist/typechain-types/factories/ExchangeLayerZeroAdapter_v1__factory.js +60 -25
  38. package/dist/typechain-types/factories/ExchangeLocalDepositAdapter_v1__factory.d.ts +255 -0
  39. package/dist/typechain-types/factories/ExchangeLocalDepositAdapter_v1__factory.d.ts.map +1 -0
  40. package/dist/typechain-types/factories/ExchangeLocalDepositAdapter_v1__factory.js +335 -0
  41. package/dist/typechain-types/factories/FixedIncomeVaultProviderStateAggregator_v1__factory.d.ts +15 -15
  42. package/dist/typechain-types/factories/FixedIncomeVaultProviderStateAggregator_v1__factory.js +20 -20
  43. package/dist/typechain-types/factories/FixedIncomeVaultProvider_v1__factory.d.ts +61 -96
  44. package/dist/typechain-types/factories/FixedIncomeVaultProvider_v1__factory.d.ts.map +1 -1
  45. package/dist/typechain-types/factories/FixedIncomeVaultProvider_v1__factory.js +72 -117
  46. package/dist/typechain-types/factories/IVaultComposerSync__factory.d.ts +422 -0
  47. package/dist/typechain-types/factories/IVaultComposerSync__factory.d.ts.map +1 -0
  48. package/dist/typechain-types/factories/IVaultComposerSync__factory.js +554 -0
  49. package/dist/typechain-types/factories/KatanaPerpsStargateForwarder_v1__factory.d.ts +86 -14
  50. package/dist/typechain-types/factories/KatanaPerpsStargateForwarder_v1__factory.d.ts.map +1 -1
  51. package/dist/typechain-types/factories/KatanaPerpsStargateForwarder_v1__factory.js +108 -14
  52. package/dist/typechain-types/factories/index.d.ts +4 -0
  53. package/dist/typechain-types/factories/index.d.ts.map +1 -1
  54. package/dist/typechain-types/factories/index.js +9 -1
  55. package/dist/typechain-types/index.d.ts +8 -0
  56. package/dist/typechain-types/index.d.ts.map +1 -1
  57. package/dist/typechain-types/index.js +9 -1
  58. package/dist/types/enums/request.d.ts +2 -2
  59. package/dist/types/enums/request.js +1 -1
  60. package/dist/types/rest/endpoints/GetExchange.d.ts +54 -0
  61. package/dist/types/rest/endpoints/GetExchange.d.ts.map +1 -1
  62. package/dist/types/rest/endpoints/GetGasFees.d.ts +2 -0
  63. package/dist/types/rest/endpoints/GetGasFees.d.ts.map +1 -1
  64. package/dist/types/rest/endpoints/internal.d.ts +8 -0
  65. package/dist/types/rest/endpoints/internal.d.ts.map +1 -1
  66. package/package.json +1 -1
@@ -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.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");
@@ -64,25 +64,33 @@ exports.decodeDepositBridgeAdapterPayload = decodeDepositBridgeAdapterPayload;
64
64
  /**
65
65
  * Deposit funds cross-chain into the Exchange using a LayerZero OFT or Stargate
66
66
  */
67
- async function depositViaBridge(parameters, providers, sourceSigner, sandbox, extraRequestParams) {
68
- const [{ sendParam, sourceConfig }, { gasFee }] = await Promise.all(parameters.sourceBridgeTarget === request_1.BridgeTarget.STARGATE_ETHEREUM ?
69
- [
70
- getDepositFromEthereumSendParamAndSourceConfig(parameters, sandbox),
71
- estimateDepositFromEthereumFees(parameters, providers, sandbox),
72
- ]
73
- : [
74
- getDepositViaForwarderSendParamAndSourceConfig(parameters, providers, sandbox),
75
- estimateDepositViaForwarderFees(parameters, providers, sandbox),
76
- ]);
67
+ async function depositViaBridge(parameters, providers, sourceSigner, sandbox, extraRequestParams,
68
+ /** Let software wallet show estimate to the user. Even on expected TX failure. */
69
+ ignoreEstimateError) {
70
+ return parameters.sourceBridgeTarget === request_1.BridgeTarget.STARGATE_ETHEREUM ?
71
+ depositViaVaultComposerSync(parameters, providers, sourceSigner, sandbox, extraRequestParams, ignoreEstimateError)
72
+ : depositViaForwarder(parameters, providers, sourceSigner, sandbox, extraRequestParams, ignoreEstimateError);
73
+ }
74
+ exports.depositViaBridge = depositViaBridge;
75
+ /**
76
+ * Deposit funds cross-chain into the Exchange using a LayerZero OFT or Stargate
77
+ */
78
+ async function depositViaVaultComposerSync(parameters, providers, sourceSigner, sandbox, extraRequestParams,
79
+ /** Let software wallet show estimate to the user. Even on expected TX failure. */
80
+ ignoreEstimateError) {
81
+ const [{ sendParam, sourceConfig }, { gasFee }] = await Promise.all([
82
+ getDepositFromEthereumSendParamAndSourceConfig(parameters, sandbox),
83
+ estimateDepositFromEthereumFees(parameters, providers, sandbox),
84
+ ]);
77
85
  let gasLimit = config_1.BridgeConfig.settings.depositSourceChainGasLimit;
78
- const oft = index_1.IOFT__factory.connect(sourceConfig.layerzeroOFTAddress, sourceSigner);
79
- const wallet = getDestinationWallet(parameters);
86
+ const vaultComposerSync = index_1.IVaultComposerSync__factory.connect(sourceConfig.layerZeroVaultComposerSyncAddress, sourceSigner);
87
+ const sourceWallet = await sourceSigner.getAddress();
80
88
  try {
81
89
  // Estimate gas
82
- const estimatedGasLimit = await oft.send.estimateGas(sendParam, { nativeFee: gasFee, lzTokenFee: 0 }, wallet, // Refund address - extra gas (if any) is returned to this address
90
+ const estimatedGasLimit = await vaultComposerSync.depositAndSend.estimateGas(parameters.quantityInAssetUnits, sendParam, sourceWallet, // Refund address - extra gas (if any) is returned to this address
83
91
  {
84
92
  ...extraRequestParams,
85
- from: wallet,
93
+ from: sourceWallet,
86
94
  // Native gas to pay for the cross chain message fee
87
95
  value: gasFee,
88
96
  });
@@ -99,19 +107,131 @@ async function depositViaBridge(parameters, providers, sourceSigner, sandbox, ex
99
107
  // fall through and use the configured default gas limit. The wallet software in use should
100
108
  // still show if that limit is insufficient, which is only an issue for blockchains with
101
109
  // variable gas costs such as Arbitrum One
102
- if (!error.code || error.code !== 'INSUFFICIENT_FUNDS') {
110
+ if (error?.code === 'INSUFFICIENT_FUNDS') {
111
+ console.log('[depositViaVaultComposerSync] Insufficient funds - continue with default gas');
112
+ }
113
+ else if (ignoreEstimateError) {
114
+ // TODO: In latest contract it throws 'CALL_EXCEPTION' instead of 'INSUFFICIENT_FUNDS'
115
+ console.log('[depositViaVaultComposerSync] Estimate failed - continue with default gas', error);
116
+ }
117
+ else {
103
118
  throw error;
104
119
  }
105
120
  }
106
- const response = await oft.send(sendParam, { nativeFee: gasFee, lzTokenFee: 0 }, wallet, // Refund address - extra gas (if any) is returned to this address
121
+ const response = await vaultComposerSync.depositAndSend.send(parameters.quantityInAssetUnits, sendParam, sourceWallet, // Refund address - extra gas (if any) is returned to this address
107
122
  {
108
- from: wallet,
123
+ ...extraRequestParams,
124
+ from: sourceWallet,
125
+ gasLimit,
126
+ value: gasFee, // Native gas to pay for the cross chain message fee
127
+ });
128
+ return response.hash;
129
+ }
130
+ exports.depositViaVaultComposerSync = depositViaVaultComposerSync;
131
+ /**
132
+ * Deposit funds cross-chain into the Exchange using a LayerZero OFT or Stargate
133
+ */
134
+ async function depositViaForwarder(parameters, providers, sourceSigner, sandbox, extraRequestParams,
135
+ /** Let software wallet show estimate to the user. Even on expected TX failure. */
136
+ ignoreEstimateError) {
137
+ const [{ sendParam, sourceConfig }, { gasFee }] = await Promise.all([
138
+ getDepositViaForwarderSendParamAndSourceConfig(parameters, providers, sandbox),
139
+ estimateDepositViaForwarderFees(parameters, providers, sandbox),
140
+ ]);
141
+ let gasLimit = config_1.BridgeConfig.settings.depositSourceChainGasLimit;
142
+ const oft = index_1.IOFT__factory.connect(sourceConfig.layerzeroOFTAddress, sourceSigner);
143
+ const sourceWallet = await sourceSigner.getAddress();
144
+ try {
145
+ // Estimate gas
146
+ const estimatedGasLimit = await oft.send.estimateGas(sendParam, { nativeFee: gasFee, lzTokenFee: 0 }, sourceWallet, // Refund address - extra gas (if any) is returned to this address
147
+ {
148
+ ...extraRequestParams,
149
+ from: sourceWallet, // Native gas to pay for the cross chain message fee
150
+ value: gasFee,
151
+ });
152
+ // Add 20% buffer for safety
153
+ gasLimit = Number(new bignumber_js_1.default(estimatedGasLimit.toString())
154
+ .times(new bignumber_js_1.default(1.2))
155
+ .toFixed(0));
156
+ }
157
+ catch (error) {
158
+ // ethers.js will perform the estimation at the block gas limit, which is much higher than the
159
+ // gas actually needed by the tx. If the wallet does not have the funds to cover the tx at this
160
+ // high gas limit then the RPC will throw an INSUFFICIENT_FUNDS error; however the wallet may
161
+ // still have enough funds to successfully bridge at the actual gas limit. In this case simply
162
+ // fall through and use the configured default gas limit. The wallet software in use should
163
+ // still show if that limit is insufficient, which is only an issue for blockchains with
164
+ // variable gas costs such as Arbitrum One
165
+ if (error?.code === 'INSUFFICIENT_FUNDS') {
166
+ console.log('[depositViaForwarder] Insufficient funds - continue with default gas');
167
+ }
168
+ else if (ignoreEstimateError) {
169
+ // TODO: In latest contract it throws 'CALL_EXCEPTION' instead of 'INSUFFICIENT_FUNDS'
170
+ console.log('[depositViaForwarder] Estimate failed - continue with default gas', error);
171
+ }
172
+ else {
173
+ throw error;
174
+ }
175
+ }
176
+ const response = await oft.send(sendParam, { nativeFee: gasFee, lzTokenFee: 0 }, sourceWallet, // Refund address - extra gas (if any) is returned to this address
177
+ {
178
+ ...extraRequestParams,
179
+ from: sourceWallet,
109
180
  gasLimit,
110
181
  value: gasFee,
111
182
  });
112
183
  return response.hash;
113
184
  }
114
- exports.depositViaBridge = depositViaBridge;
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;
115
235
  function encodeDepositBridgeAdapterPayload(sourceConfig, parameters) {
116
236
  if (parameters.bridgePayloadType ===
117
237
  DepositBridgeAdapterPayloadType.addManagedAccount) {
@@ -225,16 +345,18 @@ async function estimateDepositViaForwarderFees(parameters, providers, sandbox) {
225
345
  };
226
346
  }
227
347
  async function getDepositFromEthereumSendParamAndSourceConfig(parameters, sandbox) {
348
+ if (!parameters.minimumForwardQuantityMultiplierInPips) {
349
+ throw new Error('minimumForwardQuantityMultiplierInPips is required for deposit via forwarder');
350
+ }
228
351
  const { sourceConfig, destinationConfig } = getSourceAndDestinationConfigs(request_1.BridgeTarget.STARGATE_ETHEREUM, request_1.BridgeTarget.KATANA_KATANA, sandbox);
229
352
  const exchangeLayerZeroAdapterAddress = await (0, utils_1.loadExchangeLayerZeroAddressFromApiIfNeeded)(parameters.exchangeLayerZeroAdapterAddress);
230
- let extraOptions = new Uint8Array();
231
- if (parameters.bridgePayloadType ===
232
- DepositBridgeAdapterPayloadType.addManagedAccount) {
233
- const { Options } = await import('@layerzerolabs/lz-v2-utilities');
234
- extraOptions = Options.newOptions()
235
- .addExecutorComposeOption(0, config_1.BridgeConfig.settings.addManagedAccountExtraGas, 0)
236
- .toBytes();
237
- }
353
+ const { Options } = await import('@layerzerolabs/lz-v2-utilities');
354
+ const extraOptions = Options.newOptions()
355
+ .addExecutorComposeOption(0, (parameters.bridgePayloadType ===
356
+ DepositBridgeAdapterPayloadType.addManagedAccount) ?
357
+ config_1.BridgeConfig.settings.addManagedAccountComposeGasLimit
358
+ : config_1.BridgeConfig.settings.depositComposeGasLimit, 0)
359
+ .toBytes();
238
360
  const sendParam = {
239
361
  dstEid: destinationConfig.layerZeroEndpointId, // Destination endpoint ID
240
362
  to: ethers_1.ethers.zeroPadValue(exchangeLayerZeroAdapterAddress, 32), // Recipient address
@@ -244,9 +366,15 @@ async function getDepositFromEthereumSendParamAndSourceConfig(parameters, sandbo
244
366
  composeMsg: encodeDepositBridgeAdapterPayload(sourceConfig, parameters), // Additional options supplied by the caller to be used in the LayerZero message
245
367
  oftCmd: '0x', // The OFT command to be executed, unused in default OFT implementations
246
368
  };
247
- return { sendParam, sourceConfig };
369
+ return {
370
+ sendParam,
371
+ sourceConfig: sourceConfig,
372
+ };
248
373
  }
249
374
  async function getDepositViaForwarderSendParamAndSourceConfig(parameters, providers, sandbox) {
375
+ if (!parameters.minimumForwardQuantityMultiplierInPips) {
376
+ throw new Error('minimumForwardQuantityMultiplierInPips is required for deposit via forwarder');
377
+ }
250
378
  const { sourceConfig, destinationConfig: ethereumConfig } = getSourceAndDestinationConfigs(parameters.sourceBridgeTarget, request_1.BridgeTarget.STARGATE_ETHEREUM, sandbox);
251
379
  const { gasFee: ethereumGasFee } = await estimateDepositFromEthereumFees(parameters, providers, sandbox);
252
380
  // Add 20% buffer for safety
@@ -1,5 +1,5 @@
1
1
  import type { BridgeTarget } from '#types/enums/request';
2
- export declare const BridgeMainnetLayerZeroEndpointIds: (30110 | 30211 | 30106 | 30184 | 30102 | 30101 | 30111 | 30235 | 30214 | 30290)[];
2
+ export declare const BridgeMainnetLayerZeroEndpointIds: (30110 | 30211 | 30106 | 30184 | 30362 | 30101 | 30111 | 30235 | 30214 | 30290)[];
3
3
  export type BridgeLayerZeroEndpointIdsMainnet = (typeof BridgeMainnetLayerZeroEndpointIds)[number];
4
4
  export declare function isBridgeMainnetLayerZeroEndpointId(layerZeroEndpointId: number): layerZeroEndpointId is BridgeLayerZeroEndpointIdsMainnet;
5
5
  export declare const BridgeTestnetLayerZeroEndpointIds: (30101 | 40231)[];
@@ -16,10 +16,9 @@ export declare function isBridgeTestnetLayerZeroEndpointId(layerZeroEndpointId:
16
16
  */
17
17
  export declare function getBridgeTargetConfig<T extends BridgeTarget, S extends true | false>(bridgeTarget: T, sandbox: S): {
18
18
  readonly target: "katana.katana";
19
- readonly isSupported: true;
20
19
  readonly evmChainId: 737373;
21
- readonly layerZeroEndpointId: -1;
22
- readonly layerzeroOFTAddress: "0x0000000000000000000000000000000000000000";
20
+ readonly layerZeroEndpointId: 40448;
21
+ readonly layerzeroOFTAddress: "0x3aCAAf60502791D199a5a5F0B173D78229eBFe32";
23
22
  readonly tokenDecimals: 6;
24
23
  readonly usdcAddress: "0xc2a4C310F2512A17Ac0047cf871aCAed3E62bB4B";
25
24
  } | {
@@ -33,7 +32,8 @@ export declare function getBridgeTargetConfig<T extends BridgeTarget, S extends
33
32
  readonly target: "stargate.ethereum";
34
33
  readonly evmChainId: 11155111;
35
34
  readonly layerZeroEndpointId: 40161;
36
- readonly layerzeroOFTAddress: "0x21F1caDDBED3Cd50e6B30644459BFB80c367076c";
35
+ readonly layerzeroOFTAddress: "0x0000000000000000000000000000000000000000";
36
+ readonly layerZeroVaultComposerSync: "0x0000000000000000000000000000000000000000";
37
37
  readonly tokenDecimals: 6;
38
38
  readonly usdcAddress: "0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590";
39
39
  } | {
@@ -43,7 +43,7 @@ export declare function getBridgeTargetConfig<T extends BridgeTarget, S extends
43
43
  readonly layerZeroEndpointId: 30375;
44
44
  readonly layerzeroOFTAddress: "0x807275727Dd3E640c5F2b5DE7d1eC72B4Dd293C0";
45
45
  readonly tokenDecimals: 6;
46
- readonly usdcAddress: "0x203a662b0bd271a6ed5a60edfbd04bfce608fd36";
46
+ readonly usdcAddress: "0x203A662b0BD271A6ed5a60EdFbd04bFce608FD36";
47
47
  };
48
48
  readonly "stargate.arbitrum": {
49
49
  readonly target: "stargate.arbitrum";
@@ -77,19 +77,20 @@ export declare function getBridgeTargetConfig<T extends BridgeTarget, S extends
77
77
  readonly tokenDecimals: 6;
78
78
  readonly usdcAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
79
79
  };
80
- readonly "stargate.bnb": {
81
- readonly target: "stargate.bnb";
82
- readonly evmChainId: 56;
83
- readonly layerZeroEndpointId: 30102;
84
- readonly layerzeroOFTAddress: "0x962Bd449E630b0d928f308Ce63f1A21F02576057";
85
- readonly tokenDecimals: 18;
86
- readonly usdcAddress: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d";
80
+ readonly "stargate.berachain": {
81
+ readonly target: "stargate.berachain";
82
+ readonly evmChainId: 80094;
83
+ readonly layerZeroEndpointId: 30362;
84
+ readonly layerzeroOFTAddress: "0xAF54BE5B6eEc24d6BFACf1cce4eaF680A8239398";
85
+ readonly tokenDecimals: 6;
86
+ readonly usdcAddress: "0x549943e04f40284185054145c6E4e9568C1D3241";
87
87
  };
88
88
  readonly "stargate.ethereum": {
89
89
  readonly target: "stargate.ethereum";
90
90
  readonly evmChainId: 1;
91
91
  readonly layerZeroEndpointId: 30101;
92
- readonly layerzeroOFTAddress: "0xc026395860Db2d07ee33e05fE50ed7bD583189C7";
92
+ readonly layerzeroOFTAddress: "0xb5bADA33542a05395d504a25885e02503A957Bb3";
93
+ readonly layerZeroVaultComposerSyncAddress: "0x8A35897fda9E024d2aC20a937193e099679eC477";
93
94
  readonly tokenDecimals: 6;
94
95
  readonly usdcAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
95
96
  };
@@ -126,7 +127,8 @@ export declare function getBridgeTargetConfig<T extends BridgeTarget, S extends
126
127
  readonly usdcAddress: "0x19e26B0638bf63aa9fa4d14c6baF8D52eBE86C5C";
127
128
  };
128
129
  }[T];
129
- export declare function bridgeTargetForLayerZeroEndpointId(layerZeroEndpointId: number, sandbox: boolean): "stargate.arbitrum" | "stargate.aurora" | "stargate.avalanche" | "stargate.base" | "stargate.bnb" | "stargate.ethereum" | "stargate.optimism" | "stargate.rari" | "stargate.scroll" | "stargate.taiko" | null;
130
+ 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;
130
131
  export declare function loadExchangeLayerZeroAddressFromApiIfNeeded(exchangeLayerZeroAdapterAddress?: string): Promise<string>;
132
+ export declare function loadExchangeLocalDepositAddressFromApiIfNeeded(exchangeLocalDepositAdapterAddress?: string): Promise<string>;
131
133
  export declare function loadStargateBridgeForwarderContractAddressFromApiIfNeeded(stargateBridgeForwarderContractAddress?: string): Promise<string>;
132
134
  //# 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,iCA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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,GACvC,OAAO,CAAC,MAAM,CAAC,CAQjB;AAED,wBAAsB,8CAA8C,CAClE,kCAAkC,CAAC,EAAE,MAAM,GAC1C,OAAO,CAAC,MAAM,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;
@@ -1 +1 @@
1
- {"version":3,"file":"withdraw.d.ts","sourceRoot":"","sources":["../../src/bridge/withdraw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMhC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAQpD;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAAG,MAAM,CAAC;AAE3D,eAAO,MAAM,oCAAoC,IAAI,CAAC;AAEtD;;GAEG;AACH,wBAAgB,oCAAoC,CAClD,OAAO,EAAE,qCAAqC,GAC7C,qCAAqC,CAOvC;AAED;;GAEG;AACH,wBAAgB,oCAAoC,CAAC,EACnD,mBAAmB,GACpB,EAAE,qCAAqC,GAAG,qCAAqC,CAK/E;AAED;;GAEG;AACH,wBAAgB,0CAA0C,CACxD,YAAY,EAAE,YAAY,EAC1B,OAAO,UAAQ,GACd,qCAAqC,CAMvC;AAED;;GAEG;AACH,wBAAsB,8BAA8B,CAClD,UAAU,EAAE;IACV,+BAA+B,EAAE,MAAM,CAAC;IACxC,wBAAwB,EAAE,MAAM,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,EAED,SAAS,EAAE;IACT,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC;CACzB,EACD,OAAO,EAAE,OAAO,GACf,OAAO,CAAC;IACT,kCAAkC,EAAE,MAAM,CAAC;IAC3C,gCAAgC,EAAE,MAAM,CAAC;IACzC,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC,CAoED"}
1
+ {"version":3,"file":"withdraw.d.ts","sourceRoot":"","sources":["../../src/bridge/withdraw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMhC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAOpD;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAAG,MAAM,CAAC;AAE3D,eAAO,MAAM,oCAAoC,IAAI,CAAC;AAEtD;;GAEG;AACH,wBAAgB,oCAAoC,CAClD,OAAO,EAAE,qCAAqC,GAC7C,qCAAqC,CAOvC;AAED;;GAEG;AACH,wBAAgB,oCAAoC,CAAC,EACnD,mBAAmB,GACpB,EAAE,qCAAqC,GAAG,qCAAqC,CAK/E;AAED;;GAEG;AACH,wBAAgB,0CAA0C,CACxD,YAAY,EAAE,YAAY,EAC1B,OAAO,UAAQ,GACd,qCAAqC,CAMvC;AAED;;GAEG;AACH,wBAAsB,8BAA8B,CAClD,UAAU,EAAE;IACV,+BAA+B,EAAE,MAAM,CAAC;IACxC,wBAAwB,EAAE,MAAM,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,EAED,SAAS,EAAE;IACT,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC;CACzB,EACD,OAAO,EAAE,OAAO,GACf,OAAO,CAAC;IACT,kCAAkC,EAAE,MAAM,CAAC;IAC3C,gCAAgC,EAAE,MAAM,CAAC;IACzC,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC,CAiED"}
@@ -6,7 +6,6 @@ const _pipmath_1 = require("#pipmath");
6
6
  const ExchangeLayerZeroAdapter_v1__factory_1 = require("#typechain-types/factories/ExchangeLayerZeroAdapter_v1__factory");
7
7
  const KatanaPerpsStargateForwarder_v1__factory_1 = require("#typechain-types/factories/KatanaPerpsStargateForwarder_v1__factory");
8
8
  const request_1 = require("#types/enums/request");
9
- const config_1 = require("./config");
10
9
  const utils_1 = require("./utils");
11
10
  exports.withdrawalBridgeAdapterPayloadLength = 4; // uint32(4)
12
11
  /**
@@ -43,7 +42,7 @@ async function estimateBridgeWithdrawQuantity(parameters, providers, sandbox) {
43
42
  const exchangeBridgeAdapter = ExchangeLayerZeroAdapter_v1__factory_1.ExchangeLayerZeroAdapter_v1__factory.connect(parameters.exchangeLayerZeroAdapterAddress, providers.katana);
44
43
  const [estimatedWithdrawQuantityInAssetUnits, minimumWithdrawQuantityInAssetUnits, poolDecimals,] = await exchangeBridgeAdapter.estimateWithdrawQuantityInAssetUnits(
45
44
  // Funds must always be withdrawn to Ethereum first regardless of final target
46
- (sandbox ? config_1.BridgeConfig.testnet : config_1.BridgeConfig.mainnet)[request_1.BridgeTarget.STARGATE_ETHEREUM].layerZeroEndpointId, (0, _pipmath_1.decimalToPip)(parameters.quantityInDecimal));
45
+ (0, _pipmath_1.decimalToPip)(parameters.quantityInDecimal));
47
46
  let estimatedWithdrawQuantityInDecimal = (0, _pipmath_1.assetUnitsToDecimal)(estimatedWithdrawQuantityInAssetUnits, Number(poolDecimals));
48
47
  let minimumWithdrawQuantityInDecimal = (0, _pipmath_1.assetUnitsToDecimal)(minimumWithdrawQuantityInAssetUnits, Number(poolDecimals));
49
48
  const target = (0, utils_1.bridgeTargetForLayerZeroEndpointId)(targetEndpointId, sandbox);
@@ -84,9 +84,9 @@ export interface RestAuthenticatedClientOptions {
84
84
  */
85
85
  chainId?: number;
86
86
  /**
87
- * Optionally provide the `bridgeAdapterContractAddress` as returned by the public clients
87
+ * Optionally provide the `stargateBridgeAdapterV1KatanaContractAddress` as returned by the public clients
88
88
  * {@link RestPublicClient.getExchange getExchange} response's
89
- * {@link katanaperps.KatanaPerpsExchange.bridgeAdapterContractAddress bridgeAdapterContractAddress}
89
+ * {@link katanaperps.KatanaPerpsExchange.bridgeAdapters.stargateBridgeAdapterV1KatanaContractAddress stargateBridgeAdapterV1KatanaContractAddress}
90
90
  * property.
91
91
  *
92
92
  * - If not provided, this will be fetched and cached automatically from the public client before
@@ -95,6 +95,18 @@ export interface RestAuthenticatedClientOptions {
95
95
  * @internal
96
96
  */
97
97
  bridgeAdapterContractAddress?: string;
98
+ /**
99
+ * Optionally provide the `localDepositAdapterV1KatanaContractAddress` as returned by the public clients
100
+ * {@link RestPublicClient.getExchange getExchange} response's
101
+ * {@link katanaperps.KatanaPerpsExchange.bridgeAdapters.localDepositAdapterV1KatanaContractAddress localDepositAdapterV1KatanaContractAddress}
102
+ * property.
103
+ *
104
+ * - If not provided, this will be fetched and cached automatically from the public client before
105
+ * making the first request which requires it.
106
+ *
107
+ * @internal
108
+ */
109
+ localDepositAdapterContractAddress?: string;
98
110
  /**
99
111
  * - Changing this value will likely result in a broken client, internal use only.
100
112
  *
@@ -215,6 +227,7 @@ export declare class RestAuthenticatedClient {
215
227
  exchangeContractAddress?: string | undefined;
216
228
  chainId?: number | undefined;
217
229
  bridgeAdapterContractAddress?: string | undefined;
230
+ localDepositAdapterContractAddress?: string | undefined;
218
231
  }>;
219
232
  /**
220
233
  * The {@link RestAuthenticatedClient} is used to make authenticated requests to the Katana Perps API. It includes
@@ -1145,6 +1158,8 @@ export declare class RestAuthenticatedClient {
1145
1158
  protected getContractAndChainId(): Promise<{
1146
1159
  chainId: number;
1147
1160
  exchangeContractAddress: string;
1161
+ bridgeAdapterContractAddress: string;
1162
+ localDepositAdapterContractAddress: string;
1148
1163
  }>;
1149
1164
  /**
1150
1165
  * - Internal Use and may change or break without notice
@@ -1 +1 @@
1
- {"version":3,"file":"authenticated.d.ts","sourceRoot":"","sources":["../../../src/client/rest/authenticated.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAkB1B,OAAO,EAIL,eAAe,EAEhB,MAAM,QAAQ,CAAC;AAIhB,OAAO,KAAK,KAAK,WAAW,MAAM,QAAQ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EACvB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC,GACjC,CACI;QAAE,MAAM,EAAE,KAAK,CAAA;KAAE,GACjB;QACE,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,CAAC;QAC7D,IAAI,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;SAAE,CAAC;KAClC,CACJ,EACH,yBAAyB,UAAoC;CAwBhE"}
@@ -11,7 +11,9 @@ const ethers_1 = require("ethers");
11
11
  const _constants_1 = require("#constants");
12
12
  const _signatures_1 = require("#signatures");
13
13
  const _utils_1 = require("#utils");
14
+ const withdraw_1 = require("#bridge/withdraw");
14
15
  const public_1 = require("#client/rest/public");
16
+ const request_1 = require("#types/enums/request");
15
17
  /**
16
18
  * The {@link RestAuthenticatedClient} is used to make authenticated requests to the Katana Perps API. It includes
17
19
  * methods that make requests on behalf of a specific wallet such as creating and cancelling orders.
@@ -157,7 +159,7 @@ class RestAuthenticatedClient {
157
159
  * @category Constructor
158
160
  */
159
161
  constructor(options) {
160
- const { sandbox = false, exchangeContractAddress, chainId, bridgeAdapterContractAddress, autoCreateHmacHeader = true, } = options;
162
+ const { sandbox = false, exchangeContractAddress, chainId, bridgeAdapterContractAddress, localDepositAdapterContractAddress, autoCreateHmacHeader = true, } = options;
161
163
  const baseURL = (0, _utils_1.deriveBaseURL)({
162
164
  sandbox,
163
165
  api: 'rest',
@@ -170,6 +172,7 @@ class RestAuthenticatedClient {
170
172
  baseURL,
171
173
  sandbox,
172
174
  bridgeAdapterContractAddress,
175
+ localDepositAdapterContractAddress,
173
176
  exchangeContractAddress,
174
177
  chainId,
175
178
  autoCreateHmacHeader,
@@ -836,13 +839,13 @@ class RestAuthenticatedClient {
836
839
  */
837
840
  async withdraw($params, signer = this.#signer) {
838
841
  ensureSigner(signer);
839
- const { chainId, exchangeContractAddress } = await this.getContractAndChainId();
842
+ const { chainId, exchangeContractAddress, bridgeAdapterContractAddress } = await this.getContractAndChainId();
840
843
  let params;
841
844
  if ($params.bridgeTarget) {
842
845
  const { bridgeTarget, ...rest } = $params;
843
846
  params = {
844
847
  ...rest,
845
- ...getWithdrawalRequestBridgeAdapterParametersForTarget(),
848
+ ...getWithdrawalRequestBridgeAdapterParametersForTarget(bridgeTarget, bridgeAdapterContractAddress, this.#config.sandbox),
846
849
  };
847
850
  }
848
851
  else {
@@ -1138,13 +1141,13 @@ class RestAuthenticatedClient {
1138
1141
  },
1139
1142
  withdrawFromManagedAccountByQuantity: async ($params, signer = this.#signer) => {
1140
1143
  ensureSigner(signer);
1141
- const { chainId, exchangeContractAddress } = await this.getContractAndChainId();
1144
+ const { chainId, exchangeContractAddress, bridgeAdapterContractAddress } = await this.getContractAndChainId();
1142
1145
  let params;
1143
1146
  if ($params.bridgeTarget) {
1144
1147
  const { bridgeTarget, ...rest } = $params;
1145
1148
  params = {
1146
1149
  ...rest,
1147
- ...getWithdrawalRequestBridgeAdapterParametersForTarget(),
1150
+ ...getWithdrawalRequestBridgeAdapterParametersForTarget(bridgeTarget, bridgeAdapterContractAddress, this.#config.sandbox),
1148
1151
  };
1149
1152
  }
1150
1153
  else {
@@ -1157,13 +1160,13 @@ class RestAuthenticatedClient {
1157
1160
  },
1158
1161
  withdrawFromManagedAccountByShares: async ($params, signer = this.#signer) => {
1159
1162
  ensureSigner(signer);
1160
- const { chainId, exchangeContractAddress } = await this.getContractAndChainId();
1163
+ const { chainId, exchangeContractAddress, bridgeAdapterContractAddress } = await this.getContractAndChainId();
1161
1164
  let params;
1162
1165
  if ($params.bridgeTarget) {
1163
1166
  const { bridgeTarget, ...rest } = $params;
1164
1167
  params = {
1165
1168
  ...rest,
1166
- ...getWithdrawalRequestBridgeAdapterParametersForTarget(),
1169
+ ...getWithdrawalRequestBridgeAdapterParametersForTarget(bridgeTarget, bridgeAdapterContractAddress, this.#config.sandbox),
1167
1170
  };
1168
1171
  }
1169
1172
  else {
@@ -1177,8 +1180,11 @@ class RestAuthenticatedClient {
1177
1180
  });
1178
1181
  // Internal methods exposed for advanced usage
1179
1182
  async getContractAndChainId() {
1180
- let { chainId, exchangeContractAddress } = this.#config;
1181
- if (!chainId || !exchangeContractAddress) {
1183
+ let { chainId, exchangeContractAddress, bridgeAdapterContractAddress, localDepositAdapterContractAddress, } = this.#config;
1184
+ if (!chainId ||
1185
+ !exchangeContractAddress ||
1186
+ !bridgeAdapterContractAddress ||
1187
+ !localDepositAdapterContractAddress) {
1182
1188
  if (!this.#exchange) {
1183
1189
  this.#exchange = await this.public.getExchange();
1184
1190
  }
@@ -1189,13 +1195,26 @@ class RestAuthenticatedClient {
1189
1195
  this.#exchange.exchangeContractAddress;
1190
1196
  exchangeContractAddress ??= this.#config.exchangeContractAddress;
1191
1197
  }
1198
+ this.#config.bridgeAdapterContractAddress ??=
1199
+ this.#exchange.bridgeAdapters.stargateBridgeAdapterV1KatanaContractAddress;
1200
+ bridgeAdapterContractAddress ??=
1201
+ this.#config.bridgeAdapterContractAddress;
1202
+ this.#config.localDepositAdapterContractAddress ??=
1203
+ this.#exchange.bridgeAdapters.localDepositAdapterV1KatanaContractAddress;
1204
+ localDepositAdapterContractAddress ??=
1205
+ this.#config.localDepositAdapterContractAddress;
1192
1206
  }
1193
- if (!chainId || !exchangeContractAddress) {
1194
- throw new Error(`Could not determine chainId (${typeof chainId}) or exchangeContractAddress (${typeof exchangeContractAddress})`);
1207
+ if (!chainId ||
1208
+ !exchangeContractAddress ||
1209
+ !bridgeAdapterContractAddress ||
1210
+ !localDepositAdapterContractAddress) {
1211
+ throw new Error(`Could not determine chainId (${typeof chainId}) or exchangeContractAddress (${typeof exchangeContractAddress}) or bridgeAdapterContractAddress (${typeof bridgeAdapterContractAddress} or localDepositAdapterContractAddress (${typeof localDepositAdapterContractAddress})`);
1195
1212
  }
1196
1213
  return {
1197
1214
  chainId,
1198
1215
  exchangeContractAddress,
1216
+ bridgeAdapterContractAddress,
1217
+ localDepositAdapterContractAddress,
1199
1218
  };
1200
1219
  }
1201
1220
  /**
@@ -1303,9 +1322,13 @@ function ensureSigner(signer) {
1303
1322
  /**
1304
1323
  * @internal
1305
1324
  */
1306
- function getWithdrawalRequestBridgeAdapterParametersForTarget() {
1325
+ function getWithdrawalRequestBridgeAdapterParametersForTarget(bridgeTarget, bridgeAdapterContractAddress, sandbox) {
1307
1326
  return {
1308
- bridgeAdapterAddress: ethers_1.ethers.ZeroAddress,
1309
- bridgeAdapterPayload: '0x',
1327
+ bridgeAdapterAddress: bridgeTarget === request_1.BridgeTarget.KATANA_KATANA ?
1328
+ ethers_1.ethers.ZeroAddress
1329
+ : bridgeAdapterContractAddress,
1330
+ bridgeAdapterPayload: bridgeTarget === request_1.BridgeTarget.KATANA_KATANA ?
1331
+ '0x'
1332
+ : (0, withdraw_1.getEncodedWithdrawalPayloadForBridgeTarget)(bridgeTarget, sandbox),
1310
1333
  };
1311
1334
  }