@lifi/sdk-provider-stellar 0.0.0-preview-dd8065ff → 0.0.0-preview-1b774eec
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 +37 -3
- package/README.md +9 -0
- package/dist/esm/core/StellarStepExecutor.js +3 -2
- package/dist/esm/core/StellarStepExecutor.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/package.json +3 -3
- package/src/core/StellarStepExecutor.ts +13 -5
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,45 @@
|
|
|
1
1
|
# @lifi/sdk-provider-stellar
|
|
2
2
|
|
|
3
|
-
## 0.0.0-preview-
|
|
3
|
+
## 0.0.0-preview-1b774eec
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- Updated dependencies [[`
|
|
8
|
-
- @lifi/sdk@0.0.0-preview-
|
|
7
|
+
- Updated dependencies [[`a75a5b3`](https://github.com/lifinance/sdk/commit/a75a5b3f30716b53f6dca4b6b1bb83ba887c5243)]:
|
|
8
|
+
- @lifi/sdk@0.0.0-preview-1b774eec
|
|
9
|
+
|
|
10
|
+
## 4.3.7
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#505](https://github.com/lifinance/sdk/pull/505) [`56f9913`](https://github.com/lifinance/sdk/commit/56f9913ccbc0508c94122baf3b7bbbcaa867d95b) Thanks [@chybisov](https://github.com/chybisov)! - Pick the first pipeline task by class reference instead of by class name. In builds that mangle class names, a step could start or resume at the wrong task — for example, an unneeded `approve()` before a native-token swap.
|
|
15
|
+
|
|
16
|
+
## 4.3.6
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [#500](https://github.com/lifinance/sdk/pull/500) [`6ffd1be`](https://github.com/lifinance/sdk/commit/6ffd1be6f6c2bd2b7f00cde9bcc72dfee56afe3d) Thanks [@chybisov](https://github.com/chybisov)! - Bump runtime dependencies: viem to 2.57.1, @solana/kit to 8.4.0, @stellar/stellar-sdk to
|
|
21
|
+
17.2.0 and @mysten/sui to 2.33.2.
|
|
22
|
+
|
|
23
|
+
## 4.3.5
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [[`dcbbdcc`](https://github.com/lifinance/sdk/commit/dcbbdccc2684c4549cbfe06444698f11347206af), [`2d60ab4`](https://github.com/lifinance/sdk/commit/2d60ab43af2ecd1c17a3bbb126de408952a46d80), [`2d60ab4`](https://github.com/lifinance/sdk/commit/2d60ab43af2ecd1c17a3bbb126de408952a46d80), [`2d60ab4`](https://github.com/lifinance/sdk/commit/2d60ab43af2ecd1c17a3bbb126de408952a46d80), [`2d60ab4`](https://github.com/lifinance/sdk/commit/2d60ab43af2ecd1c17a3bbb126de408952a46d80), [`2d60ab4`](https://github.com/lifinance/sdk/commit/2d60ab43af2ecd1c17a3bbb126de408952a46d80)]:
|
|
28
|
+
- @lifi/sdk@4.10.0
|
|
29
|
+
|
|
30
|
+
## 4.3.4
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- Updated dependencies [[`a65b003`](https://github.com/lifinance/sdk/commit/a65b00391698c3e8c2a1cd826bb0969c6977ecb6), [`9e815bd`](https://github.com/lifinance/sdk/commit/9e815bdd0d818b7e0866c78bdf48065185b64210), [`145f2b4`](https://github.com/lifinance/sdk/commit/145f2b49dbbc55776e0b0fe34b0b890f3e5be199)]:
|
|
35
|
+
- @lifi/sdk@4.9.0
|
|
36
|
+
|
|
37
|
+
## 4.3.3
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [[`1a7c966`](https://github.com/lifinance/sdk/commit/1a7c96646e7a5696443b5a88485bdfb33b51682d), [`b17e93e`](https://github.com/lifinance/sdk/commit/b17e93ebc3303e34913d41dba4b71a99897138b6)]:
|
|
42
|
+
- @lifi/sdk@4.8.2
|
|
9
43
|
|
|
10
44
|
## 4.3.2
|
|
11
45
|
|
package/README.md
CHANGED
|
@@ -83,6 +83,13 @@ needs no ecosystem library. To discover and connect browser wallets such as Frei
|
|
|
83
83
|
xBull, or Lobstr, we recommend
|
|
84
84
|
[Stellar Wallets Kit](https://github.com/Creit-Tech/Stellar-Wallets-Kit).
|
|
85
85
|
|
|
86
|
+
**Zcash**
|
|
87
|
+
```bash
|
|
88
|
+
pnpm add @lifi/sdk-provider-zcash
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
ZEC is a destination-only chain: `ZcashProvider` validates transparent `t1` and `t3` receivers and needs no wallet. Register it after `BitcoinProvider`; it serves ZEC only.
|
|
92
|
+
|
|
86
93
|
## Architecture
|
|
87
94
|
|
|
88
95
|
The LI.FI SDK uses a modular provider architecture:
|
|
@@ -134,6 +141,7 @@ import { BitcoinProvider } from '@lifi/sdk-provider-bitcoin'
|
|
|
134
141
|
import { SuiProvider } from '@lifi/sdk-provider-sui'
|
|
135
142
|
import { TronProvider } from '@lifi/sdk-provider-tron'
|
|
136
143
|
import { StellarProvider } from '@lifi/sdk-provider-stellar'
|
|
144
|
+
import { ZcashProvider } from '@lifi/sdk-provider-zcash'
|
|
137
145
|
|
|
138
146
|
const client = createClient({
|
|
139
147
|
integrator: 'Your dApp/company name',
|
|
@@ -144,6 +152,7 @@ const client = createClient({
|
|
|
144
152
|
SuiProvider({ /* options */ }),
|
|
145
153
|
TronProvider({ /* options */ }),
|
|
146
154
|
StellarProvider({ /* options */ }),
|
|
155
|
+
ZcashProvider(),
|
|
147
156
|
],
|
|
148
157
|
})
|
|
149
158
|
```
|
|
@@ -40,8 +40,9 @@ var StellarStepExecutor = class extends BaseStepExecutor {
|
|
|
40
40
|
new WaitForTransactionStatusTask(isBridgeExecution ? "RECEIVING_CHAIN" : "SWAP")
|
|
41
41
|
];
|
|
42
42
|
const swapOrBridgeAction = this.statusManager.findAction(step, isBridgeExecution ? "CROSS_CHAIN" : "SWAP");
|
|
43
|
-
const
|
|
44
|
-
const firstTaskIndex = tasks.findIndex((task) => task.constructor
|
|
43
|
+
const firstTask = swapOrBridgeAction?.txHash ? swapOrBridgeAction.status === "DONE" ? WaitForTransactionStatusTask : StellarWaitForTransactionTask : CheckBalanceTask;
|
|
44
|
+
const firstTaskIndex = tasks.findIndex((task) => task.constructor === firstTask);
|
|
45
|
+
if (firstTaskIndex === -1) throw new TransactionError(LiFiErrorCode.InternalError, "StellarStepExecutor.createPipeline: first task not found");
|
|
45
46
|
const tasksToRun = tasks.slice(firstTaskIndex);
|
|
46
47
|
return new TaskPipeline(tasksToRun);
|
|
47
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StellarStepExecutor.js","names":[],"sources":["../../../src/core/StellarStepExecutor.ts"],"sourcesContent":["import {\n BaseStepExecutor,\n CheckBalanceTask,\n type ExecutionAction,\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.\n const
|
|
1
|
+
{"version":3,"file":"StellarStepExecutor.js","names":[],"sources":["../../../src/core/StellarStepExecutor.ts"],"sourcesContent":["import {\n BaseStepExecutor,\n CheckBalanceTask,\n type ExecutionAction,\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.\n const firstTask = swapOrBridgeAction?.txHash\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":";;;;;;;;AAwBA,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;EAQA,MAAM,YAAY,oBAAoB,SAClC,mBAAmB,WAAW,SAC5B,+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"}
|
package/dist/esm/version.d.ts
CHANGED
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -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-
|
|
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-1b774eec'\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-
|
|
3
|
+
"version": "0.0.0-preview-1b774eec",
|
|
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,8 +28,8 @@
|
|
|
28
28
|
"./package.json": "./package.json"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@lifi/sdk": "0.0.0-preview-
|
|
32
|
-
"@stellar/stellar-sdk": "^17.
|
|
31
|
+
"@lifi/sdk": "0.0.0-preview-1b774eec",
|
|
32
|
+
"@stellar/stellar-sdk": "^17.2.0"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
@@ -104,15 +104,23 @@ export class StellarStepExecutor extends BaseStepExecutor {
|
|
|
104
104
|
// CheckBalanceTask would re-prepare, re-sign and submit a SECOND
|
|
105
105
|
// transaction — executing the swap twice. Resume at the confirmation poll
|
|
106
106
|
// instead and let the already-broadcast transaction settle.
|
|
107
|
-
const
|
|
107
|
+
const firstTask = swapOrBridgeAction?.txHash
|
|
108
108
|
? swapOrBridgeAction.status === 'DONE'
|
|
109
|
-
? WaitForTransactionStatusTask
|
|
110
|
-
: StellarWaitForTransactionTask
|
|
111
|
-
: CheckBalanceTask
|
|
109
|
+
? WaitForTransactionStatusTask
|
|
110
|
+
: StellarWaitForTransactionTask
|
|
111
|
+
: CheckBalanceTask
|
|
112
112
|
|
|
113
|
+
// Compare classes, not names: a minifier can give two task classes the
|
|
114
|
+
// same name.
|
|
113
115
|
const firstTaskIndex = tasks.findIndex(
|
|
114
|
-
(task) => task.constructor
|
|
116
|
+
(task) => task.constructor === firstTask
|
|
115
117
|
)
|
|
118
|
+
if (firstTaskIndex === -1) {
|
|
119
|
+
throw new TransactionError(
|
|
120
|
+
LiFiErrorCode.InternalError,
|
|
121
|
+
'StellarStepExecutor.createPipeline: first task not found'
|
|
122
|
+
)
|
|
123
|
+
}
|
|
116
124
|
|
|
117
125
|
const tasksToRun = tasks.slice(firstTaskIndex)
|
|
118
126
|
|
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-
|
|
2
|
+
export const version = '0.0.0-preview-1b774eec'
|