@xswap-link/sdk 0.2.3 → 0.2.5
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 +17 -0
- package/dist/index.css +20 -21
- package/dist/index.d.mts +24 -13
- package/dist/index.d.ts +24 -13
- package/dist/index.js +747 -527
- package/dist/index.mjs +645 -425
- package/package.json +1 -1
- package/src/components/TxConfigForm/FeesDetails.tsx +55 -37
- package/src/components/TxConfigForm/Form.tsx +30 -7
- package/src/components/TxConfigForm/History.tsx +31 -4
- package/src/components/TxConfigForm/Summary.tsx +28 -11
- package/src/components/TxConfigForm/SwapPanel.tsx +5 -1
- package/src/components/TxConfigForm/TopBar.tsx +8 -3
- package/src/components/TxConfigForm/UsdPrice.tsx +14 -1
- package/src/components/TxConfigForm/index.tsx +10 -10
- package/src/components/TxStatusButton/index.tsx +21 -13
- package/src/components/UnknownTokenLogo/UnknownTokenLogo.tsx +14 -0
- package/src/components/WaitingForInit/index.tsx +20 -0
- package/src/components/global.css +1 -1
- package/src/config/init.tsx +75 -0
- package/src/constants/index.ts +1 -0
- package/src/index.ts +9 -1
- package/src/models/Route.ts +6 -2
- package/src/models/TokenData.ts +1 -1
- package/src/models/TransactionHistory.ts +12 -8
- package/src/models/payloads/GetRoutePayload.ts +1 -0
- package/src/models/payloads/GetSwapTxPayload.ts +1 -0
- package/src/services/api.ts +9 -0
- package/src/services/blockchain.ts +49 -0
- package/src/services/index.ts +1 -0
- package/src/services/integrations/monitoring.ts +34 -14
- package/src/services/integrations/transactions.ts +8 -3
- package/src/utils/contracts.ts +2 -4
- package/src/utils/strings.ts +4 -0
- package/tailwind.config.js +2 -2
- package/src/config/init.ts +0 -35
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @xswap-link/xswap-sdk
|
|
2
2
|
|
|
3
|
+
## 0.2.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 88f6ea9: Add integrator id to route payload
|
|
8
|
+
- 564895e: Set percision of max button to token decimals
|
|
9
|
+
- 81cf582: feat: unknown tokens and small ui improvements
|
|
10
|
+
|
|
11
|
+
## 0.2.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- c07f86d: add custom TransactionRequest type
|
|
16
|
+
- 108928b: express delivery limit validation
|
|
17
|
+
- 909851c: add initialization indicator
|
|
18
|
+
- 9ecf3bc: fix mobile version styling
|
|
19
|
+
|
|
3
20
|
## 0.2.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.css
CHANGED
|
@@ -358,9 +358,6 @@ video {
|
|
|
358
358
|
.top-4 {
|
|
359
359
|
top: 1rem;
|
|
360
360
|
}
|
|
361
|
-
.top-7 {
|
|
362
|
-
top: 1.75rem;
|
|
363
|
-
}
|
|
364
361
|
.top-\[46px\] {
|
|
365
362
|
top: 46px;
|
|
366
363
|
}
|
|
@@ -565,9 +562,6 @@ video {
|
|
|
565
562
|
.w-full {
|
|
566
563
|
width: 100%;
|
|
567
564
|
}
|
|
568
|
-
.w-x_mobile {
|
|
569
|
-
width: 320px;
|
|
570
|
-
}
|
|
571
565
|
.min-w-60 {
|
|
572
566
|
min-width: 15rem;
|
|
573
567
|
}
|
|
@@ -904,12 +898,6 @@ video {
|
|
|
904
898
|
padding-top: 1rem;
|
|
905
899
|
padding-bottom: 1rem;
|
|
906
900
|
}
|
|
907
|
-
.pr-8 {
|
|
908
|
-
padding-right: 2rem;
|
|
909
|
-
}
|
|
910
|
-
.pt-2 {
|
|
911
|
-
padding-top: 0.5rem;
|
|
912
|
-
}
|
|
913
901
|
.text-left {
|
|
914
902
|
text-align: left;
|
|
915
903
|
}
|
|
@@ -1006,6 +994,10 @@ video {
|
|
|
1006
994
|
.text-\[rgba\(255\,255\,255\,0\.6\)\] {
|
|
1007
995
|
color: rgba(255, 255, 255, 0.6);
|
|
1008
996
|
}
|
|
997
|
+
.text-black {
|
|
998
|
+
--tw-text-opacity: 1;
|
|
999
|
+
color: rgb(0 0 0 / var(--tw-text-opacity));
|
|
1000
|
+
}
|
|
1009
1001
|
.text-transparent {
|
|
1010
1002
|
color: transparent;
|
|
1011
1003
|
}
|
|
@@ -1030,6 +1022,14 @@ video {
|
|
|
1030
1022
|
.opacity-60 {
|
|
1031
1023
|
opacity: 0.6;
|
|
1032
1024
|
}
|
|
1025
|
+
.shadow-sm {
|
|
1026
|
+
--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
|
1027
|
+
--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
|
|
1028
|
+
box-shadow:
|
|
1029
|
+
var(--tw-ring-offset-shadow, 0 0 #0000),
|
|
1030
|
+
var(--tw-ring-shadow, 0 0 #0000),
|
|
1031
|
+
var(--tw-shadow);
|
|
1032
|
+
}
|
|
1033
1033
|
.outline-none {
|
|
1034
1034
|
outline: 2px solid transparent;
|
|
1035
1035
|
outline-offset: 2px;
|
|
@@ -1063,7 +1063,7 @@ video {
|
|
|
1063
1063
|
}
|
|
1064
1064
|
}
|
|
1065
1065
|
.xswap-tx-status {
|
|
1066
|
-
position:
|
|
1066
|
+
position: fixed;
|
|
1067
1067
|
bottom: 1.25rem;
|
|
1068
1068
|
right: 0.5rem;
|
|
1069
1069
|
z-index: 50;
|
|
@@ -1099,12 +1099,6 @@ video {
|
|
|
1099
1099
|
opacity: 0.25;
|
|
1100
1100
|
}
|
|
1101
1101
|
@media (min-width: 640px) {
|
|
1102
|
-
.sm\:h-6 {
|
|
1103
|
-
height: 1.5rem;
|
|
1104
|
-
}
|
|
1105
|
-
.sm\:w-6 {
|
|
1106
|
-
width: 1.5rem;
|
|
1107
|
-
}
|
|
1108
1102
|
.sm\:w-\[190px\] {
|
|
1109
1103
|
width: 190px;
|
|
1110
1104
|
}
|
|
@@ -1120,8 +1114,8 @@ video {
|
|
|
1120
1114
|
.sm\:gap-5 {
|
|
1121
1115
|
gap: 1.25rem;
|
|
1122
1116
|
}
|
|
1123
|
-
.sm\:
|
|
1124
|
-
padding
|
|
1117
|
+
.sm\:p-4 {
|
|
1118
|
+
padding: 1rem;
|
|
1125
1119
|
}
|
|
1126
1120
|
.sm\:text-3xl {
|
|
1127
1121
|
font-size: 1.875rem;
|
|
@@ -1140,3 +1134,8 @@ video {
|
|
|
1140
1134
|
line-height: 1.75rem;
|
|
1141
1135
|
}
|
|
1142
1136
|
}
|
|
1137
|
+
@media (min-width: 768px) {
|
|
1138
|
+
.md\:p-4 {
|
|
1139
|
+
padding: 1rem;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BigNumber } from 'ethers';
|
|
2
|
-
import { TransactionRequest } from '@ethersproject/providers';
|
|
3
2
|
|
|
4
3
|
type Addresses = {
|
|
5
4
|
[chainId: string]: Contracts;
|
|
@@ -49,7 +48,7 @@ type Token = {
|
|
|
49
48
|
name: string;
|
|
50
49
|
symbol: string;
|
|
51
50
|
decimals: number;
|
|
52
|
-
image
|
|
51
|
+
image?: string;
|
|
53
52
|
priority: number;
|
|
54
53
|
quickPick?: boolean;
|
|
55
54
|
supported?: boolean;
|
|
@@ -120,6 +119,7 @@ type GenerateStakingCallsParams = {
|
|
|
120
119
|
};
|
|
121
120
|
|
|
122
121
|
type GetRoutePayload = {
|
|
122
|
+
integratorId: string;
|
|
123
123
|
fromChain: string;
|
|
124
124
|
toChain: string;
|
|
125
125
|
fromToken: string;
|
|
@@ -146,6 +146,7 @@ type AddReferralPayload = {
|
|
|
146
146
|
};
|
|
147
147
|
|
|
148
148
|
type GetSwapTxPayload = {
|
|
149
|
+
integratorId: string;
|
|
149
150
|
dstChain: string;
|
|
150
151
|
dstToken: string;
|
|
151
152
|
customContractCalls?: ContractCall[];
|
|
@@ -175,6 +176,11 @@ type Transactions = {
|
|
|
175
176
|
approve?: TransactionRequest;
|
|
176
177
|
swap: TransactionRequest;
|
|
177
178
|
};
|
|
179
|
+
type TransactionRequest = {
|
|
180
|
+
to: string;
|
|
181
|
+
data: string;
|
|
182
|
+
value: string;
|
|
183
|
+
};
|
|
178
184
|
type XSwapFees = {
|
|
179
185
|
ccipFee?: string;
|
|
180
186
|
xSwapFee: XSwapFee;
|
|
@@ -225,7 +231,7 @@ type HistoryTransaction = {
|
|
|
225
231
|
tokenAddress: string;
|
|
226
232
|
} | null;
|
|
227
233
|
};
|
|
228
|
-
type TransactionStatus = "IN_PROGRESS" | "DONE" | "REVERTED";
|
|
234
|
+
type TransactionStatus = "IN_PROGRESS" | "DONE" | "REVERTED" | "NOT_FOUND";
|
|
229
235
|
type Transaction = {
|
|
230
236
|
hash: string;
|
|
231
237
|
timestamp: number;
|
|
@@ -239,20 +245,25 @@ type Transaction = {
|
|
|
239
245
|
status: TransactionStatus;
|
|
240
246
|
};
|
|
241
247
|
type MonitoredTransaction = {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
248
|
+
srcChain: string | undefined;
|
|
249
|
+
srcChainImage: string | undefined;
|
|
250
|
+
srcToken: string | undefined;
|
|
251
|
+
srcTokenImage: string | undefined;
|
|
252
|
+
srcAmount: string | undefined;
|
|
253
|
+
dstChain: string | undefined;
|
|
254
|
+
dstChainImage: string | undefined;
|
|
249
255
|
isDone: boolean;
|
|
250
256
|
txHash: string;
|
|
251
257
|
explorer: string | undefined;
|
|
252
258
|
};
|
|
253
259
|
|
|
254
|
-
declare const
|
|
260
|
+
declare const renderTxStatus: (txChainId: string, txHash: string) => Promise<void>;
|
|
255
261
|
|
|
256
|
-
declare const
|
|
262
|
+
declare const openTransactionModal: ({ integratorId, dstChain, dstToken, customContractCalls, desc, }: GetSwapTxPayload) => Promise<Transactions>;
|
|
263
|
+
|
|
264
|
+
declare const XPay: {
|
|
265
|
+
openTransactionModal: ({ integratorId, dstChain, dstToken, customContractCalls, desc, }: GetSwapTxPayload) => Promise<Transactions>;
|
|
266
|
+
renderTxStatus: (txChainId: string, txHash: string) => Promise<void>;
|
|
267
|
+
};
|
|
257
268
|
|
|
258
|
-
export { type AddReferralPayload, type Addresses, type BridgeToken, type Chain, type CoinTypeAddress, type CollectFees, type ContractCall, ContractName, type Contracts, Ecosystem, Environment, type GenerateStakingCallsParams, type GetPricesPayload, type GetRoutePayload, type GetSwapTxPayload, type HistoryTransaction, type MonitoredTransaction, type Prices, type Protocol, type Referral, type ReferralInfo, type Route, type Token, type TokenBalances, type TokenPrices, type Transaction, type TransactionHistory, type TransactionStatus, type Transactions, type TxConfigFormData, Web3Environment, XSwapCallType, type XSwapConfig, type XSwapFee, type XSwapFees,
|
|
269
|
+
export { type AddReferralPayload, type Addresses, type BridgeToken, type Chain, type CoinTypeAddress, type CollectFees, type ContractCall, ContractName, type Contracts, Ecosystem, Environment, type GenerateStakingCallsParams, type GetPricesPayload, type GetRoutePayload, type GetSwapTxPayload, type HistoryTransaction, type MonitoredTransaction, type Prices, type Protocol, type Referral, type ReferralInfo, type Route, type Token, type TokenBalances, type TokenPrices, type Transaction, type TransactionHistory, type TransactionRequest, type TransactionStatus, type Transactions, type TxConfigFormData, Web3Environment, XSwapCallType, type XSwapConfig, type XSwapFee, type XSwapFees, XPay as default, openTransactionModal, renderTxStatus };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BigNumber } from 'ethers';
|
|
2
|
-
import { TransactionRequest } from '@ethersproject/providers';
|
|
3
2
|
|
|
4
3
|
type Addresses = {
|
|
5
4
|
[chainId: string]: Contracts;
|
|
@@ -49,7 +48,7 @@ type Token = {
|
|
|
49
48
|
name: string;
|
|
50
49
|
symbol: string;
|
|
51
50
|
decimals: number;
|
|
52
|
-
image
|
|
51
|
+
image?: string;
|
|
53
52
|
priority: number;
|
|
54
53
|
quickPick?: boolean;
|
|
55
54
|
supported?: boolean;
|
|
@@ -120,6 +119,7 @@ type GenerateStakingCallsParams = {
|
|
|
120
119
|
};
|
|
121
120
|
|
|
122
121
|
type GetRoutePayload = {
|
|
122
|
+
integratorId: string;
|
|
123
123
|
fromChain: string;
|
|
124
124
|
toChain: string;
|
|
125
125
|
fromToken: string;
|
|
@@ -146,6 +146,7 @@ type AddReferralPayload = {
|
|
|
146
146
|
};
|
|
147
147
|
|
|
148
148
|
type GetSwapTxPayload = {
|
|
149
|
+
integratorId: string;
|
|
149
150
|
dstChain: string;
|
|
150
151
|
dstToken: string;
|
|
151
152
|
customContractCalls?: ContractCall[];
|
|
@@ -175,6 +176,11 @@ type Transactions = {
|
|
|
175
176
|
approve?: TransactionRequest;
|
|
176
177
|
swap: TransactionRequest;
|
|
177
178
|
};
|
|
179
|
+
type TransactionRequest = {
|
|
180
|
+
to: string;
|
|
181
|
+
data: string;
|
|
182
|
+
value: string;
|
|
183
|
+
};
|
|
178
184
|
type XSwapFees = {
|
|
179
185
|
ccipFee?: string;
|
|
180
186
|
xSwapFee: XSwapFee;
|
|
@@ -225,7 +231,7 @@ type HistoryTransaction = {
|
|
|
225
231
|
tokenAddress: string;
|
|
226
232
|
} | null;
|
|
227
233
|
};
|
|
228
|
-
type TransactionStatus = "IN_PROGRESS" | "DONE" | "REVERTED";
|
|
234
|
+
type TransactionStatus = "IN_PROGRESS" | "DONE" | "REVERTED" | "NOT_FOUND";
|
|
229
235
|
type Transaction = {
|
|
230
236
|
hash: string;
|
|
231
237
|
timestamp: number;
|
|
@@ -239,20 +245,25 @@ type Transaction = {
|
|
|
239
245
|
status: TransactionStatus;
|
|
240
246
|
};
|
|
241
247
|
type MonitoredTransaction = {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
248
|
+
srcChain: string | undefined;
|
|
249
|
+
srcChainImage: string | undefined;
|
|
250
|
+
srcToken: string | undefined;
|
|
251
|
+
srcTokenImage: string | undefined;
|
|
252
|
+
srcAmount: string | undefined;
|
|
253
|
+
dstChain: string | undefined;
|
|
254
|
+
dstChainImage: string | undefined;
|
|
249
255
|
isDone: boolean;
|
|
250
256
|
txHash: string;
|
|
251
257
|
explorer: string | undefined;
|
|
252
258
|
};
|
|
253
259
|
|
|
254
|
-
declare const
|
|
260
|
+
declare const renderTxStatus: (txChainId: string, txHash: string) => Promise<void>;
|
|
255
261
|
|
|
256
|
-
declare const
|
|
262
|
+
declare const openTransactionModal: ({ integratorId, dstChain, dstToken, customContractCalls, desc, }: GetSwapTxPayload) => Promise<Transactions>;
|
|
263
|
+
|
|
264
|
+
declare const XPay: {
|
|
265
|
+
openTransactionModal: ({ integratorId, dstChain, dstToken, customContractCalls, desc, }: GetSwapTxPayload) => Promise<Transactions>;
|
|
266
|
+
renderTxStatus: (txChainId: string, txHash: string) => Promise<void>;
|
|
267
|
+
};
|
|
257
268
|
|
|
258
|
-
export { type AddReferralPayload, type Addresses, type BridgeToken, type Chain, type CoinTypeAddress, type CollectFees, type ContractCall, ContractName, type Contracts, Ecosystem, Environment, type GenerateStakingCallsParams, type GetPricesPayload, type GetRoutePayload, type GetSwapTxPayload, type HistoryTransaction, type MonitoredTransaction, type Prices, type Protocol, type Referral, type ReferralInfo, type Route, type Token, type TokenBalances, type TokenPrices, type Transaction, type TransactionHistory, type TransactionStatus, type Transactions, type TxConfigFormData, Web3Environment, XSwapCallType, type XSwapConfig, type XSwapFee, type XSwapFees,
|
|
269
|
+
export { type AddReferralPayload, type Addresses, type BridgeToken, type Chain, type CoinTypeAddress, type CollectFees, type ContractCall, ContractName, type Contracts, Ecosystem, Environment, type GenerateStakingCallsParams, type GetPricesPayload, type GetRoutePayload, type GetSwapTxPayload, type HistoryTransaction, type MonitoredTransaction, type Prices, type Protocol, type Referral, type ReferralInfo, type Route, type Token, type TokenBalances, type TokenPrices, type Transaction, type TransactionHistory, type TransactionRequest, type TransactionStatus, type Transactions, type TxConfigFormData, Web3Environment, XSwapCallType, type XSwapConfig, type XSwapFee, type XSwapFees, XPay as default, openTransactionModal, renderTxStatus };
|