@swapkit/helpers 4.20.4 → 5.0.0
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 +9 -16
- package/dist/api/index.js +1 -1
- package/dist/chunk-g60m4sgr.js +5 -0
- package/dist/index.js +1 -1
- package/dist/types/api/index.d.ts +24 -0
- package/dist/types/api/swapkitApi/endpoints.d.ts +24 -0
- package/dist/types/api/swapkitApi/types.d.ts +194 -18
- package/dist/types/index.d.ts +0 -3
- package/dist/types/modules/assetValue.d.ts +1 -0
- package/dist/types/modules/requestClient.d.ts +5 -0
- package/dist/types/modules/swapKitError.d.ts +12 -0
- package/dist/types/types/quotes.d.ts +2 -1
- package/dist/types/utils/asset.d.ts +3 -1
- package/dist/types/utils/chains.d.ts +9 -0
- package/dist/types/utils/evmAddress.d.ts +14 -0
- package/dist/types/utils/memo.d.ts +3 -0
- package/dist/types/utils/others.d.ts +0 -4
- package/package.json +13 -22
- package/dist/api/index.cjs +0 -4
- package/dist/chunk-8pyeeg27.js +0 -5
- package/dist/contracts.cjs +0 -1
- package/dist/index.cjs +0 -4
- package/dist/tokens.cjs +0 -1
- package/dist/types/modules/widgetAuth.d.ts +0 -5
- package/dist/types/utils/explorerUrls.d.ts +0 -9
- package/dist/types/utils/validators.d.ts +0 -2
|
@@ -14,7 +14,9 @@ export declare enum RouteQuoteTxType {
|
|
|
14
14
|
NEAR = "NEAR",
|
|
15
15
|
STELLAR = "STELLAR",
|
|
16
16
|
TON = "TON",
|
|
17
|
-
TRON = "TRON"
|
|
17
|
+
TRON = "TRON",
|
|
18
|
+
EIP_712_HYPE_SEND_ASSET = "EIP_712_HYPE_SEND_ASSET",
|
|
19
|
+
EIP_712_HYPE_WITHDRAW = "EIP_712_HYPE_WITHDRAW"
|
|
18
20
|
}
|
|
19
21
|
export declare enum TxnType {
|
|
20
22
|
approve = "approve",
|
|
@@ -1136,6 +1138,85 @@ export declare const TONTransactionSchema: z.ZodObject<{
|
|
|
1136
1138
|
sendMode: z.ZodNumber;
|
|
1137
1139
|
}, z.core.$strip>;
|
|
1138
1140
|
export type TONTransaction = z.infer<typeof TONTransactionSchema>;
|
|
1141
|
+
/** Canonical HyperCore spot token id for USDC — the only sell token HyperCore payin routes support. */
|
|
1142
|
+
export declare const HYPERCORE_USDC_TOKEN_ID = "USDC:0x6d1e7cde53ba9467b783cb7c530ce054";
|
|
1143
|
+
export declare const HyperCoreEip712TypedDataSchema: z.ZodObject<{
|
|
1144
|
+
domain: z.ZodObject<{
|
|
1145
|
+
chainId: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
1146
|
+
name: z.ZodOptional<z.ZodString>;
|
|
1147
|
+
verifyingContract: z.ZodOptional<z.ZodString>;
|
|
1148
|
+
version: z.ZodOptional<z.ZodString>;
|
|
1149
|
+
}, z.core.$loose>;
|
|
1150
|
+
message: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1151
|
+
primaryType: z.ZodString;
|
|
1152
|
+
types: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
1153
|
+
name: z.ZodString;
|
|
1154
|
+
type: z.ZodString;
|
|
1155
|
+
}, z.core.$loose>>>;
|
|
1156
|
+
}, z.core.$loose>;
|
|
1157
|
+
export declare const HyperCoreSendAssetActionSchema: z.ZodObject<{
|
|
1158
|
+
amount: z.ZodString;
|
|
1159
|
+
destination: z.ZodString;
|
|
1160
|
+
destinationDex: z.ZodString;
|
|
1161
|
+
fromSubAccount: z.ZodString;
|
|
1162
|
+
hyperliquidChain: z.ZodString;
|
|
1163
|
+
nonce: z.ZodNumber;
|
|
1164
|
+
signatureChainId: z.ZodString;
|
|
1165
|
+
sourceDex: z.ZodString;
|
|
1166
|
+
token: z.ZodString;
|
|
1167
|
+
type: z.ZodLiteral<"sendAsset">;
|
|
1168
|
+
}, z.core.$loose>;
|
|
1169
|
+
export declare const HyperCoreTypedDataTransactionSchema: z.ZodObject<{
|
|
1170
|
+
action: z.ZodObject<{
|
|
1171
|
+
type: z.ZodString;
|
|
1172
|
+
}, z.core.$loose>;
|
|
1173
|
+
submitTo: z.ZodString;
|
|
1174
|
+
typedData: z.ZodObject<{
|
|
1175
|
+
domain: z.ZodObject<{
|
|
1176
|
+
chainId: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
1177
|
+
name: z.ZodOptional<z.ZodString>;
|
|
1178
|
+
verifyingContract: z.ZodOptional<z.ZodString>;
|
|
1179
|
+
version: z.ZodOptional<z.ZodString>;
|
|
1180
|
+
}, z.core.$loose>;
|
|
1181
|
+
message: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1182
|
+
primaryType: z.ZodString;
|
|
1183
|
+
types: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
1184
|
+
name: z.ZodString;
|
|
1185
|
+
type: z.ZodString;
|
|
1186
|
+
}, z.core.$loose>>>;
|
|
1187
|
+
}, z.core.$loose>;
|
|
1188
|
+
}, z.core.$loose>;
|
|
1189
|
+
export type HyperCoreTypedDataTransaction = z.infer<typeof HyperCoreTypedDataTransactionSchema>;
|
|
1190
|
+
export declare const HyperCoreSendAssetTransactionSchema: z.ZodObject<{
|
|
1191
|
+
submitTo: z.ZodString;
|
|
1192
|
+
typedData: z.ZodObject<{
|
|
1193
|
+
domain: z.ZodObject<{
|
|
1194
|
+
chainId: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
1195
|
+
name: z.ZodOptional<z.ZodString>;
|
|
1196
|
+
verifyingContract: z.ZodOptional<z.ZodString>;
|
|
1197
|
+
version: z.ZodOptional<z.ZodString>;
|
|
1198
|
+
}, z.core.$loose>;
|
|
1199
|
+
message: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1200
|
+
primaryType: z.ZodString;
|
|
1201
|
+
types: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
1202
|
+
name: z.ZodString;
|
|
1203
|
+
type: z.ZodString;
|
|
1204
|
+
}, z.core.$loose>>>;
|
|
1205
|
+
}, z.core.$loose>;
|
|
1206
|
+
action: z.ZodObject<{
|
|
1207
|
+
amount: z.ZodString;
|
|
1208
|
+
destination: z.ZodString;
|
|
1209
|
+
destinationDex: z.ZodString;
|
|
1210
|
+
fromSubAccount: z.ZodString;
|
|
1211
|
+
hyperliquidChain: z.ZodString;
|
|
1212
|
+
nonce: z.ZodNumber;
|
|
1213
|
+
signatureChainId: z.ZodString;
|
|
1214
|
+
sourceDex: z.ZodString;
|
|
1215
|
+
token: z.ZodString;
|
|
1216
|
+
type: z.ZodLiteral<"sendAsset">;
|
|
1217
|
+
}, z.core.$loose>;
|
|
1218
|
+
}, z.core.$loose>;
|
|
1219
|
+
export type HyperCoreSendAssetTransaction = z.infer<typeof HyperCoreSendAssetTransactionSchema>;
|
|
1139
1220
|
export declare const RouteLegSchema: z.ZodObject<{
|
|
1140
1221
|
affiliate: z.ZodOptional<z.ZodString>;
|
|
1141
1222
|
affiliateFee: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1422,7 +1503,7 @@ export declare const QuoteResponseRouteItem: z.ZodObject<{
|
|
|
1422
1503
|
sourceAddress: z.ZodOptional<z.ZodString>;
|
|
1423
1504
|
targetAddress: z.ZodOptional<z.ZodString>;
|
|
1424
1505
|
totalSlippageBps: z.ZodNumber;
|
|
1425
|
-
tx: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1506
|
+
tx: z.ZodOptional<z.ZodUnion<[z.ZodUnion<readonly [z.ZodObject<{
|
|
1426
1507
|
data: z.ZodString;
|
|
1427
1508
|
from: z.ZodString;
|
|
1428
1509
|
to: z.ZodString;
|
|
@@ -1477,11 +1558,7 @@ export declare const QuoteResponseRouteItem: z.ZodObject<{
|
|
|
1477
1558
|
txID: z.ZodString;
|
|
1478
1559
|
value: z.ZodOptional<z.ZodString>;
|
|
1479
1560
|
visible: z.ZodBoolean;
|
|
1480
|
-
}, z.core.$strip>, z.
|
|
1481
|
-
calldata: z.ZodArray<z.ZodString>;
|
|
1482
|
-
contractAddress: z.ZodString;
|
|
1483
|
-
entrypoint: z.ZodString;
|
|
1484
|
-
}, z.core.$strip>>, z.ZodObject<{
|
|
1561
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1485
1562
|
messages: z.ZodArray<z.ZodObject<{
|
|
1486
1563
|
address: z.ZodString;
|
|
1487
1564
|
amount: z.ZodString;
|
|
@@ -1489,7 +1566,30 @@ export declare const QuoteResponseRouteItem: z.ZodObject<{
|
|
|
1489
1566
|
stateInit: z.ZodOptional<z.ZodString>;
|
|
1490
1567
|
}, z.core.$strip>>;
|
|
1491
1568
|
sendMode: z.ZodNumber;
|
|
1492
|
-
}, z.core.$strip>, z.
|
|
1569
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1570
|
+
action: z.ZodObject<{
|
|
1571
|
+
type: z.ZodString;
|
|
1572
|
+
}, z.core.$loose>;
|
|
1573
|
+
submitTo: z.ZodString;
|
|
1574
|
+
typedData: z.ZodObject<{
|
|
1575
|
+
domain: z.ZodObject<{
|
|
1576
|
+
chainId: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
1577
|
+
name: z.ZodOptional<z.ZodString>;
|
|
1578
|
+
verifyingContract: z.ZodOptional<z.ZodString>;
|
|
1579
|
+
version: z.ZodOptional<z.ZodString>;
|
|
1580
|
+
}, z.core.$loose>;
|
|
1581
|
+
message: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1582
|
+
primaryType: z.ZodString;
|
|
1583
|
+
types: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
1584
|
+
name: z.ZodString;
|
|
1585
|
+
type: z.ZodString;
|
|
1586
|
+
}, z.core.$loose>>>;
|
|
1587
|
+
}, z.core.$loose>;
|
|
1588
|
+
}, z.core.$loose>, z.ZodString]>, z.ZodArray<z.ZodObject<{
|
|
1589
|
+
calldata: z.ZodArray<z.ZodString>;
|
|
1590
|
+
contractAddress: z.ZodString;
|
|
1591
|
+
entrypoint: z.ZodString;
|
|
1592
|
+
}, z.core.$strip>>]>>;
|
|
1493
1593
|
txType: z.ZodOptional<z.ZodEnum<typeof RouteQuoteTxType>>;
|
|
1494
1594
|
warnings: z.ZodArray<z.ZodObject<{
|
|
1495
1595
|
code: z.ZodEnum<typeof WarningCodeEnum>;
|
|
@@ -1619,7 +1719,7 @@ export declare const QuoteResponseSchema: z.ZodObject<{
|
|
|
1619
1719
|
sourceAddress: z.ZodOptional<z.ZodString>;
|
|
1620
1720
|
targetAddress: z.ZodOptional<z.ZodString>;
|
|
1621
1721
|
totalSlippageBps: z.ZodNumber;
|
|
1622
|
-
tx: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1722
|
+
tx: z.ZodOptional<z.ZodUnion<[z.ZodUnion<readonly [z.ZodObject<{
|
|
1623
1723
|
data: z.ZodString;
|
|
1624
1724
|
from: z.ZodString;
|
|
1625
1725
|
to: z.ZodString;
|
|
@@ -1674,11 +1774,7 @@ export declare const QuoteResponseSchema: z.ZodObject<{
|
|
|
1674
1774
|
txID: z.ZodString;
|
|
1675
1775
|
value: z.ZodOptional<z.ZodString>;
|
|
1676
1776
|
visible: z.ZodBoolean;
|
|
1677
|
-
}, z.core.$strip>, z.
|
|
1678
|
-
calldata: z.ZodArray<z.ZodString>;
|
|
1679
|
-
contractAddress: z.ZodString;
|
|
1680
|
-
entrypoint: z.ZodString;
|
|
1681
|
-
}, z.core.$strip>>, z.ZodObject<{
|
|
1777
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1682
1778
|
messages: z.ZodArray<z.ZodObject<{
|
|
1683
1779
|
address: z.ZodString;
|
|
1684
1780
|
amount: z.ZodString;
|
|
@@ -1686,7 +1782,30 @@ export declare const QuoteResponseSchema: z.ZodObject<{
|
|
|
1686
1782
|
stateInit: z.ZodOptional<z.ZodString>;
|
|
1687
1783
|
}, z.core.$strip>>;
|
|
1688
1784
|
sendMode: z.ZodNumber;
|
|
1689
|
-
}, z.core.$strip>, z.
|
|
1785
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1786
|
+
action: z.ZodObject<{
|
|
1787
|
+
type: z.ZodString;
|
|
1788
|
+
}, z.core.$loose>;
|
|
1789
|
+
submitTo: z.ZodString;
|
|
1790
|
+
typedData: z.ZodObject<{
|
|
1791
|
+
domain: z.ZodObject<{
|
|
1792
|
+
chainId: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
1793
|
+
name: z.ZodOptional<z.ZodString>;
|
|
1794
|
+
verifyingContract: z.ZodOptional<z.ZodString>;
|
|
1795
|
+
version: z.ZodOptional<z.ZodString>;
|
|
1796
|
+
}, z.core.$loose>;
|
|
1797
|
+
message: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1798
|
+
primaryType: z.ZodString;
|
|
1799
|
+
types: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
1800
|
+
name: z.ZodString;
|
|
1801
|
+
type: z.ZodString;
|
|
1802
|
+
}, z.core.$loose>>>;
|
|
1803
|
+
}, z.core.$loose>;
|
|
1804
|
+
}, z.core.$loose>, z.ZodString]>, z.ZodArray<z.ZodObject<{
|
|
1805
|
+
calldata: z.ZodArray<z.ZodString>;
|
|
1806
|
+
contractAddress: z.ZodString;
|
|
1807
|
+
entrypoint: z.ZodString;
|
|
1808
|
+
}, z.core.$strip>>]>>;
|
|
1690
1809
|
txType: z.ZodOptional<z.ZodEnum<typeof RouteQuoteTxType>>;
|
|
1691
1810
|
warnings: z.ZodArray<z.ZodObject<{
|
|
1692
1811
|
code: z.ZodEnum<typeof WarningCodeEnum>;
|
|
@@ -2137,7 +2256,26 @@ export declare const QuoteRouteV2Response: z.ZodObject<{
|
|
|
2137
2256
|
stateInit: z.ZodOptional<z.ZodString>;
|
|
2138
2257
|
}, z.core.$strip>>;
|
|
2139
2258
|
sendMode: z.ZodNumber;
|
|
2140
|
-
}, z.core.$strip>, z.
|
|
2259
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2260
|
+
action: z.ZodObject<{
|
|
2261
|
+
type: z.ZodString;
|
|
2262
|
+
}, z.core.$loose>;
|
|
2263
|
+
submitTo: z.ZodString;
|
|
2264
|
+
typedData: z.ZodObject<{
|
|
2265
|
+
domain: z.ZodObject<{
|
|
2266
|
+
chainId: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
2267
|
+
name: z.ZodOptional<z.ZodString>;
|
|
2268
|
+
verifyingContract: z.ZodOptional<z.ZodString>;
|
|
2269
|
+
version: z.ZodOptional<z.ZodString>;
|
|
2270
|
+
}, z.core.$loose>;
|
|
2271
|
+
message: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
2272
|
+
primaryType: z.ZodString;
|
|
2273
|
+
types: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
2274
|
+
name: z.ZodString;
|
|
2275
|
+
type: z.ZodString;
|
|
2276
|
+
}, z.core.$loose>>>;
|
|
2277
|
+
}, z.core.$loose>;
|
|
2278
|
+
}, z.core.$loose>, z.ZodString]>>;
|
|
2141
2279
|
txType: z.ZodOptional<z.ZodEnum<typeof RouteQuoteTxType>>;
|
|
2142
2280
|
}, z.core.$strip>;
|
|
2143
2281
|
export declare const RouteQuoteProviderErrorSchema: z.ZodObject<{
|
|
@@ -2342,7 +2480,26 @@ export declare const QuoteV2ResponseSchema: z.ZodObject<{
|
|
|
2342
2480
|
stateInit: z.ZodOptional<z.ZodString>;
|
|
2343
2481
|
}, z.core.$strip>>;
|
|
2344
2482
|
sendMode: z.ZodNumber;
|
|
2345
|
-
}, z.core.$strip>, z.
|
|
2483
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2484
|
+
action: z.ZodObject<{
|
|
2485
|
+
type: z.ZodString;
|
|
2486
|
+
}, z.core.$loose>;
|
|
2487
|
+
submitTo: z.ZodString;
|
|
2488
|
+
typedData: z.ZodObject<{
|
|
2489
|
+
domain: z.ZodObject<{
|
|
2490
|
+
chainId: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
2491
|
+
name: z.ZodOptional<z.ZodString>;
|
|
2492
|
+
verifyingContract: z.ZodOptional<z.ZodString>;
|
|
2493
|
+
version: z.ZodOptional<z.ZodString>;
|
|
2494
|
+
}, z.core.$loose>;
|
|
2495
|
+
message: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
2496
|
+
primaryType: z.ZodString;
|
|
2497
|
+
types: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
2498
|
+
name: z.ZodString;
|
|
2499
|
+
type: z.ZodString;
|
|
2500
|
+
}, z.core.$loose>>>;
|
|
2501
|
+
}, z.core.$loose>;
|
|
2502
|
+
}, z.core.$loose>, z.ZodString]>>;
|
|
2346
2503
|
txType: z.ZodOptional<z.ZodEnum<typeof RouteQuoteTxType>>;
|
|
2347
2504
|
}, z.core.$strip>>;
|
|
2348
2505
|
}, z.core.$strip>;
|
|
@@ -2534,7 +2691,26 @@ export declare const SwapRouteV2ResponseSchema: z.ZodObject<{
|
|
|
2534
2691
|
stateInit: z.ZodOptional<z.ZodString>;
|
|
2535
2692
|
}, z.core.$strip>>;
|
|
2536
2693
|
sendMode: z.ZodNumber;
|
|
2537
|
-
}, z.core.$strip>, z.
|
|
2694
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2695
|
+
action: z.ZodObject<{
|
|
2696
|
+
type: z.ZodString;
|
|
2697
|
+
}, z.core.$loose>;
|
|
2698
|
+
submitTo: z.ZodString;
|
|
2699
|
+
typedData: z.ZodObject<{
|
|
2700
|
+
domain: z.ZodObject<{
|
|
2701
|
+
chainId: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
2702
|
+
name: z.ZodOptional<z.ZodString>;
|
|
2703
|
+
verifyingContract: z.ZodOptional<z.ZodString>;
|
|
2704
|
+
version: z.ZodOptional<z.ZodString>;
|
|
2705
|
+
}, z.core.$loose>;
|
|
2706
|
+
message: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
2707
|
+
primaryType: z.ZodString;
|
|
2708
|
+
types: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
2709
|
+
name: z.ZodString;
|
|
2710
|
+
type: z.ZodString;
|
|
2711
|
+
}, z.core.$loose>>>;
|
|
2712
|
+
}, z.core.$loose>;
|
|
2713
|
+
}, z.core.$loose>, z.ZodString]>>;
|
|
2538
2714
|
txType: z.ZodOptional<z.ZodEnum<typeof RouteQuoteTxType>>;
|
|
2539
2715
|
approvalTx: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
2540
2716
|
data: z.ZodString;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ export * from "./modules/requestClient";
|
|
|
14
14
|
export * from "./modules/swapKitConfig";
|
|
15
15
|
export * from "./modules/swapKitError";
|
|
16
16
|
export * from "./modules/swapKitNumber";
|
|
17
|
-
export * from "./modules/widgetAuth";
|
|
18
17
|
/**
|
|
19
18
|
* Types
|
|
20
19
|
*/
|
|
@@ -25,9 +24,7 @@ export * from "./types";
|
|
|
25
24
|
export * from "./utils/asset";
|
|
26
25
|
export * from "./utils/chains";
|
|
27
26
|
export * from "./utils/derivationPath";
|
|
28
|
-
export * from "./utils/explorerUrls";
|
|
29
27
|
export * from "./utils/liquidity";
|
|
30
28
|
export * from "./utils/memo";
|
|
31
29
|
export * from "./utils/others";
|
|
32
|
-
export * from "./utils/validators";
|
|
33
30
|
export * from "./utils/wallets";
|
|
@@ -4,6 +4,7 @@ import { type CommonAssetString, getAssetType } from "../utils/asset";
|
|
|
4
4
|
import type { NumberPrimitives } from "./bigIntArithmetics";
|
|
5
5
|
import { BigIntArithmetics } from "./bigIntArithmetics";
|
|
6
6
|
import type { SwapKitValueType } from "./swapKitNumber";
|
|
7
|
+
export declare function validateIdentifier(identifier?: string): boolean;
|
|
7
8
|
type ConditionalAssetValueReturn<T extends {
|
|
8
9
|
asyncTokenLookup?: boolean;
|
|
9
10
|
}> = T["asyncTokenLookup"] extends true ? Promise<AssetValue> : AssetValue;
|
|
@@ -27,4 +27,9 @@ export declare const RequestClient: {
|
|
|
27
27
|
get: <T>(url: string, options?: Options) => Promise<T>;
|
|
28
28
|
post: <T>(url: string, options?: Options) => Promise<T>;
|
|
29
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Widget authentication: HMAC signature so the widget can authenticate requests without
|
|
32
|
+
* exposing API keys. Used by the SwapKit API endpoints.
|
|
33
|
+
*/
|
|
34
|
+
export declare function signWidgetRequest(signingSecret: string, widgetId: string, origin: string, timestamp: number): Promise<string>;
|
|
30
35
|
export {};
|
|
@@ -385,6 +385,11 @@ declare const errorCodes: {
|
|
|
385
385
|
* Toolboxes - HyperCore
|
|
386
386
|
*/
|
|
387
387
|
readonly toolbox_hypercore_no_signer: 51001;
|
|
388
|
+
readonly toolbox_hypercore_payload_mismatch: 51002;
|
|
389
|
+
readonly toolbox_hypercore_insufficient_balance: 51003;
|
|
390
|
+
readonly toolbox_hypercore_destination_sanctioned: 51004;
|
|
391
|
+
readonly toolbox_hypercore_transfer_hash_not_found: 51005;
|
|
392
|
+
readonly toolbox_hypercore_pre_transfer_check_failed: 51006;
|
|
388
393
|
/**
|
|
389
394
|
* Toolboxes - Cardano
|
|
390
395
|
*/
|
|
@@ -499,6 +504,7 @@ declare const errorCodes: {
|
|
|
499
504
|
readonly plugin_swapkit_swap_invalid_data: 43001;
|
|
500
505
|
readonly plugin_swapkit_invalid_transaction: 43002;
|
|
501
506
|
readonly plugin_swapkit_stellar_destination_wallet_not_found: 43003;
|
|
507
|
+
readonly plugin_swapkit_unsupported_tx_type: 43004;
|
|
502
508
|
/**
|
|
503
509
|
* SwapKit API
|
|
504
510
|
*/
|
|
@@ -918,6 +924,11 @@ export declare class SwapKitError extends Error {
|
|
|
918
924
|
* Toolboxes - HyperCore
|
|
919
925
|
*/
|
|
920
926
|
readonly toolbox_hypercore_no_signer: 51001;
|
|
927
|
+
readonly toolbox_hypercore_payload_mismatch: 51002;
|
|
928
|
+
readonly toolbox_hypercore_insufficient_balance: 51003;
|
|
929
|
+
readonly toolbox_hypercore_destination_sanctioned: 51004;
|
|
930
|
+
readonly toolbox_hypercore_transfer_hash_not_found: 51005;
|
|
931
|
+
readonly toolbox_hypercore_pre_transfer_check_failed: 51006;
|
|
921
932
|
/**
|
|
922
933
|
* Toolboxes - Cardano
|
|
923
934
|
*/
|
|
@@ -1032,6 +1043,7 @@ export declare class SwapKitError extends Error {
|
|
|
1032
1043
|
readonly plugin_swapkit_swap_invalid_data: 43001;
|
|
1033
1044
|
readonly plugin_swapkit_invalid_transaction: 43002;
|
|
1034
1045
|
readonly plugin_swapkit_stellar_destination_wallet_not_found: 43003;
|
|
1046
|
+
readonly plugin_swapkit_unsupported_tx_type: 43004;
|
|
1035
1047
|
/**
|
|
1036
1048
|
* SwapKit API
|
|
1037
1049
|
*/
|
|
@@ -134,7 +134,8 @@ export declare enum ErrorCode {
|
|
|
134
134
|
}
|
|
135
135
|
export declare enum WarningCodeEnum {
|
|
136
136
|
highSlippage = "highSlippage",
|
|
137
|
-
highPriceImpact = "highPriceImpact"
|
|
137
|
+
highPriceImpact = "highPriceImpact",
|
|
138
|
+
insufficientBalance = "insufficientBalance"
|
|
138
139
|
}
|
|
139
140
|
export declare enum ProviderName {
|
|
140
141
|
CHAINFLIP = "CHAINFLIP",
|
|
@@ -3,12 +3,14 @@ import type { AssetValue } from "../modules/assetValue";
|
|
|
3
3
|
export type CommonAssetString = (typeof CommonAssetStrings)[number] | Chain;
|
|
4
4
|
export type ConditionalAssetValueReturn<T extends boolean> = T extends true ? Promise<AssetValue[]> : AssetValue[];
|
|
5
5
|
export declare const CommonAssetStrings: readonly ["MAYA.MAYA", "MAYA.CACAO", "ETH.THOR", "ETH.vTHOR", "KUJI.USK", "ETH.FLIP", "XRD.XRD"];
|
|
6
|
+
export declare function decodeABIString(hexResult: string): string;
|
|
7
|
+
export declare function decodeABIDynamicString(hex: string | undefined): string | undefined;
|
|
6
8
|
export declare function fetchTokenInfo({ chain, address }: {
|
|
7
9
|
chain: Chain;
|
|
8
10
|
address: string;
|
|
9
11
|
}): Promise<{
|
|
10
12
|
decimals: number;
|
|
11
|
-
ticker:
|
|
13
|
+
ticker: string | undefined;
|
|
12
14
|
}>;
|
|
13
15
|
export declare function isGasAsset({ chain, symbol }: {
|
|
14
16
|
chain: Chain;
|
|
@@ -12,3 +12,12 @@ export declare function getRPCUrl(chain: Chain | StagenetChain): Promise<string>
|
|
|
12
12
|
* This function is obsolete and will be removed in a future release.
|
|
13
13
|
*/
|
|
14
14
|
export declare function initializeRPCUrlsWithFallback(_chains: never): void;
|
|
15
|
+
export declare function getExplorerTxUrl({ chain, txHash }: {
|
|
16
|
+
txHash: string;
|
|
17
|
+
chain: Chain;
|
|
18
|
+
}): string;
|
|
19
|
+
export declare function getExplorerAddressUrl({ chain, address }: {
|
|
20
|
+
address: string;
|
|
21
|
+
chain: Chain;
|
|
22
|
+
}): string;
|
|
23
|
+
export declare function getChainIdentifier<T extends Chain>(chain: T): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EIP-55 checksum + validation for EVM addresses, replacing ethers' `getAddress`.
|
|
3
|
+
*
|
|
4
|
+
* Kept in helpers (not the EVM toolbox) because `AssetValue` checksums contract
|
|
5
|
+
* addresses synchronously while building identifiers, and toolboxes depend on
|
|
6
|
+
* helpers — not the other way around. Backed by `@noble/hashes` keccak256 so the
|
|
7
|
+
* core asset path no longer pulls in the whole of `ethers`.
|
|
8
|
+
*
|
|
9
|
+
* Throws on malformed input or a bad mixed-case checksum, mirroring ethers
|
|
10
|
+
* semantics so existing `try/catch` fallbacks keep behaving identically.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getAddress(address: string): string;
|
|
13
|
+
/** Returns true for a valid EVM address (incl. a correct EIP-55 checksum), false otherwise. */
|
|
14
|
+
export declare function isAddress(value: string): boolean;
|
|
@@ -61,4 +61,7 @@ type WithdrawParams = {
|
|
|
61
61
|
basisPoints: number;
|
|
62
62
|
targetAsset?: string;
|
|
63
63
|
};
|
|
64
|
+
export declare function getTHORNameCost(numberOfYears: number): number;
|
|
65
|
+
export declare function getMAYANameCost(numberOfYears: number): number;
|
|
66
|
+
export declare function validateTNS(name: string): boolean;
|
|
64
67
|
export {};
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { Chain } from "@swapkit/types";
|
|
2
1
|
import { type ErrorKeys } from "../modules/swapKitError";
|
|
3
|
-
export declare function getTHORNameCost(numberOfYears: number): number;
|
|
4
|
-
export declare function getMAYANameCost(numberOfYears: number): number;
|
|
5
2
|
export declare function wrapWithThrow<T>(fn: () => T, errorKey?: ErrorKeys): T | undefined;
|
|
6
|
-
export declare function getChainIdentifier<T extends Chain>(chain: T): string;
|
|
7
3
|
export declare function warnOnce({ condition, id, warning }: {
|
|
8
4
|
condition: boolean;
|
|
9
5
|
id: string;
|
package/package.json
CHANGED
|
@@ -1,33 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "swapkit-dev",
|
|
3
|
-
"dependencies": {
|
|
3
|
+
"dependencies": {
|
|
4
|
+
"@noble/hashes": "2.2.0",
|
|
5
|
+
"@swapkit/contracts": "5.0.0",
|
|
6
|
+
"@swapkit/tokens": "5.0.0",
|
|
7
|
+
"@swapkit/types": "1.0.0"
|
|
8
|
+
},
|
|
4
9
|
"description": "SwapKit - Helpers",
|
|
5
|
-
"devDependencies": { "@
|
|
10
|
+
"devDependencies": { "@swapkit/toolboxes": "5.0.0" },
|
|
6
11
|
"exports": {
|
|
7
|
-
".": { "default": "./dist/index.js", "
|
|
8
|
-
"./api": {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"types": "./dist/types/api/index.d.ts"
|
|
12
|
-
},
|
|
13
|
-
"./contracts": {
|
|
14
|
-
"default": "./dist/contracts.js",
|
|
15
|
-
"require": "./dist/contracts.cjs",
|
|
16
|
-
"types": "./dist/types/contracts.d.ts"
|
|
17
|
-
},
|
|
18
|
-
"./tokens": { "default": "./dist/tokens.js", "require": "./dist/tokens.cjs", "types": "./dist/types/tokens.d.ts" }
|
|
12
|
+
".": { "default": "./dist/index.js", "types": "./dist/types/index.d.ts" },
|
|
13
|
+
"./api": { "default": "./dist/api/index.js", "types": "./dist/types/api/index.d.ts" },
|
|
14
|
+
"./contracts": { "default": "./dist/contracts.js", "types": "./dist/types/contracts.d.ts" },
|
|
15
|
+
"./tokens": { "default": "./dist/tokens.js", "types": "./dist/types/tokens.d.ts" }
|
|
19
16
|
},
|
|
20
17
|
"files": ["dist/", "CHANGELOG.md"],
|
|
21
18
|
"homepage": "https://github.com/swapkit/SwapKit",
|
|
22
19
|
"license": "SEE LICENSE IN LICENSE",
|
|
23
20
|
"name": "@swapkit/helpers",
|
|
24
|
-
"peerDependencies": {
|
|
25
|
-
"@near-js/providers": "2.5.1",
|
|
26
|
-
"ethers": "6.16.0",
|
|
27
|
-
"ts-pattern": "5.9.0",
|
|
28
|
-
"zod": "4.4.3",
|
|
29
|
-
"zustand": "5.0.13"
|
|
30
|
-
},
|
|
21
|
+
"peerDependencies": { "ts-pattern": "5.9.0", "zod": "4.4.3", "zustand": "5.0.13" },
|
|
31
22
|
"publishConfig": { "access": "public" },
|
|
32
23
|
"repository": { "directory": "packages/helpers", "type": "git", "url": "git+https://github.com/swapkit/SwapKit.git" },
|
|
33
24
|
"scripts": {
|
|
@@ -39,5 +30,5 @@
|
|
|
39
30
|
"type-check:go": "tsgo"
|
|
40
31
|
},
|
|
41
32
|
"type": "module",
|
|
42
|
-
"version": "
|
|
33
|
+
"version": "5.0.0"
|
|
43
34
|
}
|