0xtrails 0.2.2 → 0.2.5
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/aave.d.ts +8 -0
- package/dist/aave.d.ts.map +1 -1
- package/dist/{ccip-ConT1gDe.js → ccip-CXlshvBY.js} +1 -1
- package/dist/chains.d.ts +5 -1
- package/dist/chains.d.ts.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/constants.d.ts +5 -4
- package/dist/constants.d.ts.map +1 -1
- package/dist/error.d.ts +1 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/estimate.d.ts +52 -0
- package/dist/estimate.d.ts.map +1 -1
- package/dist/{index-CMh8uEbV.js → index-_QuyGrjU.js} +86304 -83380
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/intentEntrypoint.d.ts +0 -8
- package/dist/intentEntrypoint.d.ts.map +1 -1
- package/dist/intents.d.ts +40 -0
- package/dist/intents.d.ts.map +1 -1
- package/dist/metaTxnMonitor.d.ts +5 -4
- package/dist/metaTxnMonitor.d.ts.map +1 -1
- package/dist/metaTxns.d.ts +3 -3
- package/dist/metaTxns.d.ts.map +1 -1
- package/dist/morpho.d.ts +8 -0
- package/dist/morpho.d.ts.map +1 -1
- package/dist/prepareSend.d.ts +16 -6
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/queryParams.d.ts.map +1 -1
- package/dist/relayer.d.ts +10 -7
- package/dist/relayer.d.ts.map +1 -1
- package/dist/sequenceWallet.d.ts +3 -2
- package/dist/sequenceWallet.d.ts.map +1 -1
- package/dist/tokenBalances.d.ts +7 -0
- package/dist/tokenBalances.d.ts.map +1 -1
- package/dist/tokens.d.ts +2 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/trails.d.ts +2 -2
- package/dist/trails.d.ts.map +1 -1
- package/dist/wallets.d.ts.map +1 -1
- package/dist/widget/components/AccountActionsDropdown.d.ts.map +1 -1
- package/dist/widget/components/AccountSettings.d.ts.map +1 -1
- package/dist/widget/components/ClassicSwap.d.ts +2 -0
- package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
- package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
- package/dist/widget/components/ConnectedWallets.d.ts +4 -0
- package/dist/widget/components/ConnectedWallets.d.ts.map +1 -1
- package/dist/widget/components/Earn.d.ts.map +1 -1
- package/dist/widget/components/EarnPools.d.ts.map +1 -1
- package/dist/widget/components/Fund.d.ts +1 -0
- package/dist/widget/components/Fund.d.ts.map +1 -1
- package/dist/widget/components/FundMethods.d.ts.map +1 -1
- package/dist/widget/components/{FundSendForm.d.ts → FundSwap.d.ts} +11 -5
- package/dist/widget/components/FundSwap.d.ts.map +1 -0
- package/dist/widget/components/FundingMethodSelectorButton.d.ts +4 -0
- package/dist/widget/components/FundingMethodSelectorButton.d.ts.map +1 -0
- package/dist/widget/components/Modal.d.ts.map +1 -1
- package/dist/widget/components/Pay.d.ts +1 -0
- package/dist/widget/components/Pay.d.ts.map +1 -1
- package/dist/widget/components/PercentageMaxButtons.d.ts +12 -0
- package/dist/widget/components/PercentageMaxButtons.d.ts.map +1 -0
- package/dist/widget/components/{PaySendForm.d.ts → PoolDeposit.d.ts} +11 -34
- package/dist/widget/components/PoolDeposit.d.ts.map +1 -0
- package/dist/widget/components/{SimpleSwap.d.ts → PoolWithdraw.d.ts} +16 -8
- package/dist/widget/components/PoolWithdraw.d.ts.map +1 -0
- package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
- package/dist/widget/components/Receive.d.ts.map +1 -1
- package/dist/widget/components/RecipientSelectorButton.d.ts +4 -0
- package/dist/widget/components/RecipientSelectorButton.d.ts.map +1 -0
- package/dist/widget/components/Recipients.d.ts.map +1 -1
- package/dist/widget/components/RefundWarning.d.ts +1 -0
- package/dist/widget/components/RefundWarning.d.ts.map +1 -1
- package/dist/widget/components/RequiredPropsError.d.ts +8 -0
- package/dist/widget/components/RequiredPropsError.d.ts.map +1 -0
- package/dist/widget/components/ScreenHeader.d.ts.map +1 -1
- package/dist/widget/components/SlippageToleranceSettings.d.ts.map +1 -1
- package/dist/widget/components/Swap.d.ts +1 -0
- package/dist/widget/components/Swap.d.ts.map +1 -1
- package/dist/widget/components/SwapSettings.d.ts.map +1 -1
- package/dist/widget/components/TokenImage.d.ts +1 -0
- package/dist/widget/components/TokenImage.d.ts.map +1 -1
- package/dist/widget/components/TokenList.d.ts.map +1 -1
- package/dist/widget/components/TokenSelector.d.ts.map +1 -1
- package/dist/widget/components/TokenSelectorButton.d.ts +16 -0
- package/dist/widget/components/TokenSelectorButton.d.ts.map +1 -0
- package/dist/widget/components/UserPreferences.d.ts.map +1 -1
- package/dist/widget/components/WaasFeeOptions.d.ts +8 -0
- package/dist/widget/components/WaasFeeOptions.d.ts.map +1 -0
- package/dist/widget/components/WalletConfirmation.d.ts.map +1 -1
- package/dist/widget/components/WalletList.d.ts.map +1 -1
- package/dist/widget/css/compiled.css +2 -0
- package/dist/widget/css/index.css +554 -0
- package/dist/widget/hooks/useBack.d.ts +6 -0
- package/dist/widget/hooks/useBack.d.ts.map +1 -1
- package/dist/widget/hooks/useCheckout.d.ts +1 -1
- package/dist/widget/hooks/useCheckout.d.ts.map +1 -1
- package/dist/widget/hooks/useCurrentScreen.d.ts +1 -1
- package/dist/widget/hooks/useCurrentScreen.d.ts.map +1 -1
- package/dist/widget/hooks/useDefaultTokenSelection.d.ts +3 -3
- package/dist/widget/hooks/useDefaultTokenSelection.d.ts.map +1 -1
- package/dist/widget/hooks/useInitialRedirect.d.ts +7 -0
- package/dist/widget/hooks/useInitialRedirect.d.ts.map +1 -0
- package/dist/widget/hooks/usePayMessage.d.ts.map +1 -1
- package/dist/widget/hooks/useSelectedFeeToken.d.ts.map +1 -1
- package/dist/widget/hooks/useSelectedFundMethod.d.ts +12 -0
- package/dist/widget/hooks/useSelectedFundMethod.d.ts.map +1 -0
- package/dist/widget/hooks/useSelectedRecipient.d.ts.map +1 -1
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/index.js +1 -1
- package/dist/widget/widget.d.ts +4 -4
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +30 -23
- package/src/aave.ts +32 -0
- package/src/chains.ts +23 -3
- package/src/config.ts +12 -4
- package/src/constants.ts +11 -16
- package/src/error.ts +20 -2
- package/src/estimate.ts +416 -5
- package/src/index.ts +8 -3
- package/src/intentEntrypoint.ts +0 -15
- package/src/intents.ts +161 -11
- package/src/metaTxnMonitor.ts +28 -22
- package/src/metaTxns.ts +3 -3
- package/src/morpho.ts +32 -0
- package/src/prepareSend.ts +710 -458
- package/src/queryParams.ts +2 -1
- package/src/relayer.ts +15 -16
- package/src/sequenceWallet.ts +7 -3
- package/src/tokenBalances.ts +47 -0
- package/src/tokens.ts +17 -1
- package/src/trails.ts +2 -2
- package/src/wallets.ts +8 -0
- package/src/widget/compiled.css +2 -2
- package/src/widget/components/AccountActionsDropdown.tsx +9 -15
- package/src/widget/components/AccountIntentTransactionHistory.tsx +1 -1
- package/src/widget/components/AccountSettings.tsx +10 -27
- package/src/widget/components/ChainFilterDropdown.tsx +1 -1
- package/src/widget/components/ChainList.tsx +1 -1
- package/src/widget/components/ClassicSwap.tsx +111 -155
- package/src/widget/components/ConnectWallet.tsx +10 -39
- package/src/widget/components/ConnectedWallets.tsx +113 -58
- package/src/widget/components/Earn.tsx +73 -589
- package/src/widget/components/EarnPools.tsx +2 -1
- package/src/widget/components/Fund.tsx +81 -109
- package/src/widget/components/FundMethods.tsx +82 -159
- package/src/widget/components/FundSwap.tsx +52 -0
- package/src/widget/components/FundingMethodSelectorButton.tsx +60 -0
- package/src/widget/components/Modal.tsx +6 -2
- package/src/widget/components/Pay.tsx +198 -200
- package/src/widget/components/PercentageMaxButtons.tsx +77 -0
- package/src/widget/components/PoolDeposit.tsx +593 -0
- package/src/widget/components/PoolWithdraw.tsx +903 -0
- package/src/widget/components/QuoteDetails.tsx +22 -8
- package/src/widget/components/Receive.tsx +1 -3
- package/src/widget/components/RecipientSelectorButton.tsx +42 -0
- package/src/widget/components/Recipients.tsx +64 -156
- package/src/widget/components/RefundWarning.tsx +5 -1
- package/src/widget/components/RequiredPropsError.tsx +33 -0
- package/src/widget/components/ScreenHeader.tsx +5 -1
- package/src/widget/components/SlippageToleranceSettings.tsx +2 -1
- package/src/widget/components/Swap.tsx +2 -43
- package/src/widget/components/SwapSettings.tsx +3 -15
- package/src/widget/components/TokenImage.tsx +21 -4
- package/src/widget/components/TokenList.tsx +0 -1
- package/src/widget/components/TokenSelector.tsx +2 -1
- package/src/widget/components/TokenSelectorButton.tsx +75 -0
- package/src/widget/components/UserPreferences.tsx +6 -24
- package/src/widget/components/WaasFeeOptions.tsx +331 -0
- package/src/widget/components/WalletConfirmation.tsx +55 -3
- package/src/widget/components/WalletList.tsx +7 -5
- package/src/widget/hooks/useBack.tsx +113 -9
- package/src/widget/hooks/useCheckout.ts +36 -20
- package/src/widget/hooks/useCurrentScreen.tsx +1 -0
- package/src/widget/hooks/useDefaultTokenSelection.tsx +104 -28
- package/src/widget/hooks/useInitialRedirect.tsx +70 -0
- package/src/widget/hooks/usePayMessage.tsx +86 -11
- package/src/widget/hooks/useSelectedFeeToken.tsx +10 -16
- package/src/widget/hooks/useSelectedFundMethod.tsx +41 -0
- package/src/widget/hooks/useSelectedRecipient.tsx +10 -0
- package/src/widget/hooks/useSendForm.ts +34 -12
- package/src/widget/hooks/useTokenList.ts +1 -1
- package/src/widget/index.css +27 -0
- package/src/widget/widget.tsx +245 -208
- package/dist/widget/components/FundSendForm.d.ts.map +0 -1
- package/dist/widget/components/PaySendForm.d.ts.map +0 -1
- package/dist/widget/components/SimpleSwap.d.ts.map +0 -1
- package/dist/widget/hooks/useSwapSettings.d.ts +0 -16
- package/dist/widget/hooks/useSwapSettings.d.ts.map +0 -1
- package/src/widget/components/FundSendForm.tsx +0 -903
- package/src/widget/components/PaySendForm.tsx +0 -869
- package/src/widget/components/SimpleSwap.tsx +0 -983
- package/src/widget/hooks/useSwapSettings.tsx +0 -100
- /package/dist/{style.css → 0xtrails.css} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSelectedFundMethod.d.ts","sourceRoot":"","sources":["../../../src/widget/hooks/useSelectedFundMethod.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAE3E,UAAU,6BAA6B;IACrC,kBAAkB,EAAE,MAAM,CAAA;IAC1B,qBAAqB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CAChD;AAMD,UAAU,+BAA+B;IACvC,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,eAAO,MAAM,0BAA0B,GAAI,eAExC,+BAA+B,4CAajC,CAAA;AAED,eAAO,MAAM,qBAAqB,QAAO,6BAQxC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSelectedRecipient.d.ts","sourceRoot":"","sources":["../../../src/widget/hooks/useSelectedRecipient.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"useSelectedRecipient.d.ts","sourceRoot":"","sources":["../../../src/widget/hooks/useSelectedRecipient.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAKZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAGd,UAAU,4BAA4B;IACpC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,oBAAoB,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;CACzD;AAMD,UAAU,8BAA8B;IACtC,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,EAAE,CAC9C,8BAA8B,CAwB/B,CAAA;AAED,eAAO,MAAM,oBAAoB,oCAQhC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSendForm.d.ts","sourceRoot":"","sources":["../../../src/widget/hooks/useSendForm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EACL,KAAK,OAAO,EAIZ,KAAK,YAAY,EAElB,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"useSendForm.d.ts","sourceRoot":"","sources":["../../../src/widget/hooks/useSendForm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EACL,KAAK,OAAO,EAIZ,KAAK,YAAY,EAElB,MAAM,MAAM,CAAA;AAKb,OAAO,EAEL,SAAS,EAET,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAU7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAMrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAS1D,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,YAAY,CAAC,EAAE;QACb,QAAQ,EAAE,MAAM,CAAA;QAChB,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;CACF;AAED,MAAM,MAAM,SAA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AK,CAAA;IACrB,gBAAgB,EAAE,SAAS,GAAG,IAAI,CAAA;IAClC,sBAAsB,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;IACjD,sBAAsB,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;IACjD,iBAAiB,EAAE,MAAM,CAAA;IACzB,uBAAuB,EAAE,MAAM,GAAG,IAAI,CAAA;IACtC,kBAAkB,EAAE,OAAO,CAAA;IAC3B,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAAA;IACzC,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,gCAAgC,EAAE,OAAO,CAAA;IACzC,mBAAmB,EAAE,OAAO,CAAA;IAC5B,wBAAwB,EAAE,OAAO,CAAA;IACjC,6BAA6B,EAAE,OAAO,CAAA;CACvC,CAAA;AAED,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,QAAQ,EAAE,0BAA0B;AACpC,WAAW,EAAE,6BAA6B;AAC1C,SAAS,EAAE,wCAAwC;AACnD,OAAO,EAAE,uDAAuD;AAChE,UAAU,EAAE,wCAAwC;AACpD,aAAa,EAAE,kCAAkC;AACjD,YAAY,EACZ,wBAAwB,EACxB,OAAO,EACP,yBAAyB,EACzB,aAAa,EACb,OAAO,EACP,aAAa,EACb,MAAM,EACN,SAAS,EACT,UAAU,EACV,4BAA4B,EAC5B,SAAkC,EAClC,aAAa,EACb,UAAU,EACV,IAAI,EACJ,uBAAuB,EACvB,kBAAkB,EAClB,cAAkB,GACnB,EAAE,YAAY,GAAG,aAAa,CA8nC9B"}
|
package/dist/widget/index.js
CHANGED
package/dist/widget/widget.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { AaveClient } from '@aave/react';
|
|
1
2
|
import { default as React } from 'react';
|
|
2
3
|
import { Connector } from 'wagmi';
|
|
3
|
-
import {
|
|
4
|
+
import { Mode } from '../mode.js';
|
|
4
5
|
import { RelayerEnv } from '../relayer.js';
|
|
5
6
|
import { Theme } from '../theme.js';
|
|
6
|
-
import {
|
|
7
|
-
import { AaveClient } from '@aave/react';
|
|
7
|
+
import { TransactionState } from '../transactions.js';
|
|
8
8
|
export declare const aaveClient: AaveClient;
|
|
9
9
|
export type TrailsWidgetProps = {
|
|
10
10
|
appId?: string;
|
|
@@ -23,7 +23,6 @@ export type TrailsWidgetProps = {
|
|
|
23
23
|
renderInline?: boolean;
|
|
24
24
|
theme?: Theme;
|
|
25
25
|
mode?: Mode;
|
|
26
|
-
swapMode?: "simple" | "classic";
|
|
27
26
|
walletOptions?: string[];
|
|
28
27
|
onOriginConfirmation?: (data: {
|
|
29
28
|
txHash: string;
|
|
@@ -63,6 +62,7 @@ export type TrailsWidgetProps = {
|
|
|
63
62
|
gasless?: boolean;
|
|
64
63
|
buttonText?: string;
|
|
65
64
|
customCss?: string | Record<string, string>;
|
|
65
|
+
disableCss?: boolean;
|
|
66
66
|
quoteProvider?: string;
|
|
67
67
|
slippageTolerance?: number | string;
|
|
68
68
|
priceImpactWarningThresholdBps?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../src/widget/widget.tsx"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAA;
|
|
1
|
+
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../src/widget/widget.tsx"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAA;AAEzC,OAAO,EAAE,UAAU,EAAgB,MAAM,aAAa,CAAA;AAGtD,OAAO,KAUN,MAAM,OAAO,CAAA;AAUd,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAgDtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAKtC,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/D,OAAO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CAAA;IACrC,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,eAAe,CAAC,EAAE,SAAS,EAAE,CAAA;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,UAAU,EAAE,MAAM,IAAI,CAAA;IACtB,WAAW,EAAE,OAAO,CAAA;CACrB;AAq1DD,eAAO,MAAM,YAAY,2FAwLxB,CAAA;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC5C,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA0CpB;AAGD,eAAO,MAAM,qBAAqB,GAChC,KAAK,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC;;;;CAKrC,CAAA;AAEF,eAAe,YAAY,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "0xtrails",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "SDK for Trails",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@0xsequence/account": "^2.3.30",
|
|
26
26
|
"@0xsequence/api": "^2.3.30",
|
|
27
|
-
"@0xsequence/connect": "^5.3.
|
|
27
|
+
"@0xsequence/connect": "^5.3.26",
|
|
28
28
|
"@0xsequence/core": "^2.3.30",
|
|
29
29
|
"@0xsequence/design-system": "^2.2.5",
|
|
30
30
|
"@0xsequence/guard": "^2.3.30",
|
|
@@ -32,44 +32,45 @@
|
|
|
32
32
|
"@0xsequence/indexer": "^2.3.30",
|
|
33
33
|
"@0xsequence/metadata": "^2.3.30",
|
|
34
34
|
"@0xsequence/network": "^2.3.30",
|
|
35
|
-
"@0xsequence/relayer": "
|
|
35
|
+
"@0xsequence/relayer": "0.0.0-20251021104024",
|
|
36
36
|
"@0xsequence/sessions": "^2.3.30",
|
|
37
37
|
"@0xsequence/signhub": "^2.3.30",
|
|
38
|
-
"@0xsequence/trails-api": "^0.1.
|
|
39
|
-
"@0xsequence/wallet-core": "
|
|
40
|
-
"@0xsequence/wallet-primitives": "
|
|
41
|
-
"@aave/react": "^0.
|
|
38
|
+
"@0xsequence/trails-api": "^0.1.3",
|
|
39
|
+
"@0xsequence/wallet-core": "0.0.0-20251021104024",
|
|
40
|
+
"@0xsequence/wallet-primitives": "0.0.0-20251021104024",
|
|
41
|
+
"@aave/react": "^0.7.0",
|
|
42
42
|
"@databeat/tracker": "^0.9.3",
|
|
43
|
-
"@emotion/is-prop-valid": "^1.
|
|
44
|
-
"@meshconnect/web-link-sdk": "3.
|
|
43
|
+
"@emotion/is-prop-valid": "^1.4.0",
|
|
44
|
+
"@meshconnect/web-link-sdk": "3.3.4",
|
|
45
45
|
"@reservoir0x/relay-sdk": "^2.4.0",
|
|
46
46
|
"@tanstack/react-query": "^5.90.3",
|
|
47
47
|
"@types/qrcode": "^1.5.5",
|
|
48
48
|
"buffer": "^6.0.3",
|
|
49
49
|
"framer-motion": "^12.23.24",
|
|
50
|
-
"lucide-react": "^0.
|
|
50
|
+
"lucide-react": "^0.545.0",
|
|
51
51
|
"motion": "^12.23.24",
|
|
52
|
-
"ox": "^0.
|
|
53
|
-
"qrcode": "^1.5.4"
|
|
52
|
+
"ox": "^0.9.11",
|
|
53
|
+
"qrcode": "^1.5.4",
|
|
54
|
+
"vite-plugin-static-copy": "^3.1.4"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
|
-
"@tailwindcss/cli": "^4.1.
|
|
57
|
+
"@tailwindcss/cli": "^4.1.15",
|
|
57
58
|
"@testing-library/jest-dom": "^6.9.1",
|
|
58
59
|
"@testing-library/react": "^16.3.0",
|
|
59
|
-
"@types/node": "^
|
|
60
|
+
"@types/node": "^24.9.1",
|
|
60
61
|
"@types/react": "^19.2.2",
|
|
61
62
|
"@types/react-dom": "^19.2.2",
|
|
62
|
-
"@vitejs/plugin-react": "^
|
|
63
|
-
"dotenv": "^
|
|
64
|
-
"globals": "^
|
|
65
|
-
"happy-dom": "^
|
|
66
|
-
"jsdom": "^
|
|
63
|
+
"@vitejs/plugin-react": "^5.0.4",
|
|
64
|
+
"dotenv": "^17.2.3",
|
|
65
|
+
"globals": "^16.4.0",
|
|
66
|
+
"happy-dom": "^20.0.7",
|
|
67
|
+
"jsdom": "^27.0.1",
|
|
67
68
|
"patch-package": "^8.0.1",
|
|
68
69
|
"table": "^6.9.0",
|
|
69
|
-
"tailwindcss": "^4.1.
|
|
70
|
+
"tailwindcss": "^4.1.15",
|
|
70
71
|
"turbo": "^2.5.8",
|
|
71
72
|
"typescript": "^5.9.3",
|
|
72
|
-
"vite": "^
|
|
73
|
+
"vite": "^7.1.11",
|
|
73
74
|
"vite-plugin-dts": "^4.5.4",
|
|
74
75
|
"vitest": "^3.2.4"
|
|
75
76
|
},
|
|
@@ -92,10 +93,16 @@
|
|
|
92
93
|
"import": "./dist/widget/index.js",
|
|
93
94
|
"require": "./dist/widget/index.js",
|
|
94
95
|
"types": "./dist/widget/index.d.ts"
|
|
96
|
+
},
|
|
97
|
+
"./widget/css/*": {
|
|
98
|
+
"import": "./dist/widget/css/*",
|
|
99
|
+
"require": "./dist/widget/css/*",
|
|
100
|
+
"default": "./dist/widget/css/*"
|
|
95
101
|
}
|
|
96
102
|
},
|
|
97
103
|
"scripts": {
|
|
98
|
-
"build": "rimraf dist && npm run build:css && npm run build:vite",
|
|
104
|
+
"build": "rimraf dist && npm run build:css && npm run build:vite && npm run build:patch",
|
|
105
|
+
"build:patch": "node scripts/apply-react-patch.cjs",
|
|
99
106
|
"build:vite": "vite build --config vite.config.ts --mode production",
|
|
100
107
|
"build:umd": "BUILD_MODE=umd vite build --config vite.umd.config.ts --mode production && npm run build:copy-umd-js",
|
|
101
108
|
"build:copy-umd-js": "mkdir -p ../../apps/trails-demo/public/js && cp ./dist/umd/trails.min.js ../../apps/trails-demo/public/js/trails.min.js",
|
|
@@ -103,7 +110,7 @@
|
|
|
103
110
|
"dev": "npm run build:vite -- --watch",
|
|
104
111
|
"test": "vitest",
|
|
105
112
|
"test:run": "vitest --run",
|
|
106
|
-
"test:scenarios": "vitest --run test/scenarios/useQuote.test.tsx",
|
|
113
|
+
"test:scenarios": "RUN_TEST_SCENARIOS=true vitest --run test/scenarios/useQuote.test.tsx",
|
|
107
114
|
"clean": "rimraf dist node_modules",
|
|
108
115
|
"lint": "biome lint ./src",
|
|
109
116
|
"lint:fix": "biome lint --write ./src",
|
package/src/aave.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useAaveMarkets, chainId } from "@aave/react"
|
|
2
2
|
import { useMemo } from "react"
|
|
3
|
+
import { encodeFunctionData } from "viem"
|
|
3
4
|
import { logger } from "./logger.js"
|
|
4
5
|
|
|
5
6
|
// Chain ID to Aave market name mapping
|
|
@@ -186,4 +187,35 @@ export function useAavePools() {
|
|
|
186
187
|
}
|
|
187
188
|
}
|
|
188
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Generate Aave withdraw calldata
|
|
192
|
+
* @param asset - The address of the underlying asset to withdraw
|
|
193
|
+
* @param amount - The amount to withdraw in wei
|
|
194
|
+
* @param to - The address that will receive the underlying tokens
|
|
195
|
+
* @returns Encoded calldata for Aave withdraw function
|
|
196
|
+
*/
|
|
197
|
+
export function generateAaveWithdrawCalldata(
|
|
198
|
+
asset: string,
|
|
199
|
+
amount: bigint,
|
|
200
|
+
to: string,
|
|
201
|
+
): `0x${string}` {
|
|
202
|
+
return encodeFunctionData({
|
|
203
|
+
abi: [
|
|
204
|
+
{
|
|
205
|
+
name: "withdraw",
|
|
206
|
+
type: "function",
|
|
207
|
+
stateMutability: "nonpayable",
|
|
208
|
+
inputs: [
|
|
209
|
+
{ name: "asset", type: "address" },
|
|
210
|
+
{ name: "amount", type: "uint256" },
|
|
211
|
+
{ name: "to", type: "address" },
|
|
212
|
+
],
|
|
213
|
+
outputs: [{ type: "uint256" }],
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
functionName: "withdraw",
|
|
217
|
+
args: [asset as `0x${string}`, amount, to as `0x${string}`],
|
|
218
|
+
})
|
|
219
|
+
}
|
|
220
|
+
|
|
189
221
|
export default useAavePools
|
package/src/chains.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useQuery } from "@tanstack/react-query"
|
|
2
|
-
import type { Chain } from "viem"
|
|
2
|
+
import type { Chain as ViemChain } from "viem"
|
|
3
|
+
|
|
3
4
|
import {
|
|
4
5
|
arbitrum,
|
|
5
6
|
base,
|
|
@@ -41,6 +42,17 @@ import {
|
|
|
41
42
|
import type { QuoteProvider } from "./intents.js"
|
|
42
43
|
import { somnia } from "./customChains.js"
|
|
43
44
|
|
|
45
|
+
// Extended Chain type with imageUrl
|
|
46
|
+
export interface Chain extends ViemChain {
|
|
47
|
+
imageUrl?: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Function to get chain image URL
|
|
51
|
+
export function getChainImageUrl(chainId: number): string {
|
|
52
|
+
// Use Sequence's chain image assets
|
|
53
|
+
return `https://assets.sequence.info/images/networks/large/${chainId}.webp`
|
|
54
|
+
}
|
|
55
|
+
|
|
44
56
|
export function getAllChains(): Chain[] {
|
|
45
57
|
return [
|
|
46
58
|
arbitrum,
|
|
@@ -122,7 +134,7 @@ export const supportedSequenceChains: Record<number, Chain> = {
|
|
|
122
134
|
[avalanche.id]: getChainInfo(avalanche.id)!,
|
|
123
135
|
[b3.id]: getChainInfo(b3.id)!,
|
|
124
136
|
[base.id]: getChainInfo(base.id)!,
|
|
125
|
-
[blast.id]: getChainInfo(
|
|
137
|
+
[blast.id]: getChainInfo(blast.id)!,
|
|
126
138
|
[bsc.id]: getChainInfo(bsc.id)!,
|
|
127
139
|
[mainnet.id]: getChainInfo(mainnet.id)!,
|
|
128
140
|
[gnosis.id]: getChainInfo(gnosis.id)!,
|
|
@@ -207,7 +219,15 @@ export function getChainInfo(
|
|
|
207
219
|
}
|
|
208
220
|
}
|
|
209
221
|
|
|
210
|
-
|
|
222
|
+
// Add imageUrl property to chain info
|
|
223
|
+
if (chainInfo) {
|
|
224
|
+
return {
|
|
225
|
+
...chainInfo,
|
|
226
|
+
imageUrl: getChainImageUrl(chainId),
|
|
227
|
+
} as Chain
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return null
|
|
211
231
|
}
|
|
212
232
|
|
|
213
233
|
// Get testnet chain info from mainnet chain as input
|
package/src/config.ts
CHANGED
|
@@ -12,8 +12,10 @@ import {
|
|
|
12
12
|
PROD_SEQUENCE_NODE_GATEWAY_URL,
|
|
13
13
|
DEV_SEQUENCE_NODE_GATEWAY_URL,
|
|
14
14
|
PROD_TRAILS_API_URL,
|
|
15
|
+
LOCAL_TRAILS_API_URL,
|
|
15
16
|
} from "./constants.js"
|
|
16
17
|
import { getQueryParam } from "./queryParams.js"
|
|
18
|
+
import { logger } from "./logger.js"
|
|
17
19
|
|
|
18
20
|
export type SequenceEnv = "prod" | "dev" | "local" | "cors-anywhere"
|
|
19
21
|
|
|
@@ -94,7 +96,7 @@ export function declareTrailsApiUrl() {
|
|
|
94
96
|
return PROD_TRAILS_API_URL
|
|
95
97
|
}
|
|
96
98
|
if (declareSequenceEnv() === "local") {
|
|
97
|
-
return
|
|
99
|
+
return LOCAL_TRAILS_API_URL
|
|
98
100
|
}
|
|
99
101
|
return DEV_TRAILS_API_URL
|
|
100
102
|
}
|
|
@@ -129,10 +131,14 @@ export function declareCommitHash() {
|
|
|
129
131
|
const cfPagesCommitHash = getEnvVar("CF_PAGES_COMMIT_SHA")
|
|
130
132
|
const viteCommitHash = getEnvVar("VITE_COMMIT_SHA")
|
|
131
133
|
if (cfPagesCommitHash) {
|
|
132
|
-
console.log(
|
|
134
|
+
logger.console.log(
|
|
135
|
+
`[trails-sdk][config] commit hash from CF_PAGES_COMMIT_SHA: ${cfPagesCommitHash}`,
|
|
136
|
+
)
|
|
133
137
|
}
|
|
134
138
|
if (viteCommitHash) {
|
|
135
|
-
console.log(
|
|
139
|
+
logger.console.log(
|
|
140
|
+
`[trails-sdk][config] commit hash from VITE_COMMIT_SHA: ${viteCommitHash}`,
|
|
141
|
+
)
|
|
136
142
|
}
|
|
137
143
|
return cfPagesCommitHash || viteCommitHash
|
|
138
144
|
}
|
|
@@ -248,7 +254,9 @@ export function getDebug() {
|
|
|
248
254
|
|
|
249
255
|
export function setCommitHash(commitHash: string) {
|
|
250
256
|
globalConfig.commitHash = commitHash
|
|
251
|
-
console.log(
|
|
257
|
+
logger.console.log(
|
|
258
|
+
`[trails-sdk][config] commit hash manually set to: ${commitHash}`,
|
|
259
|
+
)
|
|
252
260
|
}
|
|
253
261
|
|
|
254
262
|
export function getCommitHash() {
|
package/src/constants.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { AddressOverrides } from "@0xsequence/trails-api"
|
|
2
2
|
import type { Context as ContextLike } from "@0xsequence/wallet-primitives"
|
|
3
|
+
import type { Address } from "ox"
|
|
3
4
|
|
|
4
5
|
export const SEQUENCE_V3_CONTRACT_ADDRESSES: ContextLike.Context = {
|
|
5
|
-
factory: "0x00000000000018A77519fcCCa060c2537c9D6d3F" as
|
|
6
|
-
stage1: "0x00000000000084fA81809Dd337311297C5594d62" as
|
|
7
|
-
stage2: "0x7438718F9E4b9B834e305A620EEeCf2B9E6eBE79" as
|
|
6
|
+
factory: "0x00000000000018A77519fcCCa060c2537c9D6d3F" as Address.Address,
|
|
7
|
+
stage1: "0x00000000000084fA81809Dd337311297C5594d62" as Address.Address,
|
|
8
|
+
stage2: "0x7438718F9E4b9B834e305A620EEeCf2B9E6eBE79" as Address.Address,
|
|
8
9
|
creationCode:
|
|
9
|
-
"0x6041600e3d396021805130553df33d3d36153402601f57363d3d373d363d30545af43d82803e903d91601f57fd5bf3" as
|
|
10
|
+
"0x6041600e3d396021805130553df33d3d36153402601f57363d3d373d363d30545af43d82803e903d91601f57fd5bf3" as Address.Address,
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export const SEQUENCE_V3_CONTRACT_ADDRESSES_OVERRIDES: AddressOverrides = {
|
|
@@ -16,13 +17,13 @@ export const SEQUENCE_V3_CONTRACT_ADDRESSES_OVERRIDES: AddressOverrides = {
|
|
|
16
17
|
SEQUENCE_V3_CONTRACT_ADDRESSES.stage2,
|
|
17
18
|
} as AddressOverrides
|
|
18
19
|
|
|
19
|
-
export const TRAILS_ROUTER_ADDRESS =
|
|
20
|
-
"
|
|
20
|
+
export const TRAILS_ROUTER_ADDRESS: Address.Address =
|
|
21
|
+
"0xc4415c5CabD726bA06042af752a528B3dbc263F7"
|
|
21
22
|
|
|
22
|
-
export const TRAILS_INTENT_ENTRYPOINT_ADDRESS =
|
|
23
|
-
"
|
|
23
|
+
export const TRAILS_INTENT_ENTRYPOINT_ADDRESS: Address.Address =
|
|
24
|
+
"0x9470D883bac170116d397Db3dA71B2e57d567583"
|
|
24
25
|
|
|
25
|
-
export const ATTESATION_SIGNER_ADDRESS =
|
|
26
|
+
export const ATTESATION_SIGNER_ADDRESS: Address.Address =
|
|
26
27
|
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
|
|
27
28
|
|
|
28
29
|
export const DEFAULT_SEQUENCE_ENV = "prod"
|
|
@@ -36,13 +37,7 @@ export const DEV_SEQUENCE_INDEXER_URL = "https://dev-indexer.sequence.app"
|
|
|
36
37
|
export const DEV_SEQUENCE_API_URL = "https://dev-api.sequence.app"
|
|
37
38
|
export const DEV_TRAILS_API_URL = "https://dev-trails-api.sequence-dev.app"
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
export const intentEntrypoints: Record<number, `0x${string}`> = {
|
|
41
|
-
8453: "0x80DB82D640F9Df20Cfe89fa4E70B0EcC56f3715c", // Base
|
|
42
|
-
42161: "0x20CC15eb516Ba56398c28CE1A567e3a82889Db46", // Arbitrum One
|
|
43
|
-
137: "0x1C69bCdcD751785F2a3b815333B46AB150370E6E", // Polygon
|
|
44
|
-
747474: "0x814A110fF7c664C26e6c3e2E6E85C23291e4359e", // Katana
|
|
45
|
-
}
|
|
40
|
+
export const LOCAL_TRAILS_API_URL = "http://localhost:4422"
|
|
46
41
|
|
|
47
42
|
// This is used for Sequence Indexer and API
|
|
48
43
|
export const PROD_SEQUENCE_PROJECT_ACCESS_KEY =
|
package/src/error.ts
CHANGED
|
@@ -22,7 +22,9 @@ export function getErrorString(err: unknown): string {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export function getIsWalletRejectedError(err: unknown) {
|
|
25
|
-
const isRejected = /rejected|denied/gi.test(
|
|
25
|
+
const isRejected = /rejected|denied|user rejected the request/gi.test(
|
|
26
|
+
getErrorString(err).toLowerCase(),
|
|
27
|
+
)
|
|
26
28
|
return isRejected
|
|
27
29
|
}
|
|
28
30
|
|
|
@@ -89,7 +91,7 @@ export function getIsQuoteTokenError(err: unknown) {
|
|
|
89
91
|
|
|
90
92
|
export function getIsQuoteInputError(err: unknown) {
|
|
91
93
|
const isQuoteInputError =
|
|
92
|
-
/Invalid input or output currency|originTokenAmount must be greater than zero|trails fee is greater than the origin token amount/gi.test(
|
|
94
|
+
/Invalid input or output currency|originTokenAmount must be greater than zero|trails fee is greater than the origin token amount|insufficient origin amount|fees exceed the provided amount/gi.test(
|
|
93
95
|
getErrorString(err).toLowerCase(),
|
|
94
96
|
)
|
|
95
97
|
return isQuoteInputError
|
|
@@ -103,6 +105,13 @@ export function getIsInsufficientLiquidityError(err: unknown) {
|
|
|
103
105
|
return isInsufficientLiquidity
|
|
104
106
|
}
|
|
105
107
|
|
|
108
|
+
export function getIsWalletAlreadyConnectedError(err: unknown) {
|
|
109
|
+
const isWalletAlreadyConnected = /Connector already connected/gi.test(
|
|
110
|
+
getErrorString(err).toLowerCase(),
|
|
111
|
+
)
|
|
112
|
+
return isWalletAlreadyConnected
|
|
113
|
+
}
|
|
114
|
+
|
|
106
115
|
export function getPrettifiedErrorMessage(
|
|
107
116
|
err: unknown,
|
|
108
117
|
defaultMessage: string = "",
|
|
@@ -135,5 +144,14 @@ export function getPrettifiedErrorMessage(
|
|
|
135
144
|
if (isApiError) {
|
|
136
145
|
return "An API error occurred. Please try again later."
|
|
137
146
|
}
|
|
147
|
+
const isWalletRejectedError = getIsWalletRejectedError(err)
|
|
148
|
+
if (isWalletRejectedError) {
|
|
149
|
+
return "The wallet rejected the request. Please try again."
|
|
150
|
+
}
|
|
151
|
+
const isWalletAlreadyConnected = getIsWalletAlreadyConnectedError(err)
|
|
152
|
+
if (isWalletAlreadyConnected) {
|
|
153
|
+
return "The wallet is already connected"
|
|
154
|
+
}
|
|
155
|
+
|
|
138
156
|
return defaultMessage
|
|
139
157
|
}
|