@dfns/blockchain-integration
Advanced tools
Comparing version 1.0.6 to 1.0.7
import { Signer, createSigningGroup } from "./signer"; | ||
import { createLambdaHandler } from "./lambda-handler"; | ||
export { Signer, createLambdaHandler, createSigningGroup }; | ||
export { WalletInterface } from "./types/wallet"; | ||
export { Wallet } from "./types/wallet"; | ||
export { SignerAsync } from "./types/signer"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createSigningGroup = exports.createLambdaHandler = exports.Signer = void 0; | ||
exports.Wallet = exports.createSigningGroup = exports.createLambdaHandler = exports.Signer = void 0; | ||
const signer_1 = require("./signer"); | ||
@@ -9,1 +9,3 @@ Object.defineProperty(exports, "Signer", { enumerable: true, get: function () { return signer_1.Signer; } }); | ||
Object.defineProperty(exports, "createLambdaHandler", { enumerable: true, get: function () { return lambda_handler_1.createLambdaHandler; } }); | ||
var wallet_1 = require("./types/wallet"); | ||
Object.defineProperty(exports, "Wallet", { enumerable: true, get: function () { return wallet_1.Wallet; } }); |
@@ -1,2 +0,7 @@ | ||
import { WalletConstructor } from "../types/wallet"; | ||
export declare function createLambdaHandler(WalletImplementation: WalletConstructor, prefix: string): (lambdaEvent: any, context: any) => Promise<any>; | ||
import { Wallet } from "../types/wallet"; | ||
import { SignerAsync } from "../types/signer"; | ||
interface WalletClass extends Wallet { | ||
new (signer: SignerAsync): Wallet; | ||
} | ||
export declare function createLambdaHandler(walletImplementation: WalletClass, prefix: string): (lambdaEvent: any, context: any) => Promise<any>; | ||
export {}; |
@@ -6,3 +6,3 @@ "use strict"; | ||
const { Router } = require("lambda-router"); | ||
function createLambdaHandler(WalletImplementation, prefix) { | ||
function createLambdaHandler(walletImplementation, prefix) { | ||
const router = Router({ | ||
@@ -21,3 +21,3 @@ logger: console, | ||
const signer = new signer_1.Signer(event.pathParameters.groupId); | ||
const wallet = new WalletImplementation(signer); | ||
const wallet = new walletImplementation(signer); | ||
return { | ||
@@ -30,3 +30,3 @@ groupId: event.pathParameters.groupId, | ||
const signer = new signer_1.Signer(event.pathParameters.groupId); | ||
const wallet = new WalletImplementation(signer); | ||
const wallet = new walletImplementation(signer); | ||
return { | ||
@@ -39,3 +39,3 @@ groupId: event.pathParameters.groupId, | ||
const signer = new signer_1.Signer(event.pathParameters.groupId); | ||
const wallet = new WalletImplementation(signer); | ||
const wallet = new walletImplementation(signer); | ||
return { | ||
@@ -48,3 +48,3 @@ groupId: event.pathParameters.groupId, | ||
const signer = new signer_1.Signer(event.pathParameters.groupId); | ||
const wallet = new WalletImplementation(signer); | ||
const wallet = new walletImplementation(signer); | ||
const tx = await wallet.sendTransaction({ | ||
@@ -51,0 +51,0 @@ to: event.body.to, |
import { TransactionResponse } from "./responses"; | ||
import { SendPaymentTxParams } from "./requests"; | ||
import { SignerAsync } from "../types/signer"; | ||
export interface WalletConstructor { | ||
new (signer: SignerAsync): WalletInterface; | ||
export declare abstract class Wallet { | ||
signer: SignerAsync; | ||
constructor(signer: SignerAsync); | ||
abstract getAddress(): Promise<string>; | ||
abstract getBalance(): Promise<string>; | ||
abstract getTransactions(): Promise<TransactionResponse>; | ||
abstract sendTransaction(paymentTxParams: SendPaymentTxParams): Promise<string>; | ||
} | ||
export interface WalletInterface { | ||
getAddress(): Promise<string>; | ||
getBalance(): Promise<string>; | ||
getTransactions(): Promise<TransactionResponse>; | ||
sendTransaction(paymentTxParams: SendPaymentTxParams): Promise<string>; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Wallet = void 0; | ||
class Wallet { | ||
constructor(signer) { | ||
this.signer = signer; | ||
} | ||
} | ||
exports.Wallet = Wallet; | ||
class EthWallet extends Wallet { | ||
async getAddress() { | ||
return "1"; | ||
} | ||
async getBalance() { | ||
return "1"; | ||
} | ||
async getTransactions() { | ||
return { status: 1, data: { tx_hash: "1" } }; | ||
} | ||
async sendTransaction() { | ||
return "1"; | ||
} | ||
} |
{ | ||
"name": "@dfns/blockchain-integration", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Blockchain integration Kit for DFNS", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
9172
222