@fastnear/wallet-adapter
Version:
Wallet adapter implementations for Meteor Wallet and Near Mobile
1 lines • 3.66 kB
Source Map (JSON)
{"version":3,"sources":["../../src/types.ts"],"sourcesContent":["export type WalletNetwork = \"mainnet\" | \"testnet\";\n\nexport interface WalletAccount {\n accountId: string;\n publicKey: string;\n}\n\nexport interface ConnectorActionLike {\n type: string;\n params?: Record<string, any>;\n}\n\nexport interface SignInParams {\n network: WalletNetwork;\n contractId?: string;\n methodNames?: string[];\n allowance?: string;\n}\n\nexport interface SignOutParams {\n network: WalletNetwork;\n}\n\nexport interface GetAccountsParams {\n network: WalletNetwork;\n}\n\nexport interface SignMessageParams {\n network: WalletNetwork;\n message: string;\n nonce: number[];\n recipient: string;\n callbackUrl?: string;\n state?: string;\n accountId?: string;\n}\n\nexport interface SignAndSendTransactionParams {\n network: WalletNetwork;\n signerId?: string;\n receiverId: string;\n actions: ConnectorActionLike[];\n}\n\nexport interface SignAndSendTransactionsParams {\n network: WalletNetwork;\n signerId?: string;\n transactions: Array<{\n receiverId: string;\n actions: ConnectorActionLike[];\n signerId?: string;\n }>;\n}\n\nexport interface WalletAdapter {\n signIn(params: SignInParams): Promise<WalletAccount[]>;\n signOut(params: SignOutParams): Promise<void>;\n getAccounts(params: GetAccountsParams): Promise<WalletAccount[]>;\n signMessage(params: SignMessageParams): Promise<{\n accountId: string;\n publicKey: string;\n signature: string;\n state?: string;\n }>;\n signAndSendTransaction(params: SignAndSendTransactionParams): Promise<any>;\n signAndSendTransactions(params: SignAndSendTransactionsParams): Promise<any[]>;\n}\n\nexport interface AdapterStorage {\n get(key: string): Promise<string | null | undefined> | string | null | undefined;\n set(key: string, value: string): Promise<void> | void;\n remove(key: string): Promise<void> | void;\n}\n\nexport interface PopupWindowLike {\n close?: () => void;\n focus?: () => void;\n postMessage?: (message: any, targetOrigin?: string) => void;\n closed?: boolean;\n windowIdPromise?: Promise<string | null>;\n}\n\nexport interface MeteorExtensionBridge {\n addMessageDataListener: (listener: (data: any) => void) => void;\n sendMessageData: (data: any) => void;\n}\n\nexport interface MeteorAdapterOptions {\n walletBaseUrl?: string;\n appKeyPrefix?: string;\n getLocation?: () => string;\n storage?: AdapterStorage;\n getNetworkProviders?: (network: WalletNetwork) => string[];\n openWindow?: (url: string, name?: string, features?: string) => PopupWindowLike | null | undefined;\n getExtensionBridge?: () => MeteorExtensionBridge | undefined;\n}\n\nexport interface NearMobileMetadata {\n name: string;\n logoUrl: string;\n url?: string;\n}\n\nexport interface NearMobileRequestPayload {\n id: string;\n kind: \"request\" | \"message\";\n network: WalletNetwork;\n requestUrl: string;\n request: unknown;\n close: () => Promise<void>;\n}\n\nexport interface NearMobileAdapterOptions {\n signerBackendUrl?: string;\n nearMobileWalletUrl?: string;\n storage?: AdapterStorage;\n metadata?: NearMobileMetadata;\n getNetworkProviders?: (network: WalletNetwork) => string[];\n onRequested?: (payload: NearMobileRequestPayload) => void;\n onApproved?: () => void;\n onSuccess?: () => void;\n onError?: (error?: Error) => void;\n fetcher?: typeof fetch;\n polling?: {\n delayMs?: number;\n maxIterations?: number;\n requestTimeoutMs?: number;\n backgroundVisibilityCheckIntervalMs?: number;\n backgroundVisibilityCheckTimeoutMs?: number;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}