@aurora-is-near/intents-swap-widget 2.29.3 → 2.29.4

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.
@@ -54,7 +54,7 @@ export type InputValidDryContext = {
54
54
  sourceTokenBalance?: never;
55
55
  targetToken: Token;
56
56
  targetTokenAmount: string;
57
- sendAddress?: never;
57
+ sendAddress?: string;
58
58
  walletAddress?: string;
59
59
  isDepositFromExternalWallet: boolean;
60
60
  externalDepositTxReceived?: never;
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sources":["../../src/machine/context.ts"],"sourcesContent":["import type {\n InitialDryStateError,\n InitialExternalStateError,\n InitialInternalStateError,\n InputValidDryError,\n InputValidWalletError,\n QuoteSuccessError,\n} from './errors';\nimport type { Quote, QuoteDry, QuoteReal } from '@/types/quote';\nimport type { Token, TokenBalance } from '@/types/token';\n\nexport const initialContext: Readonly<InitialDryContext> = Object.freeze({\n state: 'initial_dry',\n\n sourceToken: undefined,\n sourceTokenBalance: undefined,\n sourceTokenAmount: '',\n\n targetToken: undefined,\n targetTokenAmount: '',\n\n isDepositFromExternalWallet: false,\n externalDepositTxReceived: undefined,\n walletAddress: undefined,\n sendAddress: undefined,\n error: null,\n\n quote: undefined,\n quoteStatus: 'idle' as const,\n transferStatus: { status: 'idle' as const },\n});\n\nexport type Context =\n | InitialDryContext\n | InitialWalletContext\n | InputValidDryContext\n | InputValidInternalContext\n | InputValidExternalContext\n | QuoteSuccessDryContext\n | QuoteSuccessInternalContext\n | QuoteSuccessExternalContext\n | TransferSuccessContext;\n\nexport type ContextKeys = Array<keyof Context>;\n\nexport type ContextChange = {\n [K in keyof Context]: {\n key: K;\n value: Context[K];\n previousValue: Context[K];\n };\n}[keyof Context];\n\nexport type InitialDryContext = {\n state: 'initial_dry';\n\n sourceToken: Token | undefined;\n sourceTokenAmount: string;\n sourceTokenBalance?: never;\n\n targetToken: Token | undefined;\n targetTokenAmount: string;\n\n sendAddress?: string;\n walletAddress?: string;\n isDepositFromExternalWallet: boolean;\n externalDepositTxReceived: boolean | undefined;\n error: InitialDryStateError | null;\n\n quote?: never;\n quoteStatus: 'idle';\n transferStatus: { status: 'idle' };\n};\n\nexport type InitialWalletContext = {\n state: 'initial_wallet';\n\n sourceToken: Token | undefined;\n sourceTokenAmount: string;\n sourceTokenBalance: TokenBalance;\n\n targetToken: Token | undefined;\n targetTokenAmount: string;\n\n walletAddress: string;\n sendAddress: string | undefined;\n isDepositFromExternalWallet: boolean;\n externalDepositTxReceived: boolean | undefined;\n error: InitialInternalStateError | InitialExternalStateError | null;\n\n quote?: never;\n quoteStatus: 'idle';\n transferStatus: { status: 'idle' };\n};\n\nexport type InputValidDryContext = {\n state: 'input_valid_dry';\n\n sourceToken: Token;\n sourceTokenAmount: string;\n sourceTokenBalance?: never;\n\n targetToken: Token;\n targetTokenAmount: string;\n\n sendAddress?: never;\n walletAddress?: string;\n isDepositFromExternalWallet: boolean;\n externalDepositTxReceived?: never;\n error: InputValidDryError | null;\n\n quote?: never;\n quoteStatus: 'idle' | 'pending' | 'error';\n transferStatus: { status: 'idle' };\n};\n\nexport type InputValidInternalContext = {\n state: 'input_valid_internal';\n\n sourceToken: Token;\n sourceTokenAmount: string;\n sourceTokenBalance: TokenBalance;\n\n targetToken: Token;\n targetTokenAmount: string;\n\n sendAddress?: never;\n walletAddress: string;\n isDepositFromExternalWallet: boolean;\n externalDepositTxReceived?: never;\n error: InputValidWalletError | null;\n\n quote?: never;\n quoteStatus: 'idle' | 'pending' | 'error';\n transferStatus: { status: 'idle' };\n};\n\nexport type InputValidExternalContext = {\n state: 'input_valid_external';\n\n sourceToken: Token;\n sourceTokenAmount: string;\n sourceTokenBalance: TokenBalance;\n\n targetToken: Token;\n targetTokenAmount: string;\n\n sendAddress: string;\n walletAddress: string;\n isDepositFromExternalWallet: boolean;\n externalDepositTxReceived: boolean | undefined;\n error: InputValidWalletError | null;\n\n quote?: never;\n quoteStatus: 'idle' | 'pending' | 'error';\n transferStatus: { status: 'idle' };\n};\n\nexport type QuoteSuccessDryContext = {\n state: 'quote_success_dry';\n\n sourceToken: Token;\n sourceTokenAmount: string;\n sourceTokenBalance?: never;\n\n targetToken: Token;\n targetTokenAmount: string;\n\n sendAddress?: never;\n walletAddress?: never;\n isDepositFromExternalWallet: boolean;\n externalDepositTxReceived?: never;\n error: QuoteSuccessError | null;\n\n quote: QuoteDry;\n quoteStatus: 'success';\n transferStatus: { status: 'idle' };\n};\n\nexport type QuoteSuccessInternalContext = {\n state: 'quote_success_internal';\n\n sourceToken: Token;\n sourceTokenAmount: string;\n sourceTokenBalance: TokenBalance;\n\n targetToken: Token;\n targetTokenAmount: string;\n\n sendAddress?: never;\n walletAddress: string;\n isDepositFromExternalWallet: boolean;\n externalDepositTxReceived?: never;\n error: QuoteSuccessError | null;\n\n quote: QuoteReal;\n quoteStatus: 'success';\n transferStatus:\n | { status: 'idle' | 'error'; reason: never }\n | { status: 'pending'; reason: 'PROCESSING' | 'WAITING_CONFIRMATION' };\n};\n\nexport type QuoteSuccessExternalContext = {\n state: 'quote_success_external';\n\n sourceToken: Token;\n sourceTokenAmount: string;\n sourceTokenBalance: TokenBalance;\n\n targetToken: Token;\n targetTokenAmount: string;\n\n sendAddress: string;\n walletAddress: string;\n isDepositFromExternalWallet: boolean;\n externalDepositTxReceived: boolean | undefined;\n error: QuoteSuccessError | null;\n\n quote: QuoteReal;\n quoteStatus: 'success';\n transferStatus:\n | { status: 'idle' | 'error'; reason: never }\n | { status: 'pending'; reason: string };\n};\n\nexport type TransferSuccessContext = {\n state: 'transfer_success';\n\n sourceToken: Token;\n sourceTokenAmount: string;\n sourceTokenBalance: TokenBalance;\n\n targetToken: Token;\n targetTokenAmount: string;\n\n walletAddress: string;\n sendAddress: string | undefined;\n isDepositFromExternalWallet: boolean;\n externalDepositTxReceived: boolean | undefined;\n error?: never;\n\n quote: Quote | undefined;\n quoteStatus: 'idle' | 'error' | 'pending' | 'success';\n transferStatus: { status: 'success'; reason: never };\n};\n"],"names":["initialContext"],"mappings":"AAWO,MAAMA,IAA8C,OAAO,OAAO;AAAA,EACvE,OAAO;AAAA,EAEP,aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EAEnB,aAAa;AAAA,EACb,mBAAmB;AAAA,EAEnB,6BAA6B;AAAA,EAC7B,2BAA2B;AAAA,EAC3B,eAAe;AAAA,EACf,aAAa;AAAA,EACb,OAAO;AAAA,EAEP,OAAO;AAAA,EACP,aAAa;AAAA,EACb,gBAAgB,EAAE,QAAQ,OAAA;AAC5B,CAAC;"}
1
+ {"version":3,"file":"context.js","sources":["../../src/machine/context.ts"],"sourcesContent":["import type {\n InitialDryStateError,\n InitialExternalStateError,\n InitialInternalStateError,\n InputValidDryError,\n InputValidWalletError,\n QuoteSuccessError,\n} from './errors';\nimport type { Quote, QuoteDry, QuoteReal } from '@/types/quote';\nimport type { Token, TokenBalance } from '@/types/token';\n\nexport const initialContext: Readonly<InitialDryContext> = Object.freeze({\n state: 'initial_dry',\n\n sourceToken: undefined,\n sourceTokenBalance: undefined,\n sourceTokenAmount: '',\n\n targetToken: undefined,\n targetTokenAmount: '',\n\n isDepositFromExternalWallet: false,\n externalDepositTxReceived: undefined,\n walletAddress: undefined,\n sendAddress: undefined,\n error: null,\n\n quote: undefined,\n quoteStatus: 'idle' as const,\n transferStatus: { status: 'idle' as const },\n});\n\nexport type Context =\n | InitialDryContext\n | InitialWalletContext\n | InputValidDryContext\n | InputValidInternalContext\n | InputValidExternalContext\n | QuoteSuccessDryContext\n | QuoteSuccessInternalContext\n | QuoteSuccessExternalContext\n | TransferSuccessContext;\n\nexport type ContextKeys = Array<keyof Context>;\n\nexport type ContextChange = {\n [K in keyof Context]: {\n key: K;\n value: Context[K];\n previousValue: Context[K];\n };\n}[keyof Context];\n\nexport type InitialDryContext = {\n state: 'initial_dry';\n\n sourceToken: Token | undefined;\n sourceTokenAmount: string;\n sourceTokenBalance?: never;\n\n targetToken: Token | undefined;\n targetTokenAmount: string;\n\n sendAddress?: string;\n walletAddress?: string;\n isDepositFromExternalWallet: boolean;\n externalDepositTxReceived: boolean | undefined;\n error: InitialDryStateError | null;\n\n quote?: never;\n quoteStatus: 'idle';\n transferStatus: { status: 'idle' };\n};\n\nexport type InitialWalletContext = {\n state: 'initial_wallet';\n\n sourceToken: Token | undefined;\n sourceTokenAmount: string;\n sourceTokenBalance: TokenBalance;\n\n targetToken: Token | undefined;\n targetTokenAmount: string;\n\n walletAddress: string;\n sendAddress: string | undefined;\n isDepositFromExternalWallet: boolean;\n externalDepositTxReceived: boolean | undefined;\n error: InitialInternalStateError | InitialExternalStateError | null;\n\n quote?: never;\n quoteStatus: 'idle';\n transferStatus: { status: 'idle' };\n};\n\nexport type InputValidDryContext = {\n state: 'input_valid_dry';\n\n sourceToken: Token;\n sourceTokenAmount: string;\n sourceTokenBalance?: never;\n\n targetToken: Token;\n targetTokenAmount: string;\n\n sendAddress?: string;\n walletAddress?: string;\n isDepositFromExternalWallet: boolean;\n externalDepositTxReceived?: never;\n error: InputValidDryError | null;\n\n quote?: never;\n quoteStatus: 'idle' | 'pending' | 'error';\n transferStatus: { status: 'idle' };\n};\n\nexport type InputValidInternalContext = {\n state: 'input_valid_internal';\n\n sourceToken: Token;\n sourceTokenAmount: string;\n sourceTokenBalance: TokenBalance;\n\n targetToken: Token;\n targetTokenAmount: string;\n\n sendAddress?: never;\n walletAddress: string;\n isDepositFromExternalWallet: boolean;\n externalDepositTxReceived?: never;\n error: InputValidWalletError | null;\n\n quote?: never;\n quoteStatus: 'idle' | 'pending' | 'error';\n transferStatus: { status: 'idle' };\n};\n\nexport type InputValidExternalContext = {\n state: 'input_valid_external';\n\n sourceToken: Token;\n sourceTokenAmount: string;\n sourceTokenBalance: TokenBalance;\n\n targetToken: Token;\n targetTokenAmount: string;\n\n sendAddress: string;\n walletAddress: string;\n isDepositFromExternalWallet: boolean;\n externalDepositTxReceived: boolean | undefined;\n error: InputValidWalletError | null;\n\n quote?: never;\n quoteStatus: 'idle' | 'pending' | 'error';\n transferStatus: { status: 'idle' };\n};\n\nexport type QuoteSuccessDryContext = {\n state: 'quote_success_dry';\n\n sourceToken: Token;\n sourceTokenAmount: string;\n sourceTokenBalance?: never;\n\n targetToken: Token;\n targetTokenAmount: string;\n\n sendAddress?: never;\n walletAddress?: never;\n isDepositFromExternalWallet: boolean;\n externalDepositTxReceived?: never;\n error: QuoteSuccessError | null;\n\n quote: QuoteDry;\n quoteStatus: 'success';\n transferStatus: { status: 'idle' };\n};\n\nexport type QuoteSuccessInternalContext = {\n state: 'quote_success_internal';\n\n sourceToken: Token;\n sourceTokenAmount: string;\n sourceTokenBalance: TokenBalance;\n\n targetToken: Token;\n targetTokenAmount: string;\n\n sendAddress?: never;\n walletAddress: string;\n isDepositFromExternalWallet: boolean;\n externalDepositTxReceived?: never;\n error: QuoteSuccessError | null;\n\n quote: QuoteReal;\n quoteStatus: 'success';\n transferStatus:\n | { status: 'idle' | 'error'; reason: never }\n | { status: 'pending'; reason: 'PROCESSING' | 'WAITING_CONFIRMATION' };\n};\n\nexport type QuoteSuccessExternalContext = {\n state: 'quote_success_external';\n\n sourceToken: Token;\n sourceTokenAmount: string;\n sourceTokenBalance: TokenBalance;\n\n targetToken: Token;\n targetTokenAmount: string;\n\n sendAddress: string;\n walletAddress: string;\n isDepositFromExternalWallet: boolean;\n externalDepositTxReceived: boolean | undefined;\n error: QuoteSuccessError | null;\n\n quote: QuoteReal;\n quoteStatus: 'success';\n transferStatus:\n | { status: 'idle' | 'error'; reason: never }\n | { status: 'pending'; reason: string };\n};\n\nexport type TransferSuccessContext = {\n state: 'transfer_success';\n\n sourceToken: Token;\n sourceTokenAmount: string;\n sourceTokenBalance: TokenBalance;\n\n targetToken: Token;\n targetTokenAmount: string;\n\n walletAddress: string;\n sendAddress: string | undefined;\n isDepositFromExternalWallet: boolean;\n externalDepositTxReceived: boolean | undefined;\n error?: never;\n\n quote: Quote | undefined;\n quoteStatus: 'idle' | 'error' | 'pending' | 'success';\n transferStatus: { status: 'success'; reason: never };\n};\n"],"names":["initialContext"],"mappings":"AAWO,MAAMA,IAA8C,OAAO,OAAO;AAAA,EACvE,OAAO;AAAA,EAEP,aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EAEnB,aAAa;AAAA,EACb,mBAAmB;AAAA,EAEnB,6BAA6B;AAAA,EAC7B,2BAA2B;AAAA,EAC3B,eAAe;AAAA,EACf,aAAa;AAAA,EACb,OAAO;AAAA,EAEP,OAAO;AAAA,EACP,aAAa;AAAA,EACb,gBAAgB,EAAE,QAAQ,OAAA;AAC5B,CAAC;"}
@@ -1,7 +1,11 @@
1
1
  import { isBalanceSufficient as r } from "./isBalanceSufficient.js";
2
- import { isNotEmptyAmount as t } from "../../../utils/checkers/isNotEmptyAmount.js";
3
- const m = (o) => !o.walletAddress || t(o.sourceTokenAmount) && !r(o);
2
+ import { isNotEmptyAmount as e } from "../../../utils/checkers/isNotEmptyAmount.js";
3
+ const n = (o) => (
4
+ // wallet is not connected
5
+ !o.walletAddress && e(o.sourceTokenAmount) || // or insufficient balance for connected wallet
6
+ !!o.walletAddress && !o.isDepositFromExternalWallet && e(o.sourceTokenAmount) && !r(o)
7
+ );
4
8
  export {
5
- m as isDryQuote
9
+ n as isDryQuote
6
10
  };
7
11
  //# sourceMappingURL=isDryQuote.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isDryQuote.js","sources":["../../../../src/machine/guards/checks/isDryQuote.ts"],"sourcesContent":["import { isBalanceSufficient } from './isBalanceSufficient';\nimport { isNotEmptyAmount } from '@/utils/checkers/isNotEmptyAmount';\nimport type { Context } from '@/machine/context';\n\nexport const isDryQuote = (ctx: Context): boolean => {\n return (\n !ctx.walletAddress ||\n (isNotEmptyAmount(ctx.sourceTokenAmount) && !isBalanceSufficient(ctx))\n );\n};\n"],"names":["isDryQuote","ctx","isNotEmptyAmount","isBalanceSufficient"],"mappings":";;AAIO,MAAMA,IAAa,CAACC,MAEvB,CAACA,EAAI,iBACJC,EAAiBD,EAAI,iBAAiB,KAAK,CAACE,EAAoBF,CAAG;"}
1
+ {"version":3,"file":"isDryQuote.js","sources":["../../../../src/machine/guards/checks/isDryQuote.ts"],"sourcesContent":["import { isBalanceSufficient } from './isBalanceSufficient';\nimport { isNotEmptyAmount } from '@/utils/checkers/isNotEmptyAmount';\nimport type { Context } from '@/machine/context';\n\nexport const isDryQuote = (ctx: Context): boolean => {\n return (\n // wallet is not connected\n (!ctx.walletAddress && isNotEmptyAmount(ctx.sourceTokenAmount)) ||\n // or insufficient balance for connected wallet\n (!!ctx.walletAddress &&\n !ctx.isDepositFromExternalWallet &&\n isNotEmptyAmount(ctx.sourceTokenAmount) &&\n !isBalanceSufficient(ctx))\n );\n};\n"],"names":["isDryQuote","ctx","isNotEmptyAmount","isBalanceSufficient"],"mappings":";;AAIO,MAAMA,IAAa,CAACC;AAAA;AAAA,EAGtB,CAACA,EAAI,iBAAiBC,EAAiBD,EAAI,iBAAiB;AAAA,EAE5D,CAAC,CAACA,EAAI,iBACL,CAACA,EAAI,+BACLC,EAAiBD,EAAI,iBAAiB,KACtC,CAACE,EAAoBF,CAAG;AAAA;"}
@@ -1,7 +1,7 @@
1
1
  import { isBalanceSufficient as o } from "./checks/isBalanceSufficient.js";
2
2
  import { isNotEmptyAmount as t } from "../../utils/checkers/isNotEmptyAmount.js";
3
- const u = (e) => !e.quote && e.quoteStatus === "idle" && e.transferStatus.status === "idle" && (!e.sourceToken || !e.targetToken || !t(e.sourceTokenAmount) || !!e.walletAddress && !o(e));
3
+ const a = (e) => !e.quote && e.quoteStatus === "idle" && e.transferStatus.status === "idle" && (!e.sourceToken || !e.targetToken || !t(e.sourceTokenAmount) || !!e.walletAddress && !o(e) && !e.isDepositFromExternalWallet);
4
4
  export {
5
- u as guardInitialDry
5
+ a as guardInitialDry
6
6
  };
7
7
  //# sourceMappingURL=guardInitialDry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"guardInitialDry.js","sources":["../../../src/machine/guards/guardInitialDry.ts"],"sourcesContent":["import { isBalanceSufficient } from './checks/isBalanceSufficient';\nimport { isNotEmptyAmount } from '@/utils/checkers/isNotEmptyAmount';\nimport type { Context, InitialDryContext } from '@/machine/context';\n\nexport const guardInitialDry = (ctx: Context): ctx is InitialDryContext => {\n return (\n !ctx.quote &&\n ctx.quoteStatus === 'idle' &&\n ctx.transferStatus.status === 'idle' &&\n (!ctx.sourceToken ||\n !ctx.targetToken ||\n !isNotEmptyAmount(ctx.sourceTokenAmount) ||\n (!!ctx.walletAddress && !isBalanceSufficient(ctx)))\n );\n};\n"],"names":["guardInitialDry","ctx","isNotEmptyAmount","isBalanceSufficient"],"mappings":";;AAIO,MAAMA,IAAkB,CAACC,MAE5B,CAACA,EAAI,SACLA,EAAI,gBAAgB,UACpBA,EAAI,eAAe,WAAW,WAC7B,CAACA,EAAI,eACJ,CAACA,EAAI,eACL,CAACC,EAAiBD,EAAI,iBAAiB,KACtC,CAAC,CAACA,EAAI,iBAAiB,CAACE,EAAoBF,CAAG;"}
1
+ {"version":3,"file":"guardInitialDry.js","sources":["../../../src/machine/guards/guardInitialDry.ts"],"sourcesContent":["import { isBalanceSufficient } from './checks/isBalanceSufficient';\nimport { isNotEmptyAmount } from '@/utils/checkers/isNotEmptyAmount';\nimport type { Context, InitialDryContext } from '@/machine/context';\n\nexport const guardInitialDry = (ctx: Context): ctx is InitialDryContext => {\n return (\n !ctx.quote &&\n ctx.quoteStatus === 'idle' &&\n ctx.transferStatus.status === 'idle' &&\n (!ctx.sourceToken ||\n !ctx.targetToken ||\n !isNotEmptyAmount(ctx.sourceTokenAmount) ||\n (!!ctx.walletAddress &&\n !isBalanceSufficient(ctx) &&\n !ctx.isDepositFromExternalWallet))\n );\n};\n"],"names":["guardInitialDry","ctx","isNotEmptyAmount","isBalanceSufficient"],"mappings":";;AAIO,MAAMA,IAAkB,CAACC,MAE5B,CAACA,EAAI,SACLA,EAAI,gBAAgB,UACpBA,EAAI,eAAe,WAAW,WAC7B,CAACA,EAAI,eACJ,CAACA,EAAI,eACL,CAACC,EAAiBD,EAAI,iBAAiB,KACtC,CAAC,CAACA,EAAI,iBACL,CAACE,EAAoBF,CAAG,KACxB,CAACA,EAAI;"}
@@ -1,6 +1,6 @@
1
1
  import { isBalanceSufficient as s } from "./checks/isBalanceSufficient.js";
2
2
  import { isNotEmptyAmount as o } from "../../utils/checkers/isNotEmptyAmount.js";
3
- const u = (e) => !e.quote && e.quoteStatus !== "success" && e.transferStatus.status === "idle" && (!e.walletAddress || !!e.walletAddress && !s(e)) && !!e.sourceToken && !!e.targetToken && o(e.sourceTokenAmount);
3
+ const u = (e) => !e.quote && e.quoteStatus !== "success" && e.transferStatus.status === "idle" && (!e.walletAddress || !!e.walletAddress && !s(e) && !e.isDepositFromExternalWallet) && !!e.sourceToken && !!e.targetToken && o(e.sourceTokenAmount);
4
4
  export {
5
5
  u as guardInputValidDry
6
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"guardInputValidDry.js","sources":["../../../src/machine/guards/guardInputValidDry.ts"],"sourcesContent":["import { isBalanceSufficient } from './checks/isBalanceSufficient';\nimport { isNotEmptyAmount } from '@/utils/checkers/isNotEmptyAmount';\nimport type { Context, InputValidDryContext } from '@/machine/context';\n\nexport const guardInputValidDry = (\n ctx: Context,\n): ctx is InputValidDryContext => {\n return (\n !ctx.quote &&\n ctx.quoteStatus !== 'success' &&\n ctx.transferStatus.status === 'idle' &&\n (!ctx.walletAddress ||\n (!!ctx.walletAddress && !isBalanceSufficient(ctx))) &&\n !!ctx.sourceToken &&\n !!ctx.targetToken &&\n isNotEmptyAmount(ctx.sourceTokenAmount)\n );\n};\n"],"names":["guardInputValidDry","ctx","isBalanceSufficient","isNotEmptyAmount"],"mappings":";;AAIO,MAAMA,IAAqB,CAChCC,MAGE,CAACA,EAAI,SACLA,EAAI,gBAAgB,aACpBA,EAAI,eAAe,WAAW,WAC7B,CAACA,EAAI,iBACH,CAAC,CAACA,EAAI,iBAAiB,CAACC,EAAoBD,CAAG,MAClD,CAAC,CAACA,EAAI,eACN,CAAC,CAACA,EAAI,eACNE,EAAiBF,EAAI,iBAAiB;"}
1
+ {"version":3,"file":"guardInputValidDry.js","sources":["../../../src/machine/guards/guardInputValidDry.ts"],"sourcesContent":["import { isBalanceSufficient } from './checks/isBalanceSufficient';\nimport { isNotEmptyAmount } from '@/utils/checkers/isNotEmptyAmount';\nimport type { Context, InputValidDryContext } from '@/machine/context';\n\nexport const guardInputValidDry = (\n ctx: Context,\n): ctx is InputValidDryContext => {\n return (\n !ctx.quote &&\n ctx.quoteStatus !== 'success' &&\n ctx.transferStatus.status === 'idle' &&\n (!ctx.walletAddress ||\n (!!ctx.walletAddress &&\n !isBalanceSufficient(ctx) &&\n !ctx.isDepositFromExternalWallet)) &&\n !!ctx.sourceToken &&\n !!ctx.targetToken &&\n isNotEmptyAmount(ctx.sourceTokenAmount)\n );\n};\n"],"names":["guardInputValidDry","ctx","isBalanceSufficient","isNotEmptyAmount"],"mappings":";;AAIO,MAAMA,IAAqB,CAChCC,MAGE,CAACA,EAAI,SACLA,EAAI,gBAAgB,aACpBA,EAAI,eAAe,WAAW,WAC7B,CAACA,EAAI,iBACH,CAAC,CAACA,EAAI,iBACL,CAACC,EAAoBD,CAAG,KACxB,CAACA,EAAI,gCACT,CAAC,CAACA,EAAI,eACN,CAAC,CAACA,EAAI,eACNE,EAAiBF,EAAI,iBAAiB;"}
@@ -1,6 +1,6 @@
1
1
  import { isBalanceSufficient as s } from "./checks/isBalanceSufficient.js";
2
2
  import { isNotEmptyAmount as o } from "../../utils/checkers/isNotEmptyAmount.js";
3
- const u = (e) => !!e.quote && e.quoteStatus === "success" && e.transferStatus.status === "idle" && (!e.walletAddress || !!e.walletAddress && !s(e)) && !!e.sourceToken && !!e.targetToken && o(e.sourceTokenAmount);
3
+ const u = (e) => !!e.quote && e.quoteStatus === "success" && e.transferStatus.status === "idle" && (!e.walletAddress || !!e.walletAddress && !s(e) && !e.isDepositFromExternalWallet) && !!e.sourceToken && !!e.targetToken && o(e.sourceTokenAmount);
4
4
  export {
5
5
  u as guardQuoteSuccessDry
6
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"guardQuoteSuccessDry.js","sources":["../../../src/machine/guards/guardQuoteSuccessDry.ts"],"sourcesContent":["import { isBalanceSufficient } from './checks/isBalanceSufficient';\nimport { isNotEmptyAmount } from '@/utils/checkers/isNotEmptyAmount';\nimport type { Context, QuoteSuccessDryContext } from '@/machine/context';\n\nexport const guardQuoteSuccessDry = (\n ctx: Context,\n): ctx is QuoteSuccessDryContext => {\n return (\n !!ctx.quote &&\n ctx.quoteStatus === 'success' &&\n ctx.transferStatus.status === 'idle' &&\n (!ctx.walletAddress ||\n (!!ctx.walletAddress && !isBalanceSufficient(ctx))) &&\n !!ctx.sourceToken &&\n !!ctx.targetToken &&\n isNotEmptyAmount(ctx.sourceTokenAmount)\n );\n};\n"],"names":["guardQuoteSuccessDry","ctx","isBalanceSufficient","isNotEmptyAmount"],"mappings":";;AAIO,MAAMA,IAAuB,CAClCC,MAGE,CAAC,CAACA,EAAI,SACNA,EAAI,gBAAgB,aACpBA,EAAI,eAAe,WAAW,WAC7B,CAACA,EAAI,iBACH,CAAC,CAACA,EAAI,iBAAiB,CAACC,EAAoBD,CAAG,MAClD,CAAC,CAACA,EAAI,eACN,CAAC,CAACA,EAAI,eACNE,EAAiBF,EAAI,iBAAiB;"}
1
+ {"version":3,"file":"guardQuoteSuccessDry.js","sources":["../../../src/machine/guards/guardQuoteSuccessDry.ts"],"sourcesContent":["import { isBalanceSufficient } from './checks/isBalanceSufficient';\nimport { isNotEmptyAmount } from '@/utils/checkers/isNotEmptyAmount';\nimport type { Context, QuoteSuccessDryContext } from '@/machine/context';\n\nexport const guardQuoteSuccessDry = (\n ctx: Context,\n): ctx is QuoteSuccessDryContext => {\n return (\n !!ctx.quote &&\n ctx.quoteStatus === 'success' &&\n ctx.transferStatus.status === 'idle' &&\n (!ctx.walletAddress ||\n (!!ctx.walletAddress &&\n !isBalanceSufficient(ctx) &&\n !ctx.isDepositFromExternalWallet)) &&\n !!ctx.sourceToken &&\n !!ctx.targetToken &&\n isNotEmptyAmount(ctx.sourceTokenAmount)\n );\n};\n"],"names":["guardQuoteSuccessDry","ctx","isBalanceSufficient","isNotEmptyAmount"],"mappings":";;AAIO,MAAMA,IAAuB,CAClCC,MAGE,CAAC,CAACA,EAAI,SACNA,EAAI,gBAAgB,aACpBA,EAAI,eAAe,WAAW,WAC7B,CAACA,EAAI,iBACH,CAAC,CAACA,EAAI,iBACL,CAACC,EAAoBD,CAAG,KACxB,CAACA,EAAI,gCACT,CAAC,CAACA,EAAI,eACN,CAAC,CAACA,EAAI,eACNE,EAAiBF,EAAI,iBAAiB;"}
@@ -150,7 +150,7 @@ export declare const useUnsafeSnapshot: () => {
150
150
  readonly chainIcon: string;
151
151
  };
152
152
  readonly targetTokenAmount: string;
153
- readonly sendAddress?: never | undefined;
153
+ readonly sendAddress?: string | undefined;
154
154
  readonly walletAddress?: string | undefined;
155
155
  readonly isDepositFromExternalWallet: boolean;
156
156
  readonly externalDepositTxReceived?: never | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurora-is-near/intents-swap-widget",
3
- "version": "2.29.3",
3
+ "version": "2.29.4",
4
4
  "description": "Provides components and hooks to build your own Intents swap widget",
5
5
  "author": "Maksim Vashchuk",
6
6
  "license": "MIT",
@@ -103,7 +103,7 @@ export type InputValidDryContext = {
103
103
  targetToken: Token;
104
104
  targetTokenAmount: string;
105
105
 
106
- sendAddress?: never;
106
+ sendAddress?: string;
107
107
  walletAddress?: string;
108
108
  isDepositFromExternalWallet: boolean;
109
109
  externalDepositTxReceived?: never;
@@ -4,7 +4,12 @@ import type { Context } from '@/machine/context';
4
4
 
5
5
  export const isDryQuote = (ctx: Context): boolean => {
6
6
  return (
7
- !ctx.walletAddress ||
8
- (isNotEmptyAmount(ctx.sourceTokenAmount) && !isBalanceSufficient(ctx))
7
+ // wallet is not connected
8
+ (!ctx.walletAddress && isNotEmptyAmount(ctx.sourceTokenAmount)) ||
9
+ // or insufficient balance for connected wallet
10
+ (!!ctx.walletAddress &&
11
+ !ctx.isDepositFromExternalWallet &&
12
+ isNotEmptyAmount(ctx.sourceTokenAmount) &&
13
+ !isBalanceSufficient(ctx))
9
14
  );
10
15
  };
@@ -10,6 +10,8 @@ export const guardInitialDry = (ctx: Context): ctx is InitialDryContext => {
10
10
  (!ctx.sourceToken ||
11
11
  !ctx.targetToken ||
12
12
  !isNotEmptyAmount(ctx.sourceTokenAmount) ||
13
- (!!ctx.walletAddress && !isBalanceSufficient(ctx)))
13
+ (!!ctx.walletAddress &&
14
+ !isBalanceSufficient(ctx) &&
15
+ !ctx.isDepositFromExternalWallet))
14
16
  );
15
17
  };
@@ -10,7 +10,9 @@ export const guardInputValidDry = (
10
10
  ctx.quoteStatus !== 'success' &&
11
11
  ctx.transferStatus.status === 'idle' &&
12
12
  (!ctx.walletAddress ||
13
- (!!ctx.walletAddress && !isBalanceSufficient(ctx))) &&
13
+ (!!ctx.walletAddress &&
14
+ !isBalanceSufficient(ctx) &&
15
+ !ctx.isDepositFromExternalWallet)) &&
14
16
  !!ctx.sourceToken &&
15
17
  !!ctx.targetToken &&
16
18
  isNotEmptyAmount(ctx.sourceTokenAmount)
@@ -10,7 +10,9 @@ export const guardQuoteSuccessDry = (
10
10
  ctx.quoteStatus === 'success' &&
11
11
  ctx.transferStatus.status === 'idle' &&
12
12
  (!ctx.walletAddress ||
13
- (!!ctx.walletAddress && !isBalanceSufficient(ctx))) &&
13
+ (!!ctx.walletAddress &&
14
+ !isBalanceSufficient(ctx) &&
15
+ !ctx.isDepositFromExternalWallet)) &&
14
16
  !!ctx.sourceToken &&
15
17
  !!ctx.targetToken &&
16
18
  isNotEmptyAmount(ctx.sourceTokenAmount)