@sodax/sdk 2.0.0-rc.17 → 2.0.0-rc.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1744 -875
- package/dist/index.d.cts +262 -9
- package/dist/index.d.ts +262 -9
- package/dist/index.mjs +1743 -876
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -4218,7 +4218,7 @@ function isValidWalletProviderForChainKey(chainKey, walletProvider) {
|
|
|
4218
4218
|
}
|
|
4219
4219
|
|
|
4220
4220
|
// ../types/dist/index.js
|
|
4221
|
-
var CONFIG_VERSION =
|
|
4221
|
+
var CONFIG_VERSION = 216;
|
|
4222
4222
|
function isEvmSpokeChainConfig(value) {
|
|
4223
4223
|
return typeof value === "object" && value !== null && value.chain.type === "EVM" && value.chain.key !== HUB_CHAIN_KEY;
|
|
4224
4224
|
}
|
|
@@ -10621,6 +10621,144 @@ var ProtocolIntentsAbi = [
|
|
|
10621
10621
|
}
|
|
10622
10622
|
],
|
|
10623
10623
|
stateMutability: "view"
|
|
10624
|
+
},
|
|
10625
|
+
{
|
|
10626
|
+
type: "function",
|
|
10627
|
+
name: "cancelIntent",
|
|
10628
|
+
inputs: [
|
|
10629
|
+
{
|
|
10630
|
+
name: "fromToken",
|
|
10631
|
+
type: "address",
|
|
10632
|
+
internalType: "address"
|
|
10633
|
+
},
|
|
10634
|
+
{
|
|
10635
|
+
name: "toToken",
|
|
10636
|
+
type: "address",
|
|
10637
|
+
internalType: "address"
|
|
10638
|
+
}
|
|
10639
|
+
],
|
|
10640
|
+
outputs: [],
|
|
10641
|
+
stateMutability: "nonpayable"
|
|
10642
|
+
},
|
|
10643
|
+
{
|
|
10644
|
+
type: "function",
|
|
10645
|
+
name: "getUserIntent",
|
|
10646
|
+
inputs: [
|
|
10647
|
+
{
|
|
10648
|
+
name: "user",
|
|
10649
|
+
type: "address",
|
|
10650
|
+
internalType: "address"
|
|
10651
|
+
},
|
|
10652
|
+
{
|
|
10653
|
+
name: "fromToken",
|
|
10654
|
+
type: "address",
|
|
10655
|
+
internalType: "address"
|
|
10656
|
+
},
|
|
10657
|
+
{
|
|
10658
|
+
name: "toToken",
|
|
10659
|
+
type: "address",
|
|
10660
|
+
internalType: "address"
|
|
10661
|
+
}
|
|
10662
|
+
],
|
|
10663
|
+
outputs: [
|
|
10664
|
+
{
|
|
10665
|
+
name: "intentHash",
|
|
10666
|
+
type: "bytes32",
|
|
10667
|
+
internalType: "bytes32"
|
|
10668
|
+
}
|
|
10669
|
+
],
|
|
10670
|
+
stateMutability: "view"
|
|
10671
|
+
},
|
|
10672
|
+
{
|
|
10673
|
+
type: "function",
|
|
10674
|
+
name: "getIntentDetails",
|
|
10675
|
+
inputs: [
|
|
10676
|
+
{
|
|
10677
|
+
name: "intentHash",
|
|
10678
|
+
type: "bytes32",
|
|
10679
|
+
internalType: "bytes32"
|
|
10680
|
+
}
|
|
10681
|
+
],
|
|
10682
|
+
outputs: [
|
|
10683
|
+
{
|
|
10684
|
+
name: "intent",
|
|
10685
|
+
type: "tuple",
|
|
10686
|
+
internalType: "struct Intents.Intent",
|
|
10687
|
+
components: [
|
|
10688
|
+
{
|
|
10689
|
+
name: "intentId",
|
|
10690
|
+
type: "uint256",
|
|
10691
|
+
internalType: "uint256"
|
|
10692
|
+
},
|
|
10693
|
+
{
|
|
10694
|
+
name: "creator",
|
|
10695
|
+
type: "address",
|
|
10696
|
+
internalType: "address"
|
|
10697
|
+
},
|
|
10698
|
+
{
|
|
10699
|
+
name: "inputToken",
|
|
10700
|
+
type: "address",
|
|
10701
|
+
internalType: "address"
|
|
10702
|
+
},
|
|
10703
|
+
{
|
|
10704
|
+
name: "outputToken",
|
|
10705
|
+
type: "address",
|
|
10706
|
+
internalType: "address"
|
|
10707
|
+
},
|
|
10708
|
+
{
|
|
10709
|
+
name: "inputAmount",
|
|
10710
|
+
type: "uint256",
|
|
10711
|
+
internalType: "uint256"
|
|
10712
|
+
},
|
|
10713
|
+
{
|
|
10714
|
+
name: "minOutputAmount",
|
|
10715
|
+
type: "uint256",
|
|
10716
|
+
internalType: "uint256"
|
|
10717
|
+
},
|
|
10718
|
+
{
|
|
10719
|
+
name: "deadline",
|
|
10720
|
+
type: "uint256",
|
|
10721
|
+
internalType: "uint256"
|
|
10722
|
+
},
|
|
10723
|
+
{
|
|
10724
|
+
name: "allowPartialFill",
|
|
10725
|
+
type: "bool",
|
|
10726
|
+
internalType: "bool"
|
|
10727
|
+
},
|
|
10728
|
+
{
|
|
10729
|
+
name: "srcChain",
|
|
10730
|
+
type: "uint256",
|
|
10731
|
+
internalType: "uint256"
|
|
10732
|
+
},
|
|
10733
|
+
{
|
|
10734
|
+
name: "dstChain",
|
|
10735
|
+
type: "uint256",
|
|
10736
|
+
internalType: "uint256"
|
|
10737
|
+
},
|
|
10738
|
+
{
|
|
10739
|
+
name: "srcAddress",
|
|
10740
|
+
type: "bytes",
|
|
10741
|
+
internalType: "bytes"
|
|
10742
|
+
},
|
|
10743
|
+
{
|
|
10744
|
+
name: "dstAddress",
|
|
10745
|
+
type: "bytes",
|
|
10746
|
+
internalType: "bytes"
|
|
10747
|
+
},
|
|
10748
|
+
{
|
|
10749
|
+
name: "solver",
|
|
10750
|
+
type: "address",
|
|
10751
|
+
internalType: "address"
|
|
10752
|
+
},
|
|
10753
|
+
{
|
|
10754
|
+
name: "data",
|
|
10755
|
+
type: "bytes",
|
|
10756
|
+
internalType: "bytes"
|
|
10757
|
+
}
|
|
10758
|
+
]
|
|
10759
|
+
}
|
|
10760
|
+
],
|
|
10761
|
+
stateMutability: "view"
|
|
10624
10762
|
}
|
|
10625
10763
|
];
|
|
10626
10764
|
|
|
@@ -13528,6 +13666,68 @@ function resolveLogger(option) {
|
|
|
13528
13666
|
return option;
|
|
13529
13667
|
}
|
|
13530
13668
|
|
|
13669
|
+
// src/shared/analytics.ts
|
|
13670
|
+
var noopAnalytics = {
|
|
13671
|
+
isEnabled: () => false,
|
|
13672
|
+
emit: () => {
|
|
13673
|
+
},
|
|
13674
|
+
trackResult: (_feature, _action, run) => run()
|
|
13675
|
+
};
|
|
13676
|
+
var LEVEL_RANK = { basic: 0, detailed: 1 };
|
|
13677
|
+
function normalizeFeatures(features) {
|
|
13678
|
+
if (features === void 0) return null;
|
|
13679
|
+
const map = /* @__PURE__ */ new Map();
|
|
13680
|
+
if (Array.isArray(features)) {
|
|
13681
|
+
for (const feature of features) map.set(feature, true);
|
|
13682
|
+
} else {
|
|
13683
|
+
for (const [feature, scope] of Object.entries(features)) {
|
|
13684
|
+
if (scope === true) map.set(feature, true);
|
|
13685
|
+
else if (scope) map.set(feature, new Set(scope.actions));
|
|
13686
|
+
}
|
|
13687
|
+
}
|
|
13688
|
+
return map;
|
|
13689
|
+
}
|
|
13690
|
+
function resolveAnalytics(option) {
|
|
13691
|
+
if (!option) return noopAnalytics;
|
|
13692
|
+
const { tracker, level: configuredLevel = "basic", features } = option;
|
|
13693
|
+
const maxRank = LEVEL_RANK[configuredLevel];
|
|
13694
|
+
const allow = normalizeFeatures(features);
|
|
13695
|
+
const isEnabled = (feature, action, level = "basic") => {
|
|
13696
|
+
if (LEVEL_RANK[level] > maxRank) return false;
|
|
13697
|
+
if (allow === null) return true;
|
|
13698
|
+
const scope = allow.get(feature);
|
|
13699
|
+
if (scope === void 0) return false;
|
|
13700
|
+
if (scope === true) return true;
|
|
13701
|
+
if (action === void 0) return scope.size > 0;
|
|
13702
|
+
return scope.has(action);
|
|
13703
|
+
};
|
|
13704
|
+
const emit = (feature, action, phase, build, level = "basic") => {
|
|
13705
|
+
if (!isEnabled(feature, action, level)) return;
|
|
13706
|
+
try {
|
|
13707
|
+
tracker({ feature, action, phase, level, data: build?.() });
|
|
13708
|
+
} catch {
|
|
13709
|
+
}
|
|
13710
|
+
};
|
|
13711
|
+
const trackResult = async (feature, action, run, data) => {
|
|
13712
|
+
emit(feature, action, "start", data?.start);
|
|
13713
|
+
try {
|
|
13714
|
+
const result = await run();
|
|
13715
|
+
if (result.ok) {
|
|
13716
|
+
const build = data?.success;
|
|
13717
|
+
emit(feature, action, "success", build ? () => build(result.value) : void 0);
|
|
13718
|
+
} else {
|
|
13719
|
+
const build = data?.failure;
|
|
13720
|
+
emit(feature, action, "failure", build ? () => build(result.error) : void 0);
|
|
13721
|
+
}
|
|
13722
|
+
return result;
|
|
13723
|
+
} catch (error) {
|
|
13724
|
+
emit(feature, action, "failure", () => ({ error: error instanceof Error ? error.message : String(error) }));
|
|
13725
|
+
throw error;
|
|
13726
|
+
}
|
|
13727
|
+
};
|
|
13728
|
+
return { isEnabled, emit, trackResult };
|
|
13729
|
+
}
|
|
13730
|
+
|
|
13531
13731
|
// src/shared/config/ConfigService.ts
|
|
13532
13732
|
var ConfigService = class {
|
|
13533
13733
|
sodax;
|
|
@@ -13538,6 +13738,12 @@ var ConfigService = class {
|
|
|
13538
13738
|
* {@link initialize}'s dynamic-config swap never clobbers it. Read by services via `config.logger`.
|
|
13539
13739
|
*/
|
|
13540
13740
|
logger;
|
|
13741
|
+
/**
|
|
13742
|
+
* Analytics emitter. Resolved once at construction and kept independent of {@link sodax} so that
|
|
13743
|
+
* {@link initialize}'s dynamic-config swap never clobbers it. Read by services via `config.analytics`;
|
|
13744
|
+
* disabled (no-op) unless the consumer passed an `analytics` config to `new Sodax(...)`.
|
|
13745
|
+
*/
|
|
13746
|
+
analytics;
|
|
13541
13747
|
/**
|
|
13542
13748
|
* Global partner fee. Resolved once at construction and kept independent of {@link sodax} so that
|
|
13543
13749
|
* {@link initialize}'s dynamic-config swap never clobbers it. The backend never supplies it — it is
|
|
@@ -13555,11 +13761,12 @@ var ConfigService = class {
|
|
|
13555
13761
|
stakedATokenAddressesSet;
|
|
13556
13762
|
chainToSupportedTokenAddressMap;
|
|
13557
13763
|
hubAssetToXTokenMap;
|
|
13558
|
-
constructor({ api, config, userConfig, logger, fee }) {
|
|
13764
|
+
constructor({ api, config, userConfig, logger, analytics, fee }) {
|
|
13559
13765
|
this.api = api;
|
|
13560
13766
|
this.sodax = config;
|
|
13561
13767
|
this.userConfig = userConfig;
|
|
13562
13768
|
this.logger = logger ?? resolveLogger(void 0);
|
|
13769
|
+
this.analytics = analytics ?? noopAnalytics;
|
|
13563
13770
|
this.fee = fee;
|
|
13564
13771
|
this.loadSodaxConfigDataStructures(config);
|
|
13565
13772
|
}
|
|
@@ -13610,6 +13817,16 @@ var ConfigService = class {
|
|
|
13610
13817
|
getOriginalAssetAddress(chainId, hubAsset) {
|
|
13611
13818
|
return this.hubAssetToXTokenMap.get(hubAsset.toLowerCase())?.address;
|
|
13612
13819
|
}
|
|
13820
|
+
/**
|
|
13821
|
+
* Resolves the {@link XToken} descriptor (hub asset, vault, decimals) for a hub-asset address.
|
|
13822
|
+
*
|
|
13823
|
+
* Useful when a caller holds a hub asset directly on Sonic that has no spoke-token entry under
|
|
13824
|
+
* the hub chain — e.g. a partner BTC fee held as the BTC hub asset, which only exists as a spoke
|
|
13825
|
+
* token on Bitcoin. Returns `undefined` when the address is not a known hub asset.
|
|
13826
|
+
*/
|
|
13827
|
+
getXTokenFromHubAsset(hubAsset) {
|
|
13828
|
+
return this.hubAssetToXTokenMap.get(hubAsset.toLowerCase());
|
|
13829
|
+
}
|
|
13613
13830
|
getSpokeTokenFromOriginalAssetAddress(chainId, originalAssetAddress) {
|
|
13614
13831
|
return this.supportedTokensPerChain.get(chainId)?.find((token) => token.address.toLowerCase() === originalAssetAddress.toLowerCase());
|
|
13615
13832
|
}
|
|
@@ -26397,64 +26614,88 @@ var SwapService = class {
|
|
|
26397
26614
|
const { params } = _params;
|
|
26398
26615
|
const srcChainKey = params.srcChainKey;
|
|
26399
26616
|
const baseCtx = { srcChainKey, dstChainKey: params.dstChainKey };
|
|
26400
|
-
|
|
26401
|
-
|
|
26402
|
-
|
|
26403
|
-
|
|
26404
|
-
|
|
26405
|
-
|
|
26406
|
-
|
|
26407
|
-
|
|
26408
|
-
|
|
26409
|
-
|
|
26410
|
-
|
|
26411
|
-
|
|
26412
|
-
|
|
26413
|
-
|
|
26414
|
-
|
|
26415
|
-
|
|
26416
|
-
|
|
26417
|
-
|
|
26418
|
-
|
|
26419
|
-
|
|
26420
|
-
|
|
26421
|
-
|
|
26422
|
-
|
|
26423
|
-
|
|
26424
|
-
|
|
26425
|
-
|
|
26426
|
-
|
|
26427
|
-
|
|
26428
|
-
|
|
26429
|
-
|
|
26430
|
-
|
|
26431
|
-
|
|
26432
|
-
|
|
26433
|
-
|
|
26434
|
-
|
|
26435
|
-
|
|
26436
|
-
|
|
26437
|
-
|
|
26438
|
-
|
|
26439
|
-
|
|
26440
|
-
|
|
26441
|
-
|
|
26442
|
-
srcChainKey,
|
|
26443
|
-
srcTxHash: spokeTxHash,
|
|
26444
|
-
srcAddress: params.srcAddress,
|
|
26445
|
-
dstChainKey: params.dstChainKey,
|
|
26446
|
-
dstTxHash: dstIntentTxHash,
|
|
26447
|
-
dstAddress: params.dstAddress
|
|
26617
|
+
return this.config.analytics.trackResult(
|
|
26618
|
+
"swap",
|
|
26619
|
+
"swap",
|
|
26620
|
+
async () => {
|
|
26621
|
+
try {
|
|
26622
|
+
const timeout = _params.timeout;
|
|
26623
|
+
const createIntentResult = await this.createIntent(_params);
|
|
26624
|
+
if (!createIntentResult.ok) {
|
|
26625
|
+
return { ok: false, error: createIntentResult.error };
|
|
26626
|
+
}
|
|
26627
|
+
const { tx: spokeTxHash, intent, relayData } = createIntentResult.value;
|
|
26628
|
+
const verifyTxHashResult = await this.spoke.verifyTxHash({
|
|
26629
|
+
txHash: spokeTxHash,
|
|
26630
|
+
chainKey: srcChainKey
|
|
26631
|
+
});
|
|
26632
|
+
if (!verifyTxHashResult.ok) {
|
|
26633
|
+
return { ok: false, error: verifyFailed("swap", verifyTxHashResult.error, { ...baseCtx, action: "swap" }) };
|
|
26634
|
+
}
|
|
26635
|
+
let dstIntentTxHash;
|
|
26636
|
+
if (isHubChainKeyType(srcChainKey)) {
|
|
26637
|
+
dstIntentTxHash = spokeTxHash;
|
|
26638
|
+
} else {
|
|
26639
|
+
const packet = await relayTxAndWaitPacket({
|
|
26640
|
+
srcTxHash: spokeTxHash,
|
|
26641
|
+
data: relayData,
|
|
26642
|
+
chainKey: srcChainKey,
|
|
26643
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
26644
|
+
timeout
|
|
26645
|
+
});
|
|
26646
|
+
if (!packet.ok) {
|
|
26647
|
+
return {
|
|
26648
|
+
ok: false,
|
|
26649
|
+
error: mapRelayFailure(packet.error, { feature: "swap", action: "swap", ...baseCtx })
|
|
26650
|
+
};
|
|
26651
|
+
}
|
|
26652
|
+
dstIntentTxHash = packet.value.dst_tx_hash;
|
|
26653
|
+
}
|
|
26654
|
+
const postExecResult = await this.postExecution({
|
|
26655
|
+
intent_tx_hash: dstIntentTxHash
|
|
26656
|
+
});
|
|
26657
|
+
if (!postExecResult.ok) {
|
|
26658
|
+
return { ok: false, error: postExecResult.error };
|
|
26448
26659
|
}
|
|
26660
|
+
return {
|
|
26661
|
+
ok: true,
|
|
26662
|
+
value: {
|
|
26663
|
+
solverExecutionResponse: postExecResult.value,
|
|
26664
|
+
intent,
|
|
26665
|
+
intentDeliveryInfo: {
|
|
26666
|
+
srcChainKey,
|
|
26667
|
+
srcTxHash: spokeTxHash,
|
|
26668
|
+
srcAddress: params.srcAddress,
|
|
26669
|
+
dstChainKey: params.dstChainKey,
|
|
26670
|
+
dstTxHash: dstIntentTxHash,
|
|
26671
|
+
dstAddress: params.dstAddress
|
|
26672
|
+
}
|
|
26673
|
+
}
|
|
26674
|
+
};
|
|
26675
|
+
} catch (error) {
|
|
26676
|
+
if (isSwapError(error)) return { ok: false, error };
|
|
26677
|
+
return {
|
|
26678
|
+
ok: false,
|
|
26679
|
+
error: unknownFailed("swap", error, { ...baseCtx, action: "swap" })
|
|
26680
|
+
};
|
|
26449
26681
|
}
|
|
26450
|
-
}
|
|
26451
|
-
|
|
26452
|
-
|
|
26453
|
-
|
|
26454
|
-
|
|
26455
|
-
|
|
26456
|
-
|
|
26457
|
-
|
|
26682
|
+
},
|
|
26683
|
+
{
|
|
26684
|
+
start: () => ({
|
|
26685
|
+
srcChainKey,
|
|
26686
|
+
dstChainKey: params.dstChainKey,
|
|
26687
|
+
srcAddress: params.srcAddress,
|
|
26688
|
+
dstAddress: params.dstAddress
|
|
26689
|
+
}),
|
|
26690
|
+
success: (value) => ({
|
|
26691
|
+
srcChainKey,
|
|
26692
|
+
dstChainKey: params.dstChainKey,
|
|
26693
|
+
srcTxHash: value.intentDeliveryInfo.srcTxHash,
|
|
26694
|
+
dstTxHash: value.intentDeliveryInfo.dstTxHash
|
|
26695
|
+
}),
|
|
26696
|
+
failure: (error) => ({ code: error.code })
|
|
26697
|
+
}
|
|
26698
|
+
);
|
|
26458
26699
|
}
|
|
26459
26700
|
/**
|
|
26460
26701
|
* Checks whether the relevant spender contract is already approved to spend the input token amount.
|
|
@@ -28500,72 +28741,94 @@ var MigrationService = class {
|
|
|
28500
28741
|
* }
|
|
28501
28742
|
*/
|
|
28502
28743
|
async migratebnUSD(_params) {
|
|
28503
|
-
|
|
28504
|
-
|
|
28505
|
-
|
|
28506
|
-
|
|
28507
|
-
|
|
28508
|
-
|
|
28509
|
-
|
|
28510
|
-
|
|
28511
|
-
|
|
28512
|
-
const { tx: spokeTxHash, relayData: extraData } = intentResult.value;
|
|
28513
|
-
const verifyTxHashResult = await this.spoke.verifyTxHash({
|
|
28514
|
-
txHash: spokeTxHash,
|
|
28515
|
-
chainKey: params.srcChainKey
|
|
28516
|
-
});
|
|
28517
|
-
if (!verifyTxHashResult.ok) {
|
|
28518
|
-
return {
|
|
28519
|
-
ok: false,
|
|
28520
|
-
error: verifyFailed("migration", verifyTxHashResult.error, baseCtx)
|
|
28521
|
-
};
|
|
28522
|
-
}
|
|
28523
|
-
const packetResult = await relayTxAndWaitPacket({
|
|
28524
|
-
srcTxHash: spokeTxHash,
|
|
28525
|
-
data: extraData,
|
|
28526
|
-
chainKey: params.srcChainKey,
|
|
28527
|
-
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
28528
|
-
timeout
|
|
28529
|
-
});
|
|
28530
|
-
if (!packetResult.ok) {
|
|
28531
|
-
return {
|
|
28532
|
-
ok: false,
|
|
28533
|
-
error: mapRelayFailure(packetResult.error, {
|
|
28534
|
-
feature: "migration",
|
|
28535
|
-
action: baseCtx.action,
|
|
28536
|
-
srcChainKey: baseCtx.srcChainKey,
|
|
28537
|
-
dstChainKey: baseCtx.dstChainKey
|
|
28538
|
-
})
|
|
28744
|
+
return this.config.analytics.trackResult(
|
|
28745
|
+
"migration",
|
|
28746
|
+
"migratebnUSD",
|
|
28747
|
+
async () => {
|
|
28748
|
+
const { params, timeout } = _params;
|
|
28749
|
+
const baseCtx = {
|
|
28750
|
+
srcChainKey: params.srcChainKey,
|
|
28751
|
+
dstChainKey: params.dstChainKey,
|
|
28752
|
+
action: "migratebnUSD"
|
|
28539
28753
|
};
|
|
28540
|
-
|
|
28541
|
-
|
|
28542
|
-
|
|
28543
|
-
|
|
28544
|
-
|
|
28545
|
-
|
|
28546
|
-
|
|
28547
|
-
|
|
28548
|
-
|
|
28754
|
+
try {
|
|
28755
|
+
const intentResult = await this.createMigratebnUSDIntent(_params);
|
|
28756
|
+
if (!intentResult.ok) return { ok: false, error: intentResult.error };
|
|
28757
|
+
const { tx: spokeTxHash, relayData: extraData } = intentResult.value;
|
|
28758
|
+
const verifyTxHashResult = await this.spoke.verifyTxHash({
|
|
28759
|
+
txHash: spokeTxHash,
|
|
28760
|
+
chainKey: params.srcChainKey
|
|
28761
|
+
});
|
|
28762
|
+
if (!verifyTxHashResult.ok) {
|
|
28763
|
+
return {
|
|
28764
|
+
ok: false,
|
|
28765
|
+
error: verifyFailed("migration", verifyTxHashResult.error, baseCtx)
|
|
28766
|
+
};
|
|
28767
|
+
}
|
|
28768
|
+
const packetResult = await relayTxAndWaitPacket({
|
|
28769
|
+
srcTxHash: spokeTxHash,
|
|
28770
|
+
data: extraData,
|
|
28771
|
+
chainKey: params.srcChainKey,
|
|
28772
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
28773
|
+
timeout
|
|
28774
|
+
});
|
|
28775
|
+
if (!packetResult.ok) {
|
|
28776
|
+
return {
|
|
28777
|
+
ok: false,
|
|
28778
|
+
error: mapRelayFailure(packetResult.error, {
|
|
28779
|
+
feature: "migration",
|
|
28780
|
+
action: baseCtx.action,
|
|
28781
|
+
srcChainKey: baseCtx.srcChainKey,
|
|
28782
|
+
dstChainKey: baseCtx.dstChainKey
|
|
28783
|
+
})
|
|
28784
|
+
};
|
|
28785
|
+
}
|
|
28786
|
+
if (!(params.srcChainKey === ChainKeys.SONIC_MAINNET || params.dstChainKey === ChainKeys.SONIC_MAINNET)) {
|
|
28787
|
+
const execResult = await waitUntilIntentExecuted({
|
|
28788
|
+
intentRelayChainId: getIntentRelayChainId(ChainKeys.SONIC_MAINNET).toString(),
|
|
28789
|
+
srcTxHash: packetResult.value.dst_tx_hash,
|
|
28790
|
+
timeout,
|
|
28791
|
+
apiUrl: this.relayerApiEndpoint
|
|
28792
|
+
});
|
|
28793
|
+
if (!execResult.ok) {
|
|
28794
|
+
return {
|
|
28795
|
+
ok: false,
|
|
28796
|
+
error: mapRelayFailure(execResult.error, {
|
|
28797
|
+
feature: "migration",
|
|
28798
|
+
action: baseCtx.action,
|
|
28799
|
+
srcChainKey: baseCtx.srcChainKey,
|
|
28800
|
+
dstChainKey: baseCtx.dstChainKey,
|
|
28801
|
+
phase: "destinationExecution"
|
|
28802
|
+
})
|
|
28803
|
+
};
|
|
28804
|
+
}
|
|
28805
|
+
}
|
|
28806
|
+
return { ok: true, value: { srcChainTxHash: spokeTxHash, dstChainTxHash: packetResult.value.dst_tx_hash } };
|
|
28807
|
+
} catch (error) {
|
|
28808
|
+
if (isMigrateOrchestrationError(error)) return { ok: false, error };
|
|
28549
28809
|
return {
|
|
28550
28810
|
ok: false,
|
|
28551
|
-
error:
|
|
28552
|
-
feature: "migration",
|
|
28553
|
-
action: baseCtx.action,
|
|
28554
|
-
srcChainKey: baseCtx.srcChainKey,
|
|
28555
|
-
dstChainKey: baseCtx.dstChainKey,
|
|
28556
|
-
phase: "destinationExecution"
|
|
28557
|
-
})
|
|
28811
|
+
error: executionFailed("migration", error, baseCtx)
|
|
28558
28812
|
};
|
|
28559
28813
|
}
|
|
28814
|
+
},
|
|
28815
|
+
{
|
|
28816
|
+
start: () => ({
|
|
28817
|
+
srcChainKey: _params.params.srcChainKey,
|
|
28818
|
+
dstChainKey: _params.params.dstChainKey,
|
|
28819
|
+
srcAddress: _params.params.srcAddress,
|
|
28820
|
+
dstAddress: _params.params.dstAddress,
|
|
28821
|
+
srcbnUSD: _params.params.srcbnUSD,
|
|
28822
|
+
dstbnUSD: _params.params.dstbnUSD,
|
|
28823
|
+
amount: _params.params.amount
|
|
28824
|
+
}),
|
|
28825
|
+
success: (value) => ({
|
|
28826
|
+
srcChainTxHash: value.srcChainTxHash,
|
|
28827
|
+
dstChainTxHash: value.dstChainTxHash
|
|
28828
|
+
}),
|
|
28829
|
+
failure: (error) => ({ code: error.code })
|
|
28560
28830
|
}
|
|
28561
|
-
|
|
28562
|
-
} catch (error) {
|
|
28563
|
-
if (isMigrateOrchestrationError(error)) return { ok: false, error };
|
|
28564
|
-
return {
|
|
28565
|
-
ok: false,
|
|
28566
|
-
error: executionFailed("migration", error, baseCtx)
|
|
28567
|
-
};
|
|
28568
|
-
}
|
|
28831
|
+
);
|
|
28569
28832
|
}
|
|
28570
28833
|
/**
|
|
28571
28834
|
* Migrates ICX or wICX tokens from ICON to SODA on the hub chain (Sonic), including relay.
|
|
@@ -28580,37 +28843,57 @@ var MigrationService = class {
|
|
|
28580
28843
|
* check fails, the deposit reverts, or the relay times out.
|
|
28581
28844
|
*/
|
|
28582
28845
|
async migrateIcxToSoda(_params) {
|
|
28583
|
-
|
|
28584
|
-
|
|
28585
|
-
|
|
28586
|
-
|
|
28587
|
-
|
|
28588
|
-
|
|
28589
|
-
|
|
28590
|
-
|
|
28591
|
-
|
|
28592
|
-
|
|
28593
|
-
|
|
28594
|
-
|
|
28595
|
-
|
|
28596
|
-
|
|
28597
|
-
|
|
28598
|
-
|
|
28599
|
-
|
|
28600
|
-
|
|
28601
|
-
|
|
28602
|
-
|
|
28603
|
-
|
|
28604
|
-
|
|
28846
|
+
return this.config.analytics.trackResult(
|
|
28847
|
+
"migration",
|
|
28848
|
+
"migrateIcxToSoda",
|
|
28849
|
+
async () => {
|
|
28850
|
+
const { timeout } = _params;
|
|
28851
|
+
const baseCtx = { srcChainKey: _params.params.srcChainKey, action: "migrateIcxToSoda" };
|
|
28852
|
+
try {
|
|
28853
|
+
const txResult = await this.createMigrateIcxToSodaIntent(_params);
|
|
28854
|
+
if (!txResult.ok) return { ok: false, error: txResult.error };
|
|
28855
|
+
const { tx, relayData } = txResult.value;
|
|
28856
|
+
const packetResult = await relayTxAndWaitPacket({
|
|
28857
|
+
srcTxHash: tx,
|
|
28858
|
+
data: relayData,
|
|
28859
|
+
chainKey: _params.params.srcChainKey,
|
|
28860
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
28861
|
+
timeout
|
|
28862
|
+
});
|
|
28863
|
+
if (!packetResult.ok) {
|
|
28864
|
+
return {
|
|
28865
|
+
ok: false,
|
|
28866
|
+
error: mapRelayFailure(packetResult.error, {
|
|
28867
|
+
feature: "migration",
|
|
28868
|
+
action: baseCtx.action,
|
|
28869
|
+
srcChainKey: baseCtx.srcChainKey
|
|
28870
|
+
})
|
|
28871
|
+
};
|
|
28872
|
+
}
|
|
28873
|
+
return { ok: true, value: { srcChainTxHash: tx, dstChainTxHash: packetResult.value.dst_tx_hash } };
|
|
28874
|
+
} catch (error) {
|
|
28875
|
+
if (isMigrateOrchestrationError(error)) return { ok: false, error };
|
|
28876
|
+
return {
|
|
28877
|
+
ok: false,
|
|
28878
|
+
error: executionFailed("migration", error, baseCtx)
|
|
28879
|
+
};
|
|
28880
|
+
}
|
|
28881
|
+
},
|
|
28882
|
+
{
|
|
28883
|
+
start: () => ({
|
|
28884
|
+
srcChainKey: _params.params.srcChainKey,
|
|
28885
|
+
srcAddress: _params.params.srcAddress,
|
|
28886
|
+
dstAddress: _params.params.dstAddress,
|
|
28887
|
+
address: _params.params.address,
|
|
28888
|
+
amount: _params.params.amount
|
|
28889
|
+
}),
|
|
28890
|
+
success: (value) => ({
|
|
28891
|
+
srcChainTxHash: value.srcChainTxHash,
|
|
28892
|
+
dstChainTxHash: value.dstChainTxHash
|
|
28893
|
+
}),
|
|
28894
|
+
failure: (error) => ({ code: error.code })
|
|
28605
28895
|
}
|
|
28606
|
-
|
|
28607
|
-
} catch (error) {
|
|
28608
|
-
if (isMigrateOrchestrationError(error)) return { ok: false, error };
|
|
28609
|
-
return {
|
|
28610
|
-
ok: false,
|
|
28611
|
-
error: executionFailed("migration", error, baseCtx)
|
|
28612
|
-
};
|
|
28613
|
-
}
|
|
28896
|
+
);
|
|
28614
28897
|
}
|
|
28615
28898
|
/**
|
|
28616
28899
|
* Reverts a previous ICX→SODA migration by swapping SODA back to wICX on the hub and
|
|
@@ -28628,37 +28911,56 @@ var MigrationService = class {
|
|
|
28628
28911
|
* Sonic deposit transaction and `dstChainTxHash` is the hub-side packet receipt.
|
|
28629
28912
|
*/
|
|
28630
28913
|
async revertMigrateSodaToIcx(_params) {
|
|
28631
|
-
|
|
28632
|
-
|
|
28633
|
-
|
|
28634
|
-
|
|
28635
|
-
|
|
28636
|
-
|
|
28637
|
-
|
|
28638
|
-
|
|
28639
|
-
|
|
28640
|
-
|
|
28641
|
-
|
|
28642
|
-
|
|
28643
|
-
|
|
28644
|
-
|
|
28645
|
-
|
|
28646
|
-
|
|
28647
|
-
|
|
28648
|
-
|
|
28649
|
-
|
|
28650
|
-
|
|
28651
|
-
|
|
28652
|
-
|
|
28914
|
+
return this.config.analytics.trackResult(
|
|
28915
|
+
"migration",
|
|
28916
|
+
"revertMigrateSodaToIcx",
|
|
28917
|
+
async () => {
|
|
28918
|
+
const { timeout } = _params;
|
|
28919
|
+
const baseCtx = { srcChainKey: ChainKeys.SONIC_MAINNET, action: "revertMigrateSodaToIcx" };
|
|
28920
|
+
try {
|
|
28921
|
+
const txResult = await this.createRevertSodaToIcxMigrationIntent(_params);
|
|
28922
|
+
if (!txResult.ok) return { ok: false, error: txResult.error };
|
|
28923
|
+
const { tx, relayData } = txResult.value;
|
|
28924
|
+
const packetResult = await relayTxAndWaitPacket({
|
|
28925
|
+
srcTxHash: tx,
|
|
28926
|
+
data: relayData,
|
|
28927
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
28928
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
28929
|
+
timeout
|
|
28930
|
+
});
|
|
28931
|
+
if (!packetResult.ok) {
|
|
28932
|
+
return {
|
|
28933
|
+
ok: false,
|
|
28934
|
+
error: mapRelayFailure(packetResult.error, {
|
|
28935
|
+
feature: "migration",
|
|
28936
|
+
action: baseCtx.action,
|
|
28937
|
+
srcChainKey: baseCtx.srcChainKey
|
|
28938
|
+
})
|
|
28939
|
+
};
|
|
28940
|
+
}
|
|
28941
|
+
return { ok: true, value: { srcChainTxHash: tx, dstChainTxHash: packetResult.value.dst_tx_hash } };
|
|
28942
|
+
} catch (error) {
|
|
28943
|
+
if (isRevertMigrationOrchestrationError(error)) return { ok: false, error };
|
|
28944
|
+
return {
|
|
28945
|
+
ok: false,
|
|
28946
|
+
error: executionFailed("migration", error, baseCtx)
|
|
28947
|
+
};
|
|
28948
|
+
}
|
|
28949
|
+
},
|
|
28950
|
+
{
|
|
28951
|
+
start: () => ({
|
|
28952
|
+
srcChainKey: _params.params.srcChainKey,
|
|
28953
|
+
srcAddress: _params.params.srcAddress,
|
|
28954
|
+
dstAddress: _params.params.dstAddress,
|
|
28955
|
+
amount: _params.params.amount
|
|
28956
|
+
}),
|
|
28957
|
+
success: (value) => ({
|
|
28958
|
+
srcChainTxHash: value.srcChainTxHash,
|
|
28959
|
+
dstChainTxHash: value.dstChainTxHash
|
|
28960
|
+
}),
|
|
28961
|
+
failure: (error) => ({ code: error.code })
|
|
28653
28962
|
}
|
|
28654
|
-
|
|
28655
|
-
} catch (error) {
|
|
28656
|
-
if (isRevertMigrationOrchestrationError(error)) return { ok: false, error };
|
|
28657
|
-
return {
|
|
28658
|
-
ok: false,
|
|
28659
|
-
error: executionFailed("migration", error, baseCtx)
|
|
28660
|
-
};
|
|
28661
|
-
}
|
|
28963
|
+
);
|
|
28662
28964
|
}
|
|
28663
28965
|
/**
|
|
28664
28966
|
* Migrates BALN tokens from ICON to SODA on the hub chain (Sonic), including relay.
|
|
@@ -28675,37 +28977,58 @@ var MigrationService = class {
|
|
|
28675
28977
|
* ICON deposit transaction and `dstChainTxHash` is the hub-side packet receipt.
|
|
28676
28978
|
*/
|
|
28677
28979
|
async migrateBaln(_params) {
|
|
28678
|
-
|
|
28679
|
-
|
|
28680
|
-
|
|
28681
|
-
|
|
28682
|
-
|
|
28683
|
-
|
|
28684
|
-
|
|
28685
|
-
|
|
28686
|
-
|
|
28687
|
-
|
|
28688
|
-
|
|
28689
|
-
|
|
28690
|
-
|
|
28691
|
-
|
|
28692
|
-
|
|
28693
|
-
|
|
28694
|
-
|
|
28695
|
-
|
|
28696
|
-
|
|
28697
|
-
|
|
28698
|
-
|
|
28699
|
-
|
|
28980
|
+
return this.config.analytics.trackResult(
|
|
28981
|
+
"migration",
|
|
28982
|
+
"migrateBaln",
|
|
28983
|
+
async () => {
|
|
28984
|
+
const { timeout } = _params;
|
|
28985
|
+
const baseCtx = { srcChainKey: ChainKeys.ICON_MAINNET, action: "migrateBaln" };
|
|
28986
|
+
try {
|
|
28987
|
+
const txResult = await this.createMigrateBalnIntent(_params);
|
|
28988
|
+
if (!txResult.ok) return { ok: false, error: txResult.error };
|
|
28989
|
+
const { tx, relayData } = txResult.value;
|
|
28990
|
+
const packetResult = await relayTxAndWaitPacket({
|
|
28991
|
+
srcTxHash: tx,
|
|
28992
|
+
data: relayData,
|
|
28993
|
+
chainKey: ChainKeys.ICON_MAINNET,
|
|
28994
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
28995
|
+
timeout
|
|
28996
|
+
});
|
|
28997
|
+
if (!packetResult.ok) {
|
|
28998
|
+
return {
|
|
28999
|
+
ok: false,
|
|
29000
|
+
error: mapRelayFailure(packetResult.error, {
|
|
29001
|
+
feature: "migration",
|
|
29002
|
+
action: baseCtx.action,
|
|
29003
|
+
srcChainKey: baseCtx.srcChainKey
|
|
29004
|
+
})
|
|
29005
|
+
};
|
|
29006
|
+
}
|
|
29007
|
+
return { ok: true, value: { srcChainTxHash: tx, dstChainTxHash: packetResult.value.dst_tx_hash } };
|
|
29008
|
+
} catch (error) {
|
|
29009
|
+
if (isMigrateOrchestrationError(error)) return { ok: false, error };
|
|
29010
|
+
return {
|
|
29011
|
+
ok: false,
|
|
29012
|
+
error: executionFailed("migration", error, baseCtx)
|
|
29013
|
+
};
|
|
29014
|
+
}
|
|
29015
|
+
},
|
|
29016
|
+
{
|
|
29017
|
+
start: () => ({
|
|
29018
|
+
srcChainKey: _params.params.srcChainKey,
|
|
29019
|
+
srcAddress: _params.params.srcAddress,
|
|
29020
|
+
dstAddress: _params.params.dstAddress,
|
|
29021
|
+
amount: _params.params.amount,
|
|
29022
|
+
lockupPeriod: _params.params.lockupPeriod,
|
|
29023
|
+
stake: _params.params.stake
|
|
29024
|
+
}),
|
|
29025
|
+
success: (value) => ({
|
|
29026
|
+
srcChainTxHash: value.srcChainTxHash,
|
|
29027
|
+
dstChainTxHash: value.dstChainTxHash
|
|
29028
|
+
}),
|
|
29029
|
+
failure: (error) => ({ code: error.code })
|
|
28700
29030
|
}
|
|
28701
|
-
|
|
28702
|
-
} catch (error) {
|
|
28703
|
-
if (isMigrateOrchestrationError(error)) return { ok: false, error };
|
|
28704
|
-
return {
|
|
28705
|
-
ok: false,
|
|
28706
|
-
error: executionFailed("migration", error, baseCtx)
|
|
28707
|
-
};
|
|
28708
|
-
}
|
|
29031
|
+
);
|
|
28709
29032
|
}
|
|
28710
29033
|
/**
|
|
28711
29034
|
* Builds and submits the spoke-side deposit for a BALN→SODA migration without relaying.
|
|
@@ -29759,49 +30082,71 @@ var BridgeService = class {
|
|
|
29759
30082
|
* }
|
|
29760
30083
|
*/
|
|
29761
30084
|
async bridge(_params) {
|
|
29762
|
-
|
|
29763
|
-
|
|
29764
|
-
|
|
29765
|
-
|
|
29766
|
-
|
|
29767
|
-
|
|
29768
|
-
|
|
29769
|
-
|
|
29770
|
-
|
|
29771
|
-
|
|
29772
|
-
|
|
29773
|
-
|
|
29774
|
-
|
|
29775
|
-
|
|
30085
|
+
return this.config.analytics.trackResult(
|
|
30086
|
+
"bridge",
|
|
30087
|
+
"bridge",
|
|
30088
|
+
async () => {
|
|
30089
|
+
const { params, timeout } = _params;
|
|
30090
|
+
const baseCtx = { srcChainKey: params.srcChainKey, dstChainKey: params.dstChainKey };
|
|
30091
|
+
try {
|
|
30092
|
+
const txResult = await this.createBridgeIntent(_params);
|
|
30093
|
+
if (!txResult.ok) return { ok: false, error: txResult.error };
|
|
30094
|
+
const verifyTxHashResult = await this.spoke.verifyTxHash({
|
|
30095
|
+
txHash: txResult.value.tx,
|
|
30096
|
+
chainKey: params.srcChainKey
|
|
30097
|
+
});
|
|
30098
|
+
if (!verifyTxHashResult.ok) {
|
|
30099
|
+
return {
|
|
30100
|
+
ok: false,
|
|
30101
|
+
error: verifyFailed("bridge", verifyTxHashResult.error, baseCtx)
|
|
30102
|
+
};
|
|
30103
|
+
}
|
|
30104
|
+
const packetResult = await relayTxAndWaitPacket({
|
|
30105
|
+
srcTxHash: txResult.value.tx,
|
|
30106
|
+
data: txResult.value.relayData,
|
|
30107
|
+
chainKey: params.srcChainKey,
|
|
30108
|
+
relayerApiEndpoint: this.config.relay.relayerApiEndpoint,
|
|
30109
|
+
timeout
|
|
30110
|
+
});
|
|
30111
|
+
if (!packetResult.ok)
|
|
30112
|
+
return {
|
|
30113
|
+
ok: false,
|
|
30114
|
+
error: mapRelayFailure(packetResult.error, {
|
|
30115
|
+
feature: "bridge",
|
|
30116
|
+
action: "bridge",
|
|
30117
|
+
srcChainKey: baseCtx.srcChainKey,
|
|
30118
|
+
dstChainKey: baseCtx.dstChainKey
|
|
30119
|
+
})
|
|
30120
|
+
};
|
|
30121
|
+
return {
|
|
30122
|
+
ok: true,
|
|
30123
|
+
value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: packetResult.value.dst_tx_hash }
|
|
30124
|
+
};
|
|
30125
|
+
} catch (error) {
|
|
30126
|
+
if (isBridgeOrchestrationError(error)) return { ok: false, error };
|
|
30127
|
+
return {
|
|
30128
|
+
ok: false,
|
|
30129
|
+
error: executionFailed("bridge", error, baseCtx)
|
|
30130
|
+
};
|
|
30131
|
+
}
|
|
30132
|
+
},
|
|
30133
|
+
{
|
|
30134
|
+
start: () => ({
|
|
30135
|
+
srcChainKey: _params.params.srcChainKey,
|
|
30136
|
+
dstChainKey: _params.params.dstChainKey,
|
|
30137
|
+
srcToken: _params.params.srcToken,
|
|
30138
|
+
dstToken: _params.params.dstToken,
|
|
30139
|
+
amount: _params.params.amount,
|
|
30140
|
+
srcAddress: _params.params.srcAddress,
|
|
30141
|
+
recipient: _params.params.recipient
|
|
30142
|
+
}),
|
|
30143
|
+
success: (value) => ({
|
|
30144
|
+
srcChainTxHash: value.srcChainTxHash,
|
|
30145
|
+
dstChainTxHash: value.dstChainTxHash
|
|
30146
|
+
}),
|
|
30147
|
+
failure: (error) => ({ code: error.code })
|
|
29776
30148
|
}
|
|
29777
|
-
|
|
29778
|
-
srcTxHash: txResult.value.tx,
|
|
29779
|
-
data: txResult.value.relayData,
|
|
29780
|
-
chainKey: params.srcChainKey,
|
|
29781
|
-
relayerApiEndpoint: this.config.relay.relayerApiEndpoint,
|
|
29782
|
-
timeout
|
|
29783
|
-
});
|
|
29784
|
-
if (!packetResult.ok)
|
|
29785
|
-
return {
|
|
29786
|
-
ok: false,
|
|
29787
|
-
error: mapRelayFailure(packetResult.error, {
|
|
29788
|
-
feature: "bridge",
|
|
29789
|
-
action: "bridge",
|
|
29790
|
-
srcChainKey: baseCtx.srcChainKey,
|
|
29791
|
-
dstChainKey: baseCtx.dstChainKey
|
|
29792
|
-
})
|
|
29793
|
-
};
|
|
29794
|
-
return {
|
|
29795
|
-
ok: true,
|
|
29796
|
-
value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: packetResult.value.dst_tx_hash }
|
|
29797
|
-
};
|
|
29798
|
-
} catch (error) {
|
|
29799
|
-
if (isBridgeOrchestrationError(error)) return { ok: false, error };
|
|
29800
|
-
return {
|
|
29801
|
-
ok: false,
|
|
29802
|
-
error: executionFailed("bridge", error, baseCtx)
|
|
29803
|
-
};
|
|
29804
|
-
}
|
|
30149
|
+
);
|
|
29805
30150
|
}
|
|
29806
30151
|
/**
|
|
29807
30152
|
* Submits the spoke-side deposit transaction that initiates a bridge transfer,
|
|
@@ -29830,8 +30175,8 @@ var BridgeService = class {
|
|
|
29830
30175
|
const baseCtx = { srcChainKey: params.srcChainKey, dstChainKey: params.dstChainKey };
|
|
29831
30176
|
try {
|
|
29832
30177
|
bridgeInvariant(params.amount > 0n, "Amount must be greater than 0", { ...baseCtx, field: "amount" });
|
|
29833
|
-
const srcToken = this.
|
|
29834
|
-
const dstToken = this.
|
|
30178
|
+
const srcToken = this.resolveBridgeEndpointToken(params.srcChainKey, params.srcToken);
|
|
30179
|
+
const dstToken = this.resolveBridgeEndpointToken(params.dstChainKey, params.dstToken);
|
|
29835
30180
|
bridgeInvariant(srcToken, `Unsupported spoke chain (${params.srcChainKey}) token: ${params.srcToken}`, {
|
|
29836
30181
|
...baseCtx,
|
|
29837
30182
|
field: "srcToken"
|
|
@@ -29899,6 +30244,20 @@ var BridgeService = class {
|
|
|
29899
30244
|
};
|
|
29900
30245
|
}
|
|
29901
30246
|
}
|
|
30247
|
+
/**
|
|
30248
|
+
* Resolves a bridge endpoint's {@link XToken} descriptor from a chain key + token address.
|
|
30249
|
+
*
|
|
30250
|
+
* Spoke endpoints (and hub-native tokens such as USDC/WETH/S whose on-chain address equals their
|
|
30251
|
+
* hub asset) resolve by original asset address. On the hub a caller may instead hold a hub asset
|
|
30252
|
+
* that has no spoke-token entry under the hub chain — e.g. a partner BTC fee held as the BTC hub
|
|
30253
|
+
* asset, whose only spoke-token entry lives on Bitcoin. Resolve those by hub-asset address so the
|
|
30254
|
+
* Sonic-sourced "withdraw directly" bridge can find the matching vault/decimals.
|
|
30255
|
+
*/
|
|
30256
|
+
resolveBridgeEndpointToken(chainKey, token) {
|
|
30257
|
+
const spokeToken = this.config.getSpokeTokenFromOriginalAssetAddress(chainKey, token);
|
|
30258
|
+
if (spokeToken) return spokeToken;
|
|
30259
|
+
return isHubChainKeyType(chainKey) ? this.config.getXTokenFromHubAsset(token) : void 0;
|
|
30260
|
+
}
|
|
29902
30261
|
/**
|
|
29903
30262
|
* Encodes the hub-side execution payload for a bridge operation.
|
|
29904
30263
|
*
|
|
@@ -30781,52 +31140,71 @@ var StakingService = class {
|
|
|
30781
31140
|
* @returns `{ ok: true, value: { srcChainTxHash, dstChainTxHash } }` on success.
|
|
30782
31141
|
*/
|
|
30783
31142
|
async stake(_params) {
|
|
30784
|
-
|
|
30785
|
-
|
|
30786
|
-
|
|
30787
|
-
|
|
30788
|
-
|
|
30789
|
-
|
|
30790
|
-
|
|
30791
|
-
|
|
30792
|
-
|
|
30793
|
-
|
|
30794
|
-
|
|
30795
|
-
|
|
30796
|
-
|
|
30797
|
-
|
|
30798
|
-
|
|
30799
|
-
|
|
30800
|
-
|
|
30801
|
-
|
|
30802
|
-
|
|
30803
|
-
|
|
30804
|
-
|
|
30805
|
-
|
|
30806
|
-
|
|
30807
|
-
|
|
30808
|
-
|
|
31143
|
+
return this.config.analytics.trackResult(
|
|
31144
|
+
"staking",
|
|
31145
|
+
"stake",
|
|
31146
|
+
async () => {
|
|
31147
|
+
const { params, timeout } = _params;
|
|
31148
|
+
const baseCtx = { srcChainKey: params.srcChainKey, action: "stake" };
|
|
31149
|
+
try {
|
|
31150
|
+
const txResult = await this.createStakeIntent(_params);
|
|
31151
|
+
if (!txResult.ok) return { ok: false, error: txResult.error };
|
|
31152
|
+
const verifyTxHashResult = await this.spoke.verifyTxHash({
|
|
31153
|
+
txHash: txResult.value.tx,
|
|
31154
|
+
chainKey: params.srcChainKey
|
|
31155
|
+
});
|
|
31156
|
+
if (!verifyTxHashResult.ok) {
|
|
31157
|
+
return {
|
|
31158
|
+
ok: false,
|
|
31159
|
+
error: verifyFailed("staking", verifyTxHashResult.error, baseCtx)
|
|
31160
|
+
};
|
|
31161
|
+
}
|
|
31162
|
+
let hubTxHash;
|
|
31163
|
+
if (!isHubChainKeyType(params.srcChainKey)) {
|
|
31164
|
+
const packetResult = await relayTxAndWaitPacket({
|
|
31165
|
+
srcTxHash: txResult.value.tx,
|
|
31166
|
+
data: txResult.value.relayData,
|
|
31167
|
+
chainKey: params.srcChainKey,
|
|
31168
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
31169
|
+
timeout
|
|
31170
|
+
});
|
|
31171
|
+
if (!packetResult.ok) {
|
|
31172
|
+
return {
|
|
31173
|
+
ok: false,
|
|
31174
|
+
error: mapRelayFailure(packetResult.error, {
|
|
31175
|
+
feature: "staking",
|
|
31176
|
+
action: baseCtx.action,
|
|
31177
|
+
srcChainKey: baseCtx.srcChainKey
|
|
31178
|
+
})
|
|
31179
|
+
};
|
|
31180
|
+
}
|
|
31181
|
+
hubTxHash = packetResult.value.dst_tx_hash;
|
|
31182
|
+
} else {
|
|
31183
|
+
hubTxHash = txResult.value.tx;
|
|
31184
|
+
}
|
|
31185
|
+
return { ok: true, value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: hubTxHash } };
|
|
31186
|
+
} catch (error) {
|
|
31187
|
+
if (isStakeOrchestrationError(error)) return { ok: false, error };
|
|
30809
31188
|
return {
|
|
30810
31189
|
ok: false,
|
|
30811
|
-
error:
|
|
30812
|
-
feature: "staking",
|
|
30813
|
-
action: baseCtx.action,
|
|
30814
|
-
srcChainKey: baseCtx.srcChainKey
|
|
30815
|
-
})
|
|
31190
|
+
error: executionFailed("staking", error, baseCtx)
|
|
30816
31191
|
};
|
|
30817
31192
|
}
|
|
30818
|
-
|
|
30819
|
-
|
|
30820
|
-
|
|
31193
|
+
},
|
|
31194
|
+
{
|
|
31195
|
+
start: () => ({
|
|
31196
|
+
srcChainKey: _params.params.srcChainKey,
|
|
31197
|
+
srcAddress: _params.params.srcAddress,
|
|
31198
|
+
amount: _params.params.amount,
|
|
31199
|
+
minReceive: _params.params.minReceive
|
|
31200
|
+
}),
|
|
31201
|
+
success: (value) => ({
|
|
31202
|
+
srcChainTxHash: value.srcChainTxHash,
|
|
31203
|
+
dstChainTxHash: value.dstChainTxHash
|
|
31204
|
+
}),
|
|
31205
|
+
failure: (error) => ({ code: error.code })
|
|
30821
31206
|
}
|
|
30822
|
-
|
|
30823
|
-
} catch (error) {
|
|
30824
|
-
if (isStakeOrchestrationError(error)) return { ok: false, error };
|
|
30825
|
-
return {
|
|
30826
|
-
ok: false,
|
|
30827
|
-
error: executionFailed("staking", error, baseCtx)
|
|
30828
|
-
};
|
|
30829
|
-
}
|
|
31207
|
+
);
|
|
30830
31208
|
}
|
|
30831
31209
|
/**
|
|
30832
31210
|
* Submits the stake transaction on the spoke chain without relaying to the hub.
|
|
@@ -30931,42 +31309,60 @@ var StakingService = class {
|
|
|
30931
31309
|
* @returns `{ ok: true, value: { srcChainTxHash, dstChainTxHash } }` on success.
|
|
30932
31310
|
*/
|
|
30933
31311
|
async unstake(_params) {
|
|
30934
|
-
|
|
30935
|
-
|
|
30936
|
-
|
|
30937
|
-
|
|
30938
|
-
|
|
30939
|
-
|
|
30940
|
-
|
|
30941
|
-
|
|
30942
|
-
|
|
30943
|
-
|
|
30944
|
-
|
|
30945
|
-
|
|
30946
|
-
|
|
30947
|
-
|
|
30948
|
-
|
|
31312
|
+
return this.config.analytics.trackResult(
|
|
31313
|
+
"staking",
|
|
31314
|
+
"unstake",
|
|
31315
|
+
async () => {
|
|
31316
|
+
const { params, timeout } = _params;
|
|
31317
|
+
const baseCtx = { srcChainKey: params.srcChainKey, action: "unstake" };
|
|
31318
|
+
try {
|
|
31319
|
+
const txResult = await this.createUnstakeIntent(_params);
|
|
31320
|
+
if (!txResult.ok) return { ok: false, error: txResult.error };
|
|
31321
|
+
let hubTxHash;
|
|
31322
|
+
if (!isHubChainKeyType(params.srcChainKey)) {
|
|
31323
|
+
const packetResult = await relayTxAndWaitPacket({
|
|
31324
|
+
srcTxHash: txResult.value.tx,
|
|
31325
|
+
data: txResult.value.relayData,
|
|
31326
|
+
chainKey: params.srcChainKey,
|
|
31327
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
31328
|
+
timeout
|
|
31329
|
+
});
|
|
31330
|
+
if (!packetResult.ok) {
|
|
31331
|
+
return {
|
|
31332
|
+
ok: false,
|
|
31333
|
+
error: mapRelayFailure(packetResult.error, {
|
|
31334
|
+
feature: "staking",
|
|
31335
|
+
action: baseCtx.action,
|
|
31336
|
+
srcChainKey: baseCtx.srcChainKey
|
|
31337
|
+
})
|
|
31338
|
+
};
|
|
31339
|
+
}
|
|
31340
|
+
hubTxHash = packetResult.value.dst_tx_hash;
|
|
31341
|
+
} else {
|
|
31342
|
+
hubTxHash = txResult.value.tx;
|
|
31343
|
+
}
|
|
31344
|
+
return { ok: true, value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: hubTxHash } };
|
|
31345
|
+
} catch (error) {
|
|
31346
|
+
if (isStakingOrchestrationError(error)) return { ok: false, error };
|
|
30949
31347
|
return {
|
|
30950
31348
|
ok: false,
|
|
30951
|
-
error:
|
|
30952
|
-
feature: "staking",
|
|
30953
|
-
action: baseCtx.action,
|
|
30954
|
-
srcChainKey: baseCtx.srcChainKey
|
|
30955
|
-
})
|
|
31349
|
+
error: executionFailed("staking", error, baseCtx)
|
|
30956
31350
|
};
|
|
30957
31351
|
}
|
|
30958
|
-
|
|
30959
|
-
|
|
30960
|
-
|
|
31352
|
+
},
|
|
31353
|
+
{
|
|
31354
|
+
start: () => ({
|
|
31355
|
+
srcChainKey: _params.params.srcChainKey,
|
|
31356
|
+
srcAddress: _params.params.srcAddress,
|
|
31357
|
+
amount: _params.params.amount
|
|
31358
|
+
}),
|
|
31359
|
+
success: (value) => ({
|
|
31360
|
+
srcChainTxHash: value.srcChainTxHash,
|
|
31361
|
+
dstChainTxHash: value.dstChainTxHash
|
|
31362
|
+
}),
|
|
31363
|
+
failure: (error) => ({ code: error.code })
|
|
30961
31364
|
}
|
|
30962
|
-
|
|
30963
|
-
} catch (error) {
|
|
30964
|
-
if (isStakingOrchestrationError(error)) return { ok: false, error };
|
|
30965
|
-
return {
|
|
30966
|
-
ok: false,
|
|
30967
|
-
error: executionFailed("staking", error, baseCtx)
|
|
30968
|
-
};
|
|
30969
|
-
}
|
|
31365
|
+
);
|
|
30970
31366
|
}
|
|
30971
31367
|
/**
|
|
30972
31368
|
* Submits the unstake transaction on the spoke chain without relaying to the hub.
|
|
@@ -31062,42 +31458,61 @@ var StakingService = class {
|
|
|
31062
31458
|
* @returns `{ ok: true, value: { srcChainTxHash, dstChainTxHash } }` on success.
|
|
31063
31459
|
*/
|
|
31064
31460
|
async instantUnstake(_params) {
|
|
31065
|
-
|
|
31066
|
-
|
|
31067
|
-
|
|
31068
|
-
|
|
31069
|
-
|
|
31070
|
-
|
|
31071
|
-
|
|
31072
|
-
|
|
31073
|
-
|
|
31074
|
-
|
|
31075
|
-
|
|
31076
|
-
|
|
31077
|
-
|
|
31078
|
-
|
|
31079
|
-
|
|
31461
|
+
return this.config.analytics.trackResult(
|
|
31462
|
+
"staking",
|
|
31463
|
+
"instantUnstake",
|
|
31464
|
+
async () => {
|
|
31465
|
+
const { params, timeout } = _params;
|
|
31466
|
+
const baseCtx = { srcChainKey: params.srcChainKey, action: "instantUnstake" };
|
|
31467
|
+
try {
|
|
31468
|
+
const txResult = await this.createInstantUnstakeIntent(_params);
|
|
31469
|
+
if (!txResult.ok) return { ok: false, error: txResult.error };
|
|
31470
|
+
let hubTxHash;
|
|
31471
|
+
if (!isHubChainKeyType(params.srcChainKey)) {
|
|
31472
|
+
const packetResult = await relayTxAndWaitPacket({
|
|
31473
|
+
srcTxHash: txResult.value.tx,
|
|
31474
|
+
data: txResult.value.relayData,
|
|
31475
|
+
chainKey: params.srcChainKey,
|
|
31476
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
31477
|
+
timeout
|
|
31478
|
+
});
|
|
31479
|
+
if (!packetResult.ok) {
|
|
31480
|
+
return {
|
|
31481
|
+
ok: false,
|
|
31482
|
+
error: mapRelayFailure(packetResult.error, {
|
|
31483
|
+
feature: "staking",
|
|
31484
|
+
action: baseCtx.action,
|
|
31485
|
+
srcChainKey: baseCtx.srcChainKey
|
|
31486
|
+
})
|
|
31487
|
+
};
|
|
31488
|
+
}
|
|
31489
|
+
hubTxHash = packetResult.value.dst_tx_hash;
|
|
31490
|
+
} else {
|
|
31491
|
+
hubTxHash = txResult.value.tx;
|
|
31492
|
+
}
|
|
31493
|
+
return { ok: true, value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: hubTxHash } };
|
|
31494
|
+
} catch (error) {
|
|
31495
|
+
if (isStakingOrchestrationError(error)) return { ok: false, error };
|
|
31080
31496
|
return {
|
|
31081
31497
|
ok: false,
|
|
31082
|
-
error:
|
|
31083
|
-
feature: "staking",
|
|
31084
|
-
action: baseCtx.action,
|
|
31085
|
-
srcChainKey: baseCtx.srcChainKey
|
|
31086
|
-
})
|
|
31498
|
+
error: executionFailed("staking", error, baseCtx)
|
|
31087
31499
|
};
|
|
31088
31500
|
}
|
|
31089
|
-
|
|
31090
|
-
|
|
31091
|
-
|
|
31501
|
+
},
|
|
31502
|
+
{
|
|
31503
|
+
start: () => ({
|
|
31504
|
+
srcChainKey: _params.params.srcChainKey,
|
|
31505
|
+
srcAddress: _params.params.srcAddress,
|
|
31506
|
+
amount: _params.params.amount,
|
|
31507
|
+
minAmount: _params.params.minAmount
|
|
31508
|
+
}),
|
|
31509
|
+
success: (value) => ({
|
|
31510
|
+
srcChainTxHash: value.srcChainTxHash,
|
|
31511
|
+
dstChainTxHash: value.dstChainTxHash
|
|
31512
|
+
}),
|
|
31513
|
+
failure: (error) => ({ code: error.code })
|
|
31092
31514
|
}
|
|
31093
|
-
|
|
31094
|
-
} catch (error) {
|
|
31095
|
-
if (isStakingOrchestrationError(error)) return { ok: false, error };
|
|
31096
|
-
return {
|
|
31097
|
-
ok: false,
|
|
31098
|
-
error: executionFailed("staking", error, baseCtx)
|
|
31099
|
-
};
|
|
31100
|
-
}
|
|
31515
|
+
);
|
|
31101
31516
|
}
|
|
31102
31517
|
/**
|
|
31103
31518
|
* Submits the instant-unstake transaction on the spoke chain without relaying to the hub.
|
|
@@ -31205,42 +31620,61 @@ var StakingService = class {
|
|
|
31205
31620
|
* @returns `{ ok: true, value: { srcChainTxHash, dstChainTxHash } }` on success.
|
|
31206
31621
|
*/
|
|
31207
31622
|
async claim(_params) {
|
|
31208
|
-
|
|
31209
|
-
|
|
31210
|
-
|
|
31211
|
-
|
|
31212
|
-
|
|
31213
|
-
|
|
31214
|
-
|
|
31215
|
-
|
|
31216
|
-
|
|
31217
|
-
|
|
31218
|
-
|
|
31219
|
-
|
|
31220
|
-
|
|
31221
|
-
|
|
31222
|
-
|
|
31623
|
+
return this.config.analytics.trackResult(
|
|
31624
|
+
"staking",
|
|
31625
|
+
"claim",
|
|
31626
|
+
async () => {
|
|
31627
|
+
const { params, timeout } = _params;
|
|
31628
|
+
const baseCtx = { srcChainKey: params.srcChainKey, action: "claim" };
|
|
31629
|
+
try {
|
|
31630
|
+
const txResult = await this.createClaimIntent(_params);
|
|
31631
|
+
if (!txResult.ok) return { ok: false, error: txResult.error };
|
|
31632
|
+
let hubTxHash;
|
|
31633
|
+
if (!isHubChainKeyType(params.srcChainKey)) {
|
|
31634
|
+
const packetResult = await relayTxAndWaitPacket({
|
|
31635
|
+
srcTxHash: txResult.value.tx,
|
|
31636
|
+
data: txResult.value.relayData,
|
|
31637
|
+
chainKey: params.srcChainKey,
|
|
31638
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
31639
|
+
timeout
|
|
31640
|
+
});
|
|
31641
|
+
if (!packetResult.ok) {
|
|
31642
|
+
return {
|
|
31643
|
+
ok: false,
|
|
31644
|
+
error: mapRelayFailure(packetResult.error, {
|
|
31645
|
+
feature: "staking",
|
|
31646
|
+
action: baseCtx.action,
|
|
31647
|
+
srcChainKey: baseCtx.srcChainKey
|
|
31648
|
+
})
|
|
31649
|
+
};
|
|
31650
|
+
}
|
|
31651
|
+
hubTxHash = packetResult.value.dst_tx_hash;
|
|
31652
|
+
} else {
|
|
31653
|
+
hubTxHash = txResult.value.tx;
|
|
31654
|
+
}
|
|
31655
|
+
return { ok: true, value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: hubTxHash } };
|
|
31656
|
+
} catch (error) {
|
|
31657
|
+
if (isStakingOrchestrationError(error)) return { ok: false, error };
|
|
31223
31658
|
return {
|
|
31224
31659
|
ok: false,
|
|
31225
|
-
error:
|
|
31226
|
-
feature: "staking",
|
|
31227
|
-
action: baseCtx.action,
|
|
31228
|
-
srcChainKey: baseCtx.srcChainKey
|
|
31229
|
-
})
|
|
31660
|
+
error: executionFailed("staking", error, baseCtx)
|
|
31230
31661
|
};
|
|
31231
31662
|
}
|
|
31232
|
-
|
|
31233
|
-
|
|
31234
|
-
|
|
31663
|
+
},
|
|
31664
|
+
{
|
|
31665
|
+
start: () => ({
|
|
31666
|
+
srcChainKey: _params.params.srcChainKey,
|
|
31667
|
+
srcAddress: _params.params.srcAddress,
|
|
31668
|
+
requestId: _params.params.requestId,
|
|
31669
|
+
amount: _params.params.amount
|
|
31670
|
+
}),
|
|
31671
|
+
success: (value) => ({
|
|
31672
|
+
srcChainTxHash: value.srcChainTxHash,
|
|
31673
|
+
dstChainTxHash: value.dstChainTxHash
|
|
31674
|
+
}),
|
|
31675
|
+
failure: (error) => ({ code: error.code })
|
|
31235
31676
|
}
|
|
31236
|
-
|
|
31237
|
-
} catch (error) {
|
|
31238
|
-
if (isStakingOrchestrationError(error)) return { ok: false, error };
|
|
31239
|
-
return {
|
|
31240
|
-
ok: false,
|
|
31241
|
-
error: executionFailed("staking", error, baseCtx)
|
|
31242
|
-
};
|
|
31243
|
-
}
|
|
31677
|
+
);
|
|
31244
31678
|
}
|
|
31245
31679
|
/**
|
|
31246
31680
|
* Submits the claim transaction on the spoke chain without relaying to the hub.
|
|
@@ -31354,42 +31788,60 @@ var StakingService = class {
|
|
|
31354
31788
|
* @returns `{ ok: true, value: { srcChainTxHash, dstChainTxHash } }` on success.
|
|
31355
31789
|
*/
|
|
31356
31790
|
async cancelUnstake(_params) {
|
|
31357
|
-
|
|
31358
|
-
|
|
31359
|
-
|
|
31360
|
-
|
|
31361
|
-
|
|
31362
|
-
|
|
31363
|
-
|
|
31364
|
-
|
|
31365
|
-
|
|
31366
|
-
|
|
31367
|
-
|
|
31368
|
-
|
|
31369
|
-
|
|
31370
|
-
|
|
31371
|
-
|
|
31791
|
+
return this.config.analytics.trackResult(
|
|
31792
|
+
"staking",
|
|
31793
|
+
"cancelUnstake",
|
|
31794
|
+
async () => {
|
|
31795
|
+
const { params, timeout } = _params;
|
|
31796
|
+
const baseCtx = { srcChainKey: params.srcChainKey, action: "cancelUnstake" };
|
|
31797
|
+
try {
|
|
31798
|
+
const txResult = await this.createCancelUnstakeIntent(_params);
|
|
31799
|
+
if (!txResult.ok) return { ok: false, error: txResult.error };
|
|
31800
|
+
let hubTxHash;
|
|
31801
|
+
if (!isHubChainKeyType(params.srcChainKey)) {
|
|
31802
|
+
const packetResult = await relayTxAndWaitPacket({
|
|
31803
|
+
srcTxHash: txResult.value.tx,
|
|
31804
|
+
data: txResult.value.relayData,
|
|
31805
|
+
chainKey: params.srcChainKey,
|
|
31806
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
31807
|
+
timeout
|
|
31808
|
+
});
|
|
31809
|
+
if (!packetResult.ok) {
|
|
31810
|
+
return {
|
|
31811
|
+
ok: false,
|
|
31812
|
+
error: mapRelayFailure(packetResult.error, {
|
|
31813
|
+
feature: "staking",
|
|
31814
|
+
action: baseCtx.action,
|
|
31815
|
+
srcChainKey: baseCtx.srcChainKey
|
|
31816
|
+
})
|
|
31817
|
+
};
|
|
31818
|
+
}
|
|
31819
|
+
hubTxHash = packetResult.value.dst_tx_hash;
|
|
31820
|
+
} else {
|
|
31821
|
+
hubTxHash = txResult.value.tx;
|
|
31822
|
+
}
|
|
31823
|
+
return { ok: true, value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: hubTxHash } };
|
|
31824
|
+
} catch (error) {
|
|
31825
|
+
if (isStakingOrchestrationError(error)) return { ok: false, error };
|
|
31372
31826
|
return {
|
|
31373
31827
|
ok: false,
|
|
31374
|
-
error:
|
|
31375
|
-
feature: "staking",
|
|
31376
|
-
action: baseCtx.action,
|
|
31377
|
-
srcChainKey: baseCtx.srcChainKey
|
|
31378
|
-
})
|
|
31828
|
+
error: executionFailed("staking", error, baseCtx)
|
|
31379
31829
|
};
|
|
31380
31830
|
}
|
|
31381
|
-
|
|
31382
|
-
|
|
31383
|
-
|
|
31831
|
+
},
|
|
31832
|
+
{
|
|
31833
|
+
start: () => ({
|
|
31834
|
+
srcChainKey: _params.params.srcChainKey,
|
|
31835
|
+
srcAddress: _params.params.srcAddress,
|
|
31836
|
+
requestId: _params.params.requestId
|
|
31837
|
+
}),
|
|
31838
|
+
success: (value) => ({
|
|
31839
|
+
srcChainTxHash: value.srcChainTxHash,
|
|
31840
|
+
dstChainTxHash: value.dstChainTxHash
|
|
31841
|
+
}),
|
|
31842
|
+
failure: (error) => ({ code: error.code })
|
|
31384
31843
|
}
|
|
31385
|
-
|
|
31386
|
-
} catch (error) {
|
|
31387
|
-
if (isStakingOrchestrationError(error)) return { ok: false, error };
|
|
31388
|
-
return {
|
|
31389
|
-
ok: false,
|
|
31390
|
-
error: executionFailed("staking", error, baseCtx)
|
|
31391
|
-
};
|
|
31392
|
-
}
|
|
31844
|
+
);
|
|
31393
31845
|
}
|
|
31394
31846
|
/**
|
|
31395
31847
|
* Submits the cancel-unstake transaction on the spoke chain without relaying to the hub.
|
|
@@ -32763,34 +33215,56 @@ var ClService = class _ClService {
|
|
|
32763
33215
|
* `dstChainTxHash` (hub) once the packet has been confirmed.
|
|
32764
33216
|
*/
|
|
32765
33217
|
async supplyLiquidity(_params) {
|
|
32766
|
-
|
|
32767
|
-
|
|
32768
|
-
|
|
32769
|
-
|
|
32770
|
-
|
|
32771
|
-
|
|
32772
|
-
|
|
32773
|
-
|
|
32774
|
-
|
|
32775
|
-
|
|
32776
|
-
|
|
32777
|
-
|
|
32778
|
-
|
|
32779
|
-
|
|
32780
|
-
|
|
32781
|
-
|
|
32782
|
-
|
|
32783
|
-
|
|
32784
|
-
|
|
33218
|
+
return this.config.analytics.trackResult(
|
|
33219
|
+
"dex",
|
|
33220
|
+
"supplyLiquidity",
|
|
33221
|
+
async () => {
|
|
33222
|
+
const { params, timeout } = _params;
|
|
33223
|
+
try {
|
|
33224
|
+
const txResult = await this.executeSupplyLiquidity(_params);
|
|
33225
|
+
if (!txResult.ok) {
|
|
33226
|
+
return txResult;
|
|
33227
|
+
}
|
|
33228
|
+
let hubTxHash;
|
|
33229
|
+
if (!isHubChainKeyType(params.srcChainKey)) {
|
|
33230
|
+
const packetResult = await relayTxAndWaitPacket({
|
|
33231
|
+
srcTxHash: txResult.value.tx,
|
|
33232
|
+
data: txResult.value.relayData,
|
|
33233
|
+
chainKey: params.srcChainKey,
|
|
33234
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
33235
|
+
timeout
|
|
33236
|
+
});
|
|
33237
|
+
if (!packetResult.ok) return packetResult;
|
|
33238
|
+
hubTxHash = packetResult.value.dst_tx_hash;
|
|
33239
|
+
} else {
|
|
33240
|
+
hubTxHash = txResult.value.tx;
|
|
33241
|
+
}
|
|
33242
|
+
return { ok: true, value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: hubTxHash } };
|
|
33243
|
+
} catch (error) {
|
|
33244
|
+
this.config.logger.error("supplyLiquidity error", error);
|
|
33245
|
+
return {
|
|
33246
|
+
ok: false,
|
|
33247
|
+
error
|
|
33248
|
+
};
|
|
33249
|
+
}
|
|
33250
|
+
},
|
|
33251
|
+
{
|
|
33252
|
+
start: () => ({
|
|
33253
|
+
srcChainKey: _params.params.srcChainKey,
|
|
33254
|
+
srcAddress: _params.params.srcAddress,
|
|
33255
|
+
currency0: _params.params.poolKey.currency0,
|
|
33256
|
+
currency1: _params.params.poolKey.currency1,
|
|
33257
|
+
fee: _params.params.poolKey.fee,
|
|
33258
|
+
tickLower: _params.params.tickLower,
|
|
33259
|
+
tickUpper: _params.params.tickUpper,
|
|
33260
|
+
liquidity: _params.params.liquidity,
|
|
33261
|
+
amount0Max: _params.params.amount0Max,
|
|
33262
|
+
amount1Max: _params.params.amount1Max
|
|
33263
|
+
}),
|
|
33264
|
+
success: (value) => ({ srcChainTxHash: value.srcChainTxHash, dstChainTxHash: value.dstChainTxHash }),
|
|
33265
|
+
failure: (error) => ({ code: isSodaxError(error) ? error.code : void 0 })
|
|
32785
33266
|
}
|
|
32786
|
-
|
|
32787
|
-
} catch (error) {
|
|
32788
|
-
this.config.logger.error("supplyLiquidity error", error);
|
|
32789
|
-
return {
|
|
32790
|
-
ok: false,
|
|
32791
|
-
error
|
|
32792
|
-
};
|
|
32793
|
-
}
|
|
33267
|
+
);
|
|
32794
33268
|
}
|
|
32795
33269
|
/**
|
|
32796
33270
|
* Add liquidity to an existing position and wait for the cross-chain relay to complete.
|
|
@@ -32805,33 +33279,56 @@ var ClService = class _ClService {
|
|
|
32805
33279
|
* `dstChainTxHash` (hub) once the packet has been confirmed.
|
|
32806
33280
|
*/
|
|
32807
33281
|
async increaseLiquidity(_params) {
|
|
32808
|
-
|
|
32809
|
-
|
|
32810
|
-
|
|
32811
|
-
|
|
32812
|
-
|
|
32813
|
-
|
|
32814
|
-
|
|
32815
|
-
|
|
32816
|
-
|
|
32817
|
-
|
|
32818
|
-
|
|
32819
|
-
|
|
32820
|
-
|
|
32821
|
-
|
|
32822
|
-
|
|
32823
|
-
|
|
32824
|
-
|
|
32825
|
-
|
|
32826
|
-
|
|
33282
|
+
return this.config.analytics.trackResult(
|
|
33283
|
+
"dex",
|
|
33284
|
+
"increaseLiquidity",
|
|
33285
|
+
async () => {
|
|
33286
|
+
const { params, timeout } = _params;
|
|
33287
|
+
try {
|
|
33288
|
+
const txResult = await this.executeIncreaseLiquidity(_params);
|
|
33289
|
+
if (!txResult.ok) {
|
|
33290
|
+
return txResult;
|
|
33291
|
+
}
|
|
33292
|
+
let hubTxHash;
|
|
33293
|
+
if (!isHubChainKeyType(params.srcChainKey)) {
|
|
33294
|
+
const packetResult = await relayTxAndWaitPacket({
|
|
33295
|
+
srcTxHash: txResult.value.tx,
|
|
33296
|
+
data: txResult.value.relayData,
|
|
33297
|
+
chainKey: params.srcChainKey,
|
|
33298
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
33299
|
+
timeout
|
|
33300
|
+
});
|
|
33301
|
+
if (!packetResult.ok) return packetResult;
|
|
33302
|
+
hubTxHash = packetResult.value.dst_tx_hash;
|
|
33303
|
+
} else {
|
|
33304
|
+
hubTxHash = txResult.value.tx;
|
|
33305
|
+
}
|
|
33306
|
+
return { ok: true, value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: hubTxHash } };
|
|
33307
|
+
} catch (error) {
|
|
33308
|
+
return {
|
|
33309
|
+
ok: false,
|
|
33310
|
+
error
|
|
33311
|
+
};
|
|
33312
|
+
}
|
|
33313
|
+
},
|
|
33314
|
+
{
|
|
33315
|
+
start: () => ({
|
|
33316
|
+
srcChainKey: _params.params.srcChainKey,
|
|
33317
|
+
srcAddress: _params.params.srcAddress,
|
|
33318
|
+
currency0: _params.params.poolKey.currency0,
|
|
33319
|
+
currency1: _params.params.poolKey.currency1,
|
|
33320
|
+
fee: _params.params.poolKey.fee,
|
|
33321
|
+
tokenId: _params.params.tokenId,
|
|
33322
|
+
tickLower: _params.params.tickLower,
|
|
33323
|
+
tickUpper: _params.params.tickUpper,
|
|
33324
|
+
liquidity: _params.params.liquidity,
|
|
33325
|
+
amount0Max: _params.params.amount0Max,
|
|
33326
|
+
amount1Max: _params.params.amount1Max
|
|
33327
|
+
}),
|
|
33328
|
+
success: (value) => ({ srcChainTxHash: value.srcChainTxHash, dstChainTxHash: value.dstChainTxHash }),
|
|
33329
|
+
failure: (error) => ({ code: isSodaxError(error) ? error.code : void 0 })
|
|
32827
33330
|
}
|
|
32828
|
-
|
|
32829
|
-
} catch (error) {
|
|
32830
|
-
return {
|
|
32831
|
-
ok: false,
|
|
32832
|
-
error
|
|
32833
|
-
};
|
|
32834
|
-
}
|
|
33331
|
+
);
|
|
32835
33332
|
}
|
|
32836
33333
|
/**
|
|
32837
33334
|
* Remove liquidity from an existing position and wait for the cross-chain relay to complete.
|
|
@@ -32846,33 +33343,54 @@ var ClService = class _ClService {
|
|
|
32846
33343
|
* `dstChainTxHash` (hub) once the packet has been confirmed.
|
|
32847
33344
|
*/
|
|
32848
33345
|
async decreaseLiquidity(_params) {
|
|
32849
|
-
|
|
32850
|
-
|
|
32851
|
-
|
|
32852
|
-
|
|
32853
|
-
|
|
32854
|
-
|
|
32855
|
-
|
|
32856
|
-
|
|
32857
|
-
|
|
32858
|
-
|
|
32859
|
-
|
|
32860
|
-
|
|
32861
|
-
|
|
32862
|
-
|
|
32863
|
-
|
|
32864
|
-
|
|
32865
|
-
|
|
32866
|
-
|
|
32867
|
-
|
|
33346
|
+
return this.config.analytics.trackResult(
|
|
33347
|
+
"dex",
|
|
33348
|
+
"decreaseLiquidity",
|
|
33349
|
+
async () => {
|
|
33350
|
+
const { params, timeout } = _params;
|
|
33351
|
+
try {
|
|
33352
|
+
const txResult = await this.executeDecreaseLiquidity(_params);
|
|
33353
|
+
if (!txResult.ok) {
|
|
33354
|
+
return txResult;
|
|
33355
|
+
}
|
|
33356
|
+
let hubTxHash;
|
|
33357
|
+
if (!isHubChainKeyType(params.srcChainKey)) {
|
|
33358
|
+
const packetResult = await relayTxAndWaitPacket({
|
|
33359
|
+
srcTxHash: txResult.value.tx,
|
|
33360
|
+
data: txResult.value.relayData,
|
|
33361
|
+
chainKey: params.srcChainKey,
|
|
33362
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
33363
|
+
timeout
|
|
33364
|
+
});
|
|
33365
|
+
if (!packetResult.ok) return packetResult;
|
|
33366
|
+
hubTxHash = packetResult.value.dst_tx_hash;
|
|
33367
|
+
} else {
|
|
33368
|
+
hubTxHash = txResult.value.tx;
|
|
33369
|
+
}
|
|
33370
|
+
return { ok: true, value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: hubTxHash } };
|
|
33371
|
+
} catch (error) {
|
|
33372
|
+
return {
|
|
33373
|
+
ok: false,
|
|
33374
|
+
error
|
|
33375
|
+
};
|
|
33376
|
+
}
|
|
33377
|
+
},
|
|
33378
|
+
{
|
|
33379
|
+
start: () => ({
|
|
33380
|
+
srcChainKey: _params.params.srcChainKey,
|
|
33381
|
+
srcAddress: _params.params.srcAddress,
|
|
33382
|
+
currency0: _params.params.poolKey.currency0,
|
|
33383
|
+
currency1: _params.params.poolKey.currency1,
|
|
33384
|
+
fee: _params.params.poolKey.fee,
|
|
33385
|
+
tokenId: _params.params.tokenId,
|
|
33386
|
+
liquidity: _params.params.liquidity,
|
|
33387
|
+
amount0Min: _params.params.amount0Min,
|
|
33388
|
+
amount1Min: _params.params.amount1Min
|
|
33389
|
+
}),
|
|
33390
|
+
success: (value) => ({ srcChainTxHash: value.srcChainTxHash, dstChainTxHash: value.dstChainTxHash }),
|
|
33391
|
+
failure: (error) => ({ code: isSodaxError(error) ? error.code : void 0 })
|
|
32868
33392
|
}
|
|
32869
|
-
|
|
32870
|
-
} catch (error) {
|
|
32871
|
-
return {
|
|
32872
|
-
ok: false,
|
|
32873
|
-
error
|
|
32874
|
-
};
|
|
32875
|
-
}
|
|
33393
|
+
);
|
|
32876
33394
|
}
|
|
32877
33395
|
/**
|
|
32878
33396
|
* Fetch the reward configuration stored in the pool's hook contract.
|
|
@@ -33024,34 +33542,54 @@ var ClService = class _ClService {
|
|
|
33024
33542
|
* `dstChainTxHash` (hub) once the packet has been confirmed.
|
|
33025
33543
|
*/
|
|
33026
33544
|
async claimRewards(_params) {
|
|
33027
|
-
|
|
33028
|
-
|
|
33029
|
-
|
|
33030
|
-
|
|
33031
|
-
|
|
33032
|
-
|
|
33033
|
-
|
|
33034
|
-
|
|
33035
|
-
|
|
33036
|
-
|
|
33037
|
-
|
|
33038
|
-
|
|
33039
|
-
|
|
33040
|
-
|
|
33041
|
-
|
|
33042
|
-
|
|
33043
|
-
|
|
33044
|
-
|
|
33045
|
-
|
|
33545
|
+
return this.config.analytics.trackResult(
|
|
33546
|
+
"dex",
|
|
33547
|
+
"claimRewards",
|
|
33548
|
+
async () => {
|
|
33549
|
+
const { params, timeout } = _params;
|
|
33550
|
+
try {
|
|
33551
|
+
const txResult = await this.executeClaimRewards(_params);
|
|
33552
|
+
if (!txResult.ok) {
|
|
33553
|
+
return txResult;
|
|
33554
|
+
}
|
|
33555
|
+
let hubTxHash;
|
|
33556
|
+
if (!isHubChainKeyType(params.srcChainKey)) {
|
|
33557
|
+
const packetResult = await relayTxAndWaitPacket({
|
|
33558
|
+
srcTxHash: txResult.value.tx,
|
|
33559
|
+
data: txResult.value.relayData,
|
|
33560
|
+
chainKey: params.srcChainKey,
|
|
33561
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
33562
|
+
timeout
|
|
33563
|
+
});
|
|
33564
|
+
if (!packetResult.ok) return packetResult;
|
|
33565
|
+
hubTxHash = packetResult.value.dst_tx_hash;
|
|
33566
|
+
} else {
|
|
33567
|
+
hubTxHash = txResult.value.tx;
|
|
33568
|
+
}
|
|
33569
|
+
return { ok: true, value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: hubTxHash } };
|
|
33570
|
+
} catch (error) {
|
|
33571
|
+
this.config.logger.error("claimRewards error", error);
|
|
33572
|
+
return {
|
|
33573
|
+
ok: false,
|
|
33574
|
+
error
|
|
33575
|
+
};
|
|
33576
|
+
}
|
|
33577
|
+
},
|
|
33578
|
+
{
|
|
33579
|
+
start: () => ({
|
|
33580
|
+
srcChainKey: _params.params.srcChainKey,
|
|
33581
|
+
srcAddress: _params.params.srcAddress,
|
|
33582
|
+
currency0: _params.params.poolKey.currency0,
|
|
33583
|
+
currency1: _params.params.poolKey.currency1,
|
|
33584
|
+
fee: _params.params.poolKey.fee,
|
|
33585
|
+
tokenId: _params.params.tokenId,
|
|
33586
|
+
tickLower: _params.params.tickLower,
|
|
33587
|
+
tickUpper: _params.params.tickUpper
|
|
33588
|
+
}),
|
|
33589
|
+
success: (value) => ({ srcChainTxHash: value.srcChainTxHash, dstChainTxHash: value.dstChainTxHash }),
|
|
33590
|
+
failure: (error) => ({ code: isSodaxError(error) ? error.code : void 0 })
|
|
33046
33591
|
}
|
|
33047
|
-
|
|
33048
|
-
} catch (error) {
|
|
33049
|
-
this.config.logger.error("claimRewards error", error);
|
|
33050
|
-
return {
|
|
33051
|
-
ok: false,
|
|
33052
|
-
error
|
|
33053
|
-
};
|
|
33054
|
-
}
|
|
33592
|
+
);
|
|
33055
33593
|
}
|
|
33056
33594
|
/**
|
|
33057
33595
|
* Return the list of configured concentrated-liquidity pool keys for the SODAX DEX.
|
|
@@ -35974,50 +36512,68 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
35974
36512
|
* @returns A pair of transaction hashes — `srcChainTxHash` (spoke) and `dstChainTxHash` (hub).
|
|
35975
36513
|
*/
|
|
35976
36514
|
async supply(_params) {
|
|
35977
|
-
|
|
35978
|
-
|
|
35979
|
-
|
|
35980
|
-
|
|
35981
|
-
|
|
35982
|
-
|
|
35983
|
-
|
|
35984
|
-
|
|
35985
|
-
|
|
35986
|
-
ok: false,
|
|
35987
|
-
|
|
35988
|
-
|
|
35989
|
-
|
|
35990
|
-
|
|
35991
|
-
|
|
35992
|
-
|
|
35993
|
-
|
|
35994
|
-
|
|
36515
|
+
return this.config.analytics.trackResult(
|
|
36516
|
+
"moneyMarket",
|
|
36517
|
+
"supply",
|
|
36518
|
+
async () => {
|
|
36519
|
+
const { params, timeout = DEFAULT_RELAY_TX_TIMEOUT } = _params;
|
|
36520
|
+
const srcChainKey = params.srcChainKey;
|
|
36521
|
+
const baseCtx = { srcChainKey, dstChainKey: params.dstChainKey, action: "supply" };
|
|
36522
|
+
try {
|
|
36523
|
+
const txResult = await this.createSupplyIntent(_params);
|
|
36524
|
+
if (!txResult.ok) return { ok: false, error: txResult.error };
|
|
36525
|
+
const verify = await this.spoke.verifyTxHash({ txHash: txResult.value.tx, chainKey: srcChainKey });
|
|
36526
|
+
if (!verify.ok) {
|
|
36527
|
+
return {
|
|
36528
|
+
ok: false,
|
|
36529
|
+
error: verifyFailed("moneyMarket", verify.error, baseCtx)
|
|
36530
|
+
};
|
|
36531
|
+
}
|
|
36532
|
+
if (isHubChainKeyType(srcChainKey)) {
|
|
36533
|
+
return {
|
|
36534
|
+
ok: true,
|
|
36535
|
+
value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: txResult.value.tx }
|
|
36536
|
+
};
|
|
36537
|
+
}
|
|
36538
|
+
const packet = await relayTxAndWaitPacket({
|
|
36539
|
+
srcTxHash: txResult.value.tx,
|
|
36540
|
+
data: txResult.value.relayData,
|
|
36541
|
+
chainKey: srcChainKey,
|
|
36542
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
36543
|
+
timeout
|
|
36544
|
+
});
|
|
36545
|
+
if (!packet.ok)
|
|
36546
|
+
return {
|
|
36547
|
+
ok: false,
|
|
36548
|
+
error: mapRelayFailure(packet.error, {
|
|
36549
|
+
feature: "moneyMarket",
|
|
36550
|
+
action: baseCtx.action,
|
|
36551
|
+
srcChainKey: baseCtx.srcChainKey,
|
|
36552
|
+
dstChainKey: baseCtx.dstChainKey
|
|
36553
|
+
})
|
|
36554
|
+
};
|
|
36555
|
+
return { ok: true, value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: packet.value.dst_tx_hash } };
|
|
36556
|
+
} catch (error) {
|
|
36557
|
+
if (isMoneyMarketOrchestrationError(error)) return { ok: false, error };
|
|
36558
|
+
return {
|
|
36559
|
+
ok: false,
|
|
36560
|
+
error: executionFailed("moneyMarket", error, { ...baseCtx, phase: "intentCreation" })
|
|
36561
|
+
};
|
|
36562
|
+
}
|
|
36563
|
+
},
|
|
36564
|
+
{
|
|
36565
|
+
start: () => ({
|
|
36566
|
+
srcChainKey: _params.params.srcChainKey,
|
|
36567
|
+
srcAddress: _params.params.srcAddress,
|
|
36568
|
+
dstChainKey: _params.params.dstChainKey,
|
|
36569
|
+
dstAddress: _params.params.dstAddress,
|
|
36570
|
+
token: _params.params.token,
|
|
36571
|
+
amount: _params.params.amount
|
|
36572
|
+
}),
|
|
36573
|
+
success: (value) => ({ srcChainTxHash: value.srcChainTxHash, dstChainTxHash: value.dstChainTxHash }),
|
|
36574
|
+
failure: (error) => ({ code: error.code })
|
|
35995
36575
|
}
|
|
35996
|
-
|
|
35997
|
-
srcTxHash: txResult.value.tx,
|
|
35998
|
-
data: txResult.value.relayData,
|
|
35999
|
-
chainKey: srcChainKey,
|
|
36000
|
-
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
36001
|
-
timeout
|
|
36002
|
-
});
|
|
36003
|
-
if (!packet.ok)
|
|
36004
|
-
return {
|
|
36005
|
-
ok: false,
|
|
36006
|
-
error: mapRelayFailure(packet.error, {
|
|
36007
|
-
feature: "moneyMarket",
|
|
36008
|
-
action: baseCtx.action,
|
|
36009
|
-
srcChainKey: baseCtx.srcChainKey,
|
|
36010
|
-
dstChainKey: baseCtx.dstChainKey
|
|
36011
|
-
})
|
|
36012
|
-
};
|
|
36013
|
-
return { ok: true, value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: packet.value.dst_tx_hash } };
|
|
36014
|
-
} catch (error) {
|
|
36015
|
-
if (isMoneyMarketOrchestrationError(error)) return { ok: false, error };
|
|
36016
|
-
return {
|
|
36017
|
-
ok: false,
|
|
36018
|
-
error: executionFailed("moneyMarket", error, { ...baseCtx, phase: "intentCreation" })
|
|
36019
|
-
};
|
|
36020
|
-
}
|
|
36576
|
+
);
|
|
36021
36577
|
}
|
|
36022
36578
|
/**
|
|
36023
36579
|
* Build and optionally broadcast the spoke-side supply transaction without waiting for the
|
|
@@ -36134,58 +36690,76 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
36134
36690
|
* `dstChainTxHash` (hub delivery or relay destination).
|
|
36135
36691
|
*/
|
|
36136
36692
|
async borrow(_params) {
|
|
36137
|
-
|
|
36138
|
-
|
|
36139
|
-
|
|
36140
|
-
|
|
36141
|
-
|
|
36142
|
-
|
|
36143
|
-
|
|
36144
|
-
|
|
36145
|
-
|
|
36146
|
-
|
|
36147
|
-
ok: false,
|
|
36148
|
-
|
|
36149
|
-
|
|
36150
|
-
|
|
36151
|
-
|
|
36152
|
-
|
|
36153
|
-
|
|
36154
|
-
|
|
36155
|
-
|
|
36156
|
-
|
|
36157
|
-
|
|
36158
|
-
|
|
36159
|
-
|
|
36160
|
-
|
|
36161
|
-
|
|
36162
|
-
|
|
36163
|
-
|
|
36164
|
-
|
|
36165
|
-
|
|
36166
|
-
|
|
36167
|
-
|
|
36168
|
-
|
|
36169
|
-
|
|
36170
|
-
|
|
36171
|
-
|
|
36172
|
-
|
|
36173
|
-
|
|
36174
|
-
|
|
36175
|
-
|
|
36176
|
-
|
|
36177
|
-
|
|
36178
|
-
|
|
36179
|
-
|
|
36693
|
+
return this.config.analytics.trackResult(
|
|
36694
|
+
"moneyMarket",
|
|
36695
|
+
"borrow",
|
|
36696
|
+
async () => {
|
|
36697
|
+
const { params, timeout = DEFAULT_RELAY_TX_TIMEOUT } = _params;
|
|
36698
|
+
const srcChainKey = params.srcChainKey;
|
|
36699
|
+
const hubChainId = this.hubProvider.chainConfig.chain.key;
|
|
36700
|
+
const baseCtx = { srcChainKey, dstChainKey: params.dstChainKey, action: "borrow" };
|
|
36701
|
+
try {
|
|
36702
|
+
const txResult = await this.createBorrowIntent(_params);
|
|
36703
|
+
if (!txResult.ok) return { ok: false, error: txResult.error };
|
|
36704
|
+
const verify = await this.spoke.verifyTxHash({ txHash: txResult.value.tx, chainKey: srcChainKey });
|
|
36705
|
+
if (!verify.ok) {
|
|
36706
|
+
return {
|
|
36707
|
+
ok: false,
|
|
36708
|
+
error: verifyFailed("moneyMarket", verify.error, baseCtx)
|
|
36709
|
+
};
|
|
36710
|
+
}
|
|
36711
|
+
const needsRelay = srcChainKey !== hubChainId || params.dstChainKey != null && params.dstAddress != null && params.dstChainKey !== hubChainId;
|
|
36712
|
+
if (!needsRelay) {
|
|
36713
|
+
return {
|
|
36714
|
+
ok: true,
|
|
36715
|
+
value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: txResult.value.tx }
|
|
36716
|
+
};
|
|
36717
|
+
}
|
|
36718
|
+
const relayIdentity = this.buildRelayIdentity(srcChainKey, txResult.value.tx, txResult.value.relayData);
|
|
36719
|
+
const packet = await relayTxAndWaitPacket({
|
|
36720
|
+
...relayIdentity,
|
|
36721
|
+
chainKey: srcChainKey,
|
|
36722
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
36723
|
+
timeout
|
|
36724
|
+
});
|
|
36725
|
+
if (!packet.ok)
|
|
36726
|
+
return {
|
|
36727
|
+
ok: false,
|
|
36728
|
+
error: mapRelayFailure(packet.error, {
|
|
36729
|
+
feature: "moneyMarket",
|
|
36730
|
+
action: baseCtx.action,
|
|
36731
|
+
srcChainKey: baseCtx.srcChainKey,
|
|
36732
|
+
dstChainKey: baseCtx.dstChainKey
|
|
36733
|
+
})
|
|
36734
|
+
};
|
|
36735
|
+
return {
|
|
36736
|
+
ok: true,
|
|
36737
|
+
value: {
|
|
36738
|
+
srcChainTxHash: relayIdentity.pollTxHash ?? txResult.value.tx,
|
|
36739
|
+
dstChainTxHash: packet.value.dst_tx_hash
|
|
36740
|
+
}
|
|
36741
|
+
};
|
|
36742
|
+
} catch (error) {
|
|
36743
|
+
if (isMoneyMarketOrchestrationError(error)) return { ok: false, error };
|
|
36744
|
+
return {
|
|
36745
|
+
ok: false,
|
|
36746
|
+
error: executionFailed("moneyMarket", error, { ...baseCtx, phase: "intentCreation" })
|
|
36747
|
+
};
|
|
36180
36748
|
}
|
|
36181
|
-
}
|
|
36182
|
-
|
|
36183
|
-
|
|
36184
|
-
|
|
36185
|
-
|
|
36186
|
-
|
|
36187
|
-
|
|
36188
|
-
|
|
36749
|
+
},
|
|
36750
|
+
{
|
|
36751
|
+
start: () => ({
|
|
36752
|
+
srcChainKey: _params.params.srcChainKey,
|
|
36753
|
+
srcAddress: _params.params.srcAddress,
|
|
36754
|
+
dstChainKey: _params.params.dstChainKey,
|
|
36755
|
+
dstAddress: _params.params.dstAddress,
|
|
36756
|
+
token: _params.params.token,
|
|
36757
|
+
amount: _params.params.amount
|
|
36758
|
+
}),
|
|
36759
|
+
success: (value) => ({ srcChainTxHash: value.srcChainTxHash, dstChainTxHash: value.dstChainTxHash }),
|
|
36760
|
+
failure: (error) => ({ code: error.code })
|
|
36761
|
+
}
|
|
36762
|
+
);
|
|
36189
36763
|
}
|
|
36190
36764
|
/**
|
|
36191
36765
|
* Build and optionally broadcast the spoke-side borrow message without waiting for the
|
|
@@ -36283,59 +36857,77 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
36283
36857
|
* `dstChainTxHash` (hub or relay destination).
|
|
36284
36858
|
*/
|
|
36285
36859
|
async withdraw(_params) {
|
|
36286
|
-
|
|
36287
|
-
|
|
36288
|
-
|
|
36289
|
-
|
|
36290
|
-
|
|
36291
|
-
|
|
36292
|
-
|
|
36293
|
-
|
|
36294
|
-
|
|
36295
|
-
|
|
36296
|
-
|
|
36297
|
-
ok: false,
|
|
36298
|
-
|
|
36299
|
-
|
|
36300
|
-
|
|
36301
|
-
|
|
36302
|
-
|
|
36303
|
-
|
|
36304
|
-
|
|
36305
|
-
|
|
36306
|
-
|
|
36307
|
-
|
|
36308
|
-
|
|
36309
|
-
|
|
36310
|
-
|
|
36311
|
-
|
|
36312
|
-
|
|
36313
|
-
|
|
36314
|
-
|
|
36315
|
-
|
|
36316
|
-
|
|
36317
|
-
|
|
36318
|
-
|
|
36319
|
-
|
|
36320
|
-
|
|
36321
|
-
|
|
36322
|
-
|
|
36323
|
-
|
|
36324
|
-
|
|
36325
|
-
|
|
36326
|
-
|
|
36327
|
-
|
|
36328
|
-
|
|
36329
|
-
|
|
36860
|
+
return this.config.analytics.trackResult(
|
|
36861
|
+
"moneyMarket",
|
|
36862
|
+
"withdraw",
|
|
36863
|
+
async () => {
|
|
36864
|
+
const { params, timeout = DEFAULT_RELAY_TX_TIMEOUT } = _params;
|
|
36865
|
+
const srcChainKey = params.srcChainKey;
|
|
36866
|
+
const hubChainId = this.hubProvider.chainConfig.chain.key;
|
|
36867
|
+
const walletRouter = this.hubProvider.chainConfig.addresses.walletRouter;
|
|
36868
|
+
const baseCtx = { srcChainKey, dstChainKey: params.dstChainKey, action: "withdraw" };
|
|
36869
|
+
try {
|
|
36870
|
+
const txResult = await this.createWithdrawIntent(_params);
|
|
36871
|
+
if (!txResult.ok) return { ok: false, error: txResult.error };
|
|
36872
|
+
const verify = await this.spoke.verifyTxHash({ txHash: txResult.value.tx, chainKey: srcChainKey });
|
|
36873
|
+
if (!verify.ok) {
|
|
36874
|
+
return {
|
|
36875
|
+
ok: false,
|
|
36876
|
+
error: verifyFailed("moneyMarket", verify.error, baseCtx)
|
|
36877
|
+
};
|
|
36878
|
+
}
|
|
36879
|
+
const needsRelay = srcChainKey !== hubChainId || params.dstChainKey != null && params.dstAddress != null && params.dstChainKey !== hubChainId && params.dstAddress !== walletRouter;
|
|
36880
|
+
if (!needsRelay) {
|
|
36881
|
+
return {
|
|
36882
|
+
ok: true,
|
|
36883
|
+
value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: txResult.value.tx }
|
|
36884
|
+
};
|
|
36885
|
+
}
|
|
36886
|
+
const relayIdentity = this.buildRelayIdentity(srcChainKey, txResult.value.tx, txResult.value.relayData);
|
|
36887
|
+
const packet = await relayTxAndWaitPacket({
|
|
36888
|
+
...relayIdentity,
|
|
36889
|
+
chainKey: srcChainKey,
|
|
36890
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
36891
|
+
timeout
|
|
36892
|
+
});
|
|
36893
|
+
if (!packet.ok)
|
|
36894
|
+
return {
|
|
36895
|
+
ok: false,
|
|
36896
|
+
error: mapRelayFailure(packet.error, {
|
|
36897
|
+
feature: "moneyMarket",
|
|
36898
|
+
action: baseCtx.action,
|
|
36899
|
+
srcChainKey: baseCtx.srcChainKey,
|
|
36900
|
+
dstChainKey: baseCtx.dstChainKey
|
|
36901
|
+
})
|
|
36902
|
+
};
|
|
36903
|
+
return {
|
|
36904
|
+
ok: true,
|
|
36905
|
+
value: {
|
|
36906
|
+
srcChainTxHash: relayIdentity.pollTxHash ?? txResult.value.tx,
|
|
36907
|
+
dstChainTxHash: packet.value.dst_tx_hash
|
|
36908
|
+
}
|
|
36909
|
+
};
|
|
36910
|
+
} catch (error) {
|
|
36911
|
+
if (isMoneyMarketOrchestrationError(error)) return { ok: false, error };
|
|
36912
|
+
return {
|
|
36913
|
+
ok: false,
|
|
36914
|
+
error: executionFailed("moneyMarket", error, { ...baseCtx, phase: "intentCreation" })
|
|
36915
|
+
};
|
|
36330
36916
|
}
|
|
36331
|
-
}
|
|
36332
|
-
|
|
36333
|
-
|
|
36334
|
-
|
|
36335
|
-
|
|
36336
|
-
|
|
36337
|
-
|
|
36338
|
-
|
|
36917
|
+
},
|
|
36918
|
+
{
|
|
36919
|
+
start: () => ({
|
|
36920
|
+
srcChainKey: _params.params.srcChainKey,
|
|
36921
|
+
srcAddress: _params.params.srcAddress,
|
|
36922
|
+
dstChainKey: _params.params.dstChainKey,
|
|
36923
|
+
dstAddress: _params.params.dstAddress,
|
|
36924
|
+
token: _params.params.token,
|
|
36925
|
+
amount: _params.params.amount
|
|
36926
|
+
}),
|
|
36927
|
+
success: (value) => ({ srcChainTxHash: value.srcChainTxHash, dstChainTxHash: value.dstChainTxHash }),
|
|
36928
|
+
failure: (error) => ({ code: error.code })
|
|
36929
|
+
}
|
|
36930
|
+
);
|
|
36339
36931
|
}
|
|
36340
36932
|
/**
|
|
36341
36933
|
* Build and optionally broadcast the spoke-side withdraw message without waiting for the
|
|
@@ -36431,50 +37023,68 @@ var MoneyMarketService = class _MoneyMarketService {
|
|
|
36431
37023
|
* @returns A pair of transaction hashes — `srcChainTxHash` (spoke) and `dstChainTxHash` (hub).
|
|
36432
37024
|
*/
|
|
36433
37025
|
async repay(_params) {
|
|
36434
|
-
|
|
36435
|
-
|
|
36436
|
-
|
|
36437
|
-
|
|
36438
|
-
|
|
36439
|
-
|
|
36440
|
-
|
|
36441
|
-
|
|
36442
|
-
|
|
36443
|
-
ok: false,
|
|
36444
|
-
|
|
36445
|
-
|
|
36446
|
-
|
|
36447
|
-
|
|
36448
|
-
|
|
36449
|
-
|
|
36450
|
-
|
|
36451
|
-
|
|
37026
|
+
return this.config.analytics.trackResult(
|
|
37027
|
+
"moneyMarket",
|
|
37028
|
+
"repay",
|
|
37029
|
+
async () => {
|
|
37030
|
+
const { params, timeout = DEFAULT_RELAY_TX_TIMEOUT } = _params;
|
|
37031
|
+
const srcChainKey = params.srcChainKey;
|
|
37032
|
+
const baseCtx = { srcChainKey, dstChainKey: params.dstChainKey, action: "repay" };
|
|
37033
|
+
try {
|
|
37034
|
+
const txResult = await this.createRepayIntent(_params);
|
|
37035
|
+
if (!txResult.ok) return { ok: false, error: txResult.error };
|
|
37036
|
+
const verify = await this.spoke.verifyTxHash({ txHash: txResult.value.tx, chainKey: srcChainKey });
|
|
37037
|
+
if (!verify.ok) {
|
|
37038
|
+
return {
|
|
37039
|
+
ok: false,
|
|
37040
|
+
error: verifyFailed("moneyMarket", verify.error, baseCtx)
|
|
37041
|
+
};
|
|
37042
|
+
}
|
|
37043
|
+
if (isHubChainKeyType(srcChainKey)) {
|
|
37044
|
+
return {
|
|
37045
|
+
ok: true,
|
|
37046
|
+
value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: txResult.value.tx }
|
|
37047
|
+
};
|
|
37048
|
+
}
|
|
37049
|
+
const packet = await relayTxAndWaitPacket({
|
|
37050
|
+
srcTxHash: txResult.value.tx,
|
|
37051
|
+
data: txResult.value.relayData,
|
|
37052
|
+
chainKey: srcChainKey,
|
|
37053
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
37054
|
+
timeout
|
|
37055
|
+
});
|
|
37056
|
+
if (!packet.ok)
|
|
37057
|
+
return {
|
|
37058
|
+
ok: false,
|
|
37059
|
+
error: mapRelayFailure(packet.error, {
|
|
37060
|
+
feature: "moneyMarket",
|
|
37061
|
+
action: baseCtx.action,
|
|
37062
|
+
srcChainKey: baseCtx.srcChainKey,
|
|
37063
|
+
dstChainKey: baseCtx.dstChainKey
|
|
37064
|
+
})
|
|
37065
|
+
};
|
|
37066
|
+
return { ok: true, value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: packet.value.dst_tx_hash } };
|
|
37067
|
+
} catch (error) {
|
|
37068
|
+
if (isMoneyMarketOrchestrationError(error)) return { ok: false, error };
|
|
37069
|
+
return {
|
|
37070
|
+
ok: false,
|
|
37071
|
+
error: executionFailed("moneyMarket", error, { ...baseCtx, phase: "intentCreation" })
|
|
37072
|
+
};
|
|
37073
|
+
}
|
|
37074
|
+
},
|
|
37075
|
+
{
|
|
37076
|
+
start: () => ({
|
|
37077
|
+
srcChainKey: _params.params.srcChainKey,
|
|
37078
|
+
srcAddress: _params.params.srcAddress,
|
|
37079
|
+
dstChainKey: _params.params.dstChainKey,
|
|
37080
|
+
dstAddress: _params.params.dstAddress,
|
|
37081
|
+
token: _params.params.token,
|
|
37082
|
+
amount: _params.params.amount
|
|
37083
|
+
}),
|
|
37084
|
+
success: (value) => ({ srcChainTxHash: value.srcChainTxHash, dstChainTxHash: value.dstChainTxHash }),
|
|
37085
|
+
failure: (error) => ({ code: error.code })
|
|
36452
37086
|
}
|
|
36453
|
-
|
|
36454
|
-
srcTxHash: txResult.value.tx,
|
|
36455
|
-
data: txResult.value.relayData,
|
|
36456
|
-
chainKey: srcChainKey,
|
|
36457
|
-
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
36458
|
-
timeout
|
|
36459
|
-
});
|
|
36460
|
-
if (!packet.ok)
|
|
36461
|
-
return {
|
|
36462
|
-
ok: false,
|
|
36463
|
-
error: mapRelayFailure(packet.error, {
|
|
36464
|
-
feature: "moneyMarket",
|
|
36465
|
-
action: baseCtx.action,
|
|
36466
|
-
srcChainKey: baseCtx.srcChainKey,
|
|
36467
|
-
dstChainKey: baseCtx.dstChainKey
|
|
36468
|
-
})
|
|
36469
|
-
};
|
|
36470
|
-
return { ok: true, value: { srcChainTxHash: txResult.value.tx, dstChainTxHash: packet.value.dst_tx_hash } };
|
|
36471
|
-
} catch (error) {
|
|
36472
|
-
if (isMoneyMarketOrchestrationError(error)) return { ok: false, error };
|
|
36473
|
-
return {
|
|
36474
|
-
ok: false,
|
|
36475
|
-
error: executionFailed("moneyMarket", error, { ...baseCtx, phase: "intentCreation" })
|
|
36476
|
-
};
|
|
36477
|
-
}
|
|
37087
|
+
);
|
|
36478
37088
|
}
|
|
36479
37089
|
/**
|
|
36480
37090
|
* Build and optionally broadcast the spoke-side repay transaction without waiting for the
|
|
@@ -37175,50 +37785,67 @@ var PartnerFeeClaimService = class {
|
|
|
37175
37785
|
* unsigned raw transaction (`raw: true`). Returns an error on failure.
|
|
37176
37786
|
*/
|
|
37177
37787
|
async setSwapPreference(_params) {
|
|
37178
|
-
|
|
37179
|
-
|
|
37180
|
-
|
|
37181
|
-
|
|
37182
|
-
|
|
37183
|
-
|
|
37184
|
-
|
|
37185
|
-
|
|
37186
|
-
|
|
37187
|
-
|
|
37188
|
-
from: params.srcAddress,
|
|
37189
|
-
to: this.protocolIntentsContract,
|
|
37190
|
-
value: 0n,
|
|
37191
|
-
data: encodeFunctionData({
|
|
37192
|
-
abi: ProtocolIntentsAbi,
|
|
37193
|
-
functionName: "setAutoSwapPreferences",
|
|
37194
|
-
args: [
|
|
37788
|
+
return this.config.analytics.trackResult(
|
|
37789
|
+
"partner",
|
|
37790
|
+
"setSwapPreference",
|
|
37791
|
+
async () => {
|
|
37792
|
+
const { params, walletProvider, raw } = _params;
|
|
37793
|
+
try {
|
|
37794
|
+
invariant(isHubChainKeyType(params.srcChainKey), "PartnerFeeClaimService only supports Sonic spoke provider");
|
|
37795
|
+
invariant(this.protocolIntentsContract, "protocolIntentsContract is not configured in solver config");
|
|
37796
|
+
const outputToken = params.dstChainKey !== this.hubProvider.chainConfig.chain.key ? this.hubProvider.config.getSpokeTokenFromOriginalAssetAddress(params.dstChainKey, params.outputToken)?.hubAsset : params.outputToken;
|
|
37797
|
+
invariant(
|
|
37195
37798
|
outputToken,
|
|
37196
|
-
|
|
37197
|
-
|
|
37198
|
-
|
|
37199
|
-
|
|
37200
|
-
|
|
37201
|
-
|
|
37202
|
-
|
|
37203
|
-
|
|
37204
|
-
|
|
37205
|
-
|
|
37799
|
+
`hub asset not found for spoke chain token (params.outputToken): ${params.outputToken} with chain key: ${params.dstChainKey}`
|
|
37800
|
+
);
|
|
37801
|
+
const rawTx = {
|
|
37802
|
+
from: params.srcAddress,
|
|
37803
|
+
to: this.protocolIntentsContract,
|
|
37804
|
+
value: 0n,
|
|
37805
|
+
data: encodeFunctionData({
|
|
37806
|
+
abi: ProtocolIntentsAbi,
|
|
37807
|
+
functionName: "setAutoSwapPreferences",
|
|
37808
|
+
args: [
|
|
37809
|
+
outputToken,
|
|
37810
|
+
BigInt(getIntentRelayChainId(params.dstChainKey)),
|
|
37811
|
+
encodeAddress(params.dstChainKey, params.dstAddress)
|
|
37812
|
+
]
|
|
37813
|
+
})
|
|
37814
|
+
};
|
|
37815
|
+
if (raw) {
|
|
37816
|
+
return {
|
|
37817
|
+
ok: true,
|
|
37818
|
+
value: rawTx
|
|
37819
|
+
};
|
|
37820
|
+
}
|
|
37821
|
+
invariant(
|
|
37822
|
+
isEvmWalletProviderType(walletProvider),
|
|
37823
|
+
"PartnerFeeClaimService only supports Evm (sonic) wallet provider"
|
|
37824
|
+
);
|
|
37825
|
+
const txHash = await walletProvider.sendTransaction(rawTx);
|
|
37826
|
+
return {
|
|
37827
|
+
ok: true,
|
|
37828
|
+
value: txHash
|
|
37829
|
+
};
|
|
37830
|
+
} catch (error) {
|
|
37831
|
+
return {
|
|
37832
|
+
ok: false,
|
|
37833
|
+
error
|
|
37834
|
+
};
|
|
37835
|
+
}
|
|
37836
|
+
},
|
|
37837
|
+
{
|
|
37838
|
+
start: () => ({
|
|
37839
|
+
srcChainKey: _params.params.srcChainKey,
|
|
37840
|
+
srcAddress: _params.params.srcAddress,
|
|
37841
|
+
outputToken: _params.params.outputToken,
|
|
37842
|
+
dstChainKey: _params.params.dstChainKey,
|
|
37843
|
+
dstAddress: _params.params.dstAddress
|
|
37844
|
+
}),
|
|
37845
|
+
success: (value) => ({ txHash: value }),
|
|
37846
|
+
failure: (error) => ({ code: isSodaxError(error) ? error.code : void 0 })
|
|
37206
37847
|
}
|
|
37207
|
-
|
|
37208
|
-
isEvmWalletProviderType(walletProvider),
|
|
37209
|
-
"PartnerFeeClaimService only supports Evm (sonic) wallet provider"
|
|
37210
|
-
);
|
|
37211
|
-
const txHash = await walletProvider.sendTransaction(rawTx);
|
|
37212
|
-
return {
|
|
37213
|
-
ok: true,
|
|
37214
|
-
value: txHash
|
|
37215
|
-
};
|
|
37216
|
-
} catch (error) {
|
|
37217
|
-
return {
|
|
37218
|
-
ok: false,
|
|
37219
|
-
error
|
|
37220
|
-
};
|
|
37221
|
-
}
|
|
37848
|
+
);
|
|
37222
37849
|
}
|
|
37223
37850
|
/**
|
|
37224
37851
|
* Checks whether a hub-chain ERC-20 token is already approved for the ProtocolIntents contract.
|
|
@@ -37330,6 +37957,11 @@ var PartnerFeeClaimService = class {
|
|
|
37330
37957
|
* This is the low-level building block. Use `swap` for the full flow that also waits for
|
|
37331
37958
|
* the solver to execute the intent.
|
|
37332
37959
|
*
|
|
37960
|
+
* Guards against same-token intents: if the configured output token equals `fromToken` the solver
|
|
37961
|
+
* cannot fill the swap, so the call is rejected with `VALIDATION_FAILED` before any transaction is
|
|
37962
|
+
* built. The guard fails closed — if the preference lookup fails the call returns that error rather
|
|
37963
|
+
* than submitting an intent that may become unfillable.
|
|
37964
|
+
*
|
|
37333
37965
|
* @param _params - Action descriptor containing:
|
|
37334
37966
|
* - `params.srcChainKey` — must be the hub chain key (Sonic).
|
|
37335
37967
|
* - `params.srcAddress` — partner's EVM address; also used as the intent creator.
|
|
@@ -37353,6 +37985,25 @@ var PartnerFeeClaimService = class {
|
|
|
37353
37985
|
this.config.solver.protocolIntentsContract,
|
|
37354
37986
|
"protocolIntentsContract is not configured in solver config"
|
|
37355
37987
|
);
|
|
37988
|
+
const prefs = await this.getAutoSwapPreferences(params.srcAddress);
|
|
37989
|
+
if (!prefs.ok) return prefs;
|
|
37990
|
+
if (prefs.value.outputToken.toLowerCase() === params.fromToken.toLowerCase()) {
|
|
37991
|
+
return {
|
|
37992
|
+
ok: false,
|
|
37993
|
+
error: new SodaxError(
|
|
37994
|
+
"VALIDATION_FAILED",
|
|
37995
|
+
"Auto-swap output token equals the fee token; the solver cannot swap a token into itself. Withdraw the fee token directly (bridge/transfer) or change the swap preference before claiming.",
|
|
37996
|
+
{
|
|
37997
|
+
feature: "partner",
|
|
37998
|
+
context: {
|
|
37999
|
+
action: "createIntentAutoSwap",
|
|
38000
|
+
fromToken: params.fromToken,
|
|
38001
|
+
outputToken: prefs.value.outputToken
|
|
38002
|
+
}
|
|
38003
|
+
}
|
|
38004
|
+
)
|
|
38005
|
+
};
|
|
38006
|
+
}
|
|
37356
38007
|
const minOutputAmount = 0n;
|
|
37357
38008
|
const rawTx = {
|
|
37358
38009
|
from: params.srcAddress,
|
|
@@ -37400,47 +38051,218 @@ var PartnerFeeClaimService = class {
|
|
|
37400
38051
|
*
|
|
37401
38052
|
* On failure the `error` is tagged:
|
|
37402
38053
|
* - `WAIT_INTENT_AUTO_SWAP_FAILED` — transaction was submitted but receipt polling failed.
|
|
37403
|
-
* - Error from `createIntentAutoSwap` — if the initial submission failed
|
|
38054
|
+
* - Error from `createIntentAutoSwap` — if the initial submission failed, including
|
|
38055
|
+
* `VALIDATION_FAILED` when the output token equals the fee token (same-token guard) or the
|
|
38056
|
+
* preference lookup that backs the guard fails.
|
|
37404
38057
|
* - Error from `SolverApiService.postExecution` — if the solver notification failed.
|
|
37405
38058
|
*/
|
|
37406
38059
|
async swap(_params) {
|
|
37407
|
-
|
|
37408
|
-
|
|
37409
|
-
|
|
37410
|
-
|
|
38060
|
+
return this.config.analytics.trackResult(
|
|
38061
|
+
"partner",
|
|
38062
|
+
"swap",
|
|
38063
|
+
async () => {
|
|
38064
|
+
try {
|
|
38065
|
+
const txHash = await this.createIntentAutoSwap(_params);
|
|
38066
|
+
if (!txHash.ok) {
|
|
38067
|
+
return txHash;
|
|
38068
|
+
}
|
|
38069
|
+
let intentTxHash;
|
|
38070
|
+
try {
|
|
38071
|
+
const receipt = await this.hubProvider.publicClient.waitForTransactionReceipt({ hash: txHash.value });
|
|
38072
|
+
intentTxHash = receipt.transactionHash;
|
|
38073
|
+
} catch (error) {
|
|
38074
|
+
return {
|
|
38075
|
+
ok: false,
|
|
38076
|
+
error: new SodaxError(
|
|
38077
|
+
"EXECUTION_FAILED",
|
|
38078
|
+
error instanceof Error ? error.message : "waitIntentAutoSwap failed",
|
|
38079
|
+
{ feature: "partner", cause: error, context: { action: "waitAutoSwap", phase: "execution" } }
|
|
38080
|
+
)
|
|
38081
|
+
};
|
|
38082
|
+
}
|
|
38083
|
+
const solverExecutionResponse = await SolverApiService.postExecution(
|
|
38084
|
+
{ intent_tx_hash: intentTxHash },
|
|
38085
|
+
this.config.solver,
|
|
38086
|
+
this.config.logger
|
|
38087
|
+
);
|
|
38088
|
+
if (!solverExecutionResponse.ok) {
|
|
38089
|
+
return solverExecutionResponse;
|
|
38090
|
+
}
|
|
38091
|
+
return {
|
|
38092
|
+
ok: true,
|
|
38093
|
+
value: {
|
|
38094
|
+
srcTxHash: txHash.value,
|
|
38095
|
+
solverExecutionResponse: solverExecutionResponse.value,
|
|
38096
|
+
intentTxHash
|
|
38097
|
+
}
|
|
38098
|
+
};
|
|
38099
|
+
} catch (error) {
|
|
38100
|
+
return { ok: false, error };
|
|
38101
|
+
}
|
|
38102
|
+
},
|
|
38103
|
+
{
|
|
38104
|
+
start: () => ({
|
|
38105
|
+
srcChainKey: _params.params.srcChainKey,
|
|
38106
|
+
srcAddress: _params.params.srcAddress,
|
|
38107
|
+
fromToken: _params.params.fromToken,
|
|
38108
|
+
amount: _params.params.amount
|
|
38109
|
+
}),
|
|
38110
|
+
success: (value) => ({
|
|
38111
|
+
srcTxHash: value.srcTxHash,
|
|
38112
|
+
intentTxHash: value.intentTxHash
|
|
38113
|
+
}),
|
|
38114
|
+
failure: (error) => ({ code: isSodaxError(error) ? error.code : void 0 })
|
|
37411
38115
|
}
|
|
37412
|
-
|
|
37413
|
-
|
|
37414
|
-
|
|
37415
|
-
|
|
37416
|
-
|
|
38116
|
+
);
|
|
38117
|
+
}
|
|
38118
|
+
/**
|
|
38119
|
+
* Cancels a partner fee-claim auto-swap intent and refunds the input token to the partner.
|
|
38120
|
+
*
|
|
38121
|
+
* This targets the ProtocolIntents contract's own `cancelIntent(fromToken, toToken)`, which is
|
|
38122
|
+
* the only authorized cancel path for partner auto-swap intents: the intent's `creator` is the
|
|
38123
|
+
* ProtocolIntents contract (not the partner), so the generic `SwapService.cancelIntent` reverts
|
|
38124
|
+
* with `Unauthorized()`. ProtocolIntents looks up the caller's intent for the token pair, cancels
|
|
38125
|
+
* it in the main intents contract (as the creator), and transfers the locked `inputAmount` back
|
|
38126
|
+
* to the partner (`msg.sender`).
|
|
38127
|
+
*
|
|
38128
|
+
* Use this to recover funds stuck in an unfillable intent — most commonly a same-token claim
|
|
38129
|
+
* (`fromToken === toToken`) the solver refused to fill (see the guard in {@link swap}).
|
|
38130
|
+
*
|
|
38131
|
+
* @param _params - Action descriptor containing:
|
|
38132
|
+
* - `params.srcChainKey` — must be the hub chain key (Sonic).
|
|
38133
|
+
* - `params.srcAddress` — the partner's EVM address; must match the intent's owner.
|
|
38134
|
+
* - `params.fromToken` — the stuck intent's input (fee) token, hub-chain address.
|
|
38135
|
+
* - `params.toToken` — the stuck intent's output token, hub-chain address.
|
|
38136
|
+
* - `raw` — when `true`, returns the unsigned transaction object instead of submitting it.
|
|
38137
|
+
* - `walletProvider` — required when `raw` is `false`; must be an EVM wallet provider.
|
|
38138
|
+
* @returns A `Result` containing the submitted transaction hash (`raw: false`) or the unsigned
|
|
38139
|
+
* raw transaction (`raw: true`).
|
|
38140
|
+
*/
|
|
38141
|
+
async cancelIntent(_params) {
|
|
38142
|
+
return this.config.analytics.trackResult(
|
|
38143
|
+
"partner",
|
|
38144
|
+
"cancelIntent",
|
|
38145
|
+
async () => {
|
|
38146
|
+
const { params } = _params;
|
|
38147
|
+
try {
|
|
38148
|
+
invariant(isHubChainKeyType(params.srcChainKey), "PartnerFeeClaimService only supports Hub srcChainKey");
|
|
38149
|
+
invariant(
|
|
38150
|
+
isOptionalEvmWalletProviderType(_params.walletProvider),
|
|
38151
|
+
"PartnerFeeClaimService only supports Evm wallet provider"
|
|
38152
|
+
);
|
|
38153
|
+
invariant(this.protocolIntentsContract, "protocolIntentsContract is not configured in solver config");
|
|
38154
|
+
const rawTx = {
|
|
38155
|
+
from: params.srcAddress,
|
|
38156
|
+
to: this.protocolIntentsContract,
|
|
38157
|
+
value: 0n,
|
|
38158
|
+
data: encodeFunctionData({
|
|
38159
|
+
abi: ProtocolIntentsAbi,
|
|
38160
|
+
functionName: "cancelIntent",
|
|
38161
|
+
args: [params.fromToken, params.toToken]
|
|
38162
|
+
})
|
|
38163
|
+
};
|
|
38164
|
+
if (_params.raw) {
|
|
38165
|
+
return {
|
|
38166
|
+
ok: true,
|
|
38167
|
+
value: rawTx
|
|
38168
|
+
};
|
|
38169
|
+
}
|
|
38170
|
+
const txHash = await _params.walletProvider.sendTransaction(rawTx);
|
|
38171
|
+
return {
|
|
38172
|
+
ok: true,
|
|
38173
|
+
value: txHash
|
|
38174
|
+
};
|
|
38175
|
+
} catch (error) {
|
|
38176
|
+
return { ok: false, error };
|
|
38177
|
+
}
|
|
38178
|
+
},
|
|
38179
|
+
{
|
|
38180
|
+
start: () => ({
|
|
38181
|
+
srcChainKey: _params.params.srcChainKey,
|
|
38182
|
+
srcAddress: _params.params.srcAddress,
|
|
38183
|
+
fromToken: _params.params.fromToken,
|
|
38184
|
+
toToken: _params.params.toToken
|
|
38185
|
+
}),
|
|
38186
|
+
success: (value) => ({ txHash: value }),
|
|
38187
|
+
failure: (error) => ({ code: isSodaxError(error) ? error.code : void 0 })
|
|
38188
|
+
}
|
|
38189
|
+
);
|
|
38190
|
+
}
|
|
38191
|
+
/**
|
|
38192
|
+
* Returns the stored intent hash for a partner's `(user, fromToken, toToken)` token pair.
|
|
38193
|
+
*
|
|
38194
|
+
* A non-zero hash means an auto-swap intent currently exists for that pair (e.g. an unfilled
|
|
38195
|
+
* same-token claim) and can be cancelled via {@link cancelIntent}. A zero hash
|
|
38196
|
+
* (`0x000…0`) means there is no open intent for the pair.
|
|
38197
|
+
*
|
|
38198
|
+
* @param params.user - The partner's EVM address on Sonic.
|
|
38199
|
+
* @param params.fromToken - Input (fee) token, hub-chain address.
|
|
38200
|
+
* @param params.toToken - Output token, hub-chain address.
|
|
38201
|
+
* @returns A `Result` containing the intent hash, or an `Error` tagged `LOOKUP_FAILED`.
|
|
38202
|
+
*/
|
|
38203
|
+
async getUserIntent({ user, fromToken, toToken }) {
|
|
38204
|
+
try {
|
|
38205
|
+
invariant(this.protocolIntentsContract, "protocolIntentsContract is not configured in solver config");
|
|
38206
|
+
const intentHash = await this.hubProvider.publicClient.readContract({
|
|
38207
|
+
address: this.protocolIntentsContract,
|
|
38208
|
+
abi: ProtocolIntentsAbi,
|
|
38209
|
+
functionName: "getUserIntent",
|
|
38210
|
+
args: [user, fromToken, toToken]
|
|
38211
|
+
});
|
|
38212
|
+
return { ok: true, value: intentHash };
|
|
38213
|
+
} catch (error) {
|
|
38214
|
+
return { ok: false, error: lookupFailed("partner", "getUserIntent", error) };
|
|
38215
|
+
}
|
|
38216
|
+
}
|
|
38217
|
+
/**
|
|
38218
|
+
* Reads the full {@link Intent} details for a stored intent hash from the ProtocolIntents contract.
|
|
38219
|
+
*
|
|
38220
|
+
* Useful for displaying a stuck intent before cancelling it — e.g. the locked `inputAmount` and
|
|
38221
|
+
* `inputToken`. Pair with {@link getUserIntent} to resolve the hash from a token pair.
|
|
38222
|
+
*
|
|
38223
|
+
* @param intentHash - The intent hash (from {@link getUserIntent}).
|
|
38224
|
+
* @returns A `Result` containing the `Intent`, or an `Error` tagged `LOOKUP_FAILED`.
|
|
38225
|
+
*/
|
|
38226
|
+
async getIntentDetails(intentHash) {
|
|
38227
|
+
try {
|
|
38228
|
+
invariant(this.protocolIntentsContract, "protocolIntentsContract is not configured in solver config");
|
|
38229
|
+
const intent = await this.hubProvider.publicClient.readContract({
|
|
38230
|
+
address: this.protocolIntentsContract,
|
|
38231
|
+
abi: ProtocolIntentsAbi,
|
|
38232
|
+
functionName: "getIntentDetails",
|
|
38233
|
+
args: [intentHash]
|
|
38234
|
+
});
|
|
38235
|
+
if (!this.config.isValidIntentRelayChainId(intent.srcChain) || !this.config.isValidIntentRelayChainId(intent.dstChain)) {
|
|
37417
38236
|
return {
|
|
37418
38237
|
ok: false,
|
|
37419
|
-
error:
|
|
37420
|
-
"
|
|
37421
|
-
|
|
37422
|
-
|
|
38238
|
+
error: lookupFailed(
|
|
38239
|
+
"partner",
|
|
38240
|
+
"getIntentDetails",
|
|
38241
|
+
new Error(`Invalid intent relay chain id: ${intent.srcChain} or ${intent.dstChain}`)
|
|
37423
38242
|
)
|
|
37424
38243
|
};
|
|
37425
38244
|
}
|
|
37426
|
-
const solverExecutionResponse = await SolverApiService.postExecution(
|
|
37427
|
-
{ intent_tx_hash: intentTxHash },
|
|
37428
|
-
this.config.solver,
|
|
37429
|
-
this.config.logger
|
|
37430
|
-
);
|
|
37431
|
-
if (!solverExecutionResponse.ok) {
|
|
37432
|
-
return solverExecutionResponse;
|
|
37433
|
-
}
|
|
37434
38245
|
return {
|
|
37435
38246
|
ok: true,
|
|
37436
38247
|
value: {
|
|
37437
|
-
|
|
37438
|
-
|
|
37439
|
-
|
|
38248
|
+
intentId: intent.intentId,
|
|
38249
|
+
creator: intent.creator,
|
|
38250
|
+
inputToken: intent.inputToken,
|
|
38251
|
+
outputToken: intent.outputToken,
|
|
38252
|
+
inputAmount: intent.inputAmount,
|
|
38253
|
+
minOutputAmount: intent.minOutputAmount,
|
|
38254
|
+
deadline: intent.deadline,
|
|
38255
|
+
allowPartialFill: intent.allowPartialFill,
|
|
38256
|
+
srcChain: intent.srcChain,
|
|
38257
|
+
dstChain: intent.dstChain,
|
|
38258
|
+
srcAddress: intent.srcAddress,
|
|
38259
|
+
dstAddress: intent.dstAddress,
|
|
38260
|
+
solver: intent.solver,
|
|
38261
|
+
data: intent.data
|
|
37440
38262
|
}
|
|
37441
38263
|
};
|
|
37442
38264
|
} catch (error) {
|
|
37443
|
-
return { ok: false, error };
|
|
38265
|
+
return { ok: false, error: lookupFailed("partner", "getIntentDetails", error) };
|
|
37444
38266
|
}
|
|
37445
38267
|
}
|
|
37446
38268
|
};
|
|
@@ -37575,42 +38397,62 @@ var RecoveryService = class {
|
|
|
37575
38397
|
* transaction object when `raw: true`, or the broadcast transaction hash when `raw: false`.
|
|
37576
38398
|
*/
|
|
37577
38399
|
async withdrawHubAsset(_params) {
|
|
37578
|
-
|
|
37579
|
-
|
|
37580
|
-
|
|
37581
|
-
|
|
37582
|
-
{
|
|
37583
|
-
|
|
37584
|
-
|
|
37585
|
-
|
|
37586
|
-
|
|
37587
|
-
|
|
37588
|
-
|
|
37589
|
-
|
|
37590
|
-
|
|
37591
|
-
|
|
37592
|
-
|
|
37593
|
-
|
|
37594
|
-
|
|
37595
|
-
|
|
37596
|
-
|
|
37597
|
-
|
|
37598
|
-
|
|
37599
|
-
|
|
37600
|
-
|
|
37601
|
-
|
|
37602
|
-
|
|
37603
|
-
|
|
37604
|
-
|
|
37605
|
-
|
|
37606
|
-
|
|
37607
|
-
|
|
37608
|
-
|
|
37609
|
-
|
|
37610
|
-
|
|
37611
|
-
|
|
37612
|
-
|
|
37613
|
-
|
|
38400
|
+
return this.config.analytics.trackResult(
|
|
38401
|
+
"recovery",
|
|
38402
|
+
"withdrawHubAsset",
|
|
38403
|
+
async () => {
|
|
38404
|
+
const { params } = _params;
|
|
38405
|
+
try {
|
|
38406
|
+
const hubWallet = await this.hubProvider.getUserHubWalletAddress(params.srcAddress, params.srcChainKey);
|
|
38407
|
+
const payload = EvmAssetManagerService.withdrawAssetData(
|
|
38408
|
+
{
|
|
38409
|
+
token: params.token,
|
|
38410
|
+
to: encodeAddress(params.srcChainKey, params.srcAddress),
|
|
38411
|
+
amount: params.amount
|
|
38412
|
+
},
|
|
38413
|
+
this.hubProvider,
|
|
38414
|
+
params.srcChainKey
|
|
38415
|
+
);
|
|
38416
|
+
const coreParams = {
|
|
38417
|
+
srcChainKey: params.srcChainKey,
|
|
38418
|
+
srcAddress: params.srcAddress,
|
|
38419
|
+
dstChainKey: this.hubProvider.chainConfig.chain.key,
|
|
38420
|
+
dstAddress: hubWallet,
|
|
38421
|
+
payload
|
|
38422
|
+
};
|
|
38423
|
+
const sendMessageParams = _params.raw ? { ...coreParams, raw: true } : {
|
|
38424
|
+
...coreParams,
|
|
38425
|
+
raw: false,
|
|
38426
|
+
walletProvider: _params.walletProvider
|
|
38427
|
+
};
|
|
38428
|
+
const txResult = await this.spoke.sendMessage(sendMessageParams);
|
|
38429
|
+
if (!txResult.ok) return txResult;
|
|
38430
|
+
return {
|
|
38431
|
+
ok: true,
|
|
38432
|
+
value: txResult.value
|
|
38433
|
+
};
|
|
38434
|
+
} catch (error) {
|
|
38435
|
+
return {
|
|
38436
|
+
ok: false,
|
|
38437
|
+
error: new SodaxError(
|
|
38438
|
+
"EXECUTION_FAILED",
|
|
38439
|
+
error instanceof Error ? error.message : "withdrawHubAsset failed",
|
|
38440
|
+
{ feature: "recovery", cause: error, context: { action: "withdrawHubAsset", phase: "execution" } }
|
|
38441
|
+
)
|
|
38442
|
+
};
|
|
38443
|
+
}
|
|
38444
|
+
},
|
|
38445
|
+
{
|
|
38446
|
+
start: () => ({
|
|
38447
|
+
srcChainKey: _params.params.srcChainKey,
|
|
38448
|
+
srcAddress: _params.params.srcAddress,
|
|
38449
|
+
token: _params.params.token,
|
|
38450
|
+
amount: _params.params.amount
|
|
38451
|
+
}),
|
|
38452
|
+
success: (value) => ({ txHash: typeof value === "string" ? value : void 0 }),
|
|
38453
|
+
failure: (error) => ({ code: isSodaxError(error) ? error.code : void 0 })
|
|
38454
|
+
}
|
|
38455
|
+
);
|
|
37614
38456
|
}
|
|
37615
38457
|
};
|
|
37616
38458
|
|
|
@@ -38070,70 +38912,93 @@ var LeverageYieldService = class {
|
|
|
38070
38912
|
const { params } = _params;
|
|
38071
38913
|
const srcChainKey = params.srcChainKey;
|
|
38072
38914
|
const baseCtx = { srcChainKey, dstChainKey: params.dstChainKey, action: "vaultSwap" };
|
|
38073
|
-
|
|
38074
|
-
|
|
38075
|
-
|
|
38076
|
-
|
|
38077
|
-
|
|
38078
|
-
|
|
38079
|
-
|
|
38080
|
-
|
|
38081
|
-
|
|
38082
|
-
|
|
38083
|
-
|
|
38084
|
-
|
|
38085
|
-
|
|
38086
|
-
|
|
38087
|
-
|
|
38088
|
-
|
|
38089
|
-
|
|
38090
|
-
|
|
38091
|
-
|
|
38092
|
-
|
|
38093
|
-
|
|
38094
|
-
|
|
38095
|
-
|
|
38096
|
-
|
|
38097
|
-
|
|
38098
|
-
|
|
38099
|
-
|
|
38100
|
-
|
|
38101
|
-
|
|
38915
|
+
return this.config.analytics.trackResult(
|
|
38916
|
+
"leverageYield",
|
|
38917
|
+
"vaultSwap",
|
|
38918
|
+
async () => {
|
|
38919
|
+
try {
|
|
38920
|
+
const timeout = _params.timeout;
|
|
38921
|
+
const createIntentResult = await this.createVaultIntent(_params);
|
|
38922
|
+
if (!createIntentResult.ok) {
|
|
38923
|
+
return { ok: false, error: createIntentResult.error };
|
|
38924
|
+
}
|
|
38925
|
+
const { tx: spokeTxHash, intent, relayData } = createIntentResult.value;
|
|
38926
|
+
const verifyTxHashResult = await this.spoke.verifyTxHash({
|
|
38927
|
+
txHash: spokeTxHash,
|
|
38928
|
+
chainKey: srcChainKey
|
|
38929
|
+
});
|
|
38930
|
+
if (!verifyTxHashResult.ok) {
|
|
38931
|
+
return {
|
|
38932
|
+
ok: false,
|
|
38933
|
+
error: verifyFailed("leverageYield", verifyTxHashResult.error, baseCtx)
|
|
38934
|
+
};
|
|
38935
|
+
}
|
|
38936
|
+
let dstIntentTxHash;
|
|
38937
|
+
if (isHubChainKeyType(srcChainKey)) {
|
|
38938
|
+
dstIntentTxHash = spokeTxHash;
|
|
38939
|
+
} else {
|
|
38940
|
+
const packet = await relayTxAndWaitPacket({
|
|
38941
|
+
srcTxHash: spokeTxHash,
|
|
38942
|
+
data: relayData,
|
|
38943
|
+
chainKey: srcChainKey,
|
|
38944
|
+
relayerApiEndpoint: this.config.relay.relayerApiEndpoint,
|
|
38945
|
+
timeout
|
|
38946
|
+
});
|
|
38947
|
+
if (!packet.ok) {
|
|
38948
|
+
return {
|
|
38949
|
+
ok: false,
|
|
38950
|
+
error: mapRelayFailure(packet.error, { feature: "leverageYield", ...baseCtx })
|
|
38951
|
+
};
|
|
38952
|
+
}
|
|
38953
|
+
dstIntentTxHash = packet.value.dst_tx_hash;
|
|
38954
|
+
}
|
|
38955
|
+
const postExecResult = await this.notifySolver({
|
|
38956
|
+
intent_tx_hash: dstIntentTxHash
|
|
38957
|
+
});
|
|
38958
|
+
if (!postExecResult.ok) {
|
|
38959
|
+
return { ok: false, error: postExecResult.error };
|
|
38960
|
+
}
|
|
38961
|
+
return {
|
|
38962
|
+
ok: true,
|
|
38963
|
+
value: {
|
|
38964
|
+
solverExecutionResponse: postExecResult.value,
|
|
38965
|
+
intent,
|
|
38966
|
+
intentDeliveryInfo: {
|
|
38967
|
+
srcChainKey,
|
|
38968
|
+
srcTxHash: spokeTxHash,
|
|
38969
|
+
srcAddress: params.srcAddress,
|
|
38970
|
+
dstChainKey: params.dstChainKey,
|
|
38971
|
+
dstTxHash: dstIntentTxHash,
|
|
38972
|
+
dstAddress: params.dstAddress
|
|
38973
|
+
}
|
|
38974
|
+
}
|
|
38975
|
+
};
|
|
38976
|
+
} catch (error) {
|
|
38977
|
+
if (isLeverageYieldSwapError(error)) return { ok: false, error };
|
|
38102
38978
|
return {
|
|
38103
38979
|
ok: false,
|
|
38104
|
-
error:
|
|
38980
|
+
error: unknownFailed("leverageYield", error, baseCtx)
|
|
38105
38981
|
};
|
|
38106
38982
|
}
|
|
38107
|
-
|
|
38108
|
-
|
|
38109
|
-
|
|
38110
|
-
|
|
38111
|
-
|
|
38112
|
-
|
|
38113
|
-
|
|
38983
|
+
},
|
|
38984
|
+
{
|
|
38985
|
+
start: () => ({
|
|
38986
|
+
srcChainKey: _params.params.srcChainKey,
|
|
38987
|
+
dstChainKey: _params.params.dstChainKey,
|
|
38988
|
+
srcAddress: _params.params.srcAddress,
|
|
38989
|
+
dstAddress: _params.params.dstAddress,
|
|
38990
|
+
inputToken: _params.params.inputToken,
|
|
38991
|
+
outputToken: _params.params.outputToken,
|
|
38992
|
+
inputAmount: _params.params.inputAmount
|
|
38993
|
+
}),
|
|
38994
|
+
success: (value) => ({
|
|
38995
|
+
intentId: value.intent.intentId,
|
|
38996
|
+
srcTxHash: value.intentDeliveryInfo.srcTxHash,
|
|
38997
|
+
dstTxHash: value.intentDeliveryInfo.dstTxHash
|
|
38998
|
+
}),
|
|
38999
|
+
failure: (error) => ({ code: error.code })
|
|
38114
39000
|
}
|
|
38115
|
-
|
|
38116
|
-
ok: true,
|
|
38117
|
-
value: {
|
|
38118
|
-
solverExecutionResponse: postExecResult.value,
|
|
38119
|
-
intent,
|
|
38120
|
-
intentDeliveryInfo: {
|
|
38121
|
-
srcChainKey,
|
|
38122
|
-
srcTxHash: spokeTxHash,
|
|
38123
|
-
srcAddress: params.srcAddress,
|
|
38124
|
-
dstChainKey: params.dstChainKey,
|
|
38125
|
-
dstTxHash: dstIntentTxHash,
|
|
38126
|
-
dstAddress: params.dstAddress
|
|
38127
|
-
}
|
|
38128
|
-
}
|
|
38129
|
-
};
|
|
38130
|
-
} catch (error) {
|
|
38131
|
-
if (isLeverageYieldSwapError(error)) return { ok: false, error };
|
|
38132
|
-
return {
|
|
38133
|
-
ok: false,
|
|
38134
|
-
error: unknownFailed("leverageYield", error, baseCtx)
|
|
38135
|
-
};
|
|
38136
|
-
}
|
|
39001
|
+
);
|
|
38137
39002
|
}
|
|
38138
39003
|
/**
|
|
38139
39004
|
* Notifies the solver that the vault intent landed on the hub, triggering it to fill.
|
|
@@ -38510,6 +39375,7 @@ var Sodax = class {
|
|
|
38510
39375
|
// spoke service enabling spoke chain operations
|
|
38511
39376
|
constructor(options) {
|
|
38512
39377
|
const logger = resolveLogger(options?.logger);
|
|
39378
|
+
const analytics = resolveAnalytics(options?.analytics);
|
|
38513
39379
|
const fee = options?.fee;
|
|
38514
39380
|
this.instanceConfig = options ? mergeSodaxConfig(sodaxConfig, options) : sodaxConfig;
|
|
38515
39381
|
this.backendApi = new BackendApiService(this.instanceConfig.api, logger);
|
|
@@ -38518,6 +39384,7 @@ var Sodax = class {
|
|
|
38518
39384
|
config: this.instanceConfig,
|
|
38519
39385
|
userConfig: options,
|
|
38520
39386
|
logger,
|
|
39387
|
+
analytics,
|
|
38521
39388
|
fee
|
|
38522
39389
|
});
|
|
38523
39390
|
this.hubProvider = new EvmHubProvider({ config: this.config });
|
|
@@ -38599,4 +39466,4 @@ var isPartnerError = isCodeMember(PARTNER_CODES);
|
|
|
38599
39466
|
(*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
38600
39467
|
*/
|
|
38601
39468
|
|
|
38602
|
-
export { ALLOWANCE_CHECK_CODES, APPROVE_CODES, AssetService, BITCOIN_CHAIN_KEYS, BITCOIN_CHAIN_KEYS_SET, BTC_WALLET_ADDRESS_TYPES, BackendApiService, BalnSwapService, BigIntToHex, BigNumberZeroDecimal, BitcoinSpokeService, BnUSDMigrationService, BridgeService, CHAIN_KEYS, CHAIN_LOGO_BASE_URL, CONFIG_VERSION, CREATE_INTENT_CODES, ChainKeys, ChainTypeArr, ClService, ConfigService, CustomSorobanServer, CustomStellarAccount, DEFAULT_BACKEND_API_ENDPOINT, DEFAULT_BACKEND_API_HEADERS, DEFAULT_BACKEND_API_TIMEOUT, DEFAULT_DEADLINE_OFFSET, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, DexService, EVM_CHAIN_ID_TO_KEY, EVM_CHAIN_KEYS, EVM_CHAIN_KEYS_SET, EVM_SPOKE_ONLY_CHAIN_KEYS, EVM_SPOKE_ONLY_CHAIN_KEYS_SET, Erc20Service, Erc4626Service, EvmAssetManagerService, EvmHubProvider, EvmSolverService, EvmSpokeService, EvmVaultTokenService, FEE_PERCENTAGE_SCALE, GAS_ESTIMATION_CODES, HALF_RAY, HALF_WAD, HUB_CHAIN_KEY, HookKind, HookService, HttpRelayError, HubVaultSymbols, ICON_CHAIN_KEYS, ICON_CHAIN_KEYS_SET, ICON_TX_RESULT_WAIT_MAX_RETRY, INJECTIVE_CHAIN_KEYS, INJECTIVE_CHAIN_KEYS_SET, INTENT_CHAIN_IDS, IconSpokeService, IcxMigrationService, Injective20Token, InjectiveSpokeService, IntentCreatedEventAbi, IntentDataService, IntentDataType, IntentFilledEventAbi, IntentRelayChainIdToChainKey, IntentsAbi, LOOKUP_CODES, LTV_PRECISION, LendingPoolService, LeverageYieldService, LockupMultiplier, LockupPeriod, LsodaSymbols, LsodaTokens, MAX_UINT256, MigrationService, MintPositionEventAbi, MoneyMarketDataService, MoneyMarketService, NEAR_CHAIN_KEYS, NEAR_CHAIN_KEYS_SET, NEAR_DEFAULT_GAS, NEAR_STORAGE_DEPOSIT, NearSpokeService, PartnerFeeClaimService, PartnerService, Permit2Service, ProtocolIntentsAbi, RAY, RAY_DECIMALS, RELAY_ERROR_CODES, RadfiApiError, RadfiProvider, RecoveryService, RelayChainIdMap, SECONDS_PER_YEAR, SODAX_ERROR_CODES, SODAX_FEATURES, SOLANA_CHAIN_KEYS, SOLANA_CHAIN_KEYS_SET, SONIC_CHAIN_KEYS, SONIC_CHAIN_KEYS_SET, STACKS_CHAIN_KEYS, STACKS_CHAIN_KEYS_SET, STELLAR_CHAIN_KEYS, STELLAR_CHAIN_KEYS_SET, SUI_CHAIN_KEYS, SUI_CHAIN_KEYS_SET, SodaTokens, Sodax, SodaxError, SolanaSpokeService, SolverApiService, SolverIntentErrorCode, SolverIntentStatusCode, SonicSpokeService, SpokeService, StacksSpokeService, StakingLogic, StakingService, StatATokenAddresses, StellarSpokeService, SuiSpokeService, SupportedMigrationTokens, SwapService, USD_DECIMALS, UiPoolDataProviderService, VAULT_TOKEN_DECIMALS, WAD, WAD_RAY_RATIO, WEI_DECIMALS, adjustAmountByFee, allowanceCheckFailed, apiConfig, approveFailed, arbitrumSupportedTokens, assetManagerAbi, avalancheSupportedTokens, balnSwapAbi, baseChainInfo, baseSupportedTokens, binomialApproximatedRayPow, bitcoinSupportedTokens, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bridgeConfig, bridgeInvariant, bscSupportedTokens, calcOpReturnOutputVbytes, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, clPoolAbi, clPoolManagerAbi, clPositionManagerAbi, clQuoterAbi, clRouterAbi, clTickLensAbi, concentratedLiquidityConfig, connectionAbi, consoleLogger, convertTransactionInstructionToRaw, createInvariant, deepMerge, defaultHookAbi, detectBitcoinAddressType, dexConfig, dexInvariant, dexPools, encodeAddress, encodeBtcPayloadToBytes, encodeContractCalls, erc20Abi, erc4626Abi, estimateBitcoinTxSize, ethereumSupportedTokens, executionFailed, formatBasisPoints, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, gasEstimationFailed, getAllLegacybnUSDTokens, getAndFormatReserveEModes, getAssetManagerIdl, getAssetManagerProgram, getChainKeyFromRelayChainId, getChainType, getCompoundedBalance, getConcentratedLiquidityConfig, getConnectionIdl, getConnectionProgram, getEvmChainKeyByChainId, getEvmViemChain, getIconAddressBytes, getIntentRelayChainId, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getPacket, getProvider, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getSolverConfig, getSpokeHook, getSpokeHooks, getStagingSolverTokens, getSupportedSolverTokens, getTransactionPackets, getbnUSDToken, hexToBigInt, hexToSolanaAddress, hubConfig, hyper, hyperevmSupportedTokens, iconSupportedTokens, injectiveSupportedTokens, intentCreationFailed, isBalnMigrateParams, isBitcoinChainKey, isBitcoinChainKeyType, isBitcoinWalletProviderType, isBridgeAllowanceCheckError, isBridgeApproveError, isBridgeCreateIntentError, isBridgeError, isBridgeLookupError, isBridgeOrchestrationError, isCodeMember, isDexError, isEvmChainKey, isEvmChainKeyType, isEvmSpokeChainConfig, isEvmSpokeOnlyChainKey, isEvmSpokeOnlyChainKeyType, isEvmWalletProviderType, isFeatureError, isHookSupportedToken, isHubChainKey, isHubChainKeyType, isIconAddress, isIconChainKey, isIconChainKeyType, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveChainKey, isInjectiveChainKeyType, isJsonRpcPayloadResponse, isLegacybnUSDChainId, isLegacybnUSDToken, isLeverageYieldAllowanceCheckError, isLeverageYieldApproveError, isLeverageYieldCreateIntentError, isLeverageYieldError, isLeverageYieldLookupError, isLeverageYieldPostExecutionError, isLeverageYieldSwapError, isMigrateOrchestrationError, isMigrationAllowanceCheckError, isMigrationApproveError, isMigrationCreateIntentError, isMigrationError, isMigrationLookupError, isMoneyMarketAllowanceCheckError, isMoneyMarketApproveError, isMoneyMarketCreateIntentError, isMoneyMarketError, isMoneyMarketGasEstimationError, isMoneyMarketOrchestrationError, isNativeToken, isNearChainKey, isNearChainKeyType, isNewbnUSDChainId, isNewbnUSDToken, isOptionalBitcoinWalletProviderType, isOptionalEvmWalletProviderType, isOptionalStellarWalletProviderType, isPartnerError, isPartnerFeeAmount, isPartnerFeePercentage, isPostExecutionError, isRawDestinationParams, isRecoveryError, isResponseAddressType, isResponseSigningType, isRevertMigrationOrchestrationError, isSodaxError, isSolanaChainKey, isSolanaChainKeyType, isSolanaNativeToken, isSonicChainKey, isSonicChainKeyType, isSpokeApproveParamsEvmSpoke, isSpokeApproveParamsHub, isSpokeApproveParamsStellar, isSpokeChainKey, isSpokeIsAllowanceValidParamsEvmSpoke, isSpokeIsAllowanceValidParamsHub, isSpokeIsAllowanceValidParamsStellar, isStacksChainKey, isStacksChainKeyType, isStakeOrchestrationError, isStakingAllowanceCheckError, isStakingApproveError, isStakingCreateIntentError, isStakingError, isStakingInfoFetchError, isStakingOrchestrationError, isStellarChainKey, isStellarChainKeyType, isStellarWalletProviderType, isSubmitSwapTxResponse, isSubmitSwapTxStatusResponse, isSuiChainKey, isSuiChainKeyType, isSupportedBitcoinAddressType, isSwapCreateIntentError, isSwapError, isSwapSupportedToken, isUndefinedOrValidWalletProviderForChainKey, isUnifiedBnUSDMigrateParams, isValidWalletProviderForChainKey, kaiaSupportedTokens, leverageYieldConfig, leverageYieldInvariant, leverageYieldVaults, lightlinkSupportedTokens, lookupFailed, mapRelayFailure, mergeSodaxConfig, messageOf, migrationInvariant, mintPositionParamsAbi, mmInvariant, modifyLiquidityParamsAbi, moneyMarketConfig, moneyMarketReserveAssets, moneyMarketSupportedTokens, nativeToUSD, nearSupportedTokens, newbnUSDSpokeChainIds, normalize, normalizeBN, normalizePsbtToBase64, normalizeSignatureToBase64, normalizedToUsd, optimismSupportedTokens, pancakeSwapInfinityDefaultHookAbi, pancakeSwapInfinityPoolManagerAbi, pancakeSwapInfinityPositionManagerAbi, parseToStroops, parseTokenArrayFromJson, partnerInvariant, permit2Abi, polygonSupportedTokens, poolAbi, poolKeyAbi, randomUint256, rayDiv, rayMul, rayPow, rayToWad, recoveryInvariant, redbellySupportedTokens, relayConfig, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, resolveLogger, retry, reverseEncodeAddress, serializeAddressData, silentLogger, sleep, sodaxConfig, sodaxInvariant, solanaSupportedTokens, solverConfig, sonicSupportedTokens, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, spokeChainKeysSet, spokeHooks, stacksSupportedTokens, stagingSwapSupportedTokens, stakedSodaAbi, stakingInvariant, stakingRouterAbi, stataTokenFactoryAbi, stellarSupportedTokens, submitTransaction, suiSupportedTokens, supportedSpokeChains, supportedTokensByChain, swapExactInSingleParamsAbi, swapInvariant, swapSupportedTokens, swapsConfig, uiPoolDataAbi, universalRouterAbi, unknownFailed, usesBip322MessageSigning, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, verifyFailed, wadToRay, waitForStacksTransaction, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
|
|
39469
|
+
export { ALLOWANCE_CHECK_CODES, APPROVE_CODES, AssetService, BITCOIN_CHAIN_KEYS, BITCOIN_CHAIN_KEYS_SET, BTC_WALLET_ADDRESS_TYPES, BackendApiService, BalnSwapService, BigIntToHex, BigNumberZeroDecimal, BitcoinSpokeService, BnUSDMigrationService, BridgeService, CHAIN_KEYS, CHAIN_LOGO_BASE_URL, CONFIG_VERSION, CREATE_INTENT_CODES, ChainKeys, ChainTypeArr, ClService, ConfigService, CustomSorobanServer, CustomStellarAccount, DEFAULT_BACKEND_API_ENDPOINT, DEFAULT_BACKEND_API_HEADERS, DEFAULT_BACKEND_API_TIMEOUT, DEFAULT_DEADLINE_OFFSET, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, DexService, EVM_CHAIN_ID_TO_KEY, EVM_CHAIN_KEYS, EVM_CHAIN_KEYS_SET, EVM_SPOKE_ONLY_CHAIN_KEYS, EVM_SPOKE_ONLY_CHAIN_KEYS_SET, Erc20Service, Erc4626Service, EvmAssetManagerService, EvmHubProvider, EvmSolverService, EvmSpokeService, EvmVaultTokenService, FEE_PERCENTAGE_SCALE, GAS_ESTIMATION_CODES, HALF_RAY, HALF_WAD, HUB_CHAIN_KEY, HookKind, HookService, HttpRelayError, HubVaultSymbols, ICON_CHAIN_KEYS, ICON_CHAIN_KEYS_SET, ICON_TX_RESULT_WAIT_MAX_RETRY, INJECTIVE_CHAIN_KEYS, INJECTIVE_CHAIN_KEYS_SET, INTENT_CHAIN_IDS, IconSpokeService, IcxMigrationService, Injective20Token, InjectiveSpokeService, IntentCreatedEventAbi, IntentDataService, IntentDataType, IntentFilledEventAbi, IntentRelayChainIdToChainKey, IntentsAbi, LOOKUP_CODES, LTV_PRECISION, LendingPoolService, LeverageYieldService, LockupMultiplier, LockupPeriod, LsodaSymbols, LsodaTokens, MAX_UINT256, MigrationService, MintPositionEventAbi, MoneyMarketDataService, MoneyMarketService, NEAR_CHAIN_KEYS, NEAR_CHAIN_KEYS_SET, NEAR_DEFAULT_GAS, NEAR_STORAGE_DEPOSIT, NearSpokeService, PartnerFeeClaimService, PartnerService, Permit2Service, ProtocolIntentsAbi, RAY, RAY_DECIMALS, RELAY_ERROR_CODES, RadfiApiError, RadfiProvider, RecoveryService, RelayChainIdMap, SECONDS_PER_YEAR, SODAX_ERROR_CODES, SODAX_FEATURES, SOLANA_CHAIN_KEYS, SOLANA_CHAIN_KEYS_SET, SONIC_CHAIN_KEYS, SONIC_CHAIN_KEYS_SET, STACKS_CHAIN_KEYS, STACKS_CHAIN_KEYS_SET, STELLAR_CHAIN_KEYS, STELLAR_CHAIN_KEYS_SET, SUI_CHAIN_KEYS, SUI_CHAIN_KEYS_SET, SodaTokens, Sodax, SodaxError, SolanaSpokeService, SolverApiService, SolverIntentErrorCode, SolverIntentStatusCode, SonicSpokeService, SpokeService, StacksSpokeService, StakingLogic, StakingService, StatATokenAddresses, StellarSpokeService, SuiSpokeService, SupportedMigrationTokens, SwapService, USD_DECIMALS, UiPoolDataProviderService, VAULT_TOKEN_DECIMALS, WAD, WAD_RAY_RATIO, WEI_DECIMALS, adjustAmountByFee, allowanceCheckFailed, apiConfig, approveFailed, arbitrumSupportedTokens, assetManagerAbi, avalancheSupportedTokens, balnSwapAbi, baseChainInfo, baseSupportedTokens, binomialApproximatedRayPow, bitcoinSupportedTokens, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bridgeConfig, bridgeInvariant, bscSupportedTokens, calcOpReturnOutputVbytes, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, clPoolAbi, clPoolManagerAbi, clPositionManagerAbi, clQuoterAbi, clRouterAbi, clTickLensAbi, concentratedLiquidityConfig, connectionAbi, consoleLogger, convertTransactionInstructionToRaw, createInvariant, deepMerge, defaultHookAbi, detectBitcoinAddressType, dexConfig, dexInvariant, dexPools, encodeAddress, encodeBtcPayloadToBytes, encodeContractCalls, erc20Abi, erc4626Abi, estimateBitcoinTxSize, ethereumSupportedTokens, executionFailed, formatBasisPoints, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, gasEstimationFailed, getAllLegacybnUSDTokens, getAndFormatReserveEModes, getAssetManagerIdl, getAssetManagerProgram, getChainKeyFromRelayChainId, getChainType, getCompoundedBalance, getConcentratedLiquidityConfig, getConnectionIdl, getConnectionProgram, getEvmChainKeyByChainId, getEvmViemChain, getIconAddressBytes, getIntentRelayChainId, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getPacket, getProvider, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getSolverConfig, getSpokeHook, getSpokeHooks, getStagingSolverTokens, getSupportedSolverTokens, getTransactionPackets, getbnUSDToken, hexToBigInt, hexToSolanaAddress, hubConfig, hyper, hyperevmSupportedTokens, iconSupportedTokens, injectiveSupportedTokens, intentCreationFailed, isBalnMigrateParams, isBitcoinChainKey, isBitcoinChainKeyType, isBitcoinWalletProviderType, isBridgeAllowanceCheckError, isBridgeApproveError, isBridgeCreateIntentError, isBridgeError, isBridgeLookupError, isBridgeOrchestrationError, isCodeMember, isDexError, isEvmChainKey, isEvmChainKeyType, isEvmSpokeChainConfig, isEvmSpokeOnlyChainKey, isEvmSpokeOnlyChainKeyType, isEvmWalletProviderType, isFeatureError, isHookSupportedToken, isHubChainKey, isHubChainKeyType, isIconAddress, isIconChainKey, isIconChainKeyType, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveChainKey, isInjectiveChainKeyType, isJsonRpcPayloadResponse, isLegacybnUSDChainId, isLegacybnUSDToken, isLeverageYieldAllowanceCheckError, isLeverageYieldApproveError, isLeverageYieldCreateIntentError, isLeverageYieldError, isLeverageYieldLookupError, isLeverageYieldPostExecutionError, isLeverageYieldSwapError, isMigrateOrchestrationError, isMigrationAllowanceCheckError, isMigrationApproveError, isMigrationCreateIntentError, isMigrationError, isMigrationLookupError, isMoneyMarketAllowanceCheckError, isMoneyMarketApproveError, isMoneyMarketCreateIntentError, isMoneyMarketError, isMoneyMarketGasEstimationError, isMoneyMarketOrchestrationError, isNativeToken, isNearChainKey, isNearChainKeyType, isNewbnUSDChainId, isNewbnUSDToken, isOptionalBitcoinWalletProviderType, isOptionalEvmWalletProviderType, isOptionalStellarWalletProviderType, isPartnerError, isPartnerFeeAmount, isPartnerFeePercentage, isPostExecutionError, isRawDestinationParams, isRecoveryError, isResponseAddressType, isResponseSigningType, isRevertMigrationOrchestrationError, isSodaxError, isSolanaChainKey, isSolanaChainKeyType, isSolanaNativeToken, isSonicChainKey, isSonicChainKeyType, isSpokeApproveParamsEvmSpoke, isSpokeApproveParamsHub, isSpokeApproveParamsStellar, isSpokeChainKey, isSpokeIsAllowanceValidParamsEvmSpoke, isSpokeIsAllowanceValidParamsHub, isSpokeIsAllowanceValidParamsStellar, isStacksChainKey, isStacksChainKeyType, isStakeOrchestrationError, isStakingAllowanceCheckError, isStakingApproveError, isStakingCreateIntentError, isStakingError, isStakingInfoFetchError, isStakingOrchestrationError, isStellarChainKey, isStellarChainKeyType, isStellarWalletProviderType, isSubmitSwapTxResponse, isSubmitSwapTxStatusResponse, isSuiChainKey, isSuiChainKeyType, isSupportedBitcoinAddressType, isSwapCreateIntentError, isSwapError, isSwapSupportedToken, isUndefinedOrValidWalletProviderForChainKey, isUnifiedBnUSDMigrateParams, isValidWalletProviderForChainKey, kaiaSupportedTokens, leverageYieldConfig, leverageYieldInvariant, leverageYieldVaults, lightlinkSupportedTokens, lookupFailed, mapRelayFailure, mergeSodaxConfig, messageOf, migrationInvariant, mintPositionParamsAbi, mmInvariant, modifyLiquidityParamsAbi, moneyMarketConfig, moneyMarketReserveAssets, moneyMarketSupportedTokens, nativeToUSD, nearSupportedTokens, newbnUSDSpokeChainIds, noopAnalytics, normalize, normalizeBN, normalizePsbtToBase64, normalizeSignatureToBase64, normalizedToUsd, optimismSupportedTokens, pancakeSwapInfinityDefaultHookAbi, pancakeSwapInfinityPoolManagerAbi, pancakeSwapInfinityPositionManagerAbi, parseToStroops, parseTokenArrayFromJson, partnerInvariant, permit2Abi, polygonSupportedTokens, poolAbi, poolKeyAbi, randomUint256, rayDiv, rayMul, rayPow, rayToWad, recoveryInvariant, redbellySupportedTokens, relayConfig, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, resolveAnalytics, resolveLogger, retry, reverseEncodeAddress, serializeAddressData, silentLogger, sleep, sodaxConfig, sodaxInvariant, solanaSupportedTokens, solverConfig, sonicSupportedTokens, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, spokeChainKeysSet, spokeHooks, stacksSupportedTokens, stagingSwapSupportedTokens, stakedSodaAbi, stakingInvariant, stakingRouterAbi, stataTokenFactoryAbi, stellarSupportedTokens, submitTransaction, suiSupportedTokens, supportedSpokeChains, supportedTokensByChain, swapExactInSingleParamsAbi, swapInvariant, swapSupportedTokens, swapsConfig, uiPoolDataAbi, universalRouterAbi, unknownFailed, usesBip322MessageSigning, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, verifyFailed, wadToRay, waitForStacksTransaction, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
|