@wharfkit/contract
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -136,3 +136,3 @@ import { API, ABIDef, APIClient, ABI, NameType, Name, BytesType, ABISerializableObject, PermissionLevelType, Action } from '@greymass/eosio'; | ||
*/ | ||
static from(tableParams: TableParams): Table<any>; | ||
static from<RowType = any>(tableParams: TableParams): Table<RowType>; | ||
/** | ||
@@ -211,3 +211,3 @@ * Retrieves the rows from the table that match the given parameters. | ||
hasTable(name: NameType): boolean; | ||
table(name: NameType): Table<any>; | ||
table<RowType = any>(name: NameType, rowType?: any): Table<RowType>; | ||
get actionNames(): string[]; | ||
@@ -214,0 +214,0 @@ hasAction(name: NameType): boolean; |
@@ -271,3 +271,3 @@ 'use strict'; | ||
} | ||
table(name) { | ||
table(name, rowType) { | ||
if (!this.hasTable(name)) { | ||
@@ -281,2 +281,3 @@ throw new Error(`Contract (${this.account}) does not have a table named (${name})`); | ||
name, | ||
rowType, | ||
}); | ||
@@ -283,0 +284,0 @@ } |
@@ -244,3 +244,3 @@ import { isInstanceOf, UInt128, UInt64, Float64, Checksum256, Checksum160, Name, ABI, Serializer, PermissionLevel, Action } from '@greymass/eosio'; | ||
} | ||
table(name) { | ||
table(name, rowType) { | ||
if (!this.hasTable(name)) { | ||
@@ -254,2 +254,3 @@ throw new Error(`Contract (${this.account}) does not have a table named (${name})`); | ||
name, | ||
rowType, | ||
}); | ||
@@ -256,0 +257,0 @@ } |
{ | ||
"name": "@wharfkit/contract", | ||
"description": "ContractKit for Wharf", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"homepage": "https://github.com/wharfkit/contract", | ||
@@ -6,0 +6,0 @@ "license": "BSD-3-Clause", |
@@ -65,7 +65,7 @@ import { | ||
public table(name: NameType) { | ||
public table<RowType = any>(name: NameType, rowType?): Table<RowType> { | ||
if (!this.hasTable(name)) { | ||
throw new Error(`Contract (${this.account}) does not have a table named (${name})`) | ||
} | ||
return Table.from({ | ||
return Table.from<RowType>({ | ||
abi: this.abi, | ||
@@ -75,2 +75,3 @@ account: this.account, | ||
name, | ||
rowType, | ||
}) | ||
@@ -77,0 +78,0 @@ } |
@@ -93,4 +93,4 @@ import {ABI, ABIDef, API, APIClient, Name, NameType, Serializer} from '@greymass/eosio' | ||
*/ | ||
static from(tableParams: TableParams) { | ||
return new Table(tableParams) | ||
static from<RowType = any>(tableParams: TableParams): Table<RowType> { | ||
return new Table<RowType>(tableParams) | ||
} | ||
@@ -97,0 +97,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
117062
1191
2429