@lifi/sdk-provider-stellar 0.0.0-preview-e8c80bc4 → 0.0.0-preview-155bb7fe

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/CHANGELOG.md CHANGED
@@ -1,12 +1,19 @@
1
1
  # @lifi/sdk-provider-stellar
2
2
 
3
- ## 0.0.0-preview-e8c80bc4
3
+ ## 0.0.0-preview-155bb7fe
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`09fa8a3`](https://github.com/lifinance/sdk/commit/09fa8a35f30fe67f136cd6d6c7bd32c23f1b8c1f)]:
8
+ - @lifi/sdk@0.0.0-preview-155bb7fe
9
+
10
+ ## 4.3.11
4
11
 
5
12
  ### Patch Changes
6
13
 
7
14
  - [#539](https://github.com/lifinance/sdk/pull/539) [`b80e5f4`](https://github.com/lifinance/sdk/commit/b80e5f49941190812935644c55d5c9c075bac354) Thanks [@chybisov](https://github.com/chybisov)! - Bump runtime dependencies: @lifi/types to 18.16.0, bitcoinjs-lib to 7.0.5, viem to 2.57.17, @solana/kit to 8.6.0, @stellar/stellar-sdk to 17.4.0, @mysten/sui to 2.39.1.
8
- - Updated dependencies [[`b80e5f4`](https://github.com/lifinance/sdk/commit/b80e5f49941190812935644c55d5c9c075bac354), [`de384d3`](https://github.com/lifinance/sdk/commit/de384d3fffbe0f87f73f268529b8f528cf2c4a8b)]:
9
- - @lifi/sdk@0.0.0-preview-e8c80bc4
15
+ - Updated dependencies [[`aa5d2ff`](https://github.com/lifinance/sdk/commit/aa5d2ffe2acccc7c7e17eac09562f491eb9cc0ac), [`b80e5f4`](https://github.com/lifinance/sdk/commit/b80e5f49941190812935644c55d5c9c075bac354), [`3129a50`](https://github.com/lifinance/sdk/commit/3129a50fadf41317592b2403c42f2816540cb045)]:
16
+ - @lifi/sdk@4.13.0
10
17
 
11
18
  ## 4.3.10
12
19
 
@@ -1 +1 @@
1
- {"version":3,"file":"StellarStepExecutor.js","names":[],"sources":["../../../src/core/StellarStepExecutor.ts"],"sourcesContent":["import {\n BaseStepExecutor,\n CheckBalanceTask,\n type ExecutionAction,\n hasOpenTransaction,\n LiFiErrorCode,\n type LiFiStepExtended,\n type SDKError,\n type StepExecutorBaseContext,\n TaskPipeline,\n TransactionError,\n WaitForTransactionStatusTask,\n} from '@lifi/sdk'\nimport { parseStellarErrors } from '../errors/parseStellarErrors.js'\nimport type {\n StellarStepExecutorContext,\n StellarStepExecutorOptions,\n StellarWallet,\n} from '../types.js'\nimport { StellarCheckAllowanceTask } from './tasks/StellarCheckAllowanceTask.js'\nimport { StellarPrepareTransactionTask } from './tasks/StellarPrepareTransactionTask.js'\nimport { StellarSetAllowanceTask } from './tasks/StellarSetAllowanceTask.js'\nimport { StellarSignAndExecuteTask } from './tasks/StellarSignAndExecuteTask.js'\nimport { StellarWaitForTransactionTask } from './tasks/StellarWaitForTransactionTask.js'\n\nexport class StellarStepExecutor extends BaseStepExecutor {\n private wallet: StellarWallet\n private networkPassphrase: string\n\n constructor(options: StellarStepExecutorOptions) {\n super(options)\n this.wallet = options.wallet\n this.networkPassphrase = options.networkPassphrase\n }\n\n checkWallet = (step: LiFiStepExtended): void => {\n // Prevent execution of the quote by wallet different from the one which requested the quote\n if (this.wallet.address !== step.action.fromAddress) {\n throw new TransactionError(\n LiFiErrorCode.WalletChangedDuringExecution,\n 'The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.'\n )\n }\n\n // The provider resolves this from options first and the wallet second, so a\n // disagreement means the integrator configured one network while the user\n // connected to another. Signing would produce a txBAD_AUTH the user pays\n // for in a wasted signature.\n if (this.networkPassphrase !== this.wallet.networkPassphrase) {\n throw new TransactionError(\n LiFiErrorCode.ChainSwitchError,\n 'The connected Stellar wallet is on a different network than the route.'\n )\n }\n }\n\n override parseErrors = (\n error: Error,\n step?: LiFiStepExtended,\n action?: ExecutionAction\n ): Promise<SDKError> => parseStellarErrors(error, step, action)\n\n override createContext = async (\n baseContext: StepExecutorBaseContext\n ): Promise<StellarStepExecutorContext> => {\n return {\n ...baseContext,\n pollingIntervalMs: 3_000,\n wallet: this.wallet,\n networkPassphrase: this.networkPassphrase,\n checkWallet: this.checkWallet,\n }\n }\n\n override createPipeline = (\n context: StellarStepExecutorContext\n ): TaskPipeline => {\n const { step, isBridgeExecution } = context\n\n // Order is load-bearing: the allowance tasks must complete before the\n // transaction is prepared. Granting an allowance submits a transaction that\n // consumes the sender's sequence number, and the backend builds the route\n // envelope from a live account read — so an envelope prepared first would be\n // invalidated by the approval that follows it.\n const tasks = [\n new CheckBalanceTask(),\n new StellarCheckAllowanceTask(),\n new StellarSetAllowanceTask(),\n new StellarPrepareTransactionTask(),\n new StellarSignAndExecuteTask(),\n new StellarWaitForTransactionTask(),\n new WaitForTransactionStatusTask(\n isBridgeExecution ? 'RECEIVING_CHAIN' : 'SWAP'\n ),\n ]\n\n const swapOrBridgeAction = this.statusManager.findAction(\n step,\n isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'\n )\n\n // Three-way entry, as Bitcoin does. Stellar derives and persists the\n // transaction hash BEFORE submitting, so a hash on the action means an\n // envelope was signed and very likely broadcast. Resuming such a step at\n // CheckBalanceTask would re-prepare, re-sign and submit a SECOND\n // transaction — executing the swap twice. Resume at the confirmation poll\n // instead and let the already-broadcast transaction settle. Only a FAILED\n // action with a final outcome (`txFinal`) signs again; this is the same\n // predicate as the pre-sign guard.\n const firstTask = hasOpenTransaction(swapOrBridgeAction)\n ? swapOrBridgeAction?.status === 'DONE'\n ? WaitForTransactionStatusTask\n : StellarWaitForTransactionTask\n : CheckBalanceTask\n\n // Compare classes, not names: a minifier can give two task classes the\n // same name.\n const firstTaskIndex = tasks.findIndex(\n (task) => task.constructor === firstTask\n )\n if (firstTaskIndex === -1) {\n throw new TransactionError(\n LiFiErrorCode.InternalError,\n 'StellarStepExecutor.createPipeline: first task not found'\n )\n }\n\n const tasksToRun = tasks.slice(firstTaskIndex)\n\n return new TaskPipeline(tasksToRun)\n }\n}\n"],"mappings":";;;;;;;;AAyBA,IAAa,sBAAb,cAAyC,iBAAiB;CACxD;CACA;CAEA,YAAY,SAAqC;EAC/C,MAAM,OAAO;EACb,KAAK,SAAS,QAAQ;EACtB,KAAK,oBAAoB,QAAQ;CACnC;CAEA,eAAe,SAAiC;EAE9C,IAAI,KAAK,OAAO,YAAY,KAAK,OAAO,aACtC,MAAM,IAAI,iBACR,cAAc,8BACd,mHACF;EAOF,IAAI,KAAK,sBAAsB,KAAK,OAAO,mBACzC,MAAM,IAAI,iBACR,cAAc,kBACd,wEACF;CAEJ;CAEA,eACE,OACA,MACA,WACsB,mBAAmB,OAAO,MAAM,MAAM;CAE9D,gBAAyB,OACvB,gBACwC;EACxC,OAAO;GACL,GAAG;GACH,mBAAmB;GACnB,QAAQ,KAAK;GACb,mBAAmB,KAAK;GACxB,aAAa,KAAK;EACpB;CACF;CAEA,kBACE,YACiB;EACjB,MAAM,EAAE,MAAM,sBAAsB;EAOpC,MAAM,QAAQ;GACZ,IAAI,iBAAiB;GACrB,IAAI,0BAA0B;GAC9B,IAAI,wBAAwB;GAC5B,IAAI,8BAA8B;GAClC,IAAI,0BAA0B;GAC9B,IAAI,8BAA8B;GAClC,IAAI,6BACF,oBAAoB,oBAAoB,MAC1C;EACF;EAEA,MAAM,qBAAqB,KAAK,cAAc,WAC5C,MACA,oBAAoB,gBAAgB,MACtC;EAUA,MAAM,YAAY,mBAAmB,kBAAkB,IACnD,oBAAoB,WAAW,SAC7B,+BACA,gCACF;EAIJ,MAAM,iBAAiB,MAAM,WAC1B,SAAS,KAAK,gBAAgB,SACjC;EACA,IAAI,mBAAmB,IACrB,MAAM,IAAI,iBACR,cAAc,eACd,0DACF;EAGF,MAAM,aAAa,MAAM,MAAM,cAAc;EAE7C,OAAO,IAAI,aAAa,UAAU;CACpC;AACF"}
1
+ {"version":3,"file":"StellarStepExecutor.js","names":[],"sources":["../../../src/core/StellarStepExecutor.ts"],"sourcesContent":["import {\n BaseStepExecutor,\n CheckBalanceTask,\n type ExecutionAction,\n hasOpenTransaction,\n LiFiErrorCode,\n type LiFiStepExtended,\n type SDKError,\n type StepExecutorBaseContext,\n TaskPipeline,\n TransactionError,\n WaitForTransactionStatusTask,\n} from '@lifi/sdk'\nimport { parseStellarErrors } from '../errors/parseStellarErrors.js'\nimport type {\n StellarStepExecutorContext,\n StellarStepExecutorOptions,\n StellarWallet,\n} from '../types.js'\nimport { StellarCheckAllowanceTask } from './tasks/StellarCheckAllowanceTask.js'\nimport { StellarPrepareTransactionTask } from './tasks/StellarPrepareTransactionTask.js'\nimport { StellarSetAllowanceTask } from './tasks/StellarSetAllowanceTask.js'\nimport { StellarSignAndExecuteTask } from './tasks/StellarSignAndExecuteTask.js'\nimport { StellarWaitForTransactionTask } from './tasks/StellarWaitForTransactionTask.js'\n\nexport class StellarStepExecutor extends BaseStepExecutor {\n private wallet: StellarWallet\n private networkPassphrase: string\n\n constructor(options: StellarStepExecutorOptions) {\n super(options)\n this.wallet = options.wallet\n this.networkPassphrase = options.networkPassphrase\n }\n\n checkWallet = (step: LiFiStepExtended): void => {\n // Prevent execution of the quote by wallet different from the one which requested the quote\n if (this.wallet.address !== step.action.fromAddress) {\n throw new TransactionError(\n LiFiErrorCode.WalletChangedDuringExecution,\n 'The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.'\n )\n }\n\n // The provider resolves this from options first and the wallet second, so a\n // disagreement means the integrator configured one network while the user\n // connected to another. Signing would produce a txBAD_AUTH the user pays\n // for in a wasted signature.\n if (this.networkPassphrase !== this.wallet.networkPassphrase) {\n throw new TransactionError(\n LiFiErrorCode.ChainSwitchError,\n 'The connected Stellar wallet is on a different network than the route.'\n )\n }\n }\n\n override parseErrors = (\n error: Error,\n step?: LiFiStepExtended,\n action?: ExecutionAction\n ): Promise<SDKError> => parseStellarErrors(error, step, action)\n\n override createContext = async (\n baseContext: StepExecutorBaseContext\n ): Promise<StellarStepExecutorContext> => {\n return {\n ...baseContext,\n pollingIntervalMs: 3_000,\n wallet: this.wallet,\n networkPassphrase: this.networkPassphrase,\n checkWallet: this.checkWallet,\n }\n }\n\n override createPipeline = (\n context: StellarStepExecutorContext\n ): TaskPipeline => {\n const { step, isBridgeExecution } = context\n\n // Order is load-bearing: the allowance tasks must complete before the\n // transaction is prepared. Granting an allowance submits a transaction that\n // consumes the sender's sequence number, and the backend builds the route\n // envelope from a live account read — so an envelope prepared first would be\n // invalidated by the approval that follows it.\n const tasks = [\n new CheckBalanceTask(),\n new StellarCheckAllowanceTask(),\n new StellarSetAllowanceTask(),\n new StellarPrepareTransactionTask(),\n new StellarSignAndExecuteTask(),\n new StellarWaitForTransactionTask(),\n new WaitForTransactionStatusTask(\n isBridgeExecution ? 'RECEIVING_CHAIN' : 'SWAP'\n ),\n ]\n\n const swapOrBridgeAction = this.statusManager.findAction(\n step,\n isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'\n )\n\n // Three-way entry, as Bitcoin does. Stellar derives and persists the\n // transaction hash BEFORE submitting, so a hash on the action means an\n // envelope was signed and very likely broadcast. Resuming such a step at\n // CheckBalanceTask would re-prepare, re-sign and submit a SECOND\n // transaction — executing the swap twice. Resume at the confirmation poll\n // instead and let the already-broadcast transaction settle. Only a FAILED\n // action with a final outcome (`txFinal`) signs again; this is the same\n // predicate as the pre-sign guard.\n const firstTask = hasOpenTransaction(swapOrBridgeAction)\n ? swapOrBridgeAction?.status === 'DONE'\n ? WaitForTransactionStatusTask\n : StellarWaitForTransactionTask\n : CheckBalanceTask\n\n // Compare classes, not names: a minifier can give two task classes the\n // same name.\n const firstTaskIndex = tasks.findIndex(\n (task) => task.constructor === firstTask\n )\n if (firstTaskIndex === -1) {\n throw new TransactionError(\n LiFiErrorCode.InternalError,\n 'StellarStepExecutor.createPipeline: first task not found'\n )\n }\n\n const tasksToRun = tasks.slice(firstTaskIndex)\n\n return new TaskPipeline(tasksToRun)\n }\n}\n"],"mappings":";;;;;;;;AAyBA,IAAa,sBAAb,cAAyC,iBAAiB;CAChD;CACA;CAER,YAAY,SAAqC;EAC/C,MAAM,OAAO;EACb,KAAK,SAAS,QAAQ;EACtB,KAAK,oBAAoB,QAAQ;CACnC;CAEA,eAAe,SAAiC;EAE9C,IAAI,KAAK,OAAO,YAAY,KAAK,OAAO,aACtC,MAAM,IAAI,iBACR,cAAc,8BACd,mHACF;EAOF,IAAI,KAAK,sBAAsB,KAAK,OAAO,mBACzC,MAAM,IAAI,iBACR,cAAc,kBACd,wEACF;CAEJ;CAES,eACP,OACA,MACA,WACsB,mBAAmB,OAAO,MAAM,MAAM;CAErD,gBAAgB,OACvB,gBACwC;EACxC,OAAO;GACL,GAAG;GACH,mBAAmB;GACnB,QAAQ,KAAK;GACb,mBAAmB,KAAK;GACxB,aAAa,KAAK;EACpB;CACF;CAES,kBACP,YACiB;EACjB,MAAM,EAAE,MAAM,sBAAsB;EAOpC,MAAM,QAAQ;GACZ,IAAI,iBAAiB;GACrB,IAAI,0BAA0B;GAC9B,IAAI,wBAAwB;GAC5B,IAAI,8BAA8B;GAClC,IAAI,0BAA0B;GAC9B,IAAI,8BAA8B;GAClC,IAAI,6BACF,oBAAoB,oBAAoB,MAC1C;EACF;EAEA,MAAM,qBAAqB,KAAK,cAAc,WAC5C,MACA,oBAAoB,gBAAgB,MACtC;EAUA,MAAM,YAAY,mBAAmB,kBAAkB,IACnD,oBAAoB,WAAW,SAC7B,+BACA,gCACF;EAIJ,MAAM,iBAAiB,MAAM,WAC1B,SAAS,KAAK,gBAAgB,SACjC;EACA,IAAI,mBAAmB,IACrB,MAAM,IAAI,iBACR,cAAc,eACd,0DACF;EAGF,MAAM,aAAa,MAAM,MAAM,cAAc;EAE7C,OAAO,IAAI,aAAa,UAAU;CACpC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"StellarCheckAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/StellarCheckAllowanceTask.ts"],"mappings":";;qBAKa,kCAAkC;EAC7C,IAAU,SAAS,6BAA6B,QAAQ"}
1
+ {"version":3,"file":"StellarCheckAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/StellarCheckAllowanceTask.ts"],"mappings":";;qBAKa,kCAAkC;EACvC,IAAI,SAAS,6BAA6B,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"StellarPrepareTransactionTask.js","names":[],"sources":["../../../../src/core/tasks/StellarPrepareTransactionTask.ts"],"sourcesContent":["import { PrepareTransactionTask, type TaskResult } from '@lifi/sdk'\nimport type { StellarStepExecutorContext } from '../../types.js'\nimport { assertApprovalStillCovers } from './helpers/assertApprovalStillCovers.js'\n\n/**\n * Always re-fetches the step transaction, where the base task asks only when\n * the step carries none.\n *\n * A Stellar envelope is not a reusable payload: the backend embeds the sender's\n * account sequence number and timebounds `[0, now + 300s]` at build time.\n *\n * 1. Approvals. `StellarSetAllowanceTask` submits a transaction of its own,\n * which consumes the sender's sequence number. Any envelope built before\n * that approval is invalid (`tx_bad_seq`), so the envelope has to be\n * requested after it — which only happens if this task always asks for a\n * fresh one.\n * 2. Staleness. On the quote path `convertQuoteToRoute` carries the quote's\n * `transactionRequest` into the route, so the base guard would never\n * re-fetch and would sign an envelope minted minutes earlier — expiring as\n * `tx_too_late` once the user lingers in their wallet.\n *\n * The `getRoutes` path never carries a `transactionRequest`, and `resumeRoute`\n * clears it through `prepareRestart`, so the base guard already re-fetches for\n * both. This override is what covers the quote path.\n *\n * Re-quoting also invalidates the allowance the pipeline just granted, so the\n * refreshed route is re-checked against the chain before the step is signed.\n */\nexport class StellarPrepareTransactionTask extends PrepareTransactionTask {\n protected override shouldRefetchTransaction(): boolean {\n return true\n }\n\n override async run(context: StellarStepExecutorContext): Promise<TaskResult> {\n const result = await super.run(context)\n // The refresh above may have re-quoted the route around a different\n // adapter or amount than the allowance was granted for.\n await assertApprovalStillCovers(context)\n return result\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAa,gCAAb,cAAmD,uBAAuB;CACxE,2BAAuD;EACrD,OAAO;CACT;CAEA,MAAe,IAAI,SAA0D;EAC3E,MAAM,SAAS,MAAM,MAAM,IAAI,OAAO;EAGtC,MAAM,0BAA0B,OAAO;EACvC,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"StellarPrepareTransactionTask.js","names":[],"sources":["../../../../src/core/tasks/StellarPrepareTransactionTask.ts"],"sourcesContent":["import { PrepareTransactionTask, type TaskResult } from '@lifi/sdk'\nimport type { StellarStepExecutorContext } from '../../types.js'\nimport { assertApprovalStillCovers } from './helpers/assertApprovalStillCovers.js'\n\n/**\n * Always re-fetches the step transaction, where the base task asks only when\n * the step carries none.\n *\n * A Stellar envelope is not a reusable payload: the backend embeds the sender's\n * account sequence number and timebounds `[0, now + 300s]` at build time.\n *\n * 1. Approvals. `StellarSetAllowanceTask` submits a transaction of its own,\n * which consumes the sender's sequence number. Any envelope built before\n * that approval is invalid (`tx_bad_seq`), so the envelope has to be\n * requested after it — which only happens if this task always asks for a\n * fresh one.\n * 2. Staleness. On the quote path `convertQuoteToRoute` carries the quote's\n * `transactionRequest` into the route, so the base guard would never\n * re-fetch and would sign an envelope minted minutes earlier — expiring as\n * `tx_too_late` once the user lingers in their wallet.\n *\n * The `getRoutes` path never carries a `transactionRequest`, and `resumeRoute`\n * clears it through `prepareRestart`, so the base guard already re-fetches for\n * both. This override is what covers the quote path.\n *\n * Re-quoting also invalidates the allowance the pipeline just granted, so the\n * refreshed route is re-checked against the chain before the step is signed.\n */\nexport class StellarPrepareTransactionTask extends PrepareTransactionTask {\n protected override shouldRefetchTransaction(): boolean {\n return true\n }\n\n override async run(context: StellarStepExecutorContext): Promise<TaskResult> {\n const result = await super.run(context)\n // The refresh above may have re-quoted the route around a different\n // adapter or amount than the allowance was granted for.\n await assertApprovalStillCovers(context)\n return result\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAa,gCAAb,cAAmD,uBAAuB;CACrD,2BAAoC;EACrD,OAAO;CACT;CAEA,MAAe,IAAI,SAA0D;EAC3E,MAAM,SAAS,MAAM,MAAM,IAAI,OAAO;EAGtC,MAAM,0BAA0B,OAAO;EACvC,OAAO;CACT;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"StellarSetAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/StellarSetAllowanceTask.ts"],"mappings":";;qBAQa,gCAAgC;WAClC,UAAU,SAAS,6BAA6B;EAMzD,IAAU,SAAS,6BAA6B,QAAQ"}
1
+ {"version":3,"file":"StellarSetAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/StellarSetAllowanceTask.ts"],"mappings":";;qBAQa,gCAAgC;WAClC,UAAU,SAAS,6BAA6B;EAMnD,IAAI,SAAS,6BAA6B,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"StellarSetAllowanceTask.js","names":[],"sources":["../../../../src/core/tasks/StellarSetAllowanceTask.ts"],"sourcesContent":["import { BaseStepExecutionTask, type TaskResult } from '@lifi/sdk'\nimport type { StellarStepExecutorContext } from '../../types.js'\nimport { buildApproveTransaction } from './helpers/buildApproveTransaction.js'\nimport { deriveTransactionHash } from './helpers/deriveTransactionHash.js'\nimport { getStellarTxLink } from './helpers/getStellarTxLink.js'\nimport { submitStellarTransaction } from './helpers/submitStellarTransaction.js'\nimport { waitForStellarTransaction } from './helpers/waitForStellarTransaction.js'\n\nexport class StellarSetAllowanceTask extends BaseStepExecutionTask {\n override shouldRun(context: StellarStepExecutorContext): Promise<boolean> {\n return Promise.resolve(\n !!context.approval && !context.hasSufficientAllowance\n )\n }\n\n async run(context: StellarStepExecutorContext): Promise<TaskResult> {\n const {\n step,\n client,\n wallet,\n fromChain,\n statusManager,\n networkPassphrase,\n approval,\n allowUserInteraction,\n pollingIntervalMs,\n checkWallet,\n } = context\n // Guaranteed by shouldRun.\n const { spender, tokenAddress, amount } = approval!\n\n const action = statusManager.initializeAction({\n step,\n type: 'SET_ALLOWANCE',\n chainId: step.action.fromChainId,\n status: 'STARTED',\n })\n\n // Clear the txHash and txLink from a potential previous approval attempt\n statusManager.updateAction(step, action.type, 'ACTION_REQUIRED', {\n txHash: undefined,\n txLink: undefined,\n })\n\n if (!allowUserInteraction) {\n return { status: 'PAUSED' }\n }\n\n checkWallet(step)\n\n const envelopeXdr = await buildApproveTransaction(\n client,\n tokenAddress,\n wallet.address,\n spender,\n amount,\n networkPassphrase\n )\n\n const { signedTxXdr } = await wallet.signTransaction(envelopeXdr, {\n address: wallet.address,\n networkPassphrase,\n })\n\n // Derived locally, like the route transaction, so the hash is recorded even\n // if the submit response is lost.\n const transactionHash = deriveTransactionHash(\n signedTxXdr,\n networkPassphrase\n )\n\n statusManager.updateAction(step, action.type, 'PENDING', {\n txHash: transactionHash,\n txLink: getStellarTxLink(fromChain, transactionHash),\n })\n\n await submitStellarTransaction(client, signedTxXdr, networkPassphrase)\n\n // Wait for on-chain confirmation, not just acceptance. The route envelope is\n // built by the backend from a live `getAccount(sender)` read, so it must be\n // requested only after this approval has consumed the sender's sequence\n // number in a closed ledger — otherwise the backend hands back an envelope\n // carrying the pre-approval sequence and the route submission fails with\n // `tx_bad_seq`.\n await waitForStellarTransaction(client, transactionHash, pollingIntervalMs)\n\n statusManager.updateAction(step, action.type, 'DONE')\n\n return { status: 'COMPLETED', context: { hasSufficientAllowance: true } }\n }\n}\n"],"mappings":";;;;;;;AAQA,IAAa,0BAAb,cAA6C,sBAAsB;CACjE,UAAmB,SAAuD;EACxE,OAAO,QAAQ,QACb,CAAC,CAAC,QAAQ,YAAY,CAAC,QAAQ,sBACjC;CACF;CAEA,MAAM,IAAI,SAA0D;EAClE,MAAM,EACJ,MACA,QACA,QACA,WACA,eACA,mBACA,UACA,sBACA,mBACA,gBACE;EAEJ,MAAM,EAAE,SAAS,cAAc,WAAW;EAE1C,MAAM,SAAS,cAAc,iBAAiB;GAC5C;GACA,MAAM;GACN,SAAS,KAAK,OAAO;GACrB,QAAQ;EACV,CAAC;EAGD,cAAc,aAAa,MAAM,OAAO,MAAM,mBAAmB;GAC/D,QAAQ,KAAA;GACR,QAAQ,KAAA;EACV,CAAC;EAED,IAAI,CAAC,sBACH,OAAO,EAAE,QAAQ,SAAS;EAG5B,YAAY,IAAI;EAEhB,MAAM,cAAc,MAAM,wBACxB,QACA,cACA,OAAO,SACP,SACA,QACA,iBACF;EAEA,MAAM,EAAE,gBAAgB,MAAM,OAAO,gBAAgB,aAAa;GAChE,SAAS,OAAO;GAChB;EACF,CAAC;EAID,MAAM,kBAAkB,sBACtB,aACA,iBACF;EAEA,cAAc,aAAa,MAAM,OAAO,MAAM,WAAW;GACvD,QAAQ;GACR,QAAQ,iBAAiB,WAAW,eAAe;EACrD,CAAC;EAED,MAAM,yBAAyB,QAAQ,aAAa,iBAAiB;EAQrE,MAAM,0BAA0B,QAAQ,iBAAiB,iBAAiB;EAE1E,cAAc,aAAa,MAAM,OAAO,MAAM,MAAM;EAEpD,OAAO;GAAE,QAAQ;GAAa,SAAS,EAAE,wBAAwB,KAAK;EAAE;CAC1E;AACF"}
1
+ {"version":3,"file":"StellarSetAllowanceTask.js","names":[],"sources":["../../../../src/core/tasks/StellarSetAllowanceTask.ts"],"sourcesContent":["import { BaseStepExecutionTask, type TaskResult } from '@lifi/sdk'\nimport type { StellarStepExecutorContext } from '../../types.js'\nimport { buildApproveTransaction } from './helpers/buildApproveTransaction.js'\nimport { deriveTransactionHash } from './helpers/deriveTransactionHash.js'\nimport { getStellarTxLink } from './helpers/getStellarTxLink.js'\nimport { submitStellarTransaction } from './helpers/submitStellarTransaction.js'\nimport { waitForStellarTransaction } from './helpers/waitForStellarTransaction.js'\n\nexport class StellarSetAllowanceTask extends BaseStepExecutionTask {\n override shouldRun(context: StellarStepExecutorContext): Promise<boolean> {\n return Promise.resolve(\n !!context.approval && !context.hasSufficientAllowance\n )\n }\n\n async run(context: StellarStepExecutorContext): Promise<TaskResult> {\n const {\n step,\n client,\n wallet,\n fromChain,\n statusManager,\n networkPassphrase,\n approval,\n allowUserInteraction,\n pollingIntervalMs,\n checkWallet,\n } = context\n // Guaranteed by shouldRun.\n const { spender, tokenAddress, amount } = approval!\n\n const action = statusManager.initializeAction({\n step,\n type: 'SET_ALLOWANCE',\n chainId: step.action.fromChainId,\n status: 'STARTED',\n })\n\n // Clear the txHash and txLink from a potential previous approval attempt\n statusManager.updateAction(step, action.type, 'ACTION_REQUIRED', {\n txHash: undefined,\n txLink: undefined,\n })\n\n if (!allowUserInteraction) {\n return { status: 'PAUSED' }\n }\n\n checkWallet(step)\n\n const envelopeXdr = await buildApproveTransaction(\n client,\n tokenAddress,\n wallet.address,\n spender,\n amount,\n networkPassphrase\n )\n\n const { signedTxXdr } = await wallet.signTransaction(envelopeXdr, {\n address: wallet.address,\n networkPassphrase,\n })\n\n // Derived locally, like the route transaction, so the hash is recorded even\n // if the submit response is lost.\n const transactionHash = deriveTransactionHash(\n signedTxXdr,\n networkPassphrase\n )\n\n statusManager.updateAction(step, action.type, 'PENDING', {\n txHash: transactionHash,\n txLink: getStellarTxLink(fromChain, transactionHash),\n })\n\n await submitStellarTransaction(client, signedTxXdr, networkPassphrase)\n\n // Wait for on-chain confirmation, not just acceptance. The route envelope is\n // built by the backend from a live `getAccount(sender)` read, so it must be\n // requested only after this approval has consumed the sender's sequence\n // number in a closed ledger — otherwise the backend hands back an envelope\n // carrying the pre-approval sequence and the route submission fails with\n // `tx_bad_seq`.\n await waitForStellarTransaction(client, transactionHash, pollingIntervalMs)\n\n statusManager.updateAction(step, action.type, 'DONE')\n\n return { status: 'COMPLETED', context: { hasSufficientAllowance: true } }\n }\n}\n"],"mappings":";;;;;;;AAQA,IAAa,0BAAb,cAA6C,sBAAsB;CACxD,UAAU,SAAuD;EACxE,OAAO,QAAQ,QACb,CAAC,CAAC,QAAQ,YAAY,CAAC,QAAQ,sBACjC;CACF;CAEA,MAAM,IAAI,SAA0D;EAClE,MAAM,EACJ,MACA,QACA,QACA,WACA,eACA,mBACA,UACA,sBACA,mBACA,gBACE;EAEJ,MAAM,EAAE,SAAS,cAAc,WAAW;EAE1C,MAAM,SAAS,cAAc,iBAAiB;GAC5C;GACA,MAAM;GACN,SAAS,KAAK,OAAO;GACrB,QAAQ;EACV,CAAC;EAGD,cAAc,aAAa,MAAM,OAAO,MAAM,mBAAmB;GAC/D,QAAQ,KAAA;GACR,QAAQ,KAAA;EACV,CAAC;EAED,IAAI,CAAC,sBACH,OAAO,EAAE,QAAQ,SAAS;EAG5B,YAAY,IAAI;EAEhB,MAAM,cAAc,MAAM,wBACxB,QACA,cACA,OAAO,SACP,SACA,QACA,iBACF;EAEA,MAAM,EAAE,gBAAgB,MAAM,OAAO,gBAAgB,aAAa;GAChE,SAAS,OAAO;GAChB;EACF,CAAC;EAID,MAAM,kBAAkB,sBACtB,aACA,iBACF;EAEA,cAAc,aAAa,MAAM,OAAO,MAAM,WAAW;GACvD,QAAQ;GACR,QAAQ,iBAAiB,WAAW,eAAe;EACrD,CAAC;EAED,MAAM,yBAAyB,QAAQ,aAAa,iBAAiB;EAQrE,MAAM,0BAA0B,QAAQ,iBAAiB,iBAAiB;EAE1E,cAAc,aAAa,MAAM,OAAO,MAAM,MAAM;EAEpD,OAAO;GAAE,QAAQ;GAAa,SAAS,EAAE,wBAAwB,KAAK;EAAE;CAC1E;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"StellarSignAndExecuteTask.d.ts","names":[],"sources":["../../../../src/core/tasks/StellarSignAndExecuteTask.ts"],"mappings":";;qBAea,kCAAkC;EAC7C,IAAU,SAAS,6BAA6B,QAAQ"}
1
+ {"version":3,"file":"StellarSignAndExecuteTask.d.ts","names":[],"sources":["../../../../src/core/tasks/StellarSignAndExecuteTask.ts"],"mappings":";;qBAea,kCAAkC;EACvC,IAAI,SAAS,6BAA6B,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"StellarWaitForTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/StellarWaitForTransactionTask.ts"],"mappings":";;qBAca,sCAAsC;EACjD,IAAU,SAAS,6BAA6B,QAAQ"}
1
+ {"version":3,"file":"StellarWaitForTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/StellarWaitForTransactionTask.ts"],"mappings":";;qBAca,sCAAsC;EAC3C,IAAI,SAAS,6BAA6B,QAAQ"}
@@ -1,3 +1,3 @@
1
1
  export declare const name = "@lifi/sdk-provider-stellar";
2
- export declare const version = "0.0.0-preview-e8c80bc4";
2
+ export declare const version = "0.0.0-preview-155bb7fe";
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -1,6 +1,6 @@
1
1
  // src/version.ts
2
2
  const name = "@lifi/sdk-provider-stellar";
3
- const version = "0.0.0-preview-e8c80bc4";
3
+ const version = "0.0.0-preview-155bb7fe";
4
4
  export { name, version };
5
5
 
6
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-stellar'\nexport const version = '0.0.0-preview-e8c80bc4'\n"],"mappings":";AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
1
+ {"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-stellar'\nexport const version = '0.0.0-preview-155bb7fe'\n"],"mappings":";AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/sdk-provider-stellar",
3
- "version": "0.0.0-preview-e8c80bc4",
3
+ "version": "0.0.0-preview-155bb7fe",
4
4
  "description": "LI.FI Stellar SDK Provider for Any-to-Any Cross-Chain-Swap",
5
5
  "homepage": "https://github.com/lifinance/sdk",
6
6
  "bugs": {
@@ -28,7 +28,7 @@
28
28
  "./package.json": "./package.json"
29
29
  },
30
30
  "dependencies": {
31
- "@lifi/sdk": "0.0.0-preview-e8c80bc4",
31
+ "@lifi/sdk": "0.0.0-preview-155bb7fe",
32
32
  "@stellar/stellar-sdk": "^17.4.0"
33
33
  },
34
34
  "publishConfig": {
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/sdk-provider-stellar'
2
- export const version = '0.0.0-preview-e8c80bc4'
2
+ export const version = '0.0.0-preview-155bb7fe'