Skip to content

Commit

Permalink
adjust code for guardians support
Browse files Browse the repository at this point in the history
  • Loading branch information
juliancwirko committed Jul 28, 2023
1 parent ead421b commit 9ead2c9
Show file tree
Hide file tree
Showing 5 changed files with 2,257 additions and 3,471 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### [8.4.0](https://github.com/xdevguild/nextjs-dapp-template/releases/tag/v8.4.0) (2023-07-28)
- update useElven (guardians support)
- update other dependencies

### [8.3.0](https://github.com/xdevguild/nextjs-dapp-template/releases/tag/v8.3.0) (2023-06-29)
- update useElven (switch to tsup)
- update other dependancies
Expand Down
13 changes: 11 additions & 2 deletions components/demo/SimpleEGLDTxDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
useTransaction,
TransactionCallbackParams,
useConfig,
useAccount,
} from '@useelven/core';
import { useCallback } from 'react';
import { ActionButton } from '../tools/ActionButton';
Expand All @@ -19,17 +20,25 @@ export const SimpleEGLDTxDemo = ({
cb: (params: TransactionCallbackParams) => void;
}) => {
const { pending, triggerTx } = useTransaction({ cb });
const { activeGuardianAddress } = useAccount();
const { explorerAddress, chainType } = useConfig();

const handleSendTx = useCallback(() => {
const demoMessage = 'Transaction demo!';

let gasLimit = 50000 + 1500 * demoMessage.length;

if (activeGuardianAddress) {
gasLimit = gasLimit + 50000;
}

triggerTx({
address: egldTransferAddress,
gasLimit: 50000 + 1500 * demoMessage.length,
gasLimit,
data: new TransactionPayload(demoMessage),
value: TokenTransfer.egldFromAmount(egldTransferAmount),
});
}, [triggerTx]);
}, [activeGuardianAddress, triggerTx]);

return (
<FlexCardWrapper>
Expand Down
12 changes: 10 additions & 2 deletions components/demo/SimpleNftMintDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
useTransaction,
TransactionCallbackParams,
useConfig,
useAccount,
} from '@useelven/core';
import { useCallback } from 'react';
import { ActionButton } from '../tools/ActionButton';
Expand All @@ -27,6 +28,7 @@ export const SimpleNftMintDemo = ({
cb: (params: TransactionCallbackParams) => void;
}) => {
const { pending, triggerTx } = useTransaction({ cb });
const { activeGuardianAddress } = useAccount();
const { explorerAddress, chainType } = useConfig();

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

let gasLimit = 14000000;

if (activeGuardianAddress) {
gasLimit = gasLimit + 50000;
}

triggerTx({
address: mintSmartContractAddress,
gasLimit: 14000000,
gasLimit,
value: TokenTransfer.egldFromAmount(mintPaymentPerToken),
data,
});
}, [triggerTx]);
}, [activeGuardianAddress, triggerTx]);

return (
<FlexCardWrapper>
Expand Down
Loading

0 comments on commit 9ead2c9

Please sign in to comment.