@automata-network/2fa-guru-sdk
Advanced tools
Comparing version 1.0.5 to 1.0.6
{ | ||
"name": "@automata-network/2fa-guru-sdk", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"main": "./src/index.ts", | ||
@@ -5,0 +5,0 @@ "description": "A SDK for easy integration with 2FA Guru", |
@@ -36,5 +36,3 @@ # Introduction | ||
- `executeTxnCall` - Execute a low lvl call to the blockchain. Used with the signature generated from check2fa() | ||
- `is2faCreated` - Check whether a wallet is signed up for 2FA | ||
- `get2faCooldown` - Check at what timestamp 2fa will be disabled for the wallet | ||
- `getBindingExpiry` - Check at what timestamp recovery wallet binding will be disabllowed for the primary wallet | ||
- `get2faInfo` - Get info the binding expiry, disable 2fa cooldown and whether 2fa has been created for the wallet | ||
- `getRecoveryWallet` - Retrieve the recovery wallet of a primary wallet. 0x0 is returned if no recovery wallet is present. | ||
@@ -41,0 +39,0 @@ - `getWalletNonce` - Retrieve the nonce of a wallet address |
@@ -6,2 +6,3 @@ import { JsonRpcProvider } from '@ethersproject/providers'; | ||
import { | ||
Result, | ||
JsonResponse, | ||
@@ -323,21 +324,2 @@ ApiResponse, | ||
/** | ||
* Check whether a wallet is signed up for 2FA | ||
* @param chainId - connected chain id | ||
* @param connectedWallet - address of your connected primary wallet | ||
*/ | ||
is2faCreated = async ( | ||
chainId: number, | ||
connectedWallet: string | ||
): Promise<boolean> => { | ||
const reqOptions = buildRequest(this.is2faCreatedMethod, { | ||
chainId: chainId.toString(), | ||
signer: connectedWallet, | ||
}); | ||
const jsonResponse = await fetch(this.apiServer, reqOptions); | ||
const parsedJsonResponse: JsonResponse = await jsonResponse.json(); | ||
return parsedJsonResponse.result.success; | ||
}; | ||
/** | ||
* Check at what timestamp 2fa will be disabled for the wallet | ||
@@ -347,6 +329,6 @@ * @param chainId - connected chain id | ||
*/ | ||
get2faCooldown = async ( | ||
get2faInfo = async ( | ||
chainId: number, | ||
connectedWallet: string | ||
): Promise<number | null> => { | ||
): Promise<Result | null> => { | ||
const reqOptions = buildRequest(this.is2faCreatedMethod, { | ||
@@ -359,25 +341,6 @@ chainId: chainId.toString(), | ||
const parsedJsonResponse: JsonResponse = await jsonResponse.json(); | ||
return parsedJsonResponse.result.cooldown_ttl; | ||
return parsedJsonResponse.result; | ||
}; | ||
/** | ||
* Check at what timestamp recovery wallet binding will be disabllowed for the primary wallet | ||
* @param chainId - connected chain id | ||
* @param connectedWallet - address of your connected primary wallet | ||
*/ | ||
getBindingExpiry = async ( | ||
chainId: number, | ||
connectedWallet: string | ||
): Promise<number | null> => { | ||
const reqOptions = buildRequest(this.is2faCreatedMethod, { | ||
chainId: chainId.toString(), | ||
signer: connectedWallet, | ||
}); | ||
const jsonResponse = await fetch(this.apiServer, reqOptions); | ||
const parsedJsonResponse: JsonResponse = await jsonResponse.json(); | ||
return parsedJsonResponse.result.binding_ttl; | ||
}; | ||
/** | ||
* Retrieve the recovery wallet of a primary wallet. 0x0 is returned if no recovery wallet is present. | ||
@@ -384,0 +347,0 @@ * @param connectedWallet - address of your connected primary wallet |
@@ -15,3 +15,3 @@ import { | ||
interface Result { | ||
export interface Result { | ||
binding_ttl: null | number; | ||
@@ -18,0 +18,0 @@ cooldown_ttl: null | number; |
28967
920
67