@aurora-is-near/intents-swap-widget 2.8.0 → 2.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,19 +17,11 @@ See the `/demo` folder for some examples of how to use these widgets.
17
17
 
18
18
  To each of these components we should pass in a `makeTransfer` function. When
19
19
  the user clicks the relevant submit button this function is called with an
20
- `args` object that has the following shape:
21
-
22
- ```ts
23
- type MakeTransferArgs = {
24
- amount: string;
25
- address: string;
26
- tokenAddress?: string;
27
- chain: Chains;
28
- evmChainId: number | null;
29
- };
30
- ```
20
+ `args` object that contains details about the transfer, such as the `amount`,
21
+ `address` and, if relevant, the `evmChainId`.
31
22
 
32
- It is the responsibility of the consuming application to handle this transfer.
23
+ It is currently the responsibility of the consuming application to handle this
24
+ transfer.
33
25
 
34
26
  ## Custom implementation
35
27
 
@@ -14,7 +14,7 @@ const s = ({ text: l }) => /* @__PURE__ */ i("div", { className: "flex h-12 w-fu
14
14
  onMsg: r
15
15
  }) => {
16
16
  const { t } = y(), a = l === "error";
17
- return /* @__PURE__ */ i("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [
17
+ return /* @__PURE__ */ i("div", { className: "sw fixed inset-0 z-50 flex items-center justify-center", children: [
18
18
  /* @__PURE__ */ e("div", { className: "absolute inset-0 bg-sw-gray-975/70 backdrop-blur-[5px] transition-[backdrop-filter] duration-100" }),
19
19
  /* @__PURE__ */ i("div", { className: "relative z-50 mx-5 w-full max-w-[359px] rounded-3xl bg-sw-modal-bg px-6 pt-3 pb-6 shadow-[0px_0px_40px_0px_rgba(0,0,0,0.5)]", children: [
20
20
  /* @__PURE__ */ e(
@@ -1 +1 @@
1
- {"version":3,"file":"WalletCompatibilityModal.js","sources":["../../../src/features/WalletCompatibilityCheck/WalletCompatibilityModal.tsx"],"sourcesContent":["import {\n Check,\n Minus,\n RotateCw,\n ShieldQuestionMark,\n ShieldX,\n X,\n} from 'lucide-react';\nimport { Button } from '@/components/Button';\nimport { useTypedTranslation } from '@/localisation';\n\ntype ModalState = 'initial' | 'error';\n\ntype Msg =\n | { type: 'on_close' }\n | { type: 'on_check_compatibility' }\n | { type: 'on_try_again' }\n | { type: 'on_sign_out' };\n\ninterface WalletCompatibilityCheckProps {\n state: ModalState;\n isSigning: boolean;\n onMsg: (msg: Msg) => void;\n}\n\nconst FeatureItem = ({ text }: { text: string }) => (\n <div className=\"flex h-12 w-full items-center rounded-xl bg-sw-modal-item px-3\">\n <div className=\"flex h-6 w-6 items-center justify-center rounded-full bg-sw-complete-900\">\n <Check size={13} strokeWidth={4} className=\"text-sw-complete-100\" />\n </div>\n <p className=\"text-label-m ml-sw-md font-medium text-sw-gray-50\">{text}</p>\n </div>\n);\n\nconst ErrorItem = ({ text }: { text: string }) => (\n <div className=\"flex min-h-[56px] w-full items-center rounded-xl bg-sw-modal-item px-3 py-3\">\n <div className=\"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-sw-warn-900\">\n <Minus size={13} className=\"text-sw-warn-100\" strokeWidth={4} />\n </div>\n <p className=\"text-label-m ml-sw-md leading-4 font-medium text-sw-gray-50\">\n {text}\n </p>\n </div>\n);\n\nexport const WalletCompatibilityModal = ({\n state,\n isSigning,\n onMsg,\n}: WalletCompatibilityCheckProps) => {\n const { t } = useTypedTranslation();\n const isErrorState = state === 'error';\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center\">\n {/* Backdrop - matches Privy */}\n <div className=\"absolute inset-0 bg-sw-gray-975/70 backdrop-blur-[5px] transition-[backdrop-filter] duration-100\" />\n\n {/* Modal */}\n <div className=\"relative z-50 mx-5 w-full max-w-[359px] rounded-3xl bg-sw-modal-bg px-6 pt-3 pb-6 shadow-[0px_0px_40px_0px_rgba(0,0,0,0.5)]\">\n {/* Close button (matches Privy styles) */}\n <button\n type=\"button\"\n onClick={() => onMsg({ type: 'on_close' })}\n className=\"absolute top-4 right-4 flex h-6 w-6 cursor-pointer items-center justify-center rounded-full bg-sw-gray-975 opacity-60\">\n <X size={16} strokeWidth={2} />\n </button>\n\n {/* Header */}\n <div className=\"mt-[58px] flex flex-col items-center\">\n {/* Icon */}\n <div className=\"relative mb-5 flex h-10 w-10 items-center justify-center\">\n {isErrorState ? (\n <ShieldX size={40} className=\"text-sw-warn-100\" />\n ) : (\n <ShieldQuestionMark size={40} className=\"text-sw-complete-100\" />\n )}\n </div>\n\n {/* Title */}\n <h2 className=\"text-h5 mb-4 text-center font-medium text-sw-gray-50\">\n {t(\n isErrorState\n ? 'walletCompatibility.modal.title.error'\n : 'walletCompatibility.modal.title.initial',\n isErrorState ? 'Unable to verify' : 'Signature check required',\n )}\n </h2>\n\n {/* Description */}\n <p className=\"text-p-s mb-8 max-w-[311px] text-center leading-5 font-normal text-sw-gray-100\">\n {t(\n isErrorState\n ? 'walletCompatibility.modal.description.error'\n : 'walletCompatibility.modal.description.initial',\n isErrorState\n ? \"The check couldn't be completed. Try again or choose another sign-in option to continue.\"\n : 'To keep your account secure, we need to verify that your device is compatible with Calyx.',\n )}\n </p>\n </div>\n\n {/* Content list */}\n <div className=\"mb-8 flex flex-col gap-[10px]\">\n {isErrorState ? (\n <>\n <ErrorItem\n text={t(\n 'walletCompatibility.modal.error.interrupted',\n 'The verification was interrupted or canceled',\n )}\n />\n <ErrorItem\n text={t(\n 'walletCompatibility.modal.error.incompatible',\n 'Some wallets (or devices) are incompatible with the platform',\n )}\n />\n </>\n ) : (\n <>\n <FeatureItem\n text={t(\n 'walletCompatibility.modal.feature.secureTransactions',\n 'Secure transactions and transfers',\n )}\n />\n <FeatureItem\n text={t(\n 'walletCompatibility.modal.feature.fullAccess',\n 'Full access to all Calyx features',\n )}\n />\n <FeatureItem\n text={t(\n 'walletCompatibility.modal.feature.fundProtection',\n 'Protection for your funds',\n )}\n />\n </>\n )}\n </div>\n\n {/* Action buttons */}\n <div className=\"flex flex-col gap-3\">\n {isErrorState ? (\n <Button\n variant=\"primary\"\n size=\"md\"\n onClick={() => onMsg({ type: 'on_try_again' })}\n className=\"h-12 w-full rounded-[10px] bg-sw-gray-50 text-sw-mauve-975 hover:bg-sw-gray-100 hover:text-sw-mauve-975\">\n <RotateCw size={16} strokeWidth={3} />\n {t('walletCompatibility.modal.button.tryAgain', 'Try again')}\n </Button>\n ) : (\n <Button\n variant=\"primary\"\n size=\"md\"\n state={isSigning ? 'loading' : 'default'}\n onClick={() => onMsg({ type: 'on_check_compatibility' })}\n className=\"h-12 w-full rounded-[10px] bg-sw-gray-50 text-sw-mauve-975 hover:bg-sw-gray-100 hover:text-sw-mauve-975\">\n {t(\n 'walletCompatibility.modal.button.checkCompatibility',\n 'Check compatibility',\n )}\n </Button>\n )}\n\n <Button\n variant=\"outlined\"\n size=\"md\"\n onClick={() => onMsg({ type: 'on_sign_out' })}\n className=\"h-10 w-full rounded-[10px] border border-sw-gray-500 bg-transparent text-sw-gray-50 hover:bg-sw-gray-900 hover:text-sw-gray-50\">\n {t('walletCompatibility.modal.button.signOut', 'Sign out')}\n </Button>\n </div>\n </div>\n </div>\n );\n};\n"],"names":["FeatureItem","text","jsxs","jsx","Check","ErrorItem","Minus","WalletCompatibilityModal","state","isSigning","onMsg","useTypedTranslation","isErrorState","X","ShieldX","ShieldQuestionMark","Fragment","Button","RotateCw"],"mappings":";;;;AAyBA,MAAMA,IAAc,CAAC,EAAE,MAAAC,QACrB,gBAAAC,EAAC,OAAA,EAAI,WAAU,kEACb,UAAA;AAAA,EAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,4EACb,UAAA,gBAAAA,EAACC,GAAA,EAAM,MAAM,IAAI,aAAa,GAAG,WAAU,uBAAA,CAAuB,GACpE;AAAA,EACA,gBAAAD,EAAC,KAAA,EAAE,WAAU,qDAAqD,UAAAF,EAAA,CAAK;AAAA,GACzE,GAGII,IAAY,CAAC,EAAE,MAAAJ,QACnB,gBAAAC,EAAC,OAAA,EAAI,WAAU,+EACb,UAAA;AAAA,EAAA,gBAAAC,EAAC,OAAA,EAAI,WA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AY;AAAA,YAC/B,SAAS,MAAMC,EAAM,EAAE,MAAM,0BAA0B;AAAA,YACvD,WAAU;AAAA,YACT,UAAA;AAAA,cACC;AAAA,cACA;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,QAIJ,gBAAAP;AAAA,UAACc;AAAA,UAAA;AAAA,YACC,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,SAAS,MAAMP,EAAM,EAAE,MAAM,eAAe;AAAA,YAC5C,WAAU;AAAA,YACT,UAAA,EAAE,4CAA4C,UAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MAC3D,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"WalletCompatibilityModal.js","sources":["../../../src/features/WalletCompatibilityCheck/WalletCompatibilityModal.tsx"],"sourcesContent":["import {\n Check,\n Minus,\n RotateCw,\n ShieldQuestionMark,\n ShieldX,\n X,\n} from 'lucide-react';\nimport { Button } from '@/components/Button';\nimport { useTypedTranslation } from '@/localisation';\n\ntype ModalState = 'initial' | 'error';\n\ntype Msg =\n | { type: 'on_close' }\n | { type: 'on_check_compatibility' }\n | { type: 'on_try_again' }\n | { type: 'on_sign_out' };\n\ninterface WalletCompatibilityCheckProps {\n state: ModalState;\n isSigning: boolean;\n onMsg: (msg: Msg) => void;\n}\n\nconst FeatureItem = ({ text }: { text: string }) => (\n <div className=\"flex h-12 w-full items-center rounded-xl bg-sw-modal-item px-3\">\n <div className=\"flex h-6 w-6 items-center justify-center rounded-full bg-sw-complete-900\">\n <Check size={13} strokeWidth={4} className=\"text-sw-complete-100\" />\n </div>\n <p className=\"text-label-m ml-sw-md font-medium text-sw-gray-50\">{text}</p>\n </div>\n);\n\nconst ErrorItem = ({ text }: { text: string }) => (\n <div className=\"flex min-h-[56px] w-full items-center rounded-xl bg-sw-modal-item px-3 py-3\">\n <div className=\"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-sw-warn-900\">\n <Minus size={13} className=\"text-sw-warn-100\" strokeWidth={4} />\n </div>\n <p className=\"text-label-m ml-sw-md leading-4 font-medium text-sw-gray-50\">\n {text}\n </p>\n </div>\n);\n\nexport const WalletCompatibilityModal = ({\n state,\n isSigning,\n onMsg,\n}: WalletCompatibilityCheckProps) => {\n const { t } = useTypedTranslation();\n const isErrorState = state === 'error';\n\n return (\n <div className=\"sw fixed inset-0 z-50 flex items-center justify-center\">\n {/* Backdrop - matches Privy */}\n <div className=\"absolute inset-0 bg-sw-gray-975/70 backdrop-blur-[5px] transition-[backdrop-filter] duration-100\" />\n\n {/* Modal */}\n <div className=\"relative z-50 mx-5 w-full max-w-[359px] rounded-3xl bg-sw-modal-bg px-6 pt-3 pb-6 shadow-[0px_0px_40px_0px_rgba(0,0,0,0.5)]\">\n {/* Close button (matches Privy styles) */}\n <button\n type=\"button\"\n onClick={() => onMsg({ type: 'on_close' })}\n className=\"absolute top-4 right-4 flex h-6 w-6 cursor-pointer items-center justify-center rounded-full bg-sw-gray-975 opacity-60\">\n <X size={16} strokeWidth={2} />\n </button>\n\n {/* Header */}\n <div className=\"mt-[58px] flex flex-col items-center\">\n {/* Icon */}\n <div className=\"relative mb-5 flex h-10 w-10 items-center justify-center\">\n {isErrorState ? (\n <ShieldX size={40} className=\"text-sw-warn-100\" />\n ) : (\n <ShieldQuestionMark size={40} className=\"text-sw-complete-100\" />\n )}\n </div>\n\n {/* Title */}\n <h2 className=\"text-h5 mb-4 text-center font-medium text-sw-gray-50\">\n {t(\n isErrorState\n ? 'walletCompatibility.modal.title.error'\n : 'walletCompatibility.modal.title.initial',\n isErrorState ? 'Unable to verify' : 'Signature check required',\n )}\n </h2>\n\n {/* Description */}\n <p className=\"text-p-s mb-8 max-w-[311px] text-center leading-5 font-normal text-sw-gray-100\">\n {t(\n isErrorState\n ? 'walletCompatibility.modal.description.error'\n : 'walletCompatibility.modal.description.initial',\n isErrorState\n ? \"The check couldn't be completed. Try again or choose another sign-in option to continue.\"\n : 'To keep your account secure, we need to verify that your device is compatible with Calyx.',\n )}\n </p>\n </div>\n\n {/* Content list */}\n <div className=\"mb-8 flex flex-col gap-[10px]\">\n {isErrorState ? (\n <>\n <ErrorItem\n text={t(\n 'walletCompatibility.modal.error.interrupted',\n 'The verification was interrupted or canceled',\n )}\n />\n <ErrorItem\n text={t(\n 'walletCompatibility.modal.error.incompatible',\n 'Some wallets (or devices) are incompatible with the platform',\n )}\n />\n </>\n ) : (\n <>\n <FeatureItem\n text={t(\n 'walletCompatibility.modal.feature.secureTransactions',\n 'Secure transactions and transfers',\n )}\n />\n <FeatureItem\n text={t(\n 'walletCompatibility.modal.feature.fullAccess',\n 'Full access to all Calyx features',\n )}\n />\n <FeatureItem\n text={t(\n 'walletCompatibility.modal.feature.fundProtection',\n 'Protection for your funds',\n )}\n />\n </>\n )}\n </div>\n\n {/* Action buttons */}\n <div className=\"flex flex-col gap-3\">\n {isErrorState ? (\n <Button\n variant=\"primary\"\n size=\"md\"\n onClick={() => onMsg({ type: 'on_try_again' })}\n className=\"h-12 w-full rounded-[10px] bg-sw-gray-50 text-sw-mauve-975 hover:bg-sw-gray-100 hover:text-sw-mauve-975\">\n <RotateCw size={16} strokeWidth={3} />\n {t('walletCompatibility.modal.button.tryAgain', 'Try again')}\n </Button>\n ) : (\n <Button\n variant=\"primary\"\n size=\"md\"\n state={isSigning ? 'loading' : 'default'}\n onClick={() => onMsg({ type: 'on_check_compatibility' })}\n className=\"h-12 w-full rounded-[10px] bg-sw-gray-50 text-sw-mauve-975 hover:bg-sw-gray-100 hover:text-sw-mauve-975\">\n {t(\n 'walletCompatibility.modal.button.checkCompatibility',\n 'Check compatibility',\n )}\n </Button>\n )}\n\n <Button\n variant=\"outlined\"\n size=\"md\"\n onClick={() => onMsg({ type: 'on_sign_out' })}\n className=\"h-10 w-full rounded-[10px] border border-sw-gray-500 bg-transparent text-sw-gray-50 hover:bg-sw-gray-900 hover:text-sw-gray-50\">\n {t('walletCompatibility.modal.button.signOut', 'Sign out')}\n </Button>\n </div>\n </div>\n </div>\n );\n};\n"],"names":["FeatureItem","text","jsxs","jsx","Check","ErrorItem","Minus","WalletCompatibilityModal","state","isSigning","onMsg","useTypedTranslation","isErrorState","X","ShieldX","ShieldQuestionMark","Fragment","Button","RotateCw"],"mappings":";;;;AAyBA,MAAMA,IAAc,CAAC,EAAE,MAAAC,QACrB,gBAAAC,EAAC,OAAA,EAAI,WAAU,kEACb,UAAA;AAAA,EAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,4EACb,UAAA,gBAAAA,EAACC,GAAA,EAAM,MAAM,IAAI,aAAa,GAAG,WAAU,uBAAA,CAAuB,GACpE;AAAA,EACA,gBAAAD,EAAC,KAAA,EAAE,WAAU,qDAAqD,UAAAF,EAAA,CAAK;AAAA,GACzE,GAGII,IAAY,CAAC,EAAE,MAAAJ,QACnB,gBAAAC,EAAC,OAAA,EAAI,WAAU,+EACb,UAAA;AAAA,EAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,iFACb,UAAA,gBAAAA,EAACG,GAAA,EAAM,MAAM,IAAI,WAAU,oBAAmB,aAAa,EAAA,CAAG,GAChE;AAAA,EACA,gBAAAH,EAAC,KAAA,EAAE,WAAU,+DACV,UAAAF,EAAA,CACH;AAAA,GACF,GAGWM,IAA2B,CAAC;AAAA,EACvC,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AACF,MAAqC;AACnC,QAAM,EAAE,EAAA,IAAMC,EAAA,GACRC,IAAeJ,MAAU;AAE/B,SACE,gBAAAN,EAAC,OAAA,EAAI,WAAU,0DAEb,UAAA;AAAA,IAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,mGAAA,CAAmG;AAAA,IAGlH,gBAAAD,EAAC,OAAA,EAAI,WAAU,+HAEb,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAS,MAAMO,EAAM,EAAE,MAAM,YAAY;AAAA,UACzC,WAAU;AAAA,UACV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BAAAG;AAAA,UAACH;AAAA,UAAA;AAAA,YACC,MAAM;AAAA,cACJ;AAAA,cACA;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,MACF,EAAA,CACF,EAAA,CAEJ;AAAA,MAGA,gBAAAE,EAAC,OAAA,EAAI,WAAU,uBACZ,UAAA;AAAA,QAAAU,IACC,gBAAAV;AAAA,UAACe;AAAA,UAAA;AAAA,YACC,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,SAAS,MAAMP,EAAM,EAAE,MAAM,gBAAgB;AAAA,YAC7C,WAAU;AAAA,YACV,UAAA;AAAA,cAAA,gBAAAP,EAACe,GAAA,EAAS,MAAM,IAAI,aAAa,GAAG;AAAA,cACnC,EAAE,6CAA6C,WAAW;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA,IAG7D,gBAAAf;AAAA,UAACc;AAAA,UAAA;AAAA,YACC,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,OAAOR,IAAY,YAAY;AAAA,YAC/B,SAAS,MAAMC,EAAM,EAAE,MAAM,0BAA0B;AAAA,YACvD,WAAU;AAAA,YACT,UAAA;AAAA,cACC;AAAA,cACA;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,QAIJ,gBAAAP;AAAA,UAACc;AAAA,UAAA;AAAA,YACC,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,SAAS,MAAMP,EAAM,EAAE,MAAM,eAAe;AAAA,YAC5C,WAAU;AAAA,YACT,UAAA,EAAE,4CAA4C,UAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MAC3D,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
@@ -35,6 +35,7 @@ const p = ({ makeTransfer: i }) => {
35
35
  try {
36
36
  const e = await i({
37
37
  amount: o.quote.amountIn,
38
+ decimals: o.sourceToken.decimals,
38
39
  address: o.quote.depositAddress,
39
40
  chain: o.sourceToken.blockchain,
40
41
  evmChainId: R(o.sourceToken.blockchain) ? u[o.sourceToken.blockchain] : null,
@@ -1 +1 @@
1
- {"version":3,"file":"useMakeQuoteTransfer.js","sources":["../../src/hooks/useMakeQuoteTransfer.ts"],"sourcesContent":["import axios from 'axios';\n\nimport { logger } from '@/logger';\nimport { TransferError } from '@/errors';\nimport { useUnsafeSnapshot } from '@/machine/snap';\nimport { NATIVE_NEAR_DUMB_ASSET_ID } from '@/constants/tokens';\nimport { isUserDeniedSigning } from '@/utils/checkers/isUserDeniedSigning';\nimport type { MakeTransferArgs, TransferResult } from '@/types/transfer';\nimport { EVM_CHAIN_IDS_MAP } from '../constants/chains';\nimport { isEvmChain } from '../utils';\n\ntype Result = {\n hash: string;\n transactionLink: string;\n intent?: string;\n};\n\nexport type QuoteTransferArgs = {\n makeTransfer: (args: MakeTransferArgs) => Promise<Result | undefined | null>;\n};\n\nexport const useMakeQuoteTransfer = ({ makeTransfer }: QuoteTransferArgs) => {\n const { ctx } = useUnsafeSnapshot();\n\n const make = async (): Promise<TransferResult | undefined> => {\n if (!ctx.sourceToken) {\n const msg = 'No token selected to transfer.';\n\n throw new TransferError({\n code: 'TRANSFER_INVALID_INITIAL',\n meta: { message: msg },\n });\n }\n\n if (!ctx.quote) {\n const msg = 'Quote is required for a transfer.';\n\n throw new TransferError({\n code: 'TRANSFER_INVALID_INITIAL',\n meta: { message: msg },\n });\n }\n\n if (!ctx.quote.depositAddress) {\n const msg = 'Quote has no deposit address. Make sure not dry.';\n\n throw new TransferError({\n code: 'TRANSFER_INVALID_INITIAL',\n meta: { message: msg },\n });\n }\n\n try {\n const depositResult = await makeTransfer({\n amount: ctx.quote.amountIn,\n address: ctx.quote.depositAddress,\n chain: ctx.sourceToken.blockchain,\n evmChainId: isEvmChain(ctx.sourceToken.blockchain)\n ? EVM_CHAIN_IDS_MAP[ctx.sourceToken.blockchain]\n : null,\n tokenAddress:\n ctx.sourceToken.assetId === NATIVE_NEAR_DUMB_ASSET_ID\n ? NATIVE_NEAR_DUMB_ASSET_ID\n : ctx.sourceToken.contractAddress,\n });\n\n if (!depositResult) {\n logger.error('[TRANSFER ERROR]', 'No deposit result');\n throw new TransferError({\n code: 'NO_DEPOSIT_RESULT',\n });\n }\n\n return {\n hash: depositResult.hash,\n transactionLink: depositResult.transactionLink,\n intent: undefined,\n };\n } catch (error: unknown) {\n logger.error('[TRANSFER ERROR]', error, { error });\n let errorMessage = 'Failed to make a transfer. Please try again.';\n\n const userCancelledTx =\n error instanceof Error && isUserDeniedSigning(error.message);\n\n if (userCancelledTx) {\n return;\n }\n\n if (axios.isAxiosError<{ detail?: string }>(error)) {\n errorMessage =\n error.response?.data?.detail ??\n error.message ??\n 'Failed to make deposit. Please try again.';\n\n throw new TransferError({\n code: 'QUOTE_ERROR',\n meta: { message: errorMessage },\n });\n } else if (errorMessage === 'No quotes found') {\n throw new TransferError({\n code: 'NO_QUOTE_FOUND',\n });\n } else if (error instanceof Error) {\n if (!userCancelledTx) {\n throw new TransferError({\n code: 'QUOTE_ERROR',\n meta: { message: error.message },\n });\n }\n }\n\n throw new TransferError({\n code: 'QUOTE_ERROR',\n meta: { message: 'Unknown quote transfer error' },\n });\n }\n };\n\n return { make };\n};\n"],"names":["useMakeQuoteTransfer","makeTransfer","ctx","useUnsafeSnapshot","msg","TransferError","depositResult","isEvmChain","EVM_CHAIN_IDS_MAP","NATIVE_NEAR_DUMB_ASSET_ID","logger","error","errorMessage","userCancelledTx","isUserDeniedSigning","axios"],"mappings":";;;;;;;;;;AAqBO,MAAMA,IAAuB,CAAC,EAAE,cAAAC,QAAsC;AAC3E,QAAM,EAAE,KAAAC,EAAA,IAAQC,EAAA;AAiGhB,SAAO,EAAE,MA/FI,YAAiD;AAC5D,QAAI,CAACD,EAAI,aAAa;AACpB,YAAME,IAAM;AAEZ,YAAM,IAAIC,EAAc;AAAA,QACtB,MAAM;AAAA,QACN,MAAM,EAAE,SAASD,EAAA;AAAA,MAAI,CACtB;AAAA,IACH;AAEA,QAAI,CAACF,EAAI,OAAO;AACd,YAAME,IAAM;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ACE,IACG,IAAIR,EAAc;AAAA,QACtB,MAAM;AAAA,QACN,MAAM,EAAE,SAASM,EAAM,QAAA;AAAA,MAAQ,CAChC,IAIC,IAAIN,EAAc;AAAA,QACtB,MAAM;AAAA,QACN,MAAM,EAAE,SAAS,+BAAA;AAAA,MAA+B,CACjD;AAAA,IACH;AAAA,EACF,EAES;AACX;"}
1
+ {"version":3,"file":"useMakeQuoteTransfer.js","sources":["../../src/hooks/useMakeQuoteTransfer.ts"],"sourcesContent":["import axios from 'axios';\n\nimport { logger } from '@/logger';\nimport { TransferError } from '@/errors';\nimport { useUnsafeSnapshot } from '@/machine/snap';\nimport { NATIVE_NEAR_DUMB_ASSET_ID } from '@/constants/tokens';\nimport { isUserDeniedSigning } from '@/utils/checkers/isUserDeniedSigning';\nimport type { MakeTransferArgs, TransferResult } from '@/types/transfer';\nimport { EVM_CHAIN_IDS_MAP } from '../constants/chains';\nimport { isEvmChain } from '../utils';\n\ntype Result = {\n hash: string;\n transactionLink: string;\n intent?: string;\n};\n\nexport type QuoteTransferArgs = {\n makeTransfer: (args: MakeTransferArgs) => Promise<Result | undefined | null>;\n};\n\nexport const useMakeQuoteTransfer = ({ makeTransfer }: QuoteTransferArgs) => {\n const { ctx } = useUnsafeSnapshot();\n\n const make = async (): Promise<TransferResult | undefined> => {\n if (!ctx.sourceToken) {\n const msg = 'No token selected to transfer.';\n\n throw new TransferError({\n code: 'TRANSFER_INVALID_INITIAL',\n meta: { message: msg },\n });\n }\n\n if (!ctx.quote) {\n const msg = 'Quote is required for a transfer.';\n\n throw new TransferError({\n code: 'TRANSFER_INVALID_INITIAL',\n meta: { message: msg },\n });\n }\n\n if (!ctx.quote.depositAddress) {\n const msg = 'Quote has no deposit address. Make sure not dry.';\n\n throw new TransferError({\n code: 'TRANSFER_INVALID_INITIAL',\n meta: { message: msg },\n });\n }\n\n try {\n const depositResult = await makeTransfer({\n amount: ctx.quote.amountIn,\n decimals: ctx.sourceToken.decimals,\n address: ctx.quote.depositAddress,\n chain: ctx.sourceToken.blockchain,\n evmChainId: isEvmChain(ctx.sourceToken.blockchain)\n ? EVM_CHAIN_IDS_MAP[ctx.sourceToken.blockchain]\n : null,\n tokenAddress:\n ctx.sourceToken.assetId === NATIVE_NEAR_DUMB_ASSET_ID\n ? NATIVE_NEAR_DUMB_ASSET_ID\n : ctx.sourceToken.contractAddress,\n });\n\n if (!depositResult) {\n logger.error('[TRANSFER ERROR]', 'No deposit result');\n throw new TransferError({\n code: 'NO_DEPOSIT_RESULT',\n });\n }\n\n return {\n hash: depositResult.hash,\n transactionLink: depositResult.transactionLink,\n intent: undefined,\n };\n } catch (error: unknown) {\n logger.error('[TRANSFER ERROR]', error, { error });\n let errorMessage = 'Failed to make a transfer. Please try again.';\n\n const userCancelledTx =\n error instanceof Error && isUserDeniedSigning(error.message);\n\n if (userCancelledTx) {\n return;\n }\n\n if (axios.isAxiosError<{ detail?: string }>(error)) {\n errorMessage =\n error.response?.data?.detail ??\n error.message ??\n 'Failed to make deposit. Please try again.';\n\n throw new TransferError({\n code: 'QUOTE_ERROR',\n meta: { message: errorMessage },\n });\n } else if (errorMessage === 'No quotes found') {\n throw new TransferError({\n code: 'NO_QUOTE_FOUND',\n });\n } else if (error instanceof Error) {\n if (!userCancelledTx) {\n throw new TransferError({\n code: 'QUOTE_ERROR',\n meta: { message: error.message },\n });\n }\n }\n\n throw new TransferError({\n code: 'QUOTE_ERROR',\n meta: { message: 'Unknown quote transfer error' },\n });\n }\n };\n\n return { make };\n};\n"],"names":["useMakeQuoteTransfer","makeTransfer","ctx","useUnsafeSnapshot","msg","TransferError","depositResult","isEvmChain","EVM_CHAIN_IDS_MAP","NATIVE_NEAR_DUMB_ASSET_ID","logger","error","errorMessage","userCancelledTx","isUserDeniedSigning","axios"],"mappings":";;;;;;;;;;AAqBO,MAAMA,IAAuB,CAAC,EAAE,cAAAC,QAAsC;AAC3E,QAAM,EAAE,KAAAC,EAAA,IAAQC,EAAA;AAkGhB,SAAO,EAAE,MAh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aAAkCJ,CAAK,KAC/CC,IACED,EAAM,UAAU,MAAM,UACtBA,EAAM,WACN,6CAEI,IAAIN,EAAc;AAAA,QACtB,MAAM;AAAA,QACN,MAAM,EAAE,SAASO,EAAA;AAAA,MAAa,CAC/B,KACQA,MAAiB,oBACpB,IAAIP,EAAc;AAAA,QACtB,MAAM;AAAA,MAAA,CACP,IACQM,aAAiB,SACtB,CAACE,IACG,IAAIR,EAAc;AAAA,QACtB,MAAM;AAAA,QACN,MAAM,EAAE,SAASM,EAAM,QAAA;AAAA,MAAQ,CAChC,IAIC,IAAIN,EAAc;AAAA,QACtB,MAAM;AAAA,QACN,MAAM,EAAE,SAAS,+BAAA;AAAA,MAA+B,CACjD;AAAA,IACH;AAAA,EACF,EAES;AACX;"}
@@ -6,6 +6,7 @@ export type TransferResult = {
6
6
  };
7
7
  export type MakeTransferArgs = {
8
8
  amount: string;
9
+ decimals: number;
9
10
  address: string;
10
11
  tokenAddress?: string;
11
12
  chain: Chains;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurora-is-near/intents-swap-widget",
3
- "version": "2.8.0",
3
+ "version": "2.9.1",
4
4
  "description": "Provides components and hooks to build your own Intents swap widget",
5
5
  "author": "Maksim Vashchuk",
6
6
  "license": "MIT",
@@ -52,7 +52,7 @@ export const WalletCompatibilityModal = ({
52
52
  const isErrorState = state === 'error';
53
53
 
54
54
  return (
55
- <div className="fixed inset-0 z-50 flex items-center justify-center">
55
+ <div className="sw fixed inset-0 z-50 flex items-center justify-center">
56
56
  {/* Backdrop - matches Privy */}
57
57
  <div className="absolute inset-0 bg-sw-gray-975/70 backdrop-blur-[5px] transition-[backdrop-filter] duration-100" />
58
58
 
@@ -53,6 +53,7 @@ export const useMakeQuoteTransfer = ({ makeTransfer }: QuoteTransferArgs) => {
53
53
  try {
54
54
  const depositResult = await makeTransfer({
55
55
  amount: ctx.quote.amountIn,
56
+ decimals: ctx.sourceToken.decimals,
56
57
  address: ctx.quote.depositAddress,
57
58
  chain: ctx.sourceToken.blockchain,
58
59
  evmChainId: isEvmChain(ctx.sourceToken.blockchain)
@@ -8,6 +8,7 @@ export type TransferResult = {
8
8
 
9
9
  export type MakeTransferArgs = {
10
10
  amount: string;
11
+ decimals: number;
11
12
  address: string;
12
13
  tokenAddress?: string;
13
14
  chain: Chains;