-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgas-less-transfer.ts
40 lines (38 loc) · 1001 Bytes
/
gas-less-transfer.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { Result } from '~/suite-utils';
import { Pubkey, Secret } from '~/types/account';
import {
GasLessTransferOptions,
PartialSignStructure,
} from '~/types/transaction-builder';
import { SplToken } from '~/suite-spl-token';
export namespace RegularNft {
const NFT_AMOUNT = 1;
const NFT_DECIMALS = 0;
/**
* Transfer without solana sol, delegate feepayer for commission
*
* @param {Pubkey} mint
* @param {Secret} owner
* @param {Pubkey} dest
* @param {Pubkey} feePayer
* @param {Partial<GasLessTransferOptions>} options
* @return Promise<Result<PartialSignStructure, Error>>
*/
export const gasLessTransfer = async (
mint: Pubkey,
owner: Secret,
dest: Pubkey,
feePayer: Pubkey,
options: Partial<GasLessTransferOptions> = {},
): Promise<Result<PartialSignStructure, Error>> => {
return SplToken.gasLessTransfer(
mint,
owner,
dest,
NFT_AMOUNT,
NFT_DECIMALS,
feePayer,
options,
);
};
}