@multiversx/sdk-dapp-liquidity 1.0.3 → 1.0.4
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/api/confirmRate.d.ts +1 -1
- package/api/sendTransactions.d.ts +3 -1
- package/api/sendTransactions.js +7 -3
- package/api/sendTransactions.mjs +7 -3
- package/api/tests/confirmRate.spec.js +7 -3
- package/api/tests/confirmRate.spec.mjs +7 -3
- package/api/tests/getRate.spec.js +5 -2
- package/api/tests/getRate.spec.mjs +5 -2
- package/api/tests/sendTransactions.spec.js +9 -1
- package/api/tests/sendTransactions.spec.mjs +9 -1
- package/dto/ConfirmRate.dto.d.ts +3 -3
- package/package.json +1 -1
- package/reactjs/components/BridgeForm/BridgeForm.js +6 -1
- package/reactjs/components/BridgeForm/BridgeForm.mjs +6 -1
- package/reactjs/hooks/useBridgeFormik.d.ts +7 -2
- package/reactjs/hooks/useBridgeFormik.js +8 -2
- package/reactjs/hooks/useBridgeFormik.mjs +8 -2
- package/reactjs/hooks/useSendTransactions.d.ts +1 -1
- package/reactjs/hooks/useSendTransactions.js +8 -1
- package/reactjs/hooks/useSendTransactions.mjs +8 -1
- package/types/providerType.d.ts +5 -0
- package/types/providerType.js +10 -0
- package/types/providerType.mjs +9 -0
- package/types/rate.d.ts +3 -0
package/api/confirmRate.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { ServerTransaction } from '../types/transaction';
|
|
2
|
+
import { ProviderType } from '../types/providerType';
|
|
2
3
|
import { BatchTransactions } from '../types/batchTransactions';
|
|
3
4
|
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
4
5
|
|
|
5
6
|
export type SendTransactionsType = {
|
|
6
7
|
transactions: ServerTransaction[];
|
|
8
|
+
provider: ProviderType;
|
|
7
9
|
url: string;
|
|
8
10
|
token: string;
|
|
9
11
|
axiosConfig?: AxiosRequestConfig;
|
|
10
12
|
};
|
|
11
|
-
export declare const sendTransactions: ({ transactions, url, token, axiosConfig }: SendTransactionsType) => Promise<AxiosResponse<BatchTransactions>>;
|
|
13
|
+
export declare const sendTransactions: ({ transactions, provider, url, token, axiosConfig }: SendTransactionsType) => Promise<AxiosResponse<BatchTransactions>>;
|
package/api/sendTransactions.js
CHANGED
|
@@ -5,6 +5,7 @@ const axios = require("axios");
|
|
|
5
5
|
const helpers_serializeTransaction = require("../helpers/serializeTransaction.js");
|
|
6
6
|
const sendTransactions = async ({
|
|
7
7
|
transactions,
|
|
8
|
+
provider,
|
|
8
9
|
url,
|
|
9
10
|
token,
|
|
10
11
|
axiosConfig
|
|
@@ -20,9 +21,12 @@ const sendTransactions = async ({
|
|
|
20
21
|
};
|
|
21
22
|
return axios.post(
|
|
22
23
|
`/transactions`,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
{
|
|
25
|
+
transactions: transactions.map(
|
|
26
|
+
(transaction) => JSON.parse(helpers_serializeTransaction.serializeTransaction(transaction))
|
|
27
|
+
),
|
|
28
|
+
provider
|
|
29
|
+
},
|
|
26
30
|
config
|
|
27
31
|
);
|
|
28
32
|
};
|
package/api/sendTransactions.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import axios from "axios";
|
|
|
2
2
|
import { serializeTransaction } from "../helpers/serializeTransaction.mjs";
|
|
3
3
|
const sendTransactions = async ({
|
|
4
4
|
transactions,
|
|
5
|
+
provider,
|
|
5
6
|
url,
|
|
6
7
|
token,
|
|
7
8
|
axiosConfig
|
|
@@ -17,9 +18,12 @@ const sendTransactions = async ({
|
|
|
17
18
|
};
|
|
18
19
|
return axios.post(
|
|
19
20
|
`/transactions`,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
{
|
|
22
|
+
transactions: transactions.map(
|
|
23
|
+
(transaction) => JSON.parse(serializeTransaction(transaction))
|
|
24
|
+
),
|
|
25
|
+
provider
|
|
26
|
+
},
|
|
23
27
|
config
|
|
24
28
|
);
|
|
25
29
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
const axios = require("axios");
|
|
4
|
+
const types_providerType = require("../../types/providerType.js");
|
|
4
5
|
const api_confirmRate = require("../confirmRate.js");
|
|
5
6
|
jest.mock("axios");
|
|
6
7
|
const mockedAxios = axios;
|
|
@@ -16,7 +17,8 @@ describe("confirmRate", () => {
|
|
|
16
17
|
fromChainId: "97",
|
|
17
18
|
toChainId: "44",
|
|
18
19
|
sender: "0x123",
|
|
19
|
-
receiver: "0x456"
|
|
20
|
+
receiver: "0x456",
|
|
21
|
+
provider: types_providerType.ProviderType.None
|
|
20
22
|
};
|
|
21
23
|
const nativeAuthToken = "ZXJkMXdoOWMwc2pyMnhuOGh6ZjAybHd3Y3I0amsyczg0dGF0OXVkMmthcTZ6cjd4enB2bDlsNXE4YXdtZXg.YUhSMGNITTZMeTlrWlhadVpYUXVkR1Z0Y0d4aGRHVXRaR0Z3Y0M1dGRXeDBhWFpsY25ONExtTnZiUS5lZjc2YjRjNzZlZjZlMTNhNjM5MDc2N2ZjNzhhODhjYTRiYmI1OTE4YTJiOWRkYzQ0OTQyOTI3NjkzNjUwNjUxLjg2NDAwLmV5SjBhVzFsYzNSaGJYQWlPakUzTXpNME9EazBNREI5.04a986df7f0142837f9b1ca1ae4829f7b471e4c3470602ca6a16f2a4d7c6616c4e7628a93b4ce87d9534e95ab9215f893faeb9e0904e1d834007c16e43b12d01";
|
|
22
24
|
const config = {
|
|
@@ -61,7 +63,8 @@ describe("confirmRate", () => {
|
|
|
61
63
|
fromChainId: "97",
|
|
62
64
|
toChainId: "44",
|
|
63
65
|
sender: "0x123",
|
|
64
|
-
receiver: "0x456"
|
|
66
|
+
receiver: "0x456",
|
|
67
|
+
provider: types_providerType.ProviderType.None
|
|
65
68
|
};
|
|
66
69
|
const nativeAuthToken = "";
|
|
67
70
|
const config = {
|
|
@@ -104,7 +107,8 @@ describe("confirmRate", () => {
|
|
|
104
107
|
fromChainId: "97",
|
|
105
108
|
toChainId: "44",
|
|
106
109
|
sender: "0x123",
|
|
107
|
-
receiver: "0x456"
|
|
110
|
+
receiver: "0x456",
|
|
111
|
+
provider: types_providerType.ProviderType.None
|
|
108
112
|
};
|
|
109
113
|
const nativeAuthToken = "";
|
|
110
114
|
const config = {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
+
import { ProviderType } from "../../types/providerType.mjs";
|
|
2
3
|
import { confirmRate } from "../confirmRate.mjs";
|
|
3
4
|
jest.mock("axios");
|
|
4
5
|
const mockedAxios = axios;
|
|
@@ -14,7 +15,8 @@ describe("confirmRate", () => {
|
|
|
14
15
|
fromChainId: "97",
|
|
15
16
|
toChainId: "44",
|
|
16
17
|
sender: "0x123",
|
|
17
|
-
receiver: "0x456"
|
|
18
|
+
receiver: "0x456",
|
|
19
|
+
provider: ProviderType.None
|
|
18
20
|
};
|
|
19
21
|
const nativeAuthToken = "ZXJkMXdoOWMwc2pyMnhuOGh6ZjAybHd3Y3I0amsyczg0dGF0OXVkMmthcTZ6cjd4enB2bDlsNXE4YXdtZXg.YUhSMGNITTZMeTlrWlhadVpYUXVkR1Z0Y0d4aGRHVXRaR0Z3Y0M1dGRXeDBhWFpsY25ONExtTnZiUS5lZjc2YjRjNzZlZjZlMTNhNjM5MDc2N2ZjNzhhODhjYTRiYmI1OTE4YTJiOWRkYzQ0OTQyOTI3NjkzNjUwNjUxLjg2NDAwLmV5SjBhVzFsYzNSaGJYQWlPakUzTXpNME9EazBNREI5.04a986df7f0142837f9b1ca1ae4829f7b471e4c3470602ca6a16f2a4d7c6616c4e7628a93b4ce87d9534e95ab9215f893faeb9e0904e1d834007c16e43b12d01";
|
|
20
22
|
const config = {
|
|
@@ -59,7 +61,8 @@ describe("confirmRate", () => {
|
|
|
59
61
|
fromChainId: "97",
|
|
60
62
|
toChainId: "44",
|
|
61
63
|
sender: "0x123",
|
|
62
|
-
receiver: "0x456"
|
|
64
|
+
receiver: "0x456",
|
|
65
|
+
provider: ProviderType.None
|
|
63
66
|
};
|
|
64
67
|
const nativeAuthToken = "";
|
|
65
68
|
const config = {
|
|
@@ -102,7 +105,8 @@ describe("confirmRate", () => {
|
|
|
102
105
|
fromChainId: "97",
|
|
103
106
|
toChainId: "44",
|
|
104
107
|
sender: "0x123",
|
|
105
|
-
receiver: "0x456"
|
|
108
|
+
receiver: "0x456",
|
|
109
|
+
provider: ProviderType.None
|
|
106
110
|
};
|
|
107
111
|
const nativeAuthToken = "";
|
|
108
112
|
const config = {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
const axios = require("axios");
|
|
4
|
+
const types_providerType = require("../../types/providerType.js");
|
|
4
5
|
const api_getRate = require("../getRate.js");
|
|
5
6
|
jest.mock("axios");
|
|
6
7
|
const mockedAxios = axios;
|
|
@@ -24,7 +25,8 @@ describe("getRate", () => {
|
|
|
24
25
|
};
|
|
25
26
|
const response = {
|
|
26
27
|
fee: "5",
|
|
27
|
-
amountOut: "100"
|
|
28
|
+
amountOut: "100",
|
|
29
|
+
provider: types_providerType.ProviderType.None
|
|
28
30
|
};
|
|
29
31
|
mockedAxios.post.mockResolvedValue({ data: response });
|
|
30
32
|
const result = await api_getRate.getRate({
|
|
@@ -50,7 +52,8 @@ describe("getRate", () => {
|
|
|
50
52
|
};
|
|
51
53
|
const response = {
|
|
52
54
|
fee: "5",
|
|
53
|
-
amountOut: "100"
|
|
55
|
+
amountOut: "100",
|
|
56
|
+
provider: types_providerType.ProviderType.None
|
|
54
57
|
};
|
|
55
58
|
mockedAxios.post.mockResolvedValue({ data: response });
|
|
56
59
|
const result = await api_getRate.getRate({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
+
import { ProviderType } from "../../types/providerType.mjs";
|
|
2
3
|
import { getRate } from "../getRate.mjs";
|
|
3
4
|
jest.mock("axios");
|
|
4
5
|
const mockedAxios = axios;
|
|
@@ -22,7 +23,8 @@ describe("getRate", () => {
|
|
|
22
23
|
};
|
|
23
24
|
const response = {
|
|
24
25
|
fee: "5",
|
|
25
|
-
amountOut: "100"
|
|
26
|
+
amountOut: "100",
|
|
27
|
+
provider: ProviderType.None
|
|
26
28
|
};
|
|
27
29
|
mockedAxios.post.mockResolvedValue({ data: response });
|
|
28
30
|
const result = await getRate({
|
|
@@ -48,7 +50,8 @@ describe("getRate", () => {
|
|
|
48
50
|
};
|
|
49
51
|
const response = {
|
|
50
52
|
fee: "5",
|
|
51
|
-
amountOut: "100"
|
|
53
|
+
amountOut: "100",
|
|
54
|
+
provider: ProviderType.None
|
|
52
55
|
};
|
|
53
56
|
mockedAxios.post.mockResolvedValue({ data: response });
|
|
54
57
|
const result = await getRate({
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const axios = require("axios");
|
|
4
4
|
const api_sendTransactions = require("../sendTransactions.js");
|
|
5
5
|
const helpers_serializeTransaction = require("../../helpers/serializeTransaction.js");
|
|
6
|
+
const types_providerType = require("../../types/providerType.js");
|
|
6
7
|
jest.mock("axios");
|
|
7
8
|
const mockedAxios = axios;
|
|
8
9
|
describe("sendTransactions", () => {
|
|
@@ -24,7 +25,12 @@ describe("sendTransactions", () => {
|
|
|
24
25
|
it("POST sendTransactions successfully", async () => {
|
|
25
26
|
const response = { data: { transactions } };
|
|
26
27
|
mockedAxios.post.mockResolvedValue(response);
|
|
27
|
-
const result = await api_sendTransactions.sendTransactions({
|
|
28
|
+
const result = await api_sendTransactions.sendTransactions({
|
|
29
|
+
transactions,
|
|
30
|
+
provider: types_providerType.ProviderType.None,
|
|
31
|
+
url,
|
|
32
|
+
token
|
|
33
|
+
});
|
|
28
34
|
expect(mockedAxios.post).toHaveBeenCalledWith(
|
|
29
35
|
"/transactions",
|
|
30
36
|
transactions.map(
|
|
@@ -47,6 +53,7 @@ describe("sendTransactions", () => {
|
|
|
47
53
|
mockedAxios.post.mockResolvedValue(response);
|
|
48
54
|
const result = await api_sendTransactions.sendTransactions({
|
|
49
55
|
transactions,
|
|
56
|
+
provider: types_providerType.ProviderType.None,
|
|
50
57
|
url,
|
|
51
58
|
token,
|
|
52
59
|
axiosConfig
|
|
@@ -75,6 +82,7 @@ describe("sendTransactions", () => {
|
|
|
75
82
|
transactions: transactions.map(
|
|
76
83
|
(transaction) => JSON.parse(helpers_serializeTransaction.serializeTransaction(transaction))
|
|
77
84
|
),
|
|
85
|
+
provider: types_providerType.ProviderType.None,
|
|
78
86
|
url,
|
|
79
87
|
token
|
|
80
88
|
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import { sendTransactions } from "../sendTransactions.mjs";
|
|
3
3
|
import { serializeTransaction } from "../../helpers/serializeTransaction.mjs";
|
|
4
|
+
import { ProviderType } from "../../types/providerType.mjs";
|
|
4
5
|
jest.mock("axios");
|
|
5
6
|
const mockedAxios = axios;
|
|
6
7
|
describe("sendTransactions", () => {
|
|
@@ -22,7 +23,12 @@ describe("sendTransactions", () => {
|
|
|
22
23
|
it("POST sendTransactions successfully", async () => {
|
|
23
24
|
const response = { data: { transactions } };
|
|
24
25
|
mockedAxios.post.mockResolvedValue(response);
|
|
25
|
-
const result = await sendTransactions({
|
|
26
|
+
const result = await sendTransactions({
|
|
27
|
+
transactions,
|
|
28
|
+
provider: ProviderType.None,
|
|
29
|
+
url,
|
|
30
|
+
token
|
|
31
|
+
});
|
|
26
32
|
expect(mockedAxios.post).toHaveBeenCalledWith(
|
|
27
33
|
"/transactions",
|
|
28
34
|
transactions.map(
|
|
@@ -45,6 +51,7 @@ describe("sendTransactions", () => {
|
|
|
45
51
|
mockedAxios.post.mockResolvedValue(response);
|
|
46
52
|
const result = await sendTransactions({
|
|
47
53
|
transactions,
|
|
54
|
+
provider: ProviderType.None,
|
|
48
55
|
url,
|
|
49
56
|
token,
|
|
50
57
|
axiosConfig
|
|
@@ -73,6 +80,7 @@ describe("sendTransactions", () => {
|
|
|
73
80
|
transactions: transactions.map(
|
|
74
81
|
(transaction) => JSON.parse(serializeTransaction(transaction))
|
|
75
82
|
),
|
|
83
|
+
provider: ProviderType.None,
|
|
76
84
|
url,
|
|
77
85
|
token
|
|
78
86
|
})
|
package/dto/ConfirmRate.dto.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { RateRequestResponse } from '../types';
|
|
2
|
+
|
|
3
|
+
export interface ConfirmRateDto extends RateRequestResponse {
|
|
2
4
|
tokenIn: string;
|
|
3
5
|
amountIn: string;
|
|
4
6
|
fromChainId: string;
|
|
5
7
|
tokenOut: string;
|
|
6
8
|
toChainId: string;
|
|
7
|
-
fee: string;
|
|
8
|
-
amountOut: string;
|
|
9
9
|
sender: string;
|
|
10
10
|
receiver: string;
|
|
11
11
|
}
|
package/package.json
CHANGED
|
@@ -349,7 +349,10 @@ const BridgeForm = ({
|
|
|
349
349
|
});
|
|
350
350
|
};
|
|
351
351
|
const onSubmit = require$$0.useCallback(
|
|
352
|
-
async (
|
|
352
|
+
async ({
|
|
353
|
+
transactions,
|
|
354
|
+
provider
|
|
355
|
+
}) => {
|
|
353
356
|
const signedTransactions = [];
|
|
354
357
|
setPendingSigning(true);
|
|
355
358
|
setSigningTransactionsCount(() => transactions.length);
|
|
@@ -392,6 +395,7 @@ const BridgeForm = ({
|
|
|
392
395
|
}
|
|
393
396
|
await sendTransactions({
|
|
394
397
|
transactions: signedTransactions,
|
|
398
|
+
provider,
|
|
395
399
|
url: helpers_getApiURL.getApiURL() ?? "",
|
|
396
400
|
token: nativeAuthToken ?? ""
|
|
397
401
|
});
|
|
@@ -432,6 +436,7 @@ const BridgeForm = ({
|
|
|
432
436
|
setLastChangedField
|
|
433
437
|
} = reactjs_hooks_useBridgeFormik.useBridgeFormik({
|
|
434
438
|
fee: rate == null ? void 0 : rate.fee,
|
|
439
|
+
provider: rate == null ? void 0 : rate.provider,
|
|
435
440
|
nativeAuthToken,
|
|
436
441
|
mvxAccountAddress: mvxAddress,
|
|
437
442
|
firstToken,
|
|
@@ -346,7 +346,10 @@ const BridgeForm = ({
|
|
|
346
346
|
});
|
|
347
347
|
};
|
|
348
348
|
const onSubmit = useCallback(
|
|
349
|
-
async (
|
|
349
|
+
async ({
|
|
350
|
+
transactions,
|
|
351
|
+
provider
|
|
352
|
+
}) => {
|
|
350
353
|
const signedTransactions = [];
|
|
351
354
|
setPendingSigning(true);
|
|
352
355
|
setSigningTransactionsCount(() => transactions.length);
|
|
@@ -389,6 +392,7 @@ const BridgeForm = ({
|
|
|
389
392
|
}
|
|
390
393
|
await sendTransactions({
|
|
391
394
|
transactions: signedTransactions,
|
|
395
|
+
provider,
|
|
392
396
|
url: getApiURL() ?? "",
|
|
393
397
|
token: nativeAuthToken ?? ""
|
|
394
398
|
});
|
|
@@ -429,6 +433,7 @@ const BridgeForm = ({
|
|
|
429
433
|
setLastChangedField
|
|
430
434
|
} = useBridgeFormik({
|
|
431
435
|
fee: rate == null ? void 0 : rate.fee,
|
|
436
|
+
provider: rate == null ? void 0 : rate.provider,
|
|
432
437
|
nativeAuthToken,
|
|
433
438
|
mvxAccountAddress: mvxAddress,
|
|
434
439
|
firstToken,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ServerTransaction } from '../../types/transaction';
|
|
2
2
|
import { TokenType } from '../../types/token';
|
|
3
|
+
import { ProviderType } from '../../types/providerType';
|
|
3
4
|
|
|
4
5
|
export declare enum BridgeFormikValuesEnum {
|
|
5
6
|
firstToken = "firstToken",
|
|
@@ -17,7 +18,7 @@ export interface TradeFormikValuesType {
|
|
|
17
18
|
fromChainId?: string;
|
|
18
19
|
toChainId?: string;
|
|
19
20
|
}
|
|
20
|
-
export declare const useBridgeFormik: ({ nativeAuthToken, mvxAccountAddress, firstToken, firstAmount, secondToken, secondAmount, fromChainId, toChainId, fee, onSubmit }: {
|
|
21
|
+
export declare const useBridgeFormik: ({ nativeAuthToken, mvxAccountAddress, firstToken, firstAmount, secondToken, secondAmount, fromChainId, toChainId, fee, provider, onSubmit }: {
|
|
21
22
|
mvxAccountAddress?: string;
|
|
22
23
|
nativeAuthToken?: string;
|
|
23
24
|
firstAmount?: string;
|
|
@@ -27,7 +28,11 @@ export declare const useBridgeFormik: ({ nativeAuthToken, mvxAccountAddress, fir
|
|
|
27
28
|
firstToken?: TokenType;
|
|
28
29
|
secondToken?: TokenType;
|
|
29
30
|
fee?: string;
|
|
30
|
-
|
|
31
|
+
provider?: ProviderType;
|
|
32
|
+
onSubmit: ({ transactions, provider }: {
|
|
33
|
+
transactions: ServerTransaction[];
|
|
34
|
+
provider: ProviderType;
|
|
35
|
+
}) => void;
|
|
31
36
|
}) => {
|
|
32
37
|
formik: {
|
|
33
38
|
initialValues: TradeFormikValuesType;
|
|
@@ -10,6 +10,7 @@ const reactjs_hooks_validation_useAmountSchema = require("./validation/useAmount
|
|
|
10
10
|
const reactjs_hooks_validation_useSecondAmountSchema = require("./validation/useSecondAmountSchema.js");
|
|
11
11
|
const api_confirmRate = require("../../api/confirmRate.js");
|
|
12
12
|
const helpers_getApiURL = require("../../helpers/getApiURL.js");
|
|
13
|
+
const types_providerType = require("../../types/providerType.js");
|
|
13
14
|
var BridgeFormikValuesEnum = /* @__PURE__ */ ((BridgeFormikValuesEnum2) => {
|
|
14
15
|
BridgeFormikValuesEnum2["firstToken"] = "firstToken";
|
|
15
16
|
BridgeFormikValuesEnum2["firstAmount"] = "firstAmount";
|
|
@@ -29,6 +30,7 @@ const useBridgeFormik = ({
|
|
|
29
30
|
fromChainId,
|
|
30
31
|
toChainId,
|
|
31
32
|
fee = "0",
|
|
33
|
+
provider,
|
|
32
34
|
onSubmit
|
|
33
35
|
}) => {
|
|
34
36
|
const [lastChangedField, setLastChangedField] = require$$0.useState(null);
|
|
@@ -70,7 +72,8 @@ const useBridgeFormik = ({
|
|
|
70
72
|
fee: fee ?? "0",
|
|
71
73
|
amountOut: (secondAmount == null ? void 0 : secondAmount.toString()) ?? "",
|
|
72
74
|
sender: account.address ?? "",
|
|
73
|
-
receiver: mvxAccountAddress ?? ""
|
|
75
|
+
receiver: mvxAccountAddress ?? "",
|
|
76
|
+
provider: provider ?? types_providerType.ProviderType.None
|
|
74
77
|
}
|
|
75
78
|
});
|
|
76
79
|
const transactions = data;
|
|
@@ -79,7 +82,10 @@ const useBridgeFormik = ({
|
|
|
79
82
|
return;
|
|
80
83
|
}
|
|
81
84
|
resetSwapForm();
|
|
82
|
-
onSubmit(
|
|
85
|
+
onSubmit({
|
|
86
|
+
transactions,
|
|
87
|
+
provider: provider ?? types_providerType.ProviderType.None
|
|
88
|
+
});
|
|
83
89
|
pendingSigningRef.current = false;
|
|
84
90
|
};
|
|
85
91
|
const formik$1 = formik.useFormik({
|
|
@@ -7,6 +7,7 @@ import { useAmountSchema } from "./validation/useAmountSchema.mjs";
|
|
|
7
7
|
import { useSecondAmountSchema } from "./validation/useSecondAmountSchema.mjs";
|
|
8
8
|
import { confirmRate } from "../../api/confirmRate.mjs";
|
|
9
9
|
import { getApiURL } from "../../helpers/getApiURL.mjs";
|
|
10
|
+
import { ProviderType } from "../../types/providerType.mjs";
|
|
10
11
|
var BridgeFormikValuesEnum = /* @__PURE__ */ ((BridgeFormikValuesEnum2) => {
|
|
11
12
|
BridgeFormikValuesEnum2["firstToken"] = "firstToken";
|
|
12
13
|
BridgeFormikValuesEnum2["firstAmount"] = "firstAmount";
|
|
@@ -26,6 +27,7 @@ const useBridgeFormik = ({
|
|
|
26
27
|
fromChainId,
|
|
27
28
|
toChainId,
|
|
28
29
|
fee = "0",
|
|
30
|
+
provider,
|
|
29
31
|
onSubmit
|
|
30
32
|
}) => {
|
|
31
33
|
const [lastChangedField, setLastChangedField] = useState(null);
|
|
@@ -67,7 +69,8 @@ const useBridgeFormik = ({
|
|
|
67
69
|
fee: fee ?? "0",
|
|
68
70
|
amountOut: (secondAmount == null ? void 0 : secondAmount.toString()) ?? "",
|
|
69
71
|
sender: account.address ?? "",
|
|
70
|
-
receiver: mvxAccountAddress ?? ""
|
|
72
|
+
receiver: mvxAccountAddress ?? "",
|
|
73
|
+
provider: provider ?? ProviderType.None
|
|
71
74
|
}
|
|
72
75
|
});
|
|
73
76
|
const transactions = data;
|
|
@@ -76,7 +79,10 @@ const useBridgeFormik = ({
|
|
|
76
79
|
return;
|
|
77
80
|
}
|
|
78
81
|
resetSwapForm();
|
|
79
|
-
onSubmit(
|
|
82
|
+
onSubmit({
|
|
83
|
+
transactions,
|
|
84
|
+
provider: provider ?? ProviderType.None
|
|
85
|
+
});
|
|
80
86
|
pendingSigningRef.current = false;
|
|
81
87
|
};
|
|
82
88
|
const formik = useFormik({
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SendTransactionsType } from '../../api/sendTransactions';
|
|
2
2
|
|
|
3
|
-
export declare const useSendTransactions: () => ({ transactions, url, token, axiosConfig }: SendTransactionsType) => Promise<import('axios').AxiosResponse<import('../..').BatchTransactions, any>>;
|
|
3
|
+
export declare const useSendTransactions: () => ({ transactions, provider, url, token, axiosConfig }: SendTransactionsType) => Promise<import('axios').AxiosResponse<import('../..').BatchTransactions, any>>;
|
|
@@ -5,9 +5,16 @@ const require$$0 = require("react");
|
|
|
5
5
|
const api_sendTransactions = require("../../api/sendTransactions.js");
|
|
6
6
|
const useSendTransactions = () => {
|
|
7
7
|
return require$$0.useCallback(
|
|
8
|
-
async ({
|
|
8
|
+
async ({
|
|
9
|
+
transactions,
|
|
10
|
+
provider,
|
|
11
|
+
url,
|
|
12
|
+
token,
|
|
13
|
+
axiosConfig
|
|
14
|
+
}) => {
|
|
9
15
|
return await api_sendTransactions.sendTransactions({
|
|
10
16
|
transactions,
|
|
17
|
+
provider,
|
|
11
18
|
url,
|
|
12
19
|
token,
|
|
13
20
|
axiosConfig
|
|
@@ -2,9 +2,16 @@ import { useCallback } from "react";
|
|
|
2
2
|
import { sendTransactions } from "../../api/sendTransactions.mjs";
|
|
3
3
|
const useSendTransactions = () => {
|
|
4
4
|
return useCallback(
|
|
5
|
-
async ({
|
|
5
|
+
async ({
|
|
6
|
+
transactions,
|
|
7
|
+
provider,
|
|
8
|
+
url,
|
|
9
|
+
token,
|
|
10
|
+
axiosConfig
|
|
11
|
+
}) => {
|
|
6
12
|
return await sendTransactions({
|
|
7
13
|
transactions,
|
|
14
|
+
provider,
|
|
8
15
|
url,
|
|
9
16
|
token,
|
|
10
17
|
axiosConfig
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
var ProviderType = /* @__PURE__ */ ((ProviderType2) => {
|
|
5
|
+
ProviderType2["MultiversxBridge"] = "multiversx-bridge";
|
|
6
|
+
ProviderType2["XMoney"] = "xmoney";
|
|
7
|
+
ProviderType2["None"] = "none";
|
|
8
|
+
return ProviderType2;
|
|
9
|
+
})(ProviderType || {});
|
|
10
|
+
exports.ProviderType = ProviderType;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var ProviderType = /* @__PURE__ */ ((ProviderType2) => {
|
|
2
|
+
ProviderType2["MultiversxBridge"] = "multiversx-bridge";
|
|
3
|
+
ProviderType2["XMoney"] = "xmoney";
|
|
4
|
+
ProviderType2["None"] = "none";
|
|
5
|
+
return ProviderType2;
|
|
6
|
+
})(ProviderType || {});
|
|
7
|
+
export {
|
|
8
|
+
ProviderType
|
|
9
|
+
};
|
package/types/rate.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ProviderType } from './providerType';
|
|
2
|
+
|
|
1
3
|
export interface RateRequestBody {
|
|
2
4
|
tokenIn: string;
|
|
3
5
|
amountIn: string;
|
|
@@ -8,4 +10,5 @@ export interface RateRequestBody {
|
|
|
8
10
|
export interface RateRequestResponse {
|
|
9
11
|
fee: string;
|
|
10
12
|
amountOut: string;
|
|
13
|
+
provider: ProviderType;
|
|
11
14
|
}
|