-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor types.ts file and update AccountIdentity name to shortName (#…
…161) * Refactor types.ts file * Update AccountIdentity name to shortName
- Loading branch information
1 parent
8e2ad0e
commit 47f0b9a
Showing
1 changed file
with
78 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,111 +1,115 @@ | ||
import { TransactionFee, TransactionRPC } from '../types' | ||
import { TransactionFee, TransactionRPC } from "../types"; | ||
|
||
export type NodeRpcMethods = { | ||
contract_fun(params: { | ||
contract: string, | ||
function: string, | ||
args?: any[] | ||
}): any, | ||
estimate_transaction_fee(params: EstimateTransactionFeeRequest): TransactionFee, | ||
send_transaction(params: SendTransactionRequest): SendTransactionResponse, | ||
simulate_contract_execution(params: SimulateContractExecutionRequest): SimulateContractExecutionResponse[], | ||
add_origin_key(params: AddOriginKeyRequest): AddOriginKeyResponse | ||
} | ||
contract_fun(params: { | ||
contract: string; | ||
function: string; | ||
args?: any[]; | ||
}): any; | ||
estimate_transaction_fee( | ||
params: EstimateTransactionFeeRequest | ||
): TransactionFee; | ||
send_transaction(params: SendTransactionRequest): SendTransactionResponse; | ||
simulate_contract_execution( | ||
params: SimulateContractExecutionRequest | ||
): SimulateContractExecutionResponse[]; | ||
add_origin_key(params: AddOriginKeyRequest): AddOriginKeyResponse; | ||
}; | ||
|
||
export type AddOriginKeyRequest = { | ||
certificate: string, | ||
origin_public_key: string, | ||
} | ||
certificate: string; | ||
origin_public_key: string; | ||
}; | ||
|
||
export type AddOriginKeyResponse = { | ||
transaction_address: string, | ||
status: string | ||
} | ||
transaction_address: string; | ||
status: string; | ||
}; | ||
|
||
export type EstimateTransactionFeeRequest = { | ||
transaction: TransactionRPC | ||
} | ||
transaction: TransactionRPC; | ||
}; | ||
|
||
export type SendTransactionRequest = { | ||
transaction: TransactionRPC | ||
} | ||
transaction: TransactionRPC; | ||
}; | ||
|
||
export type SendTransactionResponse = { | ||
transaction_address: string, | ||
status: string | ||
} | ||
transaction_address: string; | ||
status: string; | ||
}; | ||
|
||
export type SimulateContractExecutionRequest = { | ||
transaction: TransactionRPC | ||
} | ||
transaction: TransactionRPC; | ||
}; | ||
|
||
export type SimulateContractExecutionResponse = { | ||
recipient_address: string, | ||
valid: boolean, | ||
error?: string | ||
} | ||
recipient_address: string; | ||
valid: boolean; | ||
error?: string; | ||
}; | ||
|
||
export enum ConnectionState { | ||
Closed = 'WalletRPCConnection_closed', | ||
Closing = 'WalletRPCConnection_closing', | ||
Connecting = 'WalletRPCConnection_connecting', | ||
Open = 'WalletRPCConnection_open', | ||
Closed = "WalletRPCConnection_closed", | ||
Closing = "WalletRPCConnection_closing", | ||
Connecting = "WalletRPCConnection_connecting", | ||
Open = "WalletRPCConnection_open", | ||
} | ||
export enum RpcErrorCode { | ||
UnsupportedMethod = -32601, | ||
Timeout = 5001, | ||
Connectivity = 4901, | ||
ConsensusNotReached = 5002, | ||
InvalidParams = -32602, | ||
InvalidTransaction = 5003, | ||
InvalidConfirmation = 5006, | ||
InsufficientFunds = 5004, | ||
ServiceNotFound = 5007, | ||
UserRejected = 4001, | ||
UnknownAccount = 5005, | ||
Other = 5000, | ||
UnsupportedMethod = -32601, | ||
Timeout = 5001, | ||
Connectivity = 4901, | ||
ConsensusNotReached = 5002, | ||
InvalidParams = -32602, | ||
InvalidTransaction = 5003, | ||
InvalidConfirmation = 5006, | ||
InsufficientFunds = 5004, | ||
ServiceNotFound = 5007, | ||
UserRejected = 4001, | ||
UnknownAccount = 5005, | ||
Other = 5000, | ||
} | ||
|
||
export type RpcSubscription = { | ||
id: string; | ||
eventListener: EventListenerOrEventListenerObject; | ||
} | ||
id: string; | ||
eventListener: EventListenerOrEventListenerObject; | ||
}; | ||
|
||
export type RpcNotification = { | ||
subscriptionId: string; | ||
data: Object; | ||
} | ||
subscriptionId: string; | ||
data: Object; | ||
}; | ||
|
||
export type RpcRequestOrigin = { | ||
name: string; | ||
url?: string; | ||
logo?: string; | ||
} | ||
name: string; | ||
url?: string; | ||
logo?: string; | ||
}; | ||
|
||
export type RpcRequest = { | ||
origin: RpcRequestOrigin; | ||
version: number; | ||
payload: Object; | ||
} | ||
origin: RpcRequestOrigin; | ||
version: number; | ||
payload: Object; | ||
}; | ||
|
||
export type Endpoint = { | ||
endpointUrl: string; | ||
} | ||
endpointUrl: string; | ||
}; | ||
|
||
export type AccountIdentity = { | ||
name: string; | ||
genesisAddress: string; | ||
} | ||
shortName: string; | ||
genesisAddress: string; | ||
}; | ||
|
||
export type TransactionSuccess = { | ||
transactionAddress: string, | ||
nbConfirmations: number, | ||
maxConfirmations: number, | ||
} | ||
transactionAddress: string; | ||
nbConfirmations: number; | ||
maxConfirmations: number; | ||
}; | ||
|
||
export type SignedTransaction = { | ||
address: string, | ||
previousPublicKey: string, | ||
previousSignature: string, | ||
originSignature: string | ||
} | ||
address: string; | ||
previousPublicKey: string; | ||
previousSignature: string; | ||
originSignature: string; | ||
}; |