@fileverse/fileverse-agent
Advanced tools
Comparing version 1.0.0 to 2.0.0
@@ -0,1 +1,3 @@ | ||
import { Wallet } from 'ethers'; | ||
import { AgentCreationResult, ICreateAgent } from './types'; | ||
declare class Agent { | ||
@@ -11,3 +13,3 @@ /** | ||
*/ | ||
createAgent(walletAddress: string, key: string): Promise<AgentCreationResult>; | ||
createAgent({ walletAddress, password }: ICreateAgent): Promise<AgentCreationResult>; | ||
/** | ||
@@ -17,4 +19,4 @@ * @dev getAgent - retrieves an agent associated with a wallet address from storage | ||
*/ | ||
getAgent(key: string, walletAddress: string): Promise<import("ethers").Wallet>; | ||
getAgent({ password, walletAddress }: ICreateAgent): Promise<Wallet>; | ||
} | ||
export default Agent; |
@@ -25,3 +25,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
*/ | ||
createAgent(walletAddress, key) { | ||
createAgent({ walletAddress, password }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -33,3 +33,3 @@ if (this.hasAgent(walletAddress)) { | ||
const wallet = generateWallet(); | ||
const encryptedWallet = yield encryptWallet(key, wallet); | ||
const encryptedWallet = yield encryptWallet(password, wallet); | ||
storeAgent(walletAddress, encryptedWallet); | ||
@@ -49,5 +49,5 @@ const agentWalletAddress = yield wallet.getAddress(); | ||
*/ | ||
getAgent(key, walletAddress) { | ||
getAgent({ password, walletAddress }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const wallet = yield getWallet(walletAddress, key); | ||
const wallet = yield getWallet(walletAddress, password); | ||
return wallet; | ||
@@ -54,0 +54,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
interface AgentCreationResult { | ||
export interface AgentCreationResult { | ||
status: string; | ||
@@ -6,1 +6,5 @@ agentAddress: string | null; | ||
} | ||
export interface ICreateAgent { | ||
walletAddress: string; | ||
password: string; | ||
} |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
export {}; | ||
//# sourceMappingURL=types.js.map |
@@ -26,3 +26,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const encryptedWallet = retrieveAgentFromStore(walletAddress); | ||
if (!encryptWallet) { | ||
if (!encryptedWallet) { | ||
throw new Error(`no wallet found from storage that's associated with wallet address: ${walletAddress} `); | ||
@@ -29,0 +29,0 @@ } |
{ | ||
"name": "@fileverse/fileverse-agent", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "signless agent for wallet addresses", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
10720
148