Skip to content

Commit

Permalink
Merge pull request #1893 from Chia-Network/zsolt/crcat-api
Browse files Browse the repository at this point in the history
Add crCat api
  • Loading branch information
seeden committed Jul 12, 2023
2 parents 5f9b3fb + 7c9a4e9 commit dbb3fc6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/api-react/src/services/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,10 @@ export const walletApi = apiWithTag.injectEndpoints({
],
}),

crCatApprovePending: mutation(build, CAT, 'crCatApprovePending', {
invalidatesTags: [{ type: 'Transactions', id: 'LIST' }],
}),

// PlotNFTs

// TODO refactor
Expand Down
1 change: 1 addition & 0 deletions packages/api/src/constants/TransactionType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ enum TransactionType {
INCOMING_CLAWBACK_RECEIVE = 6,
INCOMING_CLAWBACK_SEND = 7,
OUTGOING_CLAWBACK = 8,
INCOMING_CRCAT_PENDING = 9,
}

export default TransactionType;
16 changes: 16 additions & 0 deletions packages/api/src/wallets/CAT.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type BigNumber from 'bignumber.js';

import CATToken, { type CATTokenStray } from '../@types/CATToken';
import type Transaction from '../@types/Transaction';
import Wallet from '../services/WalletService';
Expand Down Expand Up @@ -74,4 +76,18 @@ export default class CATWallet extends Wallet {
strayCats: CATTokenStray[];
}>('get_stray_cats');
}

async crCatApprovePending(args: {
walletId: number;
minAmountToClaim: number | BigNumber;
fee: number | BigNumber;
minCoinAmount?: number | BigNumber;
maxCoinAmount?: number | BigNumber;
excludedCoinAmounts?: Array<number | BigNumber>;
reusePuzhash?: boolean;
}) {
return this.command<{
transactions: Transaction[];
}>('crcat_approve_pending', args);
}
}

0 comments on commit dbb3fc6

Please sign in to comment.