Options
All
  • Public
  • Public/Protected
  • All
Menu

Module muta-service

Index

Type aliases

Address

Address: typeof Address

Bytes

Bytes: typeof Bytes

Def

Def<T, V>: Record<keyof T, V>

Type parameters

  • T

  • V

Hash

Hash: typeof Hash

HashMap

HashMap<T>: { __computed: true; type: T }

Type parameters

  • T

Type declaration

  • __computed: true
  • type: T

IRead

IRead<P, R>: P extends null ? () => Promise<ServiceResponse<RustToTS<R>>> : (p: RustToTS<P>) => Promise<ServiceResponse<RustToTS<R>>>

Type parameters

  • P

  • R

IService

IService<T>: { read: ReadMap<PickValue<T, IReadDef>>; write: WriteMap<PickValue<T, IWriteDef>> }

Type parameters

  • T

Type declaration

IWrite

IWrite<P, R>: SendTransactionAndWaitReceipt<P, R> & { composeTransaction: (payload: P) => Promise<Transaction>; sendTransaction: (payload: P) => Promise<string> }

Type parameters

  • P

  • R

Nested

Nested<T>: {}

Type parameters

  • T

Type declaration

Option

Option<T>: { __computed: true; type: T }

Type parameters

  • T

Type declaration

  • __computed: true
  • type: T

PickValue

PickValue<T, ValueType>: Pick<T, {}[keyof T]>

Type parameters

  • T

  • ValueType

ReadMap

ReadMap<T>: {}

Type parameters

  • T

Type declaration

RustToTS

RustToTS<T>: T extends StringType ? string : T extends u32 ? number : T extends u64 ? BigNumber | number : T extends bool ? boolean : T extends Option<unknown> ? Maybe<_DynType> : T extends Vec<infer P> ? RustToTS<P>[] : T extends HashMap<infer P> ? {} : T extends Record<keyof T, unknown> ? {} : unknown

Type parameters

  • T

SendTransactionAndWaitReceipt

SendTransactionAndWaitReceipt<P, R>: P extends null ? () => Promise<Receipt<RustToTS<R>>> : (payload: RustToTS<P>) => Promise<Receipt<RustToTS<R>>>

Type parameters

  • P

  • R

ServiceType

ServiceType<T>: Address | String | Bytes | Hash | u64 | u32 | Vec<T> | HashMap<T> | Nested<T>

Type parameters

  • T

String

String: typeof String

StringType

StringType: Hash | Bytes | Address | String

Vec

Vec<T>: { __computed: true; type: T }

Type parameters

Type declaration

  • __computed: true
  • type: T

WriteMap

WriteMap<T>: {}

Type parameters

  • T

Type declaration

_DynType

_DynType: string | number | BigNumber | boolean | _DynType[] | {}

bool

bool: typeof bool

u32

u32: typeof u32

u64

u64: typeof u64

Variables

Const Address

Address: "Address" = 'Address' as const

Const ApprovePayload

ApprovePayload: { asset_id: "Hash"; to: "Address"; value: "u64" } = TransferPayload

Type declaration

  • asset_id: "Hash"
  • to: "Address"
  • value: "u64"

Const AssetService

AssetService: IServiceConstructor<{ approve: IWriteDef<{ asset_id: "Hash"; to: "Address"; value: "u64" }, null>; create_asset: IWriteDef<{ name: "String"; supply: "u64"; symbol: "String" }, { id: "Hash"; issuer: "Address"; name: "String"; supply: "u64"; symbol: "String" }>; get_allowance: IReadDef<{ asset_id: "Hash"; grantee: "Address"; grantor: "Address" }, { asset_id: "Hash"; grantee: "Address"; grantor: "Address"; value: "u64" }>; get_asset: IReadDef<{ id: "Hash" }, { id: "Hash"; issuer: "Address"; name: "String"; supply: "u64"; symbol: "String" }>; get_balance: IReadDef<{ asset_id: "Hash"; user: "Address" }, { asset_id: "Hash"; balance: "u64"; user: "Address" }>; transfer: IWriteDef<{ asset_id: "Hash"; to: "Address"; value: "u64" }, null>; transfer_from: IWriteDef<{ asset_id: "Hash"; recipient: "Address"; sender: "Address"; value: "u64" }, null> }> = createServiceClass('asset', {get_asset: read(GetAssetPayload, Asset),get_balance: read(GetBalancePayload, GetBalanceResponse),get_allowance: read(GetAllowancePayload, GetAllowanceResponse),create_asset: write(CreateAssetPayload, Asset),transfer: write(TransferPayload, null),approve: write(ApprovePayload, null),transfer_from: write(TransferFromPayload, null),})

Const AuthorizationService

AuthorizationService: IServiceConstructor<{ add_verified_item: IWriteDef<{ method_name: "String"; service_name: "String" }, null>; check_authorization: IReadDef<"String", null>; remove_verified_item: IWriteDef<{ method_name: "String"; service_name: "String" }, null>; set_admin: IWriteDef<{ new_admin: "Address" }, null> }> = createServiceClass('authorization', {check_authorization: read(String, null),add_verified_item: write(AddVerifiedItemPayload, null),remove_verified_item: write(RemoveVerifiedItemPayload, null),set_admin: write(SetAdminPayload, null),})

Const Bytes

Bytes: "Bytes" = 'Bytes' as const

Const Hash

Hash: "Hash" = 'Hash' as const

Const MAX_U64

MAX_U64: BigNumber = new BigNumber('18446744073709551615')

Const MapType

MapType: "Map" = 'Map' as const

Const MetadataService

MetadataService: IServiceConstructor<{ get_metadata: IReadDef<null, { bech32_address_hrp: "String"; brake_ratio: "u64"; chain_id: "Hash"; common_ref: "String"; cycles_limit: "u64"; cycles_price: "u64"; interval: "u64"; max_tx_size: "u64"; precommit_ratio: "u64"; prevote_ratio: "u64"; propose_ratio: "u64"; timeout_gap: "u64"; tx_num_limit: "u64"; verifier_list: { __computed: true; type: T } }> }> = createServiceClass('metadata', {get_metadata: read(null, Metadata),})

Const MultiSignatureService

MultiSignatureService: IServiceConstructor<{ add_account: IWriteDef<{ multi_sig_address: "Address"; new_account: { address: "Address"; is_multiple: "bool"; weight: "u32" } }, null>; change_memo: IWriteDef<{ multi_sig_address: "Address"; new_memo: "String" }, null>; change_owner: IWriteDef<{ multi_sig_address: "Address"; new_owner: "Address" }, null>; generate_account: IWriteDef<{ addr_with_weight: { __computed: true; type: T }; autonomy: "bool"; memo: "String"; owner: "Address"; threshold: "u32" }, { address: "Address" }>; get_account_from_address: IReadDef<{ multi_sig_address: "Address" }, { permission: { accounts: { __computed: true; type: T }; memo: "String"; owner: "Address"; threshold: "u32" } }>; remove_account: IWriteDef<{ account_address: "Address"; multi_sig_address: "Address" }, { address: "Address"; is_multiple: "bool"; weight: "u32" }>; set_account_weight: IWriteDef<{ account_address: "Address"; multi_sig_address: "Address"; new_weight: "u32" }, null>; set_threshold: IWriteDef<{ multi_sig_address: "Address"; new_threshold: "u32" }, null>; update_account: IWriteDef<{ account_address: "Address"; addr_with_weight: { __computed: true; type: T }; memo: "String"; owner: "Address"; threshold: "u32" }, null>; verify_signature: IReadDef<{ pubkey: "Bytes"; raw: { chain_id: "Hash"; cycles_limit: "u64"; cycles_price: "u64"; nonce: "Hash"; request: { method: "String"; payload: "String"; service_name: "String" }; sender: "Address"; timeout: "u64" }; signature: "Bytes"; tx_hash: "Hash" }, null> }> = createServiceClass('multi_signature', {get_account_from_address: read(GetMultiSigAccountPayload,GetMultiSigAccountResponse,),verify_signature: read(SignedTransaction, null),generate_account: write(GenerateMultiSigAccountPayload,GenerateMultiSigAccountResponse,),update_account: write(UpdateAccountPayload, null),change_owner: write(ChangeOwnerPayload, null),change_memo: write(ChangeMemoPayload, null),add_account: write(AddAccountPayload, null),remove_account: write(RemoveAccountPayload, Account),set_account_weight: write(SetAccountWeightPayload, null),set_threshold: write(SetThresholdPayload, null),})

Const OptionType

OptionType: "Option" = 'Option' as const

Const String

String: "String" = 'String' as const

Const VecType

VecType: "Vec" = 'Vec' as const

Const bool

bool: "bool" = 'bool' as const

Const u32

u32: "u32" = 'u32' as const

Const u64

u64: "u64" = 'u64' as const

Functions

HashMap

Option

  • Option<T>(type: T): Option<T>

Vec

  • Vec<T>(type: T): Vec<T>

_validate

  • _validate(payloadType: unknown, value: unknown): void

createReadMethods

createServiceClass

createWriteMethods

isHashMapType

  • isHashMapType<T>(schema: unknown): schema is HashMap<T>

isNestedType

  • isNestedType(schema: unknown): schema is Nested<unknown>

isOptionType

  • isOptionType<T>(schema: ServiceType): schema is Option<T>

isReadDef

  • isReadDef(x: unknown): x is IReadDef

isVecType

  • isVecType<T>(schema: unknown): schema is Vec<T>

isWriteDef

  • isWriteDef(x: unknown): x is IWriteDef

read

  • read<Payload, Response>(payloadType: Payload, responseType: Response): IReadDef<Payload, Response>

validate

  • validate(schema: ServiceType, value: unknown): string | undefined

write

  • write<Payload, Response>(payloadType: Payload, responseType: Response): IWriteDef<Payload, Response>

Object literals

Const Account

Account: object

address

address: "Address" = Address

is_multiple

is_multiple: "bool" = bool

weight

weight: "u32" = u32

Const AddAccountPayload

AddAccountPayload: object

multi_sig_address

multi_sig_address: "Address" = Address

new_account

new_account: { address: "Address"; is_multiple: "bool"; weight: "u32" } = Account

Type declaration

  • address: "Address"
  • is_multiple: "bool"
  • weight: "u32"

Const AddVerifiedItemPayload

AddVerifiedItemPayload: object

method_name

method_name: "String" = String

service_name

service_name: "String" = String

Const AddressWithWeight

AddressWithWeight: object

address

address: "Address" = Address

weight

weight: "u32" = u32

Const Asset

Asset: object

id

id: "Hash" = Hash

issuer

issuer: "Address" = Address

name

name: "String" = String

supply

supply: "u64" = u64

symbol

symbol: "String" = String

Const ChangeMemoPayload

ChangeMemoPayload: object

multi_sig_address

multi_sig_address: "Address" = Address

new_memo

new_memo: "String" = String

Const ChangeOwnerPayload

ChangeOwnerPayload: object

multi_sig_address

multi_sig_address: "Address" = Address

new_owner

new_owner: "Address" = Address

Const CreateAssetPayload

CreateAssetPayload: object

name

name: "String" = String

supply

supply: "u64" = u64

symbol

symbol: "String" = String

Const GenerateMultiSigAccountPayload

GenerateMultiSigAccountPayload: object

addr_with_weight

addr_with_weight: { __computed: true; type: T } = Vec(AddressWithWeight)

Type declaration

  • __computed: true
  • type: T

autonomy

autonomy: "bool" = bool

memo

memo: "String" = String

owner

owner: "Address" = Address

threshold

threshold: "u32" = u32

Const GenerateMultiSigAccountResponse

GenerateMultiSigAccountResponse: object

address

address: "Address" = Address

Const GetAllowancePayload

GetAllowancePayload: object

asset_id

asset_id: "Hash" = Hash

grantee

grantee: "Address" = Address

grantor

grantor: "Address" = Address

Const GetAllowanceResponse

GetAllowanceResponse: object

asset_id

asset_id: "Hash" = Hash

grantee

grantee: "Address" = Address

grantor

grantor: "Address" = Address

value

value: "u64" = u64

Const GetAssetPayload

GetAssetPayload: object

id

id: "Hash" = Hash

Const GetBalancePayload

GetBalancePayload: object

asset_id

asset_id: "Hash" = Hash

user

user: "Address" = Address

Const GetBalanceResponse

GetBalanceResponse: object

asset_id

asset_id: "Hash" = Hash

balance

balance: "u64" = u64

user

user: "Address" = Address

Const GetMultiSigAccountPayload

GetMultiSigAccountPayload: object

multi_sig_address

multi_sig_address: "Address" = Address

Const GetMultiSigAccountResponse

GetMultiSigAccountResponse: object

permission

permission: { accounts: { __computed: true; type: T }; memo: "String"; owner: "Address"; threshold: "u32" } = MultiSigPermission

Type declaration

  • accounts: { __computed: true; type: T }
    • __computed: true
    • type: T
  • memo: "String"
  • owner: "Address"
  • threshold: "u32"

Const Metadata

Metadata: object

bech32_address_hrp

bech32_address_hrp: "String" = String

brake_ratio

brake_ratio: "u64" = u64

chain_id

chain_id: "Hash" = Hash

common_ref

common_ref: "String" = String

cycles_limit

cycles_limit: "u64" = u64

cycles_price

cycles_price: "u64" = u64

interval

interval: "u64" = u64

max_tx_size

max_tx_size: "u64" = u64

precommit_ratio

precommit_ratio: "u64" = u64

prevote_ratio

prevote_ratio: "u64" = u64

propose_ratio

propose_ratio: "u64" = u64

timeout_gap

timeout_gap: "u64" = u64

tx_num_limit

tx_num_limit: "u64" = u64

verifier_list

verifier_list: { __computed: true; type: T } = Vec(ValidatorExtend)

Type declaration

  • __computed: true
  • type: T

Const MultiSigPermission

MultiSigPermission: object

accounts

accounts: { __computed: true; type: T } = Vec(Account)

Type declaration

  • __computed: true
  • type: T

memo

memo: "String" = String

owner

owner: "Address" = Address

threshold

threshold: "u32" = u32

Const RawTransaction

RawTransaction: object

chain_id

chain_id: "Hash" = Hash

cycles_limit

cycles_limit: "u64" = u64

cycles_price

cycles_price: "u64" = u64

nonce

nonce: "Hash" = Hash

request

request: { method: "String"; payload: "String"; service_name: "String" } = TransactionRequest

Type declaration

  • method: "String"
  • payload: "String"
  • service_name: "String"

sender

sender: "Address" = Address

timeout

timeout: "u64" = u64

Const RemoveAccountPayload

RemoveAccountPayload: object

account_address

account_address: "Address" = Address

multi_sig_address

multi_sig_address: "Address" = Address

Const RemoveVerifiedItemPayload

RemoveVerifiedItemPayload: object

method_name

method_name: "String" = String

service_name

service_name: "String" = String

Const SetAccountWeightPayload

SetAccountWeightPayload: object

account_address

account_address: "Address" = Address

multi_sig_address

multi_sig_address: "Address" = Address

new_weight

new_weight: "u32" = u32

Const SetAdminPayload

SetAdminPayload: object

new_admin

new_admin: "Address" = Address

Const SetThresholdPayload

SetThresholdPayload: object

multi_sig_address

multi_sig_address: "Address" = Address

new_threshold

new_threshold: "u32" = u32

Const SignedTransaction

SignedTransaction: object

pubkey

pubkey: "Bytes" = Bytes

raw

raw: { chain_id: "Hash"; cycles_limit: "u64"; cycles_price: "u64"; nonce: "Hash"; request: { method: "String"; payload: "String"; service_name: "String" }; sender: "Address"; timeout: "u64" } = RawTransaction

Type declaration

  • chain_id: "Hash"
  • cycles_limit: "u64"
  • cycles_price: "u64"
  • nonce: "Hash"
  • request: { method: "String"; payload: "String"; service_name: "String" }
    • method: "String"
    • payload: "String"
    • service_name: "String"
  • sender: "Address"
  • timeout: "u64"

signature

signature: "Bytes" = Bytes

tx_hash

tx_hash: "Hash" = Hash

Const TransactionRequest

TransactionRequest: object

method

method: "String" = String

payload

payload: "String" = String

service_name

service_name: "String" = String

Const TransferFromPayload

TransferFromPayload: object

asset_id

asset_id: "Hash" = Hash

recipient

recipient: "Address" = Address

sender

sender: "Address" = Address

value

value: "u64" = u64

Const TransferPayload

TransferPayload: object

asset_id

asset_id: "Hash" = Hash

to

to: "Address" = Address

value

value: "u64" = u64

Const UpdateAccountPayload

UpdateAccountPayload: object

account_address

account_address: "Address" = Address

addr_with_weight

addr_with_weight: { __computed: true; type: T } = Vec(AddressWithWeight)

Type declaration

  • __computed: true
  • type: T

memo

memo: "String" = String

owner

owner: "Address" = Address

threshold

threshold: "u32" = u32

Const ValidatorExtend

ValidatorExtend: object

address

address: "Address" = Address

bls__key

bls__key: "String" = String

propose_weight

propose_weight: "u32" = u32

pub_key

pub_key: "String" = String

vote_weight

vote_weight: "u32" = u32

Generated using TypeDoc