@lifi/sdk-provider-solana 4.3.0 → 4.3.2

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,5 +1,20 @@
1
1
  # @lifi/sdk-provider-solana
2
2
 
3
+ ## 4.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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
8
+ 17.2.0 and @mysten/sui to 2.33.2.
9
+
10
+ ## 4.3.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [#499](https://github.com/lifinance/sdk/pull/499) [`2d60ab4`](https://github.com/lifinance/sdk/commit/2d60ab43af2ecd1c17a3bbb126de408952a46d80) Thanks [@chybisov](https://github.com/chybisov)! - A user rejection from a Wallet Standard wallet (code `4001`, or a message such as "User rejected the request") is now reported as `SignatureRejected` instead of `UnknownError`. An `AbortError` is not treated as a rejection.
15
+ - 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)]:
16
+ - @lifi/sdk@4.10.0
17
+
3
18
  ## 4.3.0
4
19
 
5
20
  ### Minor Changes
@@ -2,16 +2,14 @@
2
2
  /**
3
3
  * Sleeps for `ms`, or until `signal` aborts - whichever comes first.
4
4
  *
5
- * Not `@lifi/sdk`'s `sleep`: that one is publicly exported, so making its
6
- * timer abortable or unref'd would change behaviour for every caller in the
7
- * repo. The confirmation branches need the abort, because both detached loops
5
+ * The confirmation branches need the abort, because both detached loops
8
6
  * here sleep between iterations and a plain timer stays alive for the whole
9
7
  * interval after the branch has already returned - one live timer per RPC,
10
8
  * holding the Node event loop open past the end of a race.
11
9
  *
12
- * Never rejects on abort. The callers re-check `signal.aborted` and exit
13
- * through their own loop condition, so a rejection here would only add a
14
- * catch to every call site.
10
+ * Never rejects on abort, unlike `@lifi/sdk`'s `sleep(ms, { signal })`. The
11
+ * callers re-check `signal.aborted` and exit through their own loop
12
+ * condition, so a rejection here would only add a catch to every call site.
15
13
  */
16
14
  export declare function abortableSleep(ms: number, signal: AbortSignal): Promise<void>;
17
15
  //#endregion
@@ -3,16 +3,14 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  /**
4
4
  * Sleeps for `ms`, or until `signal` aborts - whichever comes first.
5
5
  *
6
- * Not `@lifi/sdk`'s `sleep`: that one is publicly exported, so making its
7
- * timer abortable or unref'd would change behaviour for every caller in the
8
- * repo. The confirmation branches need the abort, because both detached loops
6
+ * The confirmation branches need the abort, because both detached loops
9
7
  * here sleep between iterations and a plain timer stays alive for the whole
10
8
  * interval after the branch has already returned - one live timer per RPC,
11
9
  * holding the Node event loop open past the end of a race.
12
10
  *
13
- * Never rejects on abort. The callers re-check `signal.aborted` and exit
14
- * through their own loop condition, so a rejection here would only add a
15
- * catch to every call site.
11
+ * Never rejects on abort, unlike `@lifi/sdk`'s `sleep(ms, { signal })`. The
12
+ * callers re-check `signal.aborted` and exit through their own loop
13
+ * condition, so a rejection here would only add a catch to every call site.
16
14
  */
17
15
  function abortableSleep(ms, signal) {
18
16
  if (signal.aborted) return Promise.resolve();
@@ -1 +1 @@
1
- {"version":3,"file":"abortableSleep.js","names":[],"sources":["../../../src/confirmation/abortableSleep.ts"],"sourcesContent":["/**\n * Sleeps for `ms`, or until `signal` aborts - whichever comes first.\n *\n * Not `@lifi/sdk`'s `sleep`: that one is publicly exported, so making its\n * timer abortable or unref'd would change behaviour for every caller in the\n * repo. The confirmation branches need the abort, because both detached loops\n * here sleep between iterations and a plain timer stays alive for the whole\n * interval after the branch has already returned - one live timer per RPC,\n * holding the Node event loop open past the end of a race.\n *\n * Never rejects on abort. The callers re-check `signal.aborted` and exit\n * through their own loop condition, so a rejection here would only add a\n * catch to every call site.\n */\nexport function abortableSleep(ms: number, signal: AbortSignal): Promise<void> {\n if (signal.aborted) {\n return Promise.resolve()\n }\n\n return new Promise<void>((resolve) => {\n const settle = (): void => {\n clearTimeout(timer)\n signal.removeEventListener('abort', settle)\n resolve()\n }\n\n const timer = setTimeout(settle, ms)\n signal.addEventListener('abort', settle, { once: true })\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,SAAgB,eAAe,IAAY,QAAoC;CAC7E,IAAI,OAAO,SACT,OAAO,QAAQ,QAAQ;CAGzB,OAAO,IAAI,SAAe,YAAY;EACpC,MAAM,eAAqB;GACzB,aAAa,KAAK;GAClB,OAAO,oBAAoB,SAAS,MAAM;GAC1C,QAAQ;EACV;EAEA,MAAM,QAAQ,WAAW,QAAQ,EAAE;EACnC,OAAO,iBAAiB,SAAS,QAAQ,EAAE,MAAM,KAAK,CAAC;CACzD,CAAC;AACH"}
1
+ {"version":3,"file":"abortableSleep.js","names":[],"sources":["../../../src/confirmation/abortableSleep.ts"],"sourcesContent":["/**\n * Sleeps for `ms`, or until `signal` aborts - whichever comes first.\n *\n * The confirmation branches need the abort, because both detached loops\n * here sleep between iterations and a plain timer stays alive for the whole\n * interval after the branch has already returned - one live timer per RPC,\n * holding the Node event loop open past the end of a race.\n *\n * Never rejects on abort, unlike `@lifi/sdk`'s `sleep(ms, { signal })`. The\n * callers re-check `signal.aborted` and exit through their own loop\n * condition, so a rejection here would only add a catch to every call site.\n */\nexport function abortableSleep(ms: number, signal: AbortSignal): Promise<void> {\n if (signal.aborted) {\n return Promise.resolve()\n }\n\n return new Promise<void>((resolve) => {\n const settle = (): void => {\n clearTimeout(timer)\n signal.removeEventListener('abort', settle)\n resolve()\n }\n\n const timer = setTimeout(settle, ms)\n signal.addEventListener('abort', settle, { once: true })\n })\n}\n"],"mappings":";;;;;;;;;;;;;;AAYA,SAAgB,eAAe,IAAY,QAAoC;CAC7E,IAAI,OAAO,SACT,OAAO,QAAQ,QAAQ;CAGzB,OAAO,IAAI,SAAe,YAAY;EACpC,MAAM,eAAqB;GACzB,aAAa,KAAK;GAClB,OAAO,oBAAoB,SAAS,MAAM;GAC1C,QAAQ;EACV;EAEA,MAAM,QAAQ,WAAW,QAAQ,EAAE;EACnC,OAAO,iBAAiB,SAAS,QAAQ,EAAE,MAAM,KAAK,CAAC;CACzD,CAAC;AACH"}
@@ -10,10 +10,19 @@ const parseSolanaErrors = async (e, step, action) => {
10
10
  const baseError = handleSpecificErrors(e);
11
11
  return new _lifi_sdk.SDKError(baseError, step, action);
12
12
  };
13
+ const userRejectionMessage = /(^|\W)user\W+(has\W+)?(rejected|denied|cancell?ed)|\b(rejected|denied|cancell?ed)\W+by\W+(the\W+)?user\b/i;
14
+ /**
15
+ * The SDK calls the Wallet Standard features directly, so a wallet's own error
16
+ * arrives here unwrapped. Wallets report a rejection with the EIP-1193 code
17
+ * 4001 or only with a message. An `AbortError` is not a rejection: nothing
18
+ * says the user caused it. The SDK's own errors keep their code.
19
+ */
20
+ const isUserRejection = (e) => !(e instanceof _lifi_sdk.BaseError) && (e.code === 4001 || typeof e.message === "string" && userRejectionMessage.test(e.message));
13
21
  const handleSpecificErrors = (e) => {
14
22
  if (e.name === "WalletSignTransactionError") return new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.SignatureRejected, e.message, e);
15
23
  if (e.name === "SendTransactionError") return new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionFailed, e.message, e);
16
24
  if (e.name === "TransactionExpiredBlockheightExceededError") return new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionExpired, e.message, e);
25
+ if (isUserRejection(e)) return new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.SignatureRejected, e.message, e);
17
26
  if (e.message?.includes("simulate")) return new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionSimulationFailed, e.message, e);
18
27
  if (e instanceof _lifi_sdk.BaseError) return e;
19
28
  return new _lifi_sdk.UnknownError(e.message || _lifi_sdk.ErrorMessage.UnknownError, e);
@@ -1 +1 @@
1
- {"version":3,"file":"parseSolanaErrors.js","names":["SDKError","TransactionError","LiFiErrorCode","BaseError","UnknownError","ErrorMessage"],"sources":["../../../src/errors/parseSolanaErrors.ts"],"sourcesContent":["import {\n BaseError,\n ErrorMessage,\n type ExecutionAction,\n LiFiErrorCode,\n type LiFiStep,\n SDKError,\n TransactionError,\n UnknownError,\n} from '@lifi/sdk'\n\nexport const parseSolanaErrors = async (\n e: Error,\n step?: LiFiStep,\n action?: ExecutionAction\n): Promise<SDKError> => {\n if (e instanceof SDKError) {\n e.step = e.step ?? step\n e.action = e.action ?? action\n return e\n }\n\n const baseError = handleSpecificErrors(e)\n\n return new SDKError(baseError, step, action)\n}\n\nconst handleSpecificErrors = (e: any) => {\n if (e.name === 'WalletSignTransactionError') {\n return new TransactionError(LiFiErrorCode.SignatureRejected, e.message, e)\n }\n\n if (e.name === 'SendTransactionError') {\n return new TransactionError(LiFiErrorCode.TransactionFailed, e.message, e)\n }\n\n if (e.name === 'TransactionExpiredBlockheightExceededError') {\n return new TransactionError(LiFiErrorCode.TransactionExpired, e.message, e)\n }\n\n if (e.message?.includes('simulate')) {\n return new TransactionError(\n LiFiErrorCode.TransactionSimulationFailed,\n e.message,\n e\n )\n }\n\n if (e instanceof BaseError) {\n return e\n }\n\n return new UnknownError(e.message || ErrorMessage.UnknownError, e)\n}\n"],"mappings":";;;AAWA,MAAa,oBAAoB,OAC/B,GACA,MACA,WACsB;CACtB,IAAI,aAAaA,UAAAA,UAAU;EACzB,EAAE,OAAO,EAAE,QAAQ;EACnB,EAAE,SAAS,EAAE,UAAU;EACvB,OAAO;CACT;CAEA,MAAM,YAAY,qBAAqB,CAAC;CAExC,OAAO,IAAIA,UAAAA,SAAS,WAAW,MAAM,MAAM;AAC7C;AAEA,MAAM,wBAAwB,MAAW;CACvC,IAAI,EAAE,SAAS,8BACb,OAAO,IAAIC,UAAAA,iBAAiBC,UAAAA,cAAc,mBAAmB,EAAE,SAAS,CAAC;CAG3E,IAAI,EAAE,SAAS,wBACb,OAAO,IAAID,UAAAA,iBAAiBC,UAAAA,cAAc,mBAAmB,EAAE,SAAS,CAAC;CAG3E,IAAI,EAAE,SAAS,8CACb,OAAO,IAAID,UAAAA,iBAAiBC,UAAAA,cAAc,oBAAoB,EAAE,SAAS,CAAC;CAG5E,IAAI,EAAE,SAAS,SAAS,UAAU,GAChC,OAAO,IAAID,UAAAA,iBACTC,UAAAA,cAAc,6BACd,EAAE,SACF,CACF;CAGF,IAAI,aAAaC,UAAAA,WACf,OAAO;CAGT,OAAO,IAAIC,UAAAA,aAAa,EAAE,WAAWC,UAAAA,aAAa,cAAc,CAAC;AACnE"}
1
+ {"version":3,"file":"parseSolanaErrors.js","names":["SDKError","BaseError","TransactionError","LiFiErrorCode","UnknownError","ErrorMessage"],"sources":["../../../src/errors/parseSolanaErrors.ts"],"sourcesContent":["import {\n BaseError,\n ErrorMessage,\n type ExecutionAction,\n LiFiErrorCode,\n type LiFiStep,\n SDKError,\n TransactionError,\n UnknownError,\n} from '@lifi/sdk'\n\nexport const parseSolanaErrors = async (\n e: Error,\n step?: LiFiStep,\n action?: ExecutionAction\n): Promise<SDKError> => {\n if (e instanceof SDKError) {\n e.step = e.step ?? step\n e.action = e.action ?? action\n return e\n }\n\n const baseError = handleSpecificErrors(e)\n\n return new SDKError(baseError, step, action)\n}\n\n// Same pattern as bigmi's `isUserRejection`. It is anchored on \"user\", so a\n// refusal by a node or a host does not count as a rejection.\nconst userRejectionMessage =\n /(^|\\W)user\\W+(has\\W+)?(rejected|denied|cancell?ed)|\\b(rejected|denied|cancell?ed)\\W+by\\W+(the\\W+)?user\\b/i\n\n/**\n * The SDK calls the Wallet Standard features directly, so a wallet's own error\n * arrives here unwrapped. Wallets report a rejection with the EIP-1193 code\n * 4001 or only with a message. An `AbortError` is not a rejection: nothing\n * says the user caused it. The SDK's own errors keep their code.\n */\nconst isUserRejection = (e: any): boolean =>\n !(e instanceof BaseError) &&\n (e.code === 4001 ||\n (typeof e.message === 'string' && userRejectionMessage.test(e.message)))\n\nconst handleSpecificErrors = (e: any) => {\n if (e.name === 'WalletSignTransactionError') {\n return new TransactionError(LiFiErrorCode.SignatureRejected, e.message, e)\n }\n\n if (e.name === 'SendTransactionError') {\n return new TransactionError(LiFiErrorCode.TransactionFailed, e.message, e)\n }\n\n if (e.name === 'TransactionExpiredBlockheightExceededError') {\n return new TransactionError(LiFiErrorCode.TransactionExpired, e.message, e)\n }\n\n // After the name checks: a known error keeps its code, even when its\n // message quotes program logs that look like a rejection.\n if (isUserRejection(e)) {\n return new TransactionError(LiFiErrorCode.SignatureRejected, e.message, e)\n }\n\n if (e.message?.includes('simulate')) {\n return new TransactionError(\n LiFiErrorCode.TransactionSimulationFailed,\n e.message,\n e\n )\n }\n\n if (e instanceof BaseError) {\n return e\n }\n\n return new UnknownError(e.message || ErrorMessage.UnknownError, e)\n}\n"],"mappings":";;;AAWA,MAAa,oBAAoB,OAC/B,GACA,MACA,WACsB;CACtB,IAAI,aAAaA,UAAAA,UAAU;EACzB,EAAE,OAAO,EAAE,QAAQ;EACnB,EAAE,SAAS,EAAE,UAAU;EACvB,OAAO;CACT;CAEA,MAAM,YAAY,qBAAqB,CAAC;CAExC,OAAO,IAAIA,UAAAA,SAAS,WAAW,MAAM,MAAM;AAC7C;AAIA,MAAM,uBACJ;;;;;;;AAQF,MAAM,mBAAmB,MACvB,EAAE,aAAaC,UAAAA,eACd,EAAE,SAAS,QACT,OAAO,EAAE,YAAY,YAAY,qBAAqB,KAAK,EAAE,OAAO;AAEzE,MAAM,wBAAwB,MAAW;CACvC,IAAI,EAAE,SAAS,8BACb,OAAO,IAAIC,UAAAA,iBAAiBC,UAAAA,cAAc,mBAAmB,EAAE,SAAS,CAAC;CAG3E,IAAI,EAAE,SAAS,wBACb,OAAO,IAAID,UAAAA,iBAAiBC,UAAAA,cAAc,mBAAmB,EAAE,SAAS,CAAC;CAG3E,IAAI,EAAE,SAAS,8CACb,OAAO,IAAID,UAAAA,iBAAiBC,UAAAA,cAAc,oBAAoB,EAAE,SAAS,CAAC;CAK5E,IAAI,gBAAgB,CAAC,GACnB,OAAO,IAAID,UAAAA,iBAAiBC,UAAAA,cAAc,mBAAmB,EAAE,SAAS,CAAC;CAG3E,IAAI,EAAE,SAAS,SAAS,UAAU,GAChC,OAAO,IAAID,UAAAA,iBACTC,UAAAA,cAAc,6BACd,EAAE,SACF,CACF;CAGF,IAAI,aAAaF,UAAAA,WACf,OAAO;CAGT,OAAO,IAAIG,UAAAA,aAAa,EAAE,WAAWC,UAAAA,aAAa,cAAc,CAAC;AACnE"}
@@ -1,5 +1,5 @@
1
1
  //#region src/version.d.ts
2
2
  export declare const name = "@lifi/sdk-provider-solana";
3
- export declare const version = "4.3.0";
3
+ export declare const version = "4.3.2";
4
4
  //#endregion
5
5
  //# sourceMappingURL=version.d.ts.map
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/version.ts
3
3
  const name = "@lifi/sdk-provider-solana";
4
- const version = "4.3.0";
4
+ const version = "4.3.2";
5
5
  //#endregion
6
6
  exports.name = name;
7
7
  exports.version = version;
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-solana'\nexport const version = '4.3.0'\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-solana'\nexport const version = '4.3.2'\n"],"mappings":";;AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
@@ -2,16 +2,14 @@
2
2
  /**
3
3
  * Sleeps for `ms`, or until `signal` aborts - whichever comes first.
4
4
  *
5
- * Not `@lifi/sdk`'s `sleep`: that one is publicly exported, so making its
6
- * timer abortable or unref'd would change behaviour for every caller in the
7
- * repo. The confirmation branches need the abort, because both detached loops
5
+ * The confirmation branches need the abort, because both detached loops
8
6
  * here sleep between iterations and a plain timer stays alive for the whole
9
7
  * interval after the branch has already returned - one live timer per RPC,
10
8
  * holding the Node event loop open past the end of a race.
11
9
  *
12
- * Never rejects on abort. The callers re-check `signal.aborted` and exit
13
- * through their own loop condition, so a rejection here would only add a
14
- * catch to every call site.
10
+ * Never rejects on abort, unlike `@lifi/sdk`'s `sleep(ms, { signal })`. The
11
+ * callers re-check `signal.aborted` and exit through their own loop
12
+ * condition, so a rejection here would only add a catch to every call site.
15
13
  */
16
14
  export declare function abortableSleep(ms: number, signal: AbortSignal): Promise<void>;
17
15
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"abortableSleep.d.ts","names":[],"sources":["../../../src/confirmation/abortableSleep.ts"],"mappings":";;;;;;;;;;;;;;;wBAcgB,eAAe,YAAY,QAAQ,cAAc"}
1
+ {"version":3,"file":"abortableSleep.d.ts","names":[],"sources":["../../../src/confirmation/abortableSleep.ts"],"mappings":";;;;;;;;;;;;;wBAYgB,eAAe,YAAY,QAAQ,cAAc"}
@@ -2,16 +2,14 @@
2
2
  /**
3
3
  * Sleeps for `ms`, or until `signal` aborts - whichever comes first.
4
4
  *
5
- * Not `@lifi/sdk`'s `sleep`: that one is publicly exported, so making its
6
- * timer abortable or unref'd would change behaviour for every caller in the
7
- * repo. The confirmation branches need the abort, because both detached loops
5
+ * The confirmation branches need the abort, because both detached loops
8
6
  * here sleep between iterations and a plain timer stays alive for the whole
9
7
  * interval after the branch has already returned - one live timer per RPC,
10
8
  * holding the Node event loop open past the end of a race.
11
9
  *
12
- * Never rejects on abort. The callers re-check `signal.aborted` and exit
13
- * through their own loop condition, so a rejection here would only add a
14
- * catch to every call site.
10
+ * Never rejects on abort, unlike `@lifi/sdk`'s `sleep(ms, { signal })`. The
11
+ * callers re-check `signal.aborted` and exit through their own loop
12
+ * condition, so a rejection here would only add a catch to every call site.
15
13
  */
16
14
  function abortableSleep(ms, signal) {
17
15
  if (signal.aborted) return Promise.resolve();
@@ -1 +1 @@
1
- {"version":3,"file":"abortableSleep.js","names":[],"sources":["../../../src/confirmation/abortableSleep.ts"],"sourcesContent":["/**\n * Sleeps for `ms`, or until `signal` aborts - whichever comes first.\n *\n * Not `@lifi/sdk`'s `sleep`: that one is publicly exported, so making its\n * timer abortable or unref'd would change behaviour for every caller in the\n * repo. The confirmation branches need the abort, because both detached loops\n * here sleep between iterations and a plain timer stays alive for the whole\n * interval after the branch has already returned - one live timer per RPC,\n * holding the Node event loop open past the end of a race.\n *\n * Never rejects on abort. The callers re-check `signal.aborted` and exit\n * through their own loop condition, so a rejection here would only add a\n * catch to every call site.\n */\nexport function abortableSleep(ms: number, signal: AbortSignal): Promise<void> {\n if (signal.aborted) {\n return Promise.resolve()\n }\n\n return new Promise<void>((resolve) => {\n const settle = (): void => {\n clearTimeout(timer)\n signal.removeEventListener('abort', settle)\n resolve()\n }\n\n const timer = setTimeout(settle, ms)\n signal.addEventListener('abort', settle, { once: true })\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,SAAgB,eAAe,IAAY,QAAoC;CAC7E,IAAI,OAAO,SACT,OAAO,QAAQ,QAAQ;CAGzB,OAAO,IAAI,SAAe,YAAY;EACpC,MAAM,eAAqB;GACzB,aAAa,KAAK;GAClB,OAAO,oBAAoB,SAAS,MAAM;GAC1C,QAAQ;EACV;EAEA,MAAM,QAAQ,WAAW,QAAQ,EAAE;EACnC,OAAO,iBAAiB,SAAS,QAAQ,EAAE,MAAM,KAAK,CAAC;CACzD,CAAC;AACH"}
1
+ {"version":3,"file":"abortableSleep.js","names":[],"sources":["../../../src/confirmation/abortableSleep.ts"],"sourcesContent":["/**\n * Sleeps for `ms`, or until `signal` aborts - whichever comes first.\n *\n * The confirmation branches need the abort, because both detached loops\n * here sleep between iterations and a plain timer stays alive for the whole\n * interval after the branch has already returned - one live timer per RPC,\n * holding the Node event loop open past the end of a race.\n *\n * Never rejects on abort, unlike `@lifi/sdk`'s `sleep(ms, { signal })`. The\n * callers re-check `signal.aborted` and exit through their own loop\n * condition, so a rejection here would only add a catch to every call site.\n */\nexport function abortableSleep(ms: number, signal: AbortSignal): Promise<void> {\n if (signal.aborted) {\n return Promise.resolve()\n }\n\n return new Promise<void>((resolve) => {\n const settle = (): void => {\n clearTimeout(timer)\n signal.removeEventListener('abort', settle)\n resolve()\n }\n\n const timer = setTimeout(settle, ms)\n signal.addEventListener('abort', settle, { once: true })\n })\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAgB,eAAe,IAAY,QAAoC;CAC7E,IAAI,OAAO,SACT,OAAO,QAAQ,QAAQ;CAGzB,OAAO,IAAI,SAAe,YAAY;EACpC,MAAM,eAAqB;GACzB,aAAa,KAAK;GAClB,OAAO,oBAAoB,SAAS,MAAM;GAC1C,QAAQ;EACV;EAEA,MAAM,QAAQ,WAAW,QAAQ,EAAE;EACnC,OAAO,iBAAiB,SAAS,QAAQ,EAAE,MAAM,KAAK,CAAC;CACzD,CAAC;AACH"}
@@ -9,10 +9,19 @@ const parseSolanaErrors = async (e, step, action) => {
9
9
  const baseError = handleSpecificErrors(e);
10
10
  return new SDKError(baseError, step, action);
11
11
  };
12
+ const userRejectionMessage = /(^|\W)user\W+(has\W+)?(rejected|denied|cancell?ed)|\b(rejected|denied|cancell?ed)\W+by\W+(the\W+)?user\b/i;
13
+ /**
14
+ * The SDK calls the Wallet Standard features directly, so a wallet's own error
15
+ * arrives here unwrapped. Wallets report a rejection with the EIP-1193 code
16
+ * 4001 or only with a message. An `AbortError` is not a rejection: nothing
17
+ * says the user caused it. The SDK's own errors keep their code.
18
+ */
19
+ const isUserRejection = (e) => !(e instanceof BaseError) && (e.code === 4001 || typeof e.message === "string" && userRejectionMessage.test(e.message));
12
20
  const handleSpecificErrors = (e) => {
13
21
  if (e.name === "WalletSignTransactionError") return new TransactionError(LiFiErrorCode.SignatureRejected, e.message, e);
14
22
  if (e.name === "SendTransactionError") return new TransactionError(LiFiErrorCode.TransactionFailed, e.message, e);
15
23
  if (e.name === "TransactionExpiredBlockheightExceededError") return new TransactionError(LiFiErrorCode.TransactionExpired, e.message, e);
24
+ if (isUserRejection(e)) return new TransactionError(LiFiErrorCode.SignatureRejected, e.message, e);
16
25
  if (e.message?.includes("simulate")) return new TransactionError(LiFiErrorCode.TransactionSimulationFailed, e.message, e);
17
26
  if (e instanceof BaseError) return e;
18
27
  return new UnknownError(e.message || ErrorMessage.UnknownError, e);
@@ -1 +1 @@
1
- {"version":3,"file":"parseSolanaErrors.js","names":[],"sources":["../../../src/errors/parseSolanaErrors.ts"],"sourcesContent":["import {\n BaseError,\n ErrorMessage,\n type ExecutionAction,\n LiFiErrorCode,\n type LiFiStep,\n SDKError,\n TransactionError,\n UnknownError,\n} from '@lifi/sdk'\n\nexport const parseSolanaErrors = async (\n e: Error,\n step?: LiFiStep,\n action?: ExecutionAction\n): Promise<SDKError> => {\n if (e instanceof SDKError) {\n e.step = e.step ?? step\n e.action = e.action ?? action\n return e\n }\n\n const baseError = handleSpecificErrors(e)\n\n return new SDKError(baseError, step, action)\n}\n\nconst handleSpecificErrors = (e: any) => {\n if (e.name === 'WalletSignTransactionError') {\n return new TransactionError(LiFiErrorCode.SignatureRejected, e.message, e)\n }\n\n if (e.name === 'SendTransactionError') {\n return new TransactionError(LiFiErrorCode.TransactionFailed, e.message, e)\n }\n\n if (e.name === 'TransactionExpiredBlockheightExceededError') {\n return new TransactionError(LiFiErrorCode.TransactionExpired, e.message, e)\n }\n\n if (e.message?.includes('simulate')) {\n return new TransactionError(\n LiFiErrorCode.TransactionSimulationFailed,\n e.message,\n e\n )\n }\n\n if (e instanceof BaseError) {\n return e\n }\n\n return new UnknownError(e.message || ErrorMessage.UnknownError, e)\n}\n"],"mappings":";;AAWA,MAAa,oBAAoB,OAC/B,GACA,MACA,WACsB;CACtB,IAAI,aAAa,UAAU;EACzB,EAAE,OAAO,EAAE,QAAQ;EACnB,EAAE,SAAS,EAAE,UAAU;EACvB,OAAO;CACT;CAEA,MAAM,YAAY,qBAAqB,CAAC;CAExC,OAAO,IAAI,SAAS,WAAW,MAAM,MAAM;AAC7C;AAEA,MAAM,wBAAwB,MAAW;CACvC,IAAI,EAAE,SAAS,8BACb,OAAO,IAAI,iBAAiB,cAAc,mBAAmB,EAAE,SAAS,CAAC;CAG3E,IAAI,EAAE,SAAS,wBACb,OAAO,IAAI,iBAAiB,cAAc,mBAAmB,EAAE,SAAS,CAAC;CAG3E,IAAI,EAAE,SAAS,8CACb,OAAO,IAAI,iBAAiB,cAAc,oBAAoB,EAAE,SAAS,CAAC;CAG5E,IAAI,EAAE,SAAS,SAAS,UAAU,GAChC,OAAO,IAAI,iBACT,cAAc,6BACd,EAAE,SACF,CACF;CAGF,IAAI,aAAa,WACf,OAAO;CAGT,OAAO,IAAI,aAAa,EAAE,WAAW,aAAa,cAAc,CAAC;AACnE"}
1
+ {"version":3,"file":"parseSolanaErrors.js","names":[],"sources":["../../../src/errors/parseSolanaErrors.ts"],"sourcesContent":["import {\n BaseError,\n ErrorMessage,\n type ExecutionAction,\n LiFiErrorCode,\n type LiFiStep,\n SDKError,\n TransactionError,\n UnknownError,\n} from '@lifi/sdk'\n\nexport const parseSolanaErrors = async (\n e: Error,\n step?: LiFiStep,\n action?: ExecutionAction\n): Promise<SDKError> => {\n if (e instanceof SDKError) {\n e.step = e.step ?? step\n e.action = e.action ?? action\n return e\n }\n\n const baseError = handleSpecificErrors(e)\n\n return new SDKError(baseError, step, action)\n}\n\n// Same pattern as bigmi's `isUserRejection`. It is anchored on \"user\", so a\n// refusal by a node or a host does not count as a rejection.\nconst userRejectionMessage =\n /(^|\\W)user\\W+(has\\W+)?(rejected|denied|cancell?ed)|\\b(rejected|denied|cancell?ed)\\W+by\\W+(the\\W+)?user\\b/i\n\n/**\n * The SDK calls the Wallet Standard features directly, so a wallet's own error\n * arrives here unwrapped. Wallets report a rejection with the EIP-1193 code\n * 4001 or only with a message. An `AbortError` is not a rejection: nothing\n * says the user caused it. The SDK's own errors keep their code.\n */\nconst isUserRejection = (e: any): boolean =>\n !(e instanceof BaseError) &&\n (e.code === 4001 ||\n (typeof e.message === 'string' && userRejectionMessage.test(e.message)))\n\nconst handleSpecificErrors = (e: any) => {\n if (e.name === 'WalletSignTransactionError') {\n return new TransactionError(LiFiErrorCode.SignatureRejected, e.message, e)\n }\n\n if (e.name === 'SendTransactionError') {\n return new TransactionError(LiFiErrorCode.TransactionFailed, e.message, e)\n }\n\n if (e.name === 'TransactionExpiredBlockheightExceededError') {\n return new TransactionError(LiFiErrorCode.TransactionExpired, e.message, e)\n }\n\n // After the name checks: a known error keeps its code, even when its\n // message quotes program logs that look like a rejection.\n if (isUserRejection(e)) {\n return new TransactionError(LiFiErrorCode.SignatureRejected, e.message, e)\n }\n\n if (e.message?.includes('simulate')) {\n return new TransactionError(\n LiFiErrorCode.TransactionSimulationFailed,\n e.message,\n e\n )\n }\n\n if (e instanceof BaseError) {\n return e\n }\n\n return new UnknownError(e.message || ErrorMessage.UnknownError, e)\n}\n"],"mappings":";;AAWA,MAAa,oBAAoB,OAC/B,GACA,MACA,WACsB;CACtB,IAAI,aAAa,UAAU;EACzB,EAAE,OAAO,EAAE,QAAQ;EACnB,EAAE,SAAS,EAAE,UAAU;EACvB,OAAO;CACT;CAEA,MAAM,YAAY,qBAAqB,CAAC;CAExC,OAAO,IAAI,SAAS,WAAW,MAAM,MAAM;AAC7C;AAIA,MAAM,uBACJ;;;;;;;AAQF,MAAM,mBAAmB,MACvB,EAAE,aAAa,eACd,EAAE,SAAS,QACT,OAAO,EAAE,YAAY,YAAY,qBAAqB,KAAK,EAAE,OAAO;AAEzE,MAAM,wBAAwB,MAAW;CACvC,IAAI,EAAE,SAAS,8BACb,OAAO,IAAI,iBAAiB,cAAc,mBAAmB,EAAE,SAAS,CAAC;CAG3E,IAAI,EAAE,SAAS,wBACb,OAAO,IAAI,iBAAiB,cAAc,mBAAmB,EAAE,SAAS,CAAC;CAG3E,IAAI,EAAE,SAAS,8CACb,OAAO,IAAI,iBAAiB,cAAc,oBAAoB,EAAE,SAAS,CAAC;CAK5E,IAAI,gBAAgB,CAAC,GACnB,OAAO,IAAI,iBAAiB,cAAc,mBAAmB,EAAE,SAAS,CAAC;CAG3E,IAAI,EAAE,SAAS,SAAS,UAAU,GAChC,OAAO,IAAI,iBACT,cAAc,6BACd,EAAE,SACF,CACF;CAGF,IAAI,aAAa,WACf,OAAO;CAGT,OAAO,IAAI,aAAa,EAAE,WAAW,aAAa,cAAc,CAAC;AACnE"}
@@ -1,5 +1,5 @@
1
1
  //#region src/version.d.ts
2
2
  export declare const name = "@lifi/sdk-provider-solana";
3
- export declare const version = "4.3.0";
3
+ export declare const version = "4.3.2";
4
4
  //#endregion
5
5
  //# sourceMappingURL=version.d.ts.map
@@ -1,6 +1,6 @@
1
1
  //#region src/version.ts
2
2
  const name = "@lifi/sdk-provider-solana";
3
- const version = "4.3.0";
3
+ const version = "4.3.2";
4
4
  //#endregion
5
5
  export { name, version };
6
6
 
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-solana'\nexport const version = '4.3.0'\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-solana'\nexport const version = '4.3.2'\n"],"mappings":";AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/sdk-provider-solana",
3
- "version": "4.3.0",
3
+ "version": "4.3.2",
4
4
  "description": "LI.FI Solana 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": "4.9.0",
32
- "@solana/kit": "^8.3.0",
31
+ "@lifi/sdk": "4.10.0",
32
+ "@solana/kit": "^8.4.0",
33
33
  "@solana/wallet-standard-features": "^1.5.0",
34
34
  "@wallet-standard/base": "^1.1.1"
35
35
  },
@@ -1,16 +1,14 @@
1
1
  /**
2
2
  * Sleeps for `ms`, or until `signal` aborts - whichever comes first.
3
3
  *
4
- * Not `@lifi/sdk`'s `sleep`: that one is publicly exported, so making its
5
- * timer abortable or unref'd would change behaviour for every caller in the
6
- * repo. The confirmation branches need the abort, because both detached loops
4
+ * The confirmation branches need the abort, because both detached loops
7
5
  * here sleep between iterations and a plain timer stays alive for the whole
8
6
  * interval after the branch has already returned - one live timer per RPC,
9
7
  * holding the Node event loop open past the end of a race.
10
8
  *
11
- * Never rejects on abort. The callers re-check `signal.aborted` and exit
12
- * through their own loop condition, so a rejection here would only add a
13
- * catch to every call site.
9
+ * Never rejects on abort, unlike `@lifi/sdk`'s `sleep(ms, { signal })`. The
10
+ * callers re-check `signal.aborted` and exit through their own loop
11
+ * condition, so a rejection here would only add a catch to every call site.
14
12
  */
15
13
  export function abortableSleep(ms: number, signal: AbortSignal): Promise<void> {
16
14
  if (signal.aborted) {
@@ -25,6 +25,22 @@ export const parseSolanaErrors = async (
25
25
  return new SDKError(baseError, step, action)
26
26
  }
27
27
 
28
+ // Same pattern as bigmi's `isUserRejection`. It is anchored on "user", so a
29
+ // refusal by a node or a host does not count as a rejection.
30
+ const userRejectionMessage =
31
+ /(^|\W)user\W+(has\W+)?(rejected|denied|cancell?ed)|\b(rejected|denied|cancell?ed)\W+by\W+(the\W+)?user\b/i
32
+
33
+ /**
34
+ * The SDK calls the Wallet Standard features directly, so a wallet's own error
35
+ * arrives here unwrapped. Wallets report a rejection with the EIP-1193 code
36
+ * 4001 or only with a message. An `AbortError` is not a rejection: nothing
37
+ * says the user caused it. The SDK's own errors keep their code.
38
+ */
39
+ const isUserRejection = (e: any): boolean =>
40
+ !(e instanceof BaseError) &&
41
+ (e.code === 4001 ||
42
+ (typeof e.message === 'string' && userRejectionMessage.test(e.message)))
43
+
28
44
  const handleSpecificErrors = (e: any) => {
29
45
  if (e.name === 'WalletSignTransactionError') {
30
46
  return new TransactionError(LiFiErrorCode.SignatureRejected, e.message, e)
@@ -38,6 +54,12 @@ const handleSpecificErrors = (e: any) => {
38
54
  return new TransactionError(LiFiErrorCode.TransactionExpired, e.message, e)
39
55
  }
40
56
 
57
+ // After the name checks: a known error keeps its code, even when its
58
+ // message quotes program logs that look like a rejection.
59
+ if (isUserRejection(e)) {
60
+ return new TransactionError(LiFiErrorCode.SignatureRejected, e.message, e)
61
+ }
62
+
41
63
  if (e.message?.includes('simulate')) {
42
64
  return new TransactionError(
43
65
  LiFiErrorCode.TransactionSimulationFailed,
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/sdk-provider-solana'
2
- export const version = '4.3.0'
2
+ export const version = '4.3.2'