Skip to content

Commit 9ead2c9

Browse files
committed
adjust code for guardians support
1 parent ead421b commit 9ead2c9

File tree

5 files changed

+2257
-3471
lines changed

5 files changed

+2257
-3471
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### [8.4.0](https://github.com/xdevguild/nextjs-dapp-template/releases/tag/v8.4.0) (2023-07-28)
2+
- update useElven (guardians support)
3+
- update other dependencies
4+
15
### [8.3.0](https://github.com/xdevguild/nextjs-dapp-template/releases/tag/v8.3.0) (2023-06-29)
26
- update useElven (switch to tsup)
37
- update other dependancies

components/demo/SimpleEGLDTxDemo.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
useTransaction,
55
TransactionCallbackParams,
66
useConfig,
7+
useAccount,
78
} from '@useelven/core';
89
import { useCallback } from 'react';
910
import { ActionButton } from '../tools/ActionButton';
@@ -19,17 +20,25 @@ export const SimpleEGLDTxDemo = ({
1920
cb: (params: TransactionCallbackParams) => void;
2021
}) => {
2122
const { pending, triggerTx } = useTransaction({ cb });
23+
const { activeGuardianAddress } = useAccount();
2224
const { explorerAddress, chainType } = useConfig();
2325

2426
const handleSendTx = useCallback(() => {
2527
const demoMessage = 'Transaction demo!';
28+
29+
let gasLimit = 50000 + 1500 * demoMessage.length;
30+
31+
if (activeGuardianAddress) {
32+
gasLimit = gasLimit + 50000;
33+
}
34+
2635
triggerTx({
2736
address: egldTransferAddress,
28-
gasLimit: 50000 + 1500 * demoMessage.length,
37+
gasLimit,
2938
data: new TransactionPayload(demoMessage),
3039
value: TokenTransfer.egldFromAmount(egldTransferAmount),
3140
});
32-
}, [triggerTx]);
41+
}, [activeGuardianAddress, triggerTx]);
3342

3443
return (
3544
<FlexCardWrapper>

components/demo/SimpleNftMintDemo.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
useTransaction,
1010
TransactionCallbackParams,
1111
useConfig,
12+
useAccount,
1213
} from '@useelven/core';
1314
import { useCallback } from 'react';
1415
import { ActionButton } from '../tools/ActionButton';
@@ -27,6 +28,7 @@ export const SimpleNftMintDemo = ({
2728
cb: (params: TransactionCallbackParams) => void;
2829
}) => {
2930
const { pending, triggerTx } = useTransaction({ cb });
31+
const { activeGuardianAddress } = useAccount();
3032
const { explorerAddress, chainType } = useConfig();
3133

3234
const handleSendTx = useCallback(() => {
@@ -36,13 +38,19 @@ export const SimpleNftMintDemo = ({
3638
.setArgs([new U32Value(1)])
3739
.build();
3840

41+
let gasLimit = 14000000;
42+
43+
if (activeGuardianAddress) {
44+
gasLimit = gasLimit + 50000;
45+
}
46+
3947
triggerTx({
4048
address: mintSmartContractAddress,
41-
gasLimit: 14000000,
49+
gasLimit,
4250
value: TokenTransfer.egldFromAmount(mintPaymentPerToken),
4351
data,
4452
});
45-
}, [triggerTx]);
53+
}, [activeGuardianAddress, triggerTx]);
4654

4755
return (
4856
<FlexCardWrapper>

0 commit comments

Comments
 (0)