diff --git a/src/idl/cardinal_paid_claim_approver.ts b/src/idl/cardinal_paid_claim_approver.ts index 919ce8bef..7ad3c650b 100644 --- a/src/idl/cardinal_paid_claim_approver.ts +++ b/src/idl/cardinal_paid_claim_approver.ts @@ -1,295 +1,295 @@ export type CardinalPaidClaimApprover = { - "version": "0.0.0", - "name": "cardinal_paid_claim_approver", - "instructions": [ + version: "0.0.0"; + name: "cardinal_paid_claim_approver"; + instructions: [ { - "name": "init", - "accounts": [ + name: "init"; + accounts: [ { - "name": "tokenManager", - "isMut": false, - "isSigner": false + name: "tokenManager"; + isMut: false; + isSigner: false; }, { - "name": "paymentManager", - "isMut": false, - "isSigner": false + name: "paymentManager"; + isMut: false; + isSigner: false; }, { - "name": "claimApprover", - "isMut": true, - "isSigner": false + name: "claimApprover"; + isMut: true; + isSigner: false; }, { - "name": "payer", - "isMut": true, - "isSigner": true + name: "payer"; + isMut: true; + isSigner: true; }, { - "name": "systemProgram", - "isMut": false, - "isSigner": false + name: "systemProgram"; + isMut: false; + isSigner: false; } - ], - "args": [ + ]; + args: [ { - "name": "bump", - "type": "u8" + name: "bump"; + type: "u8"; }, { - "name": "paymentAmount", - "type": "u64" + name: "paymentAmount"; + type: "u64"; } - ] + ]; }, { - "name": "pay", - "accounts": [ + name: "pay"; + accounts: [ { - "name": "tokenManager", - "isMut": false, - "isSigner": false + name: "tokenManager"; + isMut: false; + isSigner: false; }, { - "name": "paymentManager", - "isMut": false, - "isSigner": false + name: "paymentManager"; + isMut: false; + isSigner: false; }, { - "name": "paymentManagerTokenAccount", - "isMut": true, - "isSigner": false + name: "paymentManagerTokenAccount"; + isMut: true; + isSigner: false; }, { - "name": "claimApprover", - "isMut": true, - "isSigner": false + name: "claimApprover"; + isMut: true; + isSigner: false; }, { - "name": "payer", - "isMut": true, - "isSigner": true + name: "payer"; + isMut: true; + isSigner: true; }, { - "name": "payerTokenAccount", - "isMut": true, - "isSigner": false + name: "payerTokenAccount"; + isMut: true; + isSigner: false; }, { - "name": "claimReceipt", - "isMut": true, - "isSigner": false + name: "claimReceipt"; + isMut: true; + isSigner: false; }, { - "name": "cardinalTokenManager", - "isMut": false, - "isSigner": false + name: "cardinalTokenManager"; + isMut: false; + isSigner: false; }, { - "name": "tokenProgram", - "isMut": false, - "isSigner": false + name: "tokenProgram"; + isMut: false; + isSigner: false; }, { - "name": "systemProgram", - "isMut": false, - "isSigner": false + name: "systemProgram"; + isMut: false; + isSigner: false; } - ], - "args": [ + ]; + args: [ { - "name": "claimReceiptBump", - "type": "u8" + name: "claimReceiptBump"; + type: "u8"; } - ] + ]; } - ], - "accounts": [ + ]; + accounts: [ { - "name": "paidClaimApprover", - "type": { - "kind": "struct", - "fields": [ + name: "paidClaimApprover"; + type: { + kind: "struct"; + fields: [ { - "name": "bump", - "type": "u8" + name: "bump"; + type: "u8"; }, { - "name": "paymentAmount", - "type": "u64" + name: "paymentAmount"; + type: "u64"; } - ] - } + ]; + }; } - ], - "errors": [ + ]; + errors: [ { - "code": 300, - "name": "InvalidPaymentTokenAccount", - "msg": "Token account not owned by the claim approver" + code: 300; + name: "InvalidPaymentTokenAccount"; + msg: "Token account not owned by the claim approver"; }, { - "code": 301, - "name": "InvalidPayerTokenAccount", - "msg": "Token account not owned by the payer" + code: 301; + name: "InvalidPayerTokenAccount"; + msg: "Token account not owned by the payer"; }, { - "code": 302, - "name": "InvalidTokenManager", - "msg": "Invalid token manager for this claim approver" + code: 302; + name: "InvalidTokenManager"; + msg: "Invalid token manager for this claim approver"; }, { - "code": 303, - "name": "InvalidPaymentManager", - "msg": "Payment manager is invalid" + code: 303; + name: "InvalidPaymentManager"; + msg: "Payment manager is invalid"; } - ] + ]; }; export const IDL: CardinalPaidClaimApprover = { - "version": "0.0.0", - "name": "cardinal_paid_claim_approver", - "instructions": [ + version: "0.0.0", + name: "cardinal_paid_claim_approver", + instructions: [ { - "name": "init", - "accounts": [ + name: "init", + accounts: [ { - "name": "tokenManager", - "isMut": false, - "isSigner": false + name: "tokenManager", + isMut: false, + isSigner: false, }, { - "name": "paymentManager", - "isMut": false, - "isSigner": false + name: "paymentManager", + isMut: false, + isSigner: false, }, { - "name": "claimApprover", - "isMut": true, - "isSigner": false + name: "claimApprover", + isMut: true, + isSigner: false, }, { - "name": "payer", - "isMut": true, - "isSigner": true + name: "payer", + isMut: true, + isSigner: true, }, { - "name": "systemProgram", - "isMut": false, - "isSigner": false - } + name: "systemProgram", + isMut: false, + isSigner: false, + }, ], - "args": [ + args: [ { - "name": "bump", - "type": "u8" + name: "bump", + type: "u8", }, { - "name": "paymentAmount", - "type": "u64" - } - ] + name: "paymentAmount", + type: "u64", + }, + ], }, { - "name": "pay", - "accounts": [ + name: "pay", + accounts: [ { - "name": "tokenManager", - "isMut": false, - "isSigner": false + name: "tokenManager", + isMut: false, + isSigner: false, }, { - "name": "paymentManager", - "isMut": false, - "isSigner": false + name: "paymentManager", + isMut: false, + isSigner: false, }, { - "name": "paymentManagerTokenAccount", - "isMut": true, - "isSigner": false + name: "paymentManagerTokenAccount", + isMut: true, + isSigner: false, }, { - "name": "claimApprover", - "isMut": true, - "isSigner": false + name: "claimApprover", + isMut: true, + isSigner: false, }, { - "name": "payer", - "isMut": true, - "isSigner": true + name: "payer", + isMut: true, + isSigner: true, }, { - "name": "payerTokenAccount", - "isMut": true, - "isSigner": false + name: "payerTokenAccount", + isMut: true, + isSigner: false, }, { - "name": "claimReceipt", - "isMut": true, - "isSigner": false + name: "claimReceipt", + isMut: true, + isSigner: false, }, { - "name": "cardinalTokenManager", - "isMut": false, - "isSigner": false + name: "cardinalTokenManager", + isMut: false, + isSigner: false, }, { - "name": "tokenProgram", - "isMut": false, - "isSigner": false + name: "tokenProgram", + isMut: false, + isSigner: false, }, { - "name": "systemProgram", - "isMut": false, - "isSigner": false - } + name: "systemProgram", + isMut: false, + isSigner: false, + }, ], - "args": [ + args: [ { - "name": "claimReceiptBump", - "type": "u8" - } - ] - } + name: "claimReceiptBump", + type: "u8", + }, + ], + }, ], - "accounts": [ + accounts: [ { - "name": "paidClaimApprover", - "type": { - "kind": "struct", - "fields": [ + name: "paidClaimApprover", + type: { + kind: "struct", + fields: [ { - "name": "bump", - "type": "u8" + name: "bump", + type: "u8", }, { - "name": "paymentAmount", - "type": "u64" - } - ] - } - } + name: "paymentAmount", + type: "u64", + }, + ], + }, + }, ], - "errors": [ + errors: [ { - "code": 300, - "name": "InvalidPaymentTokenAccount", - "msg": "Token account not owned by the claim approver" + code: 300, + name: "InvalidPaymentTokenAccount", + msg: "Token account not owned by the claim approver", }, { - "code": 301, - "name": "InvalidPayerTokenAccount", - "msg": "Token account not owned by the payer" + code: 301, + name: "InvalidPayerTokenAccount", + msg: "Token account not owned by the payer", }, { - "code": 302, - "name": "InvalidTokenManager", - "msg": "Invalid token manager for this claim approver" + code: 302, + name: "InvalidTokenManager", + msg: "Invalid token manager for this claim approver", }, { - "code": 303, - "name": "InvalidPaymentManager", - "msg": "Payment manager is invalid" - } - ] + code: 303, + name: "InvalidPaymentManager", + msg: "Payment manager is invalid", + }, + ], }; diff --git a/src/programs/claimApprover/instruction.ts b/src/programs/claimApprover/instruction.ts index 9ccd0f104..95b0f428a 100644 --- a/src/programs/claimApprover/instruction.ts +++ b/src/programs/claimApprover/instruction.ts @@ -7,9 +7,9 @@ import type { TransactionInstruction, } from "@solana/web3.js"; import { SystemProgram } from "@solana/web3.js"; + import { TOKEN_MANAGER_ADDRESS } from "../tokenManager"; import { findClaimReceiptId } from "../tokenManager/pda"; - import type { CLAIM_APPROVER_PROGRAM } from "./constants"; import { CLAIM_APPROVER_ADDRESS, CLAIM_APPROVER_IDL } from "./constants"; import { findClaimApproverAddress } from "./pda";