Skip to content

Commit 01c3c31

Browse files
committed
refactor(app/reputation): move NFT operations into repository
1 parent ff2b4b7 commit 01c3c31

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/domain/reputation/helper/nftAbi.ts renamed to src/domain/reputation/helper/abi.ts

-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { abiContractFactory } from '@/utils/abiContractFactory';
18-
1917
const abi = [
2018
{
2119
inputs: [],
@@ -787,6 +785,4 @@ const abi = [
787785
},
788786
] as const;
789787

790-
export const { readActions: readNftAbiActions, writeActions: writeNftAbiActions } = abiContractFactory(abi);
791-
792788
export default abi;

src/domain/reputation/repository.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
import { TransactionBlock } from '@mysten/sui.js/transactions';
1818
import { waitForTransaction } from '@wagmi/core';
1919

20+
import { createContractActions } from '@/utils/contract';
2021
import httpClient from '@/utils/http';
2122

2223
import type { Address } from '@wagmi/core';
2324

24-
import { writeNftAbiActions } from './helper/nftAbi';
25+
import nftAbi from './helper/abi';
2526

27+
const { writeActions: { safeMint } } = createContractActions(nftAbi);
2628

2729
async function fetchGainedReputationList(userId) {
2830
return httpClient.get(`/nft/general/public/${userId}/infos`);
@@ -65,7 +67,7 @@ async function mintNft({
6567

6668
const signed = signRes.data;
6769

68-
const { hash } = await writeNftAbiActions.safeMint(contract, [
70+
const { hash } = await safeMint(contract, [
6971
address,
7072
id,
7173
userId,

0 commit comments

Comments
 (0)