@lifi/sdk 3.6.14-beta.0 → 3.6.14
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/package.json +2 -2
- package/src/_cjs/core/EVM/isBatchingSupported.js +2 -19
- package/src/_cjs/core/EVM/isBatchingSupported.js.map +1 -1
- package/src/_cjs/version.js +1 -1
- package/src/_cjs/version.js.map +1 -1
- package/src/_esm/core/EVM/isBatchingSupported.js +1 -17
- package/src/_esm/core/EVM/isBatchingSupported.js.map +1 -1
- package/src/_esm/version.js +1 -1
- package/src/_esm/version.js.map +1 -1
- package/src/_types/core/EVM/isBatchingSupported.d.ts +1 -3
- package/src/_types/core/EVM/isBatchingSupported.d.ts.map +1 -1
- package/src/_types/version.d.ts +1 -1
- package/src/_types/version.d.ts.map +1 -1
- package/src/core/EVM/isBatchingSupported.ts +2 -41
- package/src/version.ts +1 -1
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"bech32": "^2.0.0",
|
|
12
12
|
"bitcoinjs-lib": "^7.0.0-rc.0",
|
|
13
13
|
"bs58": "^6.0.0",
|
|
14
|
-
"viem": "^2.
|
|
14
|
+
"viem": "^2.29.2"
|
|
15
15
|
},
|
|
16
16
|
"description": "LI.FI Any-to-Any Cross-Chain-Swap SDK",
|
|
17
17
|
"exports": {
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"sideEffects": false,
|
|
68
68
|
"types": "./src/_types/index.d.ts",
|
|
69
69
|
"typings": "./src/_types/index.d.ts",
|
|
70
|
-
"version": "3.6.14
|
|
70
|
+
"version": "3.6.14"
|
|
71
71
|
}
|
|
@@ -1,28 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCapabilities = getCapabilities;
|
|
4
3
|
exports.isBatchingSupported = isBatchingSupported;
|
|
5
4
|
const types_1 = require("@lifi/types");
|
|
6
|
-
const
|
|
5
|
+
const actions_1 = require("viem/actions");
|
|
7
6
|
const utils_1 = require("viem/utils");
|
|
8
7
|
const config_js_1 = require("../../config.js");
|
|
9
8
|
const sleep_js_1 = require("../../utils/sleep.js");
|
|
10
|
-
async function getCapabilities(client, parameters = {}) {
|
|
11
|
-
const { account = client.account, chainId } = parameters;
|
|
12
|
-
const account_ = account ? (0, accounts_1.parseAccount)(account) : undefined;
|
|
13
|
-
const capabilities_raw = await client.request({
|
|
14
|
-
method: 'wallet_getCapabilities',
|
|
15
|
-
params: [account_?.address],
|
|
16
|
-
}, {
|
|
17
|
-
dedupe: true,
|
|
18
|
-
retryCount: 0,
|
|
19
|
-
});
|
|
20
|
-
const capabilities = {};
|
|
21
|
-
for (const [key, value] of Object.entries(capabilities_raw)) {
|
|
22
|
-
capabilities[Number(key)] = value;
|
|
23
|
-
}
|
|
24
|
-
return (typeof chainId === 'number' ? capabilities[chainId] : capabilities);
|
|
25
|
-
}
|
|
26
9
|
async function isBatchingSupported({ client, chainId, }) {
|
|
27
10
|
const _client = client ??
|
|
28
11
|
(await config_js_1.config.getProvider(types_1.ChainType.EVM)?.getWalletClient?.());
|
|
@@ -31,7 +14,7 @@ async function isBatchingSupported({ client, chainId, }) {
|
|
|
31
14
|
}
|
|
32
15
|
try {
|
|
33
16
|
const capabilities = await Promise.race([
|
|
34
|
-
(0, utils_1.getAction)(_client, getCapabilities, 'getCapabilities')({ chainId }),
|
|
17
|
+
(0, utils_1.getAction)(_client, actions_1.getCapabilities, 'getCapabilities')({ chainId }),
|
|
35
18
|
(0, sleep_js_1.sleep)(2_000),
|
|
36
19
|
]);
|
|
37
20
|
return (capabilities?.atomicBatch?.supported ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isBatchingSupported.js","sourceRoot":"","sources":["../../../core/EVM/isBatchingSupported.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"isBatchingSupported.js","sourceRoot":"","sources":["../../../core/EVM/isBatchingSupported.ts"],"names":[],"mappings":";;AAQA,kDAiCC;AAzCD,uCAAuC;AAEvC,0CAA8C;AAC9C,sCAAsC;AACtC,+CAAwC;AACxC,mDAA4C;AAGrC,KAAK,UAAU,mBAAmB,CAAC,EACxC,MAAM,EACN,OAAO,GAIR;IACC,MAAM,OAAO,GACX,MAAM;QACN,CAAC,MACC,kBAAM,CAAC,WAAW,CAAC,iBAAS,CAAC,GAAG,CACjC,EAAE,eAAe,EAAE,EAAE,CAAC,CAAA;IAEzB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;IAClD,CAAC;IAED,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC;YACtC,IAAA,iBAAS,EAAC,OAAO,EAAE,yBAAe,EAAE,iBAAiB,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;YACnE,IAAA,gBAAK,EAAC,KAAK,CAAC;SACb,CAAC,CAAA;QACF,OAAO,CACL,YAAY,EAAE,WAAW,EAAE,SAAS;YACpC,YAAY,EAAE,MAAM,EAAE,MAAM,KAAK,WAAW;YAC5C,YAAY,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO;YACxC,KAAK,CACN,CAAA;IACH,CAAC;IAAC,MAAM,CAAC;QAGP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC"}
|
package/src/_cjs/version.js
CHANGED
package/src/_cjs/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../version.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,WAAW,CAAA;AAClB,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../version.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,WAAW,CAAA;AAClB,QAAA,OAAO,GAAG,QAAQ,CAAA"}
|
|
@@ -1,24 +1,8 @@
|
|
|
1
1
|
import { ChainType } from '@lifi/types';
|
|
2
|
-
import {
|
|
2
|
+
import { getCapabilities } from 'viem/actions';
|
|
3
3
|
import { getAction } from 'viem/utils';
|
|
4
4
|
import { config } from '../../config.js';
|
|
5
5
|
import { sleep } from '../../utils/sleep.js';
|
|
6
|
-
export async function getCapabilities(client, parameters = {}) {
|
|
7
|
-
const { account = client.account, chainId } = parameters;
|
|
8
|
-
const account_ = account ? parseAccount(account) : undefined;
|
|
9
|
-
const capabilities_raw = await client.request({
|
|
10
|
-
method: 'wallet_getCapabilities',
|
|
11
|
-
params: [account_?.address],
|
|
12
|
-
}, {
|
|
13
|
-
dedupe: true,
|
|
14
|
-
retryCount: 0,
|
|
15
|
-
});
|
|
16
|
-
const capabilities = {};
|
|
17
|
-
for (const [key, value] of Object.entries(capabilities_raw)) {
|
|
18
|
-
capabilities[Number(key)] = value;
|
|
19
|
-
}
|
|
20
|
-
return (typeof chainId === 'number' ? capabilities[chainId] : capabilities);
|
|
21
|
-
}
|
|
22
6
|
export async function isBatchingSupported({ client, chainId, }) {
|
|
23
7
|
const _client = client ??
|
|
24
8
|
(await config.getProvider(ChainType.EVM)?.getWalletClient?.());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isBatchingSupported.js","sourceRoot":"","sources":["../../../core/EVM/isBatchingSupported.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"isBatchingSupported.js","sourceRoot":"","sources":["../../../core/EVM/isBatchingSupported.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAG5C,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EACxC,MAAM,EACN,OAAO,GAIR;IACC,MAAM,OAAO,GACX,MAAM;QACN,CAAC,MACC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,CACjC,EAAE,eAAe,EAAE,EAAE,CAAC,CAAA;IAEzB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;IAClD,CAAC;IAED,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC;YACtC,SAAS,CAAC,OAAO,EAAE,eAAe,EAAE,iBAAiB,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;YACnE,KAAK,CAAC,KAAK,CAAC;SACb,CAAC,CAAA;QACF,OAAO,CACL,YAAY,EAAE,WAAW,EAAE,SAAS;YACpC,YAAY,EAAE,MAAM,EAAE,MAAM,KAAK,WAAW;YAC5C,YAAY,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO;YACxC,KAAK,CACN,CAAA;IACH,CAAC;IAAC,MAAM,CAAC;QACP,oEAAoE;QACpE,+CAA+C;QAC/C,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC"}
|
package/src/_esm/version.js
CHANGED
package/src/_esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,WAAW,CAAA;AAC/B,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,WAAW,CAAA;AAC/B,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAA"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { Client
|
|
2
|
-
import type { GetCapabilitiesParameters, GetCapabilitiesReturnType } from 'viem';
|
|
3
|
-
export declare function getCapabilities<chainId extends number | undefined = undefined>(client: Client<Transport>, parameters?: GetCapabilitiesParameters<chainId>): Promise<GetCapabilitiesReturnType<chainId>>;
|
|
1
|
+
import type { Client } from 'viem';
|
|
4
2
|
export declare function isBatchingSupported({ client, chainId, }: {
|
|
5
3
|
client?: Client;
|
|
6
4
|
chainId: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isBatchingSupported.d.ts","sourceRoot":"","sources":["../../../core/EVM/isBatchingSupported.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"isBatchingSupported.d.ts","sourceRoot":"","sources":["../../../core/EVM/isBatchingSupported.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAOlC,wBAAsB,mBAAmB,CAAC,EACxC,MAAM,EACN,OAAO,GACR,EAAE;IACD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;CAChB,GAAG,OAAO,CAAC,OAAO,CAAC,CA2BnB"}
|
package/src/_types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,cAAc,CAAA;AAC/B,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,cAAc,CAAA;AAC/B,eAAO,MAAM,OAAO,WAAW,CAAA"}
|
|
@@ -1,50 +1,11 @@
|
|
|
1
1
|
import { ChainType } from '@lifi/types'
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
Transport,
|
|
5
|
-
WalletCapabilities,
|
|
6
|
-
WalletCapabilitiesRecord,
|
|
7
|
-
} from 'viem'
|
|
8
|
-
import type { GetCapabilitiesParameters, GetCapabilitiesReturnType } from 'viem'
|
|
9
|
-
import { parseAccount } from 'viem/accounts'
|
|
2
|
+
import type { Client } from 'viem'
|
|
3
|
+
import { getCapabilities } from 'viem/actions'
|
|
10
4
|
import { getAction } from 'viem/utils'
|
|
11
5
|
import { config } from '../../config.js'
|
|
12
6
|
import { sleep } from '../../utils/sleep.js'
|
|
13
7
|
import type { EVMProvider } from './types.js'
|
|
14
8
|
|
|
15
|
-
export async function getCapabilities<
|
|
16
|
-
chainId extends number | undefined = undefined,
|
|
17
|
-
>(
|
|
18
|
-
client: Client<Transport>,
|
|
19
|
-
parameters: GetCapabilitiesParameters<chainId> = {}
|
|
20
|
-
): Promise<GetCapabilitiesReturnType<chainId>> {
|
|
21
|
-
const { account = client.account, chainId } = parameters
|
|
22
|
-
|
|
23
|
-
const account_ = account ? parseAccount(account) : undefined
|
|
24
|
-
|
|
25
|
-
const capabilities_raw = await client.request(
|
|
26
|
-
{
|
|
27
|
-
method: 'wallet_getCapabilities',
|
|
28
|
-
params: [account_?.address],
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
dedupe: true,
|
|
32
|
-
retryCount: 0,
|
|
33
|
-
}
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
const capabilities = {} as WalletCapabilitiesRecord<
|
|
37
|
-
WalletCapabilities,
|
|
38
|
-
number
|
|
39
|
-
>
|
|
40
|
-
for (const [key, value] of Object.entries(capabilities_raw)) {
|
|
41
|
-
capabilities[Number(key)] = value
|
|
42
|
-
}
|
|
43
|
-
return (
|
|
44
|
-
typeof chainId === 'number' ? capabilities[chainId] : capabilities
|
|
45
|
-
) as never
|
|
46
|
-
}
|
|
47
|
-
|
|
48
9
|
export async function isBatchingSupported({
|
|
49
10
|
client,
|
|
50
11
|
chainId,
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/sdk'
|
|
2
|
-
export const version = '3.6.14
|
|
2
|
+
export const version = '3.6.14'
|