@dapplets/dapplet-extension
Version:
The Bridge to the Augmented Web.
46 lines (45 loc) • 2.36 kB
TypeScript
import * as nearAPI from 'near-api-js';
import { ConnectedAccountsRequestStatus, IConnectedAccountsPair, NearNetworks, TConnectedAccount, TConnectedAccountsVerificationRequestInfo, WalletDescriptorWithCAMainStatus } from '../../common/types';
import GlobalConfigService from './globalConfigService';
import { WalletService } from './walletService';
type EthSignature = {
sig: string;
v: number;
mc: boolean;
};
export default class ConnectedAccountService {
private _globalConfigService;
private _walletService;
_testnetContract: nearAPI.Contract;
_mainnetContract: nearAPI.Contract;
constructor(_globalConfigService: GlobalConfigService, _walletService: WalletService);
private _createContract;
private _getContract;
getConnectedAccounts(accountId: string, originId: string, closeness?: number, network?: NearNetworks): Promise<TConnectedAccount[][] | null>;
getMinStakeAmount(network?: NearNetworks): Promise<number>;
getPendingRequests(network?: NearNetworks): Promise<number[]>;
getVerificationRequest(id: number, network?: NearNetworks): Promise<TConnectedAccountsVerificationRequestInfo | null>;
getStatus(accountId: string, originId: string, network?: NearNetworks): Promise<boolean>;
areConnected(accountGId1: string, accountGId2: string, network?: NearNetworks): Promise<boolean>;
getNet(accountGId: string, network?: NearNetworks): Promise<string[] | null>;
getMainAccount(accountId: string, originId: string, network?: NearNetworks): Promise<string | null>;
getRequestStatus(id: number, network?: NearNetworks): Promise<ConnectedAccountsRequestStatus>;
getPairs({ receiver, prevPairs, }: {
receiver: WalletDescriptorWithCAMainStatus;
prevPairs: IConnectedAccountsPair[] | null;
}): Promise<IConnectedAccountsPair[]>;
requestVerification(props: {
firstAccountId: string;
firstOriginId: string;
secondAccountId: string;
secondOriginId: string;
isUnlink: boolean;
firstProofUrl?: string;
secondProofUrl?: string;
signature?: EthSignature;
statement?: string;
}, stake?: number, network?: NearNetworks): Promise<number>;
changeStatus(accountId: string, originId: string, isMain: boolean, network?: NearNetworks): Promise<void>;
private _hasEqualIdsPair;
}
export {};