@multiversx/sdk-dapp-liquidity 1.1.0-alpha.15 → 1.1.0-alpha.17
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/package.json +1 -1
- package/reactjs/components/BridgeForm/BridgeForm.js +49 -55
- package/reactjs/components/BridgeForm/BridgeForm.mjs +49 -55
- package/reactjs/hooks/useSignTransaction.d.ts +1 -1
- package/reactjs/hooks/useSignTransaction.js +1 -1
- package/reactjs/hooks/useSignTransaction.mjs +1 -1
package/package.json
CHANGED
|
@@ -388,33 +388,30 @@ const BridgeForm = ({
|
|
|
388
388
|
setPendingSigning(true);
|
|
389
389
|
setSigningTransactionsCount(() => transactions.length);
|
|
390
390
|
try {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
391
|
+
let txIndex = -1;
|
|
392
|
+
for (const transaction of transactions) {
|
|
393
|
+
++txIndex;
|
|
394
|
+
let txHash;
|
|
395
|
+
try {
|
|
396
|
+
switch (selectedChainOption == null ? void 0 : selectedChainOption.chainType) {
|
|
397
|
+
case types_chainType.ChainType.sol:
|
|
395
398
|
if (!transaction.instructions || !transaction.feePayer) {
|
|
396
|
-
|
|
399
|
+
break;
|
|
397
400
|
}
|
|
398
|
-
await solana.signTransaction({
|
|
401
|
+
txHash = await solana.signTransaction({
|
|
399
402
|
feePayer: transaction.feePayer,
|
|
400
403
|
instructions: transaction.instructions
|
|
401
404
|
});
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
case types_chainType.ChainType.evm:
|
|
413
|
-
let txIndex = -1;
|
|
414
|
-
for (const transaction of transactions) {
|
|
415
|
-
++txIndex;
|
|
416
|
-
try {
|
|
417
|
-
const txHash = await evm.signTransaction({
|
|
405
|
+
if (!txHash) {
|
|
406
|
+
break;
|
|
407
|
+
}
|
|
408
|
+
signedTransactions.push({
|
|
409
|
+
...transaction,
|
|
410
|
+
txHash
|
|
411
|
+
});
|
|
412
|
+
break;
|
|
413
|
+
case types_chainType.ChainType.evm:
|
|
414
|
+
txHash = await evm.signTransaction({
|
|
418
415
|
...transaction,
|
|
419
416
|
value: BigInt(transaction.value),
|
|
420
417
|
gas: BigInt(transaction.gasLimit),
|
|
@@ -424,46 +421,43 @@ const BridgeForm = ({
|
|
|
424
421
|
...transaction,
|
|
425
422
|
txHash
|
|
426
423
|
});
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
);
|
|
430
|
-
if (txIndex === transactions.length - 1) {
|
|
431
|
-
continue;
|
|
432
|
-
}
|
|
433
|
-
const transactionReceipt = await waitForTransactionReceipt(
|
|
434
|
-
config,
|
|
435
|
-
{
|
|
436
|
-
confirmations: 1,
|
|
437
|
-
hash: txHash
|
|
438
|
-
}
|
|
439
|
-
);
|
|
440
|
-
console.info({
|
|
441
|
-
transactionReceipt,
|
|
442
|
-
hash: txHash
|
|
443
|
-
});
|
|
444
|
-
} catch (e) {
|
|
445
|
-
reactToastify.toast.dismiss();
|
|
446
|
-
reactToastify.toast.error("Transaction aborted");
|
|
447
|
-
onFailedSentTransaction == null ? void 0 : onFailedSentTransaction("Transaction aborted");
|
|
424
|
+
break;
|
|
425
|
+
default:
|
|
426
|
+
reactToastify.toast.error("Provider not supported");
|
|
448
427
|
setPendingSigning(false);
|
|
449
428
|
return;
|
|
450
|
-
}
|
|
451
429
|
}
|
|
452
|
-
|
|
453
|
-
transactions
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
430
|
+
setSigningTransactionsCount(
|
|
431
|
+
() => transactions.length - 1 - txIndex
|
|
432
|
+
);
|
|
433
|
+
if (txIndex === transactions.length - 1 || !txHash || (selectedChainOption == null ? void 0 : selectedChainOption.chainType) !== types_chainType.ChainType.evm) {
|
|
434
|
+
continue;
|
|
435
|
+
}
|
|
436
|
+
const transactionReceipt = await waitForTransactionReceipt(config, {
|
|
437
|
+
confirmations: 1,
|
|
438
|
+
hash: txHash
|
|
457
439
|
});
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
reactToastify.toast.
|
|
440
|
+
console.info({
|
|
441
|
+
transactionReceipt,
|
|
442
|
+
hash: txHash
|
|
443
|
+
});
|
|
444
|
+
} catch (e) {
|
|
445
|
+
reactToastify.toast.dismiss();
|
|
446
|
+
reactToastify.toast.error("Transaction aborted");
|
|
447
|
+
onFailedSentTransaction == null ? void 0 : onFailedSentTransaction("Transaction aborted");
|
|
464
448
|
setPendingSigning(false);
|
|
465
449
|
return;
|
|
450
|
+
}
|
|
466
451
|
}
|
|
452
|
+
await sendTransactions({
|
|
453
|
+
transactions: signedTransactions,
|
|
454
|
+
provider,
|
|
455
|
+
url: helpers_getApiURL.getApiURL() ?? "",
|
|
456
|
+
token: nativeAuthToken ?? ""
|
|
457
|
+
});
|
|
458
|
+
const txHashes = signedTransactions.map((tx) => tx.txHash);
|
|
459
|
+
onSuccess(txHashes);
|
|
460
|
+
setPendingSigning(false);
|
|
467
461
|
} catch (e) {
|
|
468
462
|
console.error(e);
|
|
469
463
|
reactToastify.toast.dismiss();
|
|
@@ -385,33 +385,30 @@ const BridgeForm = ({
|
|
|
385
385
|
setPendingSigning(true);
|
|
386
386
|
setSigningTransactionsCount(() => transactions.length);
|
|
387
387
|
try {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
388
|
+
let txIndex = -1;
|
|
389
|
+
for (const transaction of transactions) {
|
|
390
|
+
++txIndex;
|
|
391
|
+
let txHash;
|
|
392
|
+
try {
|
|
393
|
+
switch (selectedChainOption == null ? void 0 : selectedChainOption.chainType) {
|
|
394
|
+
case ChainType.sol:
|
|
392
395
|
if (!transaction.instructions || !transaction.feePayer) {
|
|
393
|
-
|
|
396
|
+
break;
|
|
394
397
|
}
|
|
395
|
-
await solana.signTransaction({
|
|
398
|
+
txHash = await solana.signTransaction({
|
|
396
399
|
feePayer: transaction.feePayer,
|
|
397
400
|
instructions: transaction.instructions
|
|
398
401
|
});
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
case ChainType.evm:
|
|
410
|
-
let txIndex = -1;
|
|
411
|
-
for (const transaction of transactions) {
|
|
412
|
-
++txIndex;
|
|
413
|
-
try {
|
|
414
|
-
const txHash = await evm.signTransaction({
|
|
402
|
+
if (!txHash) {
|
|
403
|
+
break;
|
|
404
|
+
}
|
|
405
|
+
signedTransactions.push({
|
|
406
|
+
...transaction,
|
|
407
|
+
txHash
|
|
408
|
+
});
|
|
409
|
+
break;
|
|
410
|
+
case ChainType.evm:
|
|
411
|
+
txHash = await evm.signTransaction({
|
|
415
412
|
...transaction,
|
|
416
413
|
value: BigInt(transaction.value),
|
|
417
414
|
gas: BigInt(transaction.gasLimit),
|
|
@@ -421,46 +418,43 @@ const BridgeForm = ({
|
|
|
421
418
|
...transaction,
|
|
422
419
|
txHash
|
|
423
420
|
});
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
);
|
|
427
|
-
if (txIndex === transactions.length - 1) {
|
|
428
|
-
continue;
|
|
429
|
-
}
|
|
430
|
-
const transactionReceipt = await waitForTransactionReceipt(
|
|
431
|
-
config,
|
|
432
|
-
{
|
|
433
|
-
confirmations: 1,
|
|
434
|
-
hash: txHash
|
|
435
|
-
}
|
|
436
|
-
);
|
|
437
|
-
console.info({
|
|
438
|
-
transactionReceipt,
|
|
439
|
-
hash: txHash
|
|
440
|
-
});
|
|
441
|
-
} catch (e) {
|
|
442
|
-
toast.dismiss();
|
|
443
|
-
toast.error("Transaction aborted");
|
|
444
|
-
onFailedSentTransaction == null ? void 0 : onFailedSentTransaction("Transaction aborted");
|
|
421
|
+
break;
|
|
422
|
+
default:
|
|
423
|
+
toast.error("Provider not supported");
|
|
445
424
|
setPendingSigning(false);
|
|
446
425
|
return;
|
|
447
|
-
}
|
|
448
426
|
}
|
|
449
|
-
|
|
450
|
-
transactions
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
427
|
+
setSigningTransactionsCount(
|
|
428
|
+
() => transactions.length - 1 - txIndex
|
|
429
|
+
);
|
|
430
|
+
if (txIndex === transactions.length - 1 || !txHash || (selectedChainOption == null ? void 0 : selectedChainOption.chainType) !== ChainType.evm) {
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
const transactionReceipt = await waitForTransactionReceipt(config, {
|
|
434
|
+
confirmations: 1,
|
|
435
|
+
hash: txHash
|
|
454
436
|
});
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
toast.
|
|
437
|
+
console.info({
|
|
438
|
+
transactionReceipt,
|
|
439
|
+
hash: txHash
|
|
440
|
+
});
|
|
441
|
+
} catch (e) {
|
|
442
|
+
toast.dismiss();
|
|
443
|
+
toast.error("Transaction aborted");
|
|
444
|
+
onFailedSentTransaction == null ? void 0 : onFailedSentTransaction("Transaction aborted");
|
|
461
445
|
setPendingSigning(false);
|
|
462
446
|
return;
|
|
447
|
+
}
|
|
463
448
|
}
|
|
449
|
+
await sendTransactions({
|
|
450
|
+
transactions: signedTransactions,
|
|
451
|
+
provider,
|
|
452
|
+
url: getApiURL() ?? "",
|
|
453
|
+
token: nativeAuthToken ?? ""
|
|
454
|
+
});
|
|
455
|
+
const txHashes = signedTransactions.map((tx) => tx.txHash);
|
|
456
|
+
onSuccess(txHashes);
|
|
457
|
+
setPendingSigning(false);
|
|
464
458
|
} catch (e) {
|
|
465
459
|
console.error(e);
|
|
466
460
|
toast.dismiss();
|
|
@@ -75,7 +75,7 @@ export declare const useSignTransaction: () => {
|
|
|
75
75
|
signTransaction: ({ feePayer, instructions }: {
|
|
76
76
|
feePayer: string;
|
|
77
77
|
instructions: ServerTransactionInstruction[];
|
|
78
|
-
}) => Promise<
|
|
78
|
+
}) => Promise<string | undefined>;
|
|
79
79
|
connection: import('@solana/web3.js').Connection | undefined;
|
|
80
80
|
walletProvider: Provider;
|
|
81
81
|
};
|
|
@@ -34,7 +34,7 @@ const useSignTransaction = () => {
|
|
|
34
34
|
if (connection) {
|
|
35
35
|
transaction.recentBlockhash = (await connection.getLatestBlockhash("confirmed")).blockhash;
|
|
36
36
|
}
|
|
37
|
-
await walletProvider.signAndSendTransaction(transaction);
|
|
37
|
+
return await walletProvider.signAndSendTransaction(transaction);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
return {
|
|
@@ -31,7 +31,7 @@ const useSignTransaction = () => {
|
|
|
31
31
|
if (connection) {
|
|
32
32
|
transaction.recentBlockhash = (await connection.getLatestBlockhash("confirmed")).blockhash;
|
|
33
33
|
}
|
|
34
|
-
await walletProvider.signAndSendTransaction(transaction);
|
|
34
|
+
return await walletProvider.signAndSendTransaction(transaction);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
return {
|