@funded-labs/plug-controller
Version:
Internet Computer Plug wallet's controller
115 lines (114 loc) • 3.88 kB
TypeScript
import { HttpAgent, PublicKey } from '@dfinity/agent';
import { NFTDetails, TokenInterfaces } from '@funded-labs/dab-js';
import { JSONWallet, ICNSData, PlugWalletArgs, WalletNFTCollection, WalletNFTInfo } from '../interfaces/plug_wallet';
import { StandardToken, TokenBalance } from '../interfaces/token';
import { FormattedTransactions } from '../interfaces/transactions';
import { Address } from '../interfaces/contact_registry';
import { Network } from '../PlugKeyRing/modules/NetworkModule';
import { RegisteredNFT } from '../PlugKeyRing/modules/NetworkModule/Network';
import { Types } from '../utils/account/constants';
import { GenericSignIdentity } from '../utils/identity/genericSignIdentity';
declare class PlugWallet {
name: string;
icon?: string;
walletId: string;
orderNumber: number;
walletNumber?: number;
principal: string;
fetch: any;
icnsData: ICNSData;
contacts: Array<Address>;
type: Types;
private identity;
private agent;
private network;
private blsVerify;
constructor({ name, icon, walletId, orderNumber, walletNumber, fetch, icnsData, network, identity, type, blsVerify, }: PlugWalletArgs);
get accountId(): string;
setNetwork(network: Network): Promise<void>;
setName(val: string): void;
sign({ payload, }: {
payload: ArrayBuffer;
}): Promise<ArrayBuffer>;
setIcon(val: string): void;
private populateAndTrimNFTs;
private nativeGetNFTs;
getNFTs: (args?: {
refresh?: boolean | undefined;
} | undefined) => Promise<WalletNFTCollection[] | null>;
transferNFT: (args: {
token: NFTDetails;
to: string;
}) => Promise<boolean>;
getTokenInfo: ({ canisterId, standard }: {
canisterId: any;
standard: any;
}) => Promise<TokenBalance>;
getNFTInfo: ({ canisterId, standard, }: {
canisterId: any;
standard: any;
}) => Promise<WalletNFTInfo>;
registerNFT: ({ canisterId, standard, }: {
canisterId: any;
standard: any;
}) => Promise<RegisteredNFT | undefined>;
registerToken: (args: {
canisterId: string;
standard: string;
logo?: string;
shouldFetchBalance?: boolean;
}) => Promise<TokenBalance>;
toJSON: () => JSONWallet;
burnXTC: (args: {
to: string;
amount: string;
}) => Promise<TokenInterfaces.BurnResult>;
getTokenBalance: ({ token, }: {
token: StandardToken;
}) => Promise<TokenBalance>;
getBalances: () => Promise<Array<TokenBalance>>;
getTransactions: ({ icpPrice, }: {
icpPrice: any;
}) => Promise<FormattedTransactions>;
send: (args: {
to: string;
amount: string;
canisterId: string;
opts?: TokenInterfaces.SendOpts;
}) => Promise<TokenInterfaces.SendResponse>;
approve: (args: {
spender: string;
amount: bigint;
canisterId: string;
nonce?: bigint;
}) => Promise<void>;
getAgent({ host }: {
host?: string;
}): HttpAgent;
get publicKey(): PublicKey;
get pemFile(): string;
getIdentity(): GenericSignIdentity;
getICNSData: () => Promise<{
names: string[];
reverseResolvedName: string | undefined;
}>;
getReverseResolvedName: () => Promise<string | undefined>;
setReverseResolvedName: ({ name, }: {
name: string;
}) => Promise<string>;
getContacts: () => Promise<Array<Address>>;
addContact: ({ contact, }: {
contact: Address;
}) => Promise<boolean>;
deleteContact: ({ addressName, }: {
addressName: string;
}) => Promise<boolean>;
removeToken: (args: {
canisterId: string;
}) => Promise<StandardToken[]>;
delegateIdentity: (args: {
to: ArrayBuffer;
targets: string[];
}) => Promise<string>;
}
export default PlugWallet;