@greymass/eosio
Advanced tools
Comparing version 0.2.2 to 0.2.3
/** | ||
* EOSIO Core v0.2.2 | ||
* EOSIO Core v0.2.3 | ||
* https://github.com/greymass/eosio-core | ||
@@ -1162,2 +1162,17 @@ * | ||
} | ||
declare type AuthorityType = Authority | { | ||
threshold: UInt32Type; | ||
keys?: { | ||
key: PublicKeyType; | ||
weight: UInt16Type; | ||
}[]; | ||
accounts?: { | ||
permission: PermissionLevelType; | ||
weight: UInt16Type; | ||
}[]; | ||
waits?: { | ||
wait_sec: UInt32Type; | ||
weight: UInt16Type; | ||
}[]; | ||
}; | ||
declare class Authority extends Struct { | ||
@@ -1168,2 +1183,3 @@ threshold: UInt32; | ||
waits: WaitWeight[]; | ||
static from(value: AuthorityType): Authority; | ||
/** Total weight of all waits. */ | ||
@@ -1191,3 +1207,8 @@ get waitThreshold(): number; | ||
const decode: typeof abiDecode; | ||
/** Create an EOSIO ABI definition for given core type. */ | ||
function synthesize(type: ABISerializableConstructor): ABI; | ||
/** Create JSON representation of a core object. */ | ||
function stringify(object: any): string; | ||
/** Create a vanilla js representation of a core object. */ | ||
function objectify(object: any): any; | ||
} | ||
@@ -1650,2 +1671,2 @@ | ||
export { ABI, ABIDecoder, ABIDef, ABIEncoder, ABISerializable, ABISerializableConstructor, ABISerializableObject, ABISerializableType, types$1 as API, APIClient, APIClientOptions, APIError, APIErrorData, APIErrorDetail, APIProvider, Action, ActionFields, ActionType, AnyAction, AnyInt, AnyTransaction, AnyVariant, Asset, AssetType, Authority, Base58, BlockTimestamp, Bytes, BytesEncoding, BytesType, Checksum160, Checksum160Type, Checksum256, Checksum256Type, Checksum512, Checksum512Type, CurveType, ExtendedAsset, ExtendedAssetType, FetchProvider, FetchProviderOptions, Float128, Float128Type, Float32, Float32Type, Float64, Float64Type, Int128, Int128Type, Int16, Int16Type, Int32, Int32Type, Int64, Int64Type, Int8, Int8Type, KeyWeight, Name, NameType, PackedTransaction, PermissionLevel, PermissionLevelType, PermissionLevelWeight, PrivateKey, PrivateKeyType, PublicKey, PublicKeyType, Serializer, Signature, SignatureType, SignedTransaction, SignedTransactionFields, SignedTransactionType, Struct, StructConstructor, TimePoint, TimePointSec, TimePointType, Transaction, TransactionExtension, TransactionFields, TransactionHeader, TransactionHeaderFields, TransactionHeaderType, TransactionReceipt, TransactionType, TypeAlias, UInt128, UInt128Type, UInt16, UInt16Type, UInt32, UInt32Type, UInt64, UInt64Type, UInt8, UInt8Type, VarInt, VarIntType, VarUInt, VarUIntType, Variant, VariantConstructor, WaitWeight, Weight, isInstanceOf }; | ||
export { ABI, ABIDecoder, ABIDef, ABIEncoder, ABISerializable, ABISerializableConstructor, ABISerializableObject, ABISerializableType, types$1 as API, APIClient, APIClientOptions, APIError, APIErrorData, APIErrorDetail, APIProvider, Action, ActionFields, ActionType, AnyAction, AnyInt, AnyTransaction, AnyVariant, Asset, AssetType, Authority, AuthorityType, Base58, BlockTimestamp, Bytes, BytesEncoding, BytesType, Checksum160, Checksum160Type, Checksum256, Checksum256Type, Checksum512, Checksum512Type, CurveType, ExtendedAsset, ExtendedAssetType, FetchProvider, FetchProviderOptions, Float128, Float128Type, Float32, Float32Type, Float64, Float64Type, Int128, Int128Type, Int16, Int16Type, Int32, Int32Type, Int64, Int64Type, Int8, Int8Type, Name, NameType, PackedTransaction, PermissionLevel, PermissionLevelType, PrivateKey, PrivateKeyType, PublicKey, PublicKeyType, Serializer, Signature, SignatureType, SignedTransaction, SignedTransactionFields, SignedTransactionType, Struct, StructConstructor, TimePoint, TimePointSec, TimePointType, Transaction, TransactionExtension, TransactionFields, TransactionHeader, TransactionHeaderFields, TransactionHeaderType, TransactionReceipt, TransactionType, TypeAlias, UInt128, UInt128Type, UInt16, UInt16Type, UInt32, UInt32Type, UInt64, UInt64Type, UInt8, UInt8Type, VarInt, VarIntType, VarUInt, VarUIntType, Variant, VariantConstructor, isInstanceOf }; |
{ | ||
"name": "@greymass/eosio", | ||
"description": "Library for working with EOSIO blockchains", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"homepage": "https://github.com/greymass/eosio-core", | ||
@@ -6,0 +6,0 @@ "license": "BSD-3-Clause", |
@@ -1,8 +0,20 @@ | ||
import {PermissionLevel, PublicKey, PublicKeyType, Struct, TypeAlias, UInt16, UInt32} from '../' | ||
import { | ||
PermissionLevel, | ||
PermissionLevelType, | ||
PublicKey, | ||
PublicKeyType, | ||
Struct, | ||
TypeAlias, | ||
UInt16, | ||
UInt16Type, | ||
UInt32, | ||
UInt32Type, | ||
} from '../' | ||
import {isInstanceOf} from '../utils' | ||
@TypeAlias('weight_type') | ||
export class Weight extends UInt16 {} | ||
class Weight extends UInt16 {} | ||
@Struct.type('key_weight') | ||
export class KeyWeight extends Struct { | ||
class KeyWeight extends Struct { | ||
@Struct.field(PublicKey) key!: PublicKey | ||
@@ -13,3 +25,3 @@ @Struct.field(Weight) weight!: Weight | ||
@Struct.type('permission_level_weight') | ||
export class PermissionLevelWeight extends Struct { | ||
class PermissionLevelWeight extends Struct { | ||
@Struct.field(PermissionLevel) permission!: PermissionLevel | ||
@@ -20,3 +32,3 @@ @Struct.field(Weight) weight!: Weight | ||
@Struct.type('wait_weight') | ||
export class WaitWeight extends Struct { | ||
class WaitWeight extends Struct { | ||
@Struct.field(UInt32) wait_sec!: UInt32 | ||
@@ -26,2 +38,11 @@ @Struct.field(Weight) weight!: Weight | ||
export type AuthorityType = | ||
| Authority | ||
| { | ||
threshold: UInt32Type | ||
keys?: {key: PublicKeyType; weight: UInt16Type}[] | ||
accounts?: {permission: PermissionLevelType; weight: UInt16Type}[] | ||
waits?: {wait_sec: UInt32Type; weight: UInt16Type}[] | ||
} | ||
@Struct.type('authority') | ||
@@ -34,2 +55,16 @@ export class Authority extends Struct { | ||
static from(value: AuthorityType): Authority { | ||
if (isInstanceOf(value, Authority)) { | ||
return value | ||
} | ||
const rv = super.from({ | ||
keys: [], | ||
accounts: [], | ||
waits: [], | ||
...value, | ||
}) as Authority | ||
rv.sort() | ||
return rv | ||
} | ||
/** Total weight of all waits. */ | ||
@@ -36,0 +71,0 @@ get waitThreshold(): number { |
@@ -16,3 +16,3 @@ import { | ||
export class Struct implements ABISerializableObject { | ||
static abiName: string | ||
static abiName = '__struct' | ||
static abiFields: ABIField[] | ||
@@ -19,0 +19,0 @@ static abiBase: ABISerializableConstructor |
@@ -18,5 +18,14 @@ import {abiEncode} from './encoder' | ||
export const decode = abiDecode | ||
/** Create an EOSIO ABI definition for given core type. */ | ||
export function synthesize(type: ABISerializableConstructor) { | ||
return synthesizeABI(type).abi | ||
} | ||
/** Create JSON representation of a core object. */ | ||
export function stringify(object: any) { | ||
return JSON.stringify(object) | ||
} | ||
/** Create a vanilla js representation of a core object. */ | ||
export function objectify(object: any) { | ||
return JSON.parse(JSON.stringify(object)) | ||
} | ||
} |
@@ -100,2 +100,4 @@ import {ABI} from '../chain' | ||
throw new Error('Encountered non-conforming type') | ||
} else if (t.abiName === '__struct') { | ||
throw new Error('Misconfigured Struct subclass, did you forget @Struct.type?') | ||
} | ||
@@ -102,0 +104,0 @@ if (seen.has(t)) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
697228
14015