@xswap-link/sdk 0.2.6 → 0.3.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.
Files changed (34) hide show
  1. package/.github/workflows/main.yml +2 -2
  2. package/.github/workflows/publish.yml +2 -2
  3. package/CHANGELOG.md +6 -0
  4. package/dist/index.css +99 -2
  5. package/dist/index.d.mts +4 -2
  6. package/dist/index.d.ts +4 -2
  7. package/dist/index.js +1178 -409
  8. package/dist/index.mjs +1205 -430
  9. package/package.json +1 -1
  10. package/src/components/Skeleton/index.tsx +1 -1
  11. package/src/components/Spinner/index.tsx +28 -0
  12. package/src/components/TxConfigForm/ConfirmationAmount.tsx +91 -0
  13. package/src/components/TxConfigForm/Description.tsx +5 -3
  14. package/src/components/TxConfigForm/FeesDetails.tsx +5 -11
  15. package/src/components/TxConfigForm/Form.tsx +763 -118
  16. package/src/components/TxConfigForm/HistoryCard.tsx +1 -1
  17. package/src/components/TxConfigForm/Summary.tsx +9 -8
  18. package/src/components/TxConfigForm/SwapPanel.tsx +1 -4
  19. package/src/components/TxConfigForm/UsdPrice.tsx +3 -13
  20. package/src/components/TxConfigForm/index.tsx +33 -6
  21. package/src/components/TxStatusButton/index.tsx +12 -2
  22. package/src/components/icons/ErrorIcon.tsx +32 -0
  23. package/src/components/icons/SignIcon.tsx +17 -0
  24. package/src/components/icons/SuccessIcon.tsx +29 -0
  25. package/src/components/icons/index.ts +3 -0
  26. package/src/config/init.tsx +27 -10
  27. package/src/constants/index.ts +2 -2
  28. package/src/models/payloads/GetSwapTxPayload.ts +2 -0
  29. package/src/services/integrations/monitoring.ts +10 -3
  30. package/src/services/integrations/transactions.ts +9 -3
  31. package/src/utils/contracts.ts +18 -0
  32. package/src/utils/index.ts +1 -0
  33. package/src/utils/parseWeb3Error.ts +93 -0
  34. package/tailwind.config.js +39 -0
@@ -9,7 +9,7 @@ jobs:
9
9
  runs-on: ubuntu-latest
10
10
  steps:
11
11
  - uses: actions/checkout@v3
12
- - uses: pnpm/action-setup@v2
12
+ - uses: pnpm/action-setup@v4
13
13
  with:
14
14
  version: 7
15
15
  - uses: actions/setup-node@v3
@@ -19,4 +19,4 @@ jobs:
19
19
 
20
20
  - run: pnpm install
21
21
  - run: pnpm install react@18.2.0 react-dom@18.2.0 @types/react@18.2.0 @types/react-dom@18.2.0
22
- - run: pnpm run lint && pnpm run build
22
+ - run: pnpm run lint && pnpm run build
@@ -17,7 +17,7 @@ jobs:
17
17
  runs-on: ubuntu-latest
18
18
  steps:
19
19
  - uses: actions/checkout@v3
20
- - uses: pnpm/action-setup@v2
20
+ - uses: pnpm/action-setup@v4
21
21
  with:
22
22
  version: 7
23
23
  - uses: actions/setup-node@v3
@@ -53,4 +53,4 @@ jobs:
53
53
  upload_url: ${{ steps.latest_release_info.outputs.upload_url }}
54
54
  asset_path: ./dist/index.css
55
55
  asset_name: index.css
56
- asset_content_type: text/plain
56
+ asset_content_type: text/plain
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @xswap-link/xswap-sdk
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5748302: feat: new tx execution system
8
+
3
9
  ## 0.2.6
4
10
 
5
11
  ### Patch Changes
package/dist/index.css CHANGED
@@ -340,12 +340,18 @@ video {
340
340
  .xpay-bottom-0 {
341
341
  bottom: 0px;
342
342
  }
343
+ .xpay-bottom-5 {
344
+ bottom: 1.25rem;
345
+ }
343
346
  .xpay-left-0 {
344
347
  left: 0px;
345
348
  }
346
349
  .xpay-right-0 {
347
350
  right: 0px;
348
351
  }
352
+ .xpay-right-2 {
353
+ right: 0.5rem;
354
+ }
349
355
  .xpay-right-4 {
350
356
  right: 1rem;
351
357
  }
@@ -370,6 +376,9 @@ video {
370
376
  .xpay-z-20 {
371
377
  z-index: 20;
372
378
  }
379
+ .xpay-z-50 {
380
+ z-index: 50;
381
+ }
373
382
  .xpay-z-\[1\] {
374
383
  z-index: 1;
375
384
  }
@@ -412,6 +421,12 @@ video {
412
421
  margin-top: 1rem;
413
422
  margin-bottom: 1rem;
414
423
  }
424
+ .xpay--mb-6 {
425
+ margin-bottom: -1.5rem;
426
+ }
427
+ .xpay--mt-7 {
428
+ margin-top: -1.75rem;
429
+ }
415
430
  .xpay-mb-1 {
416
431
  margin-bottom: 0.25rem;
417
432
  }
@@ -427,9 +442,15 @@ video {
427
442
  .xpay-ml-2 {
428
443
  margin-left: 0.5rem;
429
444
  }
445
+ .xpay-ml-2\.5 {
446
+ margin-left: 0.625rem;
447
+ }
430
448
  .xpay-mr-1 {
431
449
  margin-right: 0.25rem;
432
450
  }
451
+ .xpay-mt-1 {
452
+ margin-top: 0.25rem;
453
+ }
433
454
  .xpay-mt-4 {
434
455
  margin-top: 1rem;
435
456
  }
@@ -445,6 +466,9 @@ video {
445
466
  .xpay-inline-flex {
446
467
  display: inline-flex;
447
468
  }
469
+ .xpay-h-10 {
470
+ height: 2.5rem;
471
+ }
448
472
  .xpay-h-14 {
449
473
  height: 3.5rem;
450
474
  }
@@ -565,6 +589,12 @@ video {
565
589
  .xpay-w-full {
566
590
  width: 100%;
567
591
  }
592
+ .xpay-w-px {
593
+ width: 1px;
594
+ }
595
+ .xpay-w-screen {
596
+ width: 100vw;
597
+ }
568
598
  .xpay-min-w-60 {
569
599
  min-width: 15rem;
570
600
  }
@@ -601,6 +631,14 @@ video {
601
631
  .xpay-animate-pulse {
602
632
  animation: xpay-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
603
633
  }
634
+ @keyframes xpay-spin {
635
+ to {
636
+ transform: rotate(360deg);
637
+ }
638
+ }
639
+ .xpay-animate-spin {
640
+ animation: xpay-spin 1s linear infinite;
641
+ }
604
642
  .xpay-cursor-pointer {
605
643
  cursor: pointer;
606
644
  }
@@ -619,6 +657,9 @@ video {
619
657
  .xpay-items-center {
620
658
  align-items: center;
621
659
  }
660
+ .xpay-justify-end {
661
+ justify-content: flex-end;
662
+ }
622
663
  .xpay-justify-center {
623
664
  justify-content: center;
624
665
  }
@@ -759,8 +800,9 @@ video {
759
800
  --tw-bg-opacity: 1;
760
801
  background-color: rgb(0 0 0 / var(--tw-bg-opacity));
761
802
  }
762
- .xpay-bg-current {
763
- background-color: currentColor;
803
+ .xpay-bg-gray-700 {
804
+ --tw-bg-opacity: 1;
805
+ background-color: rgb(55 65 81 / var(--tw-bg-opacity));
764
806
  }
765
807
  .xpay-bg-transparent {
766
808
  background-color: transparent;
@@ -802,6 +844,11 @@ video {
802
844
  --tw-gradient-to: rgba(76, 175, 80, 0) var(--tw-gradient-to-position);
803
845
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
804
846
  }
847
+ .xpay-from-x_blue_300_20 {
848
+ --tw-gradient-from: #3681C633 var(--tw-gradient-from-position);
849
+ --tw-gradient-to: rgb(54 129 198 / 0) var(--tw-gradient-to-position);
850
+ --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
851
+ }
805
852
  .xpay-from-x_blue_light {
806
853
  --tw-gradient-from: rgba(54,129,198,1) var(--tw-gradient-from-position);
807
854
  --tw-gradient-to: rgba(54, 129, 198, 0) var(--tw-gradient-to-position);
@@ -819,12 +866,18 @@ video {
819
866
  .xpay-to-\[rgba\(46\,125\,50\,0\.2\)\] {
820
867
  --tw-gradient-to: rgba(46,125,50,0.2) var(--tw-gradient-to-position);
821
868
  }
869
+ .xpay-to-x_blue_400_20 {
870
+ --tw-gradient-to: #2B4A9D33 var(--tw-gradient-to-position);
871
+ }
822
872
  .xpay-to-x_blue_dark {
823
873
  --tw-gradient-to: rgba(43,74,157,1) var(--tw-gradient-to-position);
824
874
  }
825
875
  .xpay-bg-clip-text {
826
876
  background-clip: text;
827
877
  }
878
+ .xpay-fill-\[rgba\(54\,129\,198\,1\)\] {
879
+ fill: rgba(54, 129, 198, 1);
880
+ }
828
881
  .xpay-p-0 {
829
882
  padding: 0px;
830
883
  }
@@ -843,6 +896,9 @@ video {
843
896
  .xpay-p-6 {
844
897
  padding: 1.5rem;
845
898
  }
899
+ .xpay-p-\[5px\] {
900
+ padding: 5px;
901
+ }
846
902
  .xpay-px-0 {
847
903
  padding-left: 0px;
848
904
  padding-right: 0px;
@@ -887,6 +943,12 @@ video {
887
943
  padding-top: 1rem;
888
944
  padding-bottom: 1rem;
889
945
  }
946
+ .xpay-pl-9 {
947
+ padding-left: 2.25rem;
948
+ }
949
+ .xpay-pt-2 {
950
+ padding-top: 0.5rem;
951
+ }
890
952
  .xpay-text-left {
891
953
  text-align: left;
892
954
  }
@@ -928,6 +990,9 @@ video {
928
990
  font-size: 0.75rem;
929
991
  line-height: 1rem;
930
992
  }
993
+ .xpay-font-bold {
994
+ font-weight: 700;
995
+ }
931
996
  .xpay-font-light {
932
997
  font-weight: 300;
933
998
  }
@@ -937,6 +1002,9 @@ video {
937
1002
  .xpay-font-normal {
938
1003
  font-weight: 400;
939
1004
  }
1005
+ .xpay-leading-8 {
1006
+ line-height: 2rem;
1007
+ }
940
1008
  .xpay-leading-\[10px\] {
941
1009
  line-height: 10px;
942
1010
  }
@@ -983,10 +1051,17 @@ video {
983
1051
  .xpay-text-\[rgba\(255\,255\,255\,0\.6\)\] {
984
1052
  color: rgba(255, 255, 255, 0.6);
985
1053
  }
1054
+ .xpay-text-\[rgba\(54\,129\,198\,1\)\] {
1055
+ color: rgba(54, 129, 198, 1);
1056
+ }
986
1057
  .xpay-text-black {
987
1058
  --tw-text-opacity: 1;
988
1059
  color: rgb(0 0 0 / var(--tw-text-opacity));
989
1060
  }
1061
+ .xpay-text-gray-200 {
1062
+ --tw-text-opacity: 1;
1063
+ color: rgb(229 231 235 / var(--tw-text-opacity));
1064
+ }
990
1065
  .xpay-text-transparent {
991
1066
  color: transparent;
992
1067
  }
@@ -998,6 +1073,9 @@ video {
998
1073
  --tw-text-opacity: 1;
999
1074
  color: rgb(255 226 183 / var(--tw-text-opacity));
1000
1075
  }
1076
+ .xpay-text-x_blue_dark {
1077
+ color: rgba(43, 74, 157, 1);
1078
+ }
1001
1079
  .xpay-text-x_green {
1002
1080
  --tw-text-opacity: 1;
1003
1081
  color: rgb(102 187 106 / var(--tw-text-opacity));
@@ -1005,9 +1083,15 @@ video {
1005
1083
  .xpay-text-x_grey {
1006
1084
  color: #ffffff80;
1007
1085
  }
1086
+ .xpay-underline {
1087
+ text-decoration-line: underline;
1088
+ }
1008
1089
  .xpay-no-underline {
1009
1090
  text-decoration-line: none;
1010
1091
  }
1092
+ .xpay-opacity-50 {
1093
+ opacity: 0.5;
1094
+ }
1011
1095
  .xpay-opacity-60 {
1012
1096
  opacity: 0.6;
1013
1097
  }
@@ -1055,6 +1139,9 @@ video {
1055
1139
  .last\:xpay-mb-0:last-child {
1056
1140
  margin-bottom: 0px;
1057
1141
  }
1142
+ .visited\:xpay-text-white:visited {
1143
+ color: rgb(255 255 255);
1144
+ }
1058
1145
  .hover\:xpay-cursor-pointer:hover {
1059
1146
  cursor: pointer;
1060
1147
  }
@@ -1062,6 +1149,10 @@ video {
1062
1149
  --tw-bg-opacity: 1;
1063
1150
  background-color: rgb(25 25 25 / var(--tw-bg-opacity));
1064
1151
  }
1152
+ .hover\:xpay-text-white:hover {
1153
+ --tw-text-opacity: 1;
1154
+ color: rgb(255 255 255 / var(--tw-text-opacity));
1155
+ }
1065
1156
  .focus\:xpay-outline-none:focus {
1066
1157
  outline: 2px solid transparent;
1067
1158
  outline-offset: 2px;
@@ -1110,3 +1201,9 @@ video {
1110
1201
  padding: 1rem;
1111
1202
  }
1112
1203
  }
1204
+ @media (prefers-color-scheme: dark) {
1205
+ .dark\:xpay-text-gray-600 {
1206
+ --tw-text-opacity: 1;
1207
+ color: rgb(75 85 99 / var(--tw-text-opacity));
1208
+ }
1209
+ }
package/dist/index.d.mts CHANGED
@@ -151,6 +151,8 @@ type GetSwapTxPayload = {
151
151
  dstToken: string;
152
152
  customContractCalls?: ContractCall[];
153
153
  desc?: string;
154
+ retrunTransactions?: boolean;
155
+ dstDisplayToken?: string;
154
156
  };
155
157
 
156
158
  type GetPricesPayload = {
@@ -259,10 +261,10 @@ type MonitoredTransaction = {
259
261
 
260
262
  declare const renderTxStatus: (txChainId: string, txHash: string) => Promise<void>;
261
263
 
262
- declare const openTransactionModal: ({ integratorId, dstChain, dstToken, customContractCalls, desc, }: GetSwapTxPayload) => Promise<Transactions>;
264
+ declare const openTransactionModal: ({ integratorId, dstChain, dstToken, customContractCalls, desc, retrunTransactions, dstDisplayToken, }: GetSwapTxPayload) => Promise<Transactions | undefined>;
263
265
 
264
266
  declare const XPay: {
265
- openTransactionModal: ({ integratorId, dstChain, dstToken, customContractCalls, desc, }: GetSwapTxPayload) => Promise<Transactions>;
267
+ openTransactionModal: ({ integratorId, dstChain, dstToken, customContractCalls, desc, retrunTransactions, dstDisplayToken, }: GetSwapTxPayload) => Promise<Transactions | undefined>;
266
268
  renderTxStatus: (txChainId: string, txHash: string) => Promise<void>;
267
269
  };
268
270
 
package/dist/index.d.ts CHANGED
@@ -151,6 +151,8 @@ type GetSwapTxPayload = {
151
151
  dstToken: string;
152
152
  customContractCalls?: ContractCall[];
153
153
  desc?: string;
154
+ retrunTransactions?: boolean;
155
+ dstDisplayToken?: string;
154
156
  };
155
157
 
156
158
  type GetPricesPayload = {
@@ -259,10 +261,10 @@ type MonitoredTransaction = {
259
261
 
260
262
  declare const renderTxStatus: (txChainId: string, txHash: string) => Promise<void>;
261
263
 
262
- declare const openTransactionModal: ({ integratorId, dstChain, dstToken, customContractCalls, desc, }: GetSwapTxPayload) => Promise<Transactions>;
264
+ declare const openTransactionModal: ({ integratorId, dstChain, dstToken, customContractCalls, desc, retrunTransactions, dstDisplayToken, }: GetSwapTxPayload) => Promise<Transactions | undefined>;
263
265
 
264
266
  declare const XPay: {
265
- openTransactionModal: ({ integratorId, dstChain, dstToken, customContractCalls, desc, }: GetSwapTxPayload) => Promise<Transactions>;
267
+ openTransactionModal: ({ integratorId, dstChain, dstToken, customContractCalls, desc, retrunTransactions, dstDisplayToken, }: GetSwapTxPayload) => Promise<Transactions | undefined>;
266
268
  renderTxStatus: (txChainId: string, txHash: string) => Promise<void>;
267
269
  };
268
270