-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal.d.ts
52 lines (42 loc) · 1.33 KB
/
global.d.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
41
42
43
44
45
46
47
48
49
50
51
import { WalletConnection, Contract } from 'near-api-js'
export declare global {
interface Window {
// add you custom properties and methods
accountId: any;
nftWalletConnection: WalletConnection;
minterWalletConnection: WalletConnection;
nft_contract: Contract & NftContractMethods;
minter_contract: Contract & MinterContractMethods;
}
interface NftContractMethods {
nft_mint?: ContractChangeMethod<MintArgs>
}
interface NftContractMethods {
nft_token?: ContractViewMethod<NFTTokenArgs>;
nft_tokens_for_owner?: ContractViewMethod<NFTTokensForOwnerArgs>;
// TODO: add type for TransferArgs
// see https://github.com/bafnetwork/baf-badges/issues/1
nft_transfer?: ContractChangeMethod<any>;
}
}
export type ContractViewMethod<Args> = (args: Args) => Promise<any>;
export type ContractChangeMethod<Args> = (params: ContractChangeMethodParams<Args>) => Promise<any>;
export interface ContractChangeMethodParams<Args> {
args: Args,
gas?: string,
amount?: string
}
export interface NFTTokenArgs {
token_id: string;
}
/// it must be the case that either both from_index and limit are present or none of them are
export interface NFTTokensForOwnerArgs {
account_id: string;
from_index?: number;
to_index?: number;
}
export interface MintArgs {
token_id: string;
token_owner_id: string;
token_metadata?: any;
}