Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/config/config.devnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { EnvironmentsEnum } from 'types';
export * from './sharedConfig';

export const contractAddress =
'erd1qqqqqqqqqqqqqpgqm6ad6xrsjvxlcdcffqe8w58trpec09ug9l5qde96pq';
'erd1qqqqqqqqqqqqqpgqx3p5prqkyx0cek8zapn84ejkn46j9szlk3sqpx66pm';
export const API_URL = 'https://devnet-template-api.multiversx.com';
export const sampleAuthenticatedDomains = [API_URL];
export const environment = EnvironmentsEnum.devnet;
59 changes: 59 additions & 0 deletions src/contracts/escrow.abi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"buildInfo": {
"rustc": {
"version": "1.80.0-nightly",
"commitHash": "debd22da66cfa97c74040ebf68e420672ac8560e",
"commitDate": "2024-05-29",
"channel": "Nightly",
"short": "rustc 1.80.0-nightly (debd22da6 2024-05-29)"
},
"contractCrate": {
"name": "escrow",
"version": "0.0.0"
},
"framework": {
"name": "multiversx-sc",
"version": "0.47.4"
}
},
"name": "Escrow",
"constructor": {
"inputs": [],
"outputs": []
},
"endpoints": [
{
"name": "deposit",
"mutability": "mutable",
"payableInTokens": [
"EGLD"
],
"inputs": [],
"outputs": []
},
{
"name": "withdraw",
"mutability": "mutable",
"inputs": [],
"outputs": []
},
{
"name": "getUserBalance",
"mutability": "readonly",
"inputs": [
{
"name": "address",
"type": "Address"
}
],
"outputs": [
{
"type": "BigUint"
}
]
}
],
"esdtAttributes": [],
"hasCallback": false,
"types": {}
}
4 changes: 3 additions & 1 deletion src/hooks/transactions/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export * from './useSendPingPongTransaction';
export * from './useGetBalance';
export * from './useSendDeposit';
export * from './useSendWithdraw';
5 changes: 5 additions & 0 deletions src/hooks/transactions/useGetBalance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const useGetBalance = () => {
return async () => {
console.log('useGetBalance');
};
};
33 changes: 33 additions & 0 deletions src/hooks/transactions/useSendDeposit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Address } from '@multiversx/sdk-core';
import { smartContract } from 'utils/smartContract';
import { getChainId } from 'utils/getChainId';
import { refreshAccount, sendTransactions } from 'helpers/sdkDappHelpers';
import { RouteNamesEnum } from 'localConstants';
import { useGetAccount } from 'hooks/sdkDappHooks';

export const useSendDeposit = () => {
const { address } = useGetAccount();

return async (amount: string) => {
const depositTransaction = smartContract.methodsExplicit
.deposit()
.withValue(amount)
.withGasLimit(60000000)
.withSender(new Address(address))
.withChainID(getChainId())
.buildTransaction();

await refreshAccount();

await sendTransactions({
transactions: [depositTransaction],
transactionsDisplayInfo: {
processingMessage: 'Processing Deposit transaction',
errorMessage: 'An error has occured during Ping',
successMessage: 'Deposit successful'
},
redirectAfterSign: false,
callbackRoute: RouteNamesEnum.dashboard
});
};
};
209 changes: 0 additions & 209 deletions src/hooks/transactions/useSendPingPongTransaction.ts

This file was deleted.

5 changes: 5 additions & 0 deletions src/hooks/transactions/useSendWithdraw.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const useSendWithdraw = () => {
return async () => {
console.log('useSendWithdraw');
};
};
Loading