/// import { OmitStrict } from '@neo-one/utils-esnext-esm'; import BigNumber from 'bignumber.js'; import BN from 'bn.js'; import { Observable } from 'rxjs'; import { RawSourceMap } from 'source-map'; import { ECPoint, UInt160, UInt256 } from './common'; export declare type AddressString = string; export declare type Hash256String = string; export declare type BufferString = string; export declare type PublicKeyString = string; export declare type PrivateKeyString = string; export declare type SignatureString = string; export declare type NetworkType = 'main' | 'test' | string; export declare type BufferAttributeUsage = 'DescriptionUrl' | 'Description' | 'Remark' | 'Remark1' | 'Remark2' | 'Remark3' | 'Remark4' | 'Remark5' | 'Remark6' | 'Remark7' | 'Remark8' | 'Remark9' | 'Remark10' | 'Remark11' | 'Remark12' | 'Remark13' | 'Remark14' | 'Remark15'; export declare type PublicKeyAttributeUsage = 'ECDH02' | 'ECDH03'; export declare type AddressAttributeUsage = 'Script'; export declare type Hash256AttributeUsage = 'ContractHash' | 'Vote' | 'Hash1' | 'Hash2' | 'Hash3' | 'Hash4' | 'Hash5' | 'Hash6' | 'Hash7' | 'Hash8' | 'Hash9' | 'Hash10' | 'Hash11' | 'Hash12' | 'Hash13' | 'Hash14' | 'Hash15'; export declare type AttributeUsage = BufferAttributeUsage | AddressAttributeUsage | PublicKeyAttributeUsage | Hash256AttributeUsage; export interface AttributeBase { readonly usage: AttributeUsage; } export interface BufferAttribute extends AttributeBase { readonly usage: BufferAttributeUsage; readonly data: BufferString; } export interface PublicKeyAttribute extends AttributeBase { readonly usage: PublicKeyAttributeUsage; readonly data: PublicKeyString; } export interface Hash256Attribute extends AttributeBase { readonly usage: Hash256AttributeUsage; readonly data: Hash256String; } export interface AddressAttribute extends AttributeBase { readonly usage: AddressAttributeUsage; readonly data: AddressString; } export declare type Attribute = BufferAttribute | PublicKeyAttribute | Hash256Attribute | AddressAttribute; export interface Input { readonly hash: Hash256String; readonly index: number; } export interface InputOutput extends Input, Output { } export interface Output { readonly asset: Hash256String; readonly value: BigNumber; readonly address: AddressString; } export interface Witness { readonly invocation: BufferString; readonly verification: BufferString; } export interface TransactionBase { readonly version: number; readonly hash: Hash256String; readonly size: number; readonly attributes: readonly Attribute[]; readonly inputs: readonly Input[]; readonly outputs: readonly Output[]; readonly scripts: readonly Witness[]; readonly systemFee: BigNumber; readonly networkFee: BigNumber; } export interface ConfirmedTransactionBase { readonly receipt: TransactionReceipt; } export interface ClaimTransaction extends TransactionBase { readonly type: 'ClaimTransaction'; readonly claims: readonly Input[]; } export interface ConfirmedClaimTransaction extends ClaimTransaction, ConfirmedTransactionBase { } export interface ContractTransaction extends TransactionBase { readonly type: 'ContractTransaction'; } export interface ConfirmedContractTransaction extends ContractTransaction, ConfirmedTransactionBase { } export interface EnrollmentTransaction extends TransactionBase { readonly type: 'EnrollmentTransaction'; readonly publicKey: PublicKeyString; } export interface ConfirmedEnrollmentTransaction extends EnrollmentTransaction, ConfirmedTransactionBase { } export interface IssueTransaction extends TransactionBase { readonly type: 'IssueTransaction'; } export interface ConfirmedIssueTransaction extends IssueTransaction, ConfirmedTransactionBase { } export interface InvocationTransaction extends TransactionBase { readonly type: 'InvocationTransaction'; readonly script: BufferString; readonly gas: BigNumber; } export interface ConfirmedInvocationTransaction extends InvocationTransaction, ConfirmedTransactionBase { readonly invocationData: RawInvocationData; } export interface MinerTransaction extends TransactionBase { readonly type: 'MinerTransaction'; readonly nonce: number; } export interface ConfirmedMinerTransaction extends MinerTransaction, ConfirmedTransactionBase { } export interface PublishTransaction extends TransactionBase { readonly type: 'PublishTransaction'; readonly contract: Contract; } export interface ConfirmedPublishTransaction extends PublishTransaction, ConfirmedTransactionBase { } export interface RegisterTransaction extends TransactionBase { readonly type: 'RegisterTransaction'; readonly asset: Pick; } export interface ConfirmedRegisterTransaction extends RegisterTransaction, ConfirmedTransactionBase { } export interface StateTransaction extends TransactionBase { readonly type: 'StateTransaction'; } export interface ConfirmedStateTransaction extends StateTransaction, ConfirmedTransactionBase { } export declare type Transaction = MinerTransaction | IssueTransaction | ClaimTransaction | EnrollmentTransaction | RegisterTransaction | ContractTransaction | PublishTransaction | StateTransaction | InvocationTransaction; export declare type ConfirmedTransaction = ConfirmedMinerTransaction | ConfirmedIssueTransaction | ConfirmedClaimTransaction | ConfirmedEnrollmentTransaction | ConfirmedRegisterTransaction | ConfirmedContractTransaction | ConfirmedPublishTransaction | ConfirmedStateTransaction | ConfirmedInvocationTransaction; export interface Header { readonly version: number; readonly hash: Hash256String; readonly previousBlockHash: Hash256String; readonly merkleRoot: Hash256String; readonly time: number; readonly index: number; readonly nonce: string; readonly nextConsensus: AddressString; readonly script: Witness; readonly size: number; } export interface Block extends Header { readonly transactions: readonly ConfirmedTransaction[]; } export interface TransactionReceipt { readonly blockIndex: number; readonly blockHash: Hash256String; readonly transactionIndex: number; readonly globalIndex: BigNumber; } export interface TransactionResult { readonly transaction: TTransaction; readonly confirmed: (options?: GetOptions) => Promise; } export interface RawInvocationResultBase { readonly gasConsumed: BigNumber; readonly gasCost: BigNumber; } export interface InvocationResultSuccess extends RawInvocationResultBase { readonly state: 'HALT'; readonly value: TValue; } export interface InvocationResultError extends RawInvocationResultBase { readonly state: 'FAULT'; readonly message: string; } export declare type InvocationResult = InvocationResultSuccess | InvocationResultError; export interface InvokeReceipt = Event> extends TransactionReceipt { readonly result: InvocationResult; readonly events: readonly TEvent[]; readonly logs: readonly Log[]; readonly raw: RawInvokeReceipt; } export interface Transfer { readonly amount: BigNumber; readonly asset: Hash256String; readonly to: AddressString; } export interface UserAccountID { readonly network: NetworkType; readonly address: AddressString; } export interface UserAccount { readonly id: UserAccountID; readonly name: string; readonly publicKey: PublicKeyString; } export interface UserAccountProvider { readonly currentUserAccount$: Observable; readonly userAccounts$: Observable; readonly networks$: Observable; readonly getCurrentUserAccount: () => UserAccount | undefined; readonly getUserAccounts: () => readonly UserAccount[]; readonly getNetworks: () => readonly NetworkType[]; readonly selectUserAccount: (id?: UserAccountID) => Promise; readonly deleteUserAccount?: (id: UserAccountID) => Promise; readonly updateUserAccountName?: (options: UpdateAccountNameOptions) => Promise; readonly getBlockCount: (network: NetworkType) => Promise; readonly getAccount: (network: NetworkType, address: AddressString) => Promise; readonly iterBlocks: (network: NetworkType, options?: IterOptions) => AsyncIterable; readonly iterActionsRaw?: (network: NetworkType, options?: IterOptions) => AsyncIterable; readonly transfer: (transfers: readonly Transfer[], options?: TransactionOptions) => Promise>; readonly claim: (options?: TransactionOptions) => Promise>; readonly invoke: (contract: AddressString, method: string, params: ReadonlyArray, paramsZipped: ReadonlyArray, verify: boolean, options?: InvokeSendUnsafeReceiveTransactionOptions, sourceMaps?: SourceMaps) => Promise>; readonly invokeSend: (contract: AddressString, method: string, params: ReadonlyArray, paramsZipped: ReadonlyArray, transfer: Transfer, options?: TransactionOptions, sourceMaps?: SourceMaps) => Promise>; readonly invokeCompleteSend: (contract: AddressString, method: string, params: ReadonlyArray, paramsZipped: ReadonlyArray, hash: Hash256String, options?: TransactionOptions, sourceMaps?: SourceMaps) => Promise>; readonly invokeRefundAssets: (contract: AddressString, method: string, params: ReadonlyArray, paramsZipped: ReadonlyArray, hash: Hash256String, options?: TransactionOptions, sourceMaps?: SourceMaps) => Promise>; readonly invokeClaim: (contract: AddressString, method: string, params: ReadonlyArray, paramsZipped: ReadonlyArray, options?: TransactionOptions, sourceMaps?: SourceMaps) => Promise>; readonly call: (network: NetworkType, contract: AddressString, method: string, params: ReadonlyArray) => Promise; } export interface UserAccountProviders { readonly [type: string]: TUserAccountProvider; } export interface PrivateNetworkSettings { readonly secondsPerBlock: number; } export interface DeveloperProvider { readonly network: NetworkType; readonly runConsensusNow: () => Promise; readonly updateSettings: (options: Partial) => Promise; readonly getSettings: () => Promise; readonly fastForwardOffset: (seconds: number) => Promise; readonly fastForwardToTime: (seconds: number) => Promise; readonly reset: () => Promise; readonly getNEOTrackerURL: () => Promise; readonly resetProject: () => Promise; } export interface Account { readonly address: AddressString; readonly balances: { readonly [asset: string]: BigNumber; }; } export interface EventParameters { readonly [name: string]: Param; } export interface Event extends RawActionBase { readonly type: 'Event'; readonly name: TName; readonly parameters: TEventParameters; } export interface Log extends RawActionBase { readonly type: 'Log'; readonly message: string; } export declare type Action = Event | Log; export interface SmartContractNetworkDefinition { readonly address: AddressString; } export interface SmartContractNetworksDefinition { readonly [networkType: string]: SmartContractNetworkDefinition; } export interface SmartContractDefinition { readonly networks: SmartContractNetworksDefinition; readonly abi: ABI; readonly sourceMaps?: SourceMaps; } export interface SmartContractReadOptions { readonly network?: NetworkType; } export interface SmartContractIterOptions extends SmartContractReadOptions, BlockFilter { } export interface BlockFilter { readonly indexStart?: number; readonly indexStop?: number; } export interface IterOptions extends BlockFilter { } export interface GetOptions { readonly timeoutMS?: number; } export interface TransactionOptions { from?: UserAccountID; attributes?: readonly Attribute[]; networkFee?: BigNumber; systemFee?: BigNumber; skipSysFeeCheck?: boolean; } export interface ForwardOptions = Event> { readonly events?: readonly ABIEvent[]; readonly __tag?: TEvent; } export interface InvokeSendUnsafeTransactionOptions extends TransactionOptions { readonly sendFrom?: readonly Transfer[]; } export interface InvokeReceiveTransactionOptions extends TransactionOptions { readonly sendTo?: ReadonlyArray>; } export interface InvokeSendUnsafeReceiveTransactionOptions extends InvokeSendUnsafeTransactionOptions, InvokeReceiveTransactionOptions { } export interface UpdateAccountNameOptions { readonly id: UserAccountID; readonly name: string; } export interface ABIReturnBase { readonly optional?: boolean; readonly forwardedValue?: boolean; } export interface AddressABIReturn extends ABIReturnBase { readonly type: 'Address'; } export interface ArrayABIReturn extends ABIReturnBase { readonly type: 'Array'; readonly value: ABIReturn; } export interface BooleanABIReturn extends ABIReturnBase { readonly type: 'Boolean'; } export interface BufferABIReturn extends ABIReturnBase { readonly type: 'Buffer'; } export interface ForwardValueABIReturn extends ABIReturnBase { readonly type: 'ForwardValue'; } export interface Hash256ABIReturn extends ABIReturnBase { readonly type: 'Hash256'; } export interface IntegerABIReturn extends ABIReturnBase { readonly type: 'Integer'; readonly decimals: number; } export interface MapABIReturn extends ABIReturnBase { readonly type: 'Map'; readonly key: ABIReturn; readonly value: ABIReturn; } export interface ObjectABIReturn extends ABIReturnBase { readonly type: 'Object'; readonly properties: { readonly [key: string]: ABIReturn; }; } export interface PublicKeyABIReturn extends ABIReturnBase { readonly type: 'PublicKey'; } export interface SignatureABIReturn extends ABIReturnBase { readonly type: 'Signature'; } export interface StringABIReturn extends ABIReturnBase { readonly type: 'String'; } export interface VoidABIReturn extends ABIReturnBase { readonly type: 'Void'; } export interface SenderAddressABIDefault { readonly type: 'sender'; } export declare type ABIDefault = SenderAddressABIDefault; export declare type ABIDefaultType = ABIDefault['type']; export interface ABIParameterBase { readonly name: string; readonly default?: ABIDefault; readonly rest?: boolean; } export interface AddressABIParameter extends ABIParameterBase, AddressABIReturn { } export interface ArrayABIParameter extends ABIParameterBase, ArrayABIReturn { } export interface BooleanABIParameter extends ABIParameterBase, BooleanABIReturn { } export interface BufferABIParameter extends ABIParameterBase, BufferABIReturn { } export interface Hash256ABIParameter extends ABIParameterBase, Hash256ABIReturn { } export interface IntegerABIParameter extends ABIParameterBase, IntegerABIReturn { } export interface ForwardValueABIParameter extends ABIParameterBase, ForwardValueABIReturn { } export interface MapABIParameter extends ABIParameterBase, MapABIReturn { } export interface ObjectABIParameter extends ABIParameterBase, ObjectABIReturn { } export interface PublicKeyABIParameter extends ABIParameterBase, PublicKeyABIReturn { } export interface SignatureABIParameter extends ABIParameterBase, SignatureABIReturn { } export interface StringABIParameter extends ABIParameterBase, StringABIReturn { } export interface VoidABIParameter extends ABIParameterBase, VoidABIReturn { } export declare type ABIReturn = SignatureABIReturn | BooleanABIReturn | AddressABIReturn | Hash256ABIReturn | BufferABIReturn | PublicKeyABIReturn | StringABIReturn | ArrayABIReturn | MapABIReturn | ObjectABIReturn | VoidABIReturn | IntegerABIReturn | ForwardValueABIReturn; export declare type ABIParameter = SignatureABIParameter | BooleanABIParameter | AddressABIParameter | Hash256ABIParameter | BufferABIParameter | PublicKeyABIParameter | StringABIParameter | ArrayABIParameter | MapABIParameter | ObjectABIParameter | VoidABIParameter | IntegerABIParameter | ForwardValueABIParameter; export declare type ArrayABI = ArrayABIParameter | ArrayABIReturn; export declare type MapABI = MapABIParameter | MapABIReturn; export declare type ObjectABI = ObjectABIParameter | ObjectABIReturn; export declare type SignatureABI = SignatureABIParameter | SignatureABIReturn; export declare type BooleanABI = BooleanABIParameter | BooleanABIReturn; export declare type AddressABI = AddressABIParameter | AddressABIReturn; export declare type Hash256ABI = Hash256ABIParameter | Hash256ABIReturn; export declare type BufferABI = BufferABIParameter | BufferABIReturn; export declare type PublicKeyABI = PublicKeyABIParameter | PublicKeyABIReturn; export declare type StringABI = StringABIParameter | StringABIReturn; export declare type VoidABI = VoidABIParameter | VoidABIReturn; export declare type IntegerABI = IntegerABIParameter | IntegerABIReturn; export declare type ForwardValueABI = ForwardValueABIParameter | ForwardValueABIReturn; export interface ABIFunction { readonly name: string; readonly parameters?: readonly ABIParameter[]; readonly returnType: ABIReturn; readonly constant?: boolean; readonly send?: boolean; readonly sendUnsafe?: boolean; readonly receive?: boolean; readonly claim?: boolean; readonly refundAssets?: boolean; readonly completeSend?: boolean; } export interface ABIEvent { readonly name: string; readonly parameters: readonly ABIParameter[]; } export interface ABI { readonly functions: readonly ABIFunction[]; readonly events?: readonly ABIEvent[]; } declare const OpaqueTagSymbol: unique symbol; export interface ForwardValue { readonly name: string; readonly converted: ScriptBuilderParam | undefined; readonly param: Param | undefined; readonly [OpaqueTagSymbol]: unique symbol; } export interface ScriptBuilderParamArray extends Array { } export interface ScriptBuilderParamMap extends Map { } export interface ScriptBuilderParamObject { readonly [key: string]: ScriptBuilderParam; } export declare type ScriptBuilderParam = undefined | BN | number | UInt160 | UInt256 | ECPoint | string | Buffer | boolean | ScriptBuilderParamArray | ScriptBuilderParamMap | ScriptBuilderParamObject; export interface ScriptBuilderParamToCallbacks { readonly undefined: () => T; readonly array: (param: ScriptBuilderParamArray) => T; readonly map: (param: ScriptBuilderParamMap) => T; readonly uInt160: (param: UInt160) => T; readonly uInt256: (param: UInt256) => T; readonly ecPoint: (param: ECPoint) => T; readonly bn: (param: BN) => T; readonly number: (param: number) => T; readonly string: (param: string) => T; readonly boolean: (param: boolean) => T; readonly buffer: (param: Buffer) => T; readonly object: (param: ScriptBuilderParamObject) => T; } export interface ParamArray extends Array { } export interface ParamMap extends Map { } export interface ParamObject { readonly [key: string]: Param; } export declare type Param = undefined | BigNumber | string | BufferString | AddressString | Hash256String | PublicKeyString | boolean | ParamArray | ParamMap | ParamObject | ForwardValue; export interface ParamToCallbacks { readonly undefined: () => T; readonly bigNumber: (param: BigNumber) => T; readonly string: (param: string) => T; readonly boolean: (param: boolean) => T; readonly array: (param: ParamArray) => T; readonly map: (param: ParamMap) => T; readonly object: (param: ParamObject) => T; readonly forwardValue: (param: ForwardValue) => T; } export interface ReturnArray extends ReadonlyArray { } export interface ReturnMap extends ReadonlyMap { } export interface ReturnObject { readonly [key: string]: Return; } export declare type Return = undefined | BigNumber | BufferString | AddressString | Hash256String | PublicKeyString | boolean | ReturnArray | ReturnMap | ReturnObject | ContractParameter; export declare type AssetType = 'Credit' | 'Duty' | 'Governing' | 'Utility' | 'Currency' | 'Share' | 'Invoice' | 'Token'; export interface Asset { readonly hash: Hash256String; readonly type: AssetType; readonly name: string; readonly amount: BigNumber; readonly available: BigNumber; readonly precision: number; readonly owner: PublicKeyString; readonly admin: AddressString; readonly issuer: AddressString; readonly expiration: number; readonly frozen: boolean; } export interface Contract { readonly version: number; readonly address: AddressString; readonly script: BufferString; readonly parameters: readonly ContractParameterType[]; readonly returnType: ContractParameterType; readonly name: string; readonly codeVersion: string; readonly author: string; readonly email: string; readonly description: string; readonly storage: boolean; readonly dynamicInvoke: boolean; readonly payable: boolean; } export interface SignatureContractParameter { readonly type: 'Signature'; readonly value: SignatureString; } export interface BooleanContractParameter { readonly type: 'Boolean'; readonly value: boolean; } export interface IntegerContractParameter { readonly type: 'Integer'; readonly value: BN; } export interface AddressContractParameter { readonly type: 'Address'; readonly value: AddressString; } export interface Hash256ContractParameter { readonly type: 'Hash256'; readonly value: Hash256String; } export interface BufferContractParameter { readonly type: 'Buffer'; readonly value: BufferString; } export interface PublicKeyContractParameter { readonly type: 'PublicKey'; readonly value: PublicKeyString; } export interface StringContractParameter { readonly type: 'String'; readonly value: string; } export interface ArrayContractParameter { readonly type: 'Array'; readonly value: readonly ContractParameter[]; } export interface MapContractParameter { readonly type: 'Map'; readonly value: ReadonlyArray; } export interface InteropInterfaceContractParameter { readonly type: 'InteropInterface'; } export interface VoidContractParameter { readonly type: 'Void'; } export declare type ContractParameter = SignatureContractParameter | BooleanContractParameter | IntegerContractParameter | AddressContractParameter | Hash256ContractParameter | BufferContractParameter | PublicKeyContractParameter | StringContractParameter | ArrayContractParameter | MapContractParameter | InteropInterfaceContractParameter | VoidContractParameter; export declare type ContractParameterType = ContractParameter['type']; export interface RawInvocationResultSuccess extends RawInvocationResultBase { readonly state: 'HALT'; readonly stack: readonly ContractParameter[]; } export interface RawInvocationResultError extends RawInvocationResultBase { readonly state: 'FAULT'; readonly stack: readonly ContractParameter[]; readonly message: string; } export declare type RawInvocationResult = RawInvocationResultSuccess | RawInvocationResultError; export interface RawActionBase { readonly version: number; readonly blockIndex: number; readonly blockHash: Hash256String; readonly transactionIndex: number; readonly transactionHash: Hash256String; readonly index: number; readonly globalIndex: BigNumber; readonly address: AddressString; } export interface RawNotification extends RawActionBase { readonly type: 'Notification'; readonly args: readonly ContractParameter[]; } export interface RawLog extends RawActionBase { readonly type: 'Log'; readonly message: string; } export declare type RawAction = RawNotification | RawLog; export interface RawStorageChangeBase { readonly address: AddressString; readonly key: BufferString; } export interface RawStorageChangeAddModifyBase extends RawStorageChangeBase { readonly value: BufferString; } export interface RawStorageChangeAdd extends RawStorageChangeAddModifyBase { readonly type: 'Add'; } export interface RawStorageChangeModify extends RawStorageChangeAddModifyBase { readonly type: 'Modify'; } export interface RawStorageChangeDelete extends RawStorageChangeBase { readonly type: 'Delete'; } export declare type RawStorageChange = RawStorageChangeAdd | RawStorageChangeModify | RawStorageChangeDelete; export interface RawCallReceipt { readonly result: RawInvocationResult; readonly actions: readonly RawAction[]; } export interface RawInvokeReceipt extends TransactionReceipt { readonly result: RawInvocationResult; readonly actions: readonly RawAction[]; } export interface SourceMaps { readonly [address: string]: RawSourceMap; } export interface JSONRPCErrorResponse { readonly code: number; readonly message: string; readonly data?: any; } export interface VerifyScriptResult { readonly failureMessage?: string; readonly address: AddressString; readonly witness: Witness; readonly actions: readonly RawAction[]; } export interface VerifyTransactionResult { readonly verifications: readonly VerifyScriptResult[]; } export interface RelayTransactionResult { readonly transaction: Transaction; readonly verifyResult?: VerifyTransactionResult; } export interface RawInvocationData { readonly asset?: Asset; readonly contracts: readonly Contract[]; readonly deletedContractAddresses: readonly AddressString[]; readonly migratedContractAddresses: ReadonlyArray; readonly result: RawInvocationResult; readonly actions: readonly RawAction[]; readonly storageChanges: readonly RawStorageChange[]; } export interface ParamJSONArray extends ReadonlyArray { } export declare type ParamJSON = undefined | string | BufferString | AddressString | Hash256String | PublicKeyString | boolean | ParamJSONArray; export interface NetworkSettings { readonly issueGASFee: BigNumber; } export interface Peer { readonly address: string; readonly port: number; } export interface StorageItem { readonly address: string; readonly key: string; readonly value: string; } export {};