@xswap-link/sdk 0.2.4 → 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 +8 -0
- package/dist/index.css +13 -7
- package/dist/index.d.mts +19 -12
- package/dist/index.d.ts +19 -12
- package/dist/index.js +408 -263
- package/dist/index.mjs +337 -192
- package/package.json +1 -1
- package/src/components/TxConfigForm/FeesDetails.tsx +17 -13
- package/src/components/TxConfigForm/Form.tsx +21 -5
- package/src/components/TxConfigForm/History.tsx +31 -4
- package/src/components/TxConfigForm/Summary.tsx +16 -4
- package/src/components/TxConfigForm/SwapPanel.tsx +1 -1
- package/src/components/TxConfigForm/index.tsx +5 -0
- package/src/components/TxStatusButton/index.tsx +21 -13
- package/src/components/UnknownTokenLogo/UnknownTokenLogo.tsx +14 -0
- package/src/components/global.css +1 -1
- package/src/config/init.tsx +2 -2
- package/src/index.ts +9 -1
- 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/strings.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
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
|
+
|
|
3
11
|
## 0.2.4
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/index.css
CHANGED
|
@@ -994,6 +994,10 @@ video {
|
|
|
994
994
|
.text-\[rgba\(255\,255\,255\,0\.6\)\] {
|
|
995
995
|
color: rgba(255, 255, 255, 0.6);
|
|
996
996
|
}
|
|
997
|
+
.text-black {
|
|
998
|
+
--tw-text-opacity: 1;
|
|
999
|
+
color: rgb(0 0 0 / var(--tw-text-opacity));
|
|
1000
|
+
}
|
|
997
1001
|
.text-transparent {
|
|
998
1002
|
color: transparent;
|
|
999
1003
|
}
|
|
@@ -1018,6 +1022,14 @@ video {
|
|
|
1018
1022
|
.opacity-60 {
|
|
1019
1023
|
opacity: 0.6;
|
|
1020
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
|
+
}
|
|
1021
1033
|
.outline-none {
|
|
1022
1034
|
outline: 2px solid transparent;
|
|
1023
1035
|
outline-offset: 2px;
|
|
@@ -1051,7 +1063,7 @@ video {
|
|
|
1051
1063
|
}
|
|
1052
1064
|
}
|
|
1053
1065
|
.xswap-tx-status {
|
|
1054
|
-
position:
|
|
1066
|
+
position: fixed;
|
|
1055
1067
|
bottom: 1.25rem;
|
|
1056
1068
|
right: 0.5rem;
|
|
1057
1069
|
z-index: 50;
|
|
@@ -1087,12 +1099,6 @@ video {
|
|
|
1087
1099
|
opacity: 0.25;
|
|
1088
1100
|
}
|
|
1089
1101
|
@media (min-width: 640px) {
|
|
1090
|
-
.sm\:h-6 {
|
|
1091
|
-
height: 1.5rem;
|
|
1092
|
-
}
|
|
1093
|
-
.sm\:w-6 {
|
|
1094
|
-
width: 1.5rem;
|
|
1095
|
-
}
|
|
1096
1102
|
.sm\:w-\[190px\] {
|
|
1097
1103
|
width: 190px;
|
|
1098
1104
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -48,7 +48,7 @@ type Token = {
|
|
|
48
48
|
name: string;
|
|
49
49
|
symbol: string;
|
|
50
50
|
decimals: number;
|
|
51
|
-
image
|
|
51
|
+
image?: string;
|
|
52
52
|
priority: number;
|
|
53
53
|
quickPick?: boolean;
|
|
54
54
|
supported?: boolean;
|
|
@@ -119,6 +119,7 @@ type GenerateStakingCallsParams = {
|
|
|
119
119
|
};
|
|
120
120
|
|
|
121
121
|
type GetRoutePayload = {
|
|
122
|
+
integratorId: string;
|
|
122
123
|
fromChain: string;
|
|
123
124
|
toChain: string;
|
|
124
125
|
fromToken: string;
|
|
@@ -145,6 +146,7 @@ type AddReferralPayload = {
|
|
|
145
146
|
};
|
|
146
147
|
|
|
147
148
|
type GetSwapTxPayload = {
|
|
149
|
+
integratorId: string;
|
|
148
150
|
dstChain: string;
|
|
149
151
|
dstToken: string;
|
|
150
152
|
customContractCalls?: ContractCall[];
|
|
@@ -229,7 +231,7 @@ type HistoryTransaction = {
|
|
|
229
231
|
tokenAddress: string;
|
|
230
232
|
} | null;
|
|
231
233
|
};
|
|
232
|
-
type TransactionStatus = "IN_PROGRESS" | "DONE" | "REVERTED";
|
|
234
|
+
type TransactionStatus = "IN_PROGRESS" | "DONE" | "REVERTED" | "NOT_FOUND";
|
|
233
235
|
type Transaction = {
|
|
234
236
|
hash: string;
|
|
235
237
|
timestamp: number;
|
|
@@ -243,20 +245,25 @@ type Transaction = {
|
|
|
243
245
|
status: TransactionStatus;
|
|
244
246
|
};
|
|
245
247
|
type MonitoredTransaction = {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
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;
|
|
253
255
|
isDone: boolean;
|
|
254
256
|
txHash: string;
|
|
255
257
|
explorer: string | undefined;
|
|
256
258
|
};
|
|
257
259
|
|
|
258
|
-
declare const
|
|
260
|
+
declare const renderTxStatus: (txChainId: string, txHash: string) => Promise<void>;
|
|
261
|
+
|
|
262
|
+
declare const openTransactionModal: ({ integratorId, dstChain, dstToken, customContractCalls, desc, }: GetSwapTxPayload) => Promise<Transactions>;
|
|
259
263
|
|
|
260
|
-
declare const
|
|
264
|
+
declare const XPay: {
|
|
265
|
+
openTransactionModal: ({ integratorId, dstChain, dstToken, customContractCalls, desc, }: GetSwapTxPayload) => Promise<Transactions>;
|
|
266
|
+
renderTxStatus: (txChainId: string, txHash: string) => Promise<void>;
|
|
267
|
+
};
|
|
261
268
|
|
|
262
|
-
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,
|
|
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
|
@@ -48,7 +48,7 @@ type Token = {
|
|
|
48
48
|
name: string;
|
|
49
49
|
symbol: string;
|
|
50
50
|
decimals: number;
|
|
51
|
-
image
|
|
51
|
+
image?: string;
|
|
52
52
|
priority: number;
|
|
53
53
|
quickPick?: boolean;
|
|
54
54
|
supported?: boolean;
|
|
@@ -119,6 +119,7 @@ type GenerateStakingCallsParams = {
|
|
|
119
119
|
};
|
|
120
120
|
|
|
121
121
|
type GetRoutePayload = {
|
|
122
|
+
integratorId: string;
|
|
122
123
|
fromChain: string;
|
|
123
124
|
toChain: string;
|
|
124
125
|
fromToken: string;
|
|
@@ -145,6 +146,7 @@ type AddReferralPayload = {
|
|
|
145
146
|
};
|
|
146
147
|
|
|
147
148
|
type GetSwapTxPayload = {
|
|
149
|
+
integratorId: string;
|
|
148
150
|
dstChain: string;
|
|
149
151
|
dstToken: string;
|
|
150
152
|
customContractCalls?: ContractCall[];
|
|
@@ -229,7 +231,7 @@ type HistoryTransaction = {
|
|
|
229
231
|
tokenAddress: string;
|
|
230
232
|
} | null;
|
|
231
233
|
};
|
|
232
|
-
type TransactionStatus = "IN_PROGRESS" | "DONE" | "REVERTED";
|
|
234
|
+
type TransactionStatus = "IN_PROGRESS" | "DONE" | "REVERTED" | "NOT_FOUND";
|
|
233
235
|
type Transaction = {
|
|
234
236
|
hash: string;
|
|
235
237
|
timestamp: number;
|
|
@@ -243,20 +245,25 @@ type Transaction = {
|
|
|
243
245
|
status: TransactionStatus;
|
|
244
246
|
};
|
|
245
247
|
type MonitoredTransaction = {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
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;
|
|
253
255
|
isDone: boolean;
|
|
254
256
|
txHash: string;
|
|
255
257
|
explorer: string | undefined;
|
|
256
258
|
};
|
|
257
259
|
|
|
258
|
-
declare const
|
|
260
|
+
declare const renderTxStatus: (txChainId: string, txHash: string) => Promise<void>;
|
|
261
|
+
|
|
262
|
+
declare const openTransactionModal: ({ integratorId, dstChain, dstToken, customContractCalls, desc, }: GetSwapTxPayload) => Promise<Transactions>;
|
|
259
263
|
|
|
260
|
-
declare const
|
|
264
|
+
declare const XPay: {
|
|
265
|
+
openTransactionModal: ({ integratorId, dstChain, dstToken, customContractCalls, desc, }: GetSwapTxPayload) => Promise<Transactions>;
|
|
266
|
+
renderTxStatus: (txChainId: string, txHash: string) => Promise<void>;
|
|
267
|
+
};
|
|
261
268
|
|
|
262
|
-
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,
|
|
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 };
|