Skip to content

Commit

Permalink
The user triggers the tx checking
Browse files Browse the repository at this point in the history
  • Loading branch information
en committed Jul 30, 2024
1 parent 0c0358f commit a456077
Show file tree
Hide file tree
Showing 17 changed files with 1,007 additions and 243 deletions.
28 changes: 24 additions & 4 deletions assets/evm_route/service.did.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export type Directive = { 'UpdateChain' : Chain } |
{ 'UpdateToken' : Token };
export type EcdsaCurve = { 'secp256k1' : null };
export interface EcdsaKeyId { 'name' : string, 'curve' : EcdsaCurve }
export type EvmTxType = { 'Eip1559' : null } |
{ 'Legacy' : null };
export type Factor = { 'UpdateFeeTokenFactor' : FeeTokenFactor } |
{ 'UpdateTargetChainFactor' : TargetChainFactor };
export interface FeeTokenFactor {
Expand All @@ -43,14 +45,21 @@ export interface HttpResponse {
}
export interface InitArgs {
'evm_chain_id' : bigint,
'admin' : Principal,
'hub_principal' : Principal,
'rpcs' : Array<RpcApi>,
'evm_tx_type' : EvmTxType,
'network' : Network,
'fee_token_id' : string,
'block_interval_secs' : bigint,
'chain_id' : string,
'rpc_url' : string,
'admins' : Array<Principal>,
'evm_rpc_canister_addr' : Principal,
'scan_start_height' : bigint,
'port_addr' : [] | [string],
}
export interface MetricsStatus {
'chainkey_addr_balance' : bigint,
'latest_scan_interval_secs' : bigint,
}
export type MintTokenStatus = { 'Finalized' : { 'tx_hash' : string } } |
{ 'Unknown' : null };
Expand All @@ -68,22 +77,25 @@ export interface PendingTicketStatus {
'ticket_id' : string,
'error' : [] | [string],
}
export type Result = { 'Ok' : null } |
{ 'Err' : string };
export interface RpcApi { 'url' : string, 'headers' : [] | [Array<HttpHeader>] }
export interface StateProfile {
'next_consume_ticket_seq' : bigint,
'evm_chain_id' : bigint,
'admin' : Principal,
'omnity_port_contract' : Uint8Array | number[],
'next_consume_directive_seq' : bigint,
'hub_principal' : Principal,
'key_id' : EcdsaKeyId,
'token_contracts' : Array<[string, string]>,
'next_directive_seq' : bigint,
'evm_tx_type' : EvmTxType,
'pubkey' : Uint8Array | number[],
'start_scan_height' : bigint,
'key_derivation_path' : Array<Uint8Array | number[]>,
'omnity_chain_id' : string,
'tokens' : Array<[string, Token]>,
'admins' : Array<Principal>,
'target_chain_factor' : Array<[string, bigint]>,
'evm_rpc_addr' : Principal,
'counterparties' : Array<[string, Chain]>,
Expand Down Expand Up @@ -130,14 +142,18 @@ export interface TokenResp {
'rune_id' : [] | [string],
'symbol' : string,
}
export type TxAction = { 'Redeem' : null } |
export type TxAction = { 'Burn' : null } |
{ 'Redeem' : null } |
{ 'Mint' : null } |
{ 'Transfer' : null };
export interface _SERVICE {
'generate_ticket' : ActorMethod<[string], Result>,
'get_chain_list' : ActorMethod<[], Array<Chain>>,
'get_fee' : ActorMethod<[string], [] | [bigint]>,
'get_ticket' : ActorMethod<[string], [] | [[bigint, Ticket]]>,
'get_token_list' : ActorMethod<[], Array<TokenResp>>,
'http_request' : ActorMethod<[HttpRequest], HttpResponse>,
'metrics' : ActorMethod<[], MetricsStatus>,
'mint_token_status' : ActorMethod<[string], MintTokenStatus>,
'pubkey_and_evm_addr' : ActorMethod<[], [string, string]>,
'query_directives' : ActorMethod<
Expand All @@ -156,7 +172,11 @@ export interface _SERVICE {
'resend_directive' : ActorMethod<[bigint], undefined>,
'resend_ticket' : ActorMethod<[bigint], undefined>,
'route_state' : ActorMethod<[], StateProfile>,
'set_port_address' : ActorMethod<[string], undefined>,
'set_scan_height' : ActorMethod<[bigint], [] | [bigint]>,
'update_admins' : ActorMethod<[Array<Principal>], undefined>,
'update_consume_directive_seq' : ActorMethod<[bigint], undefined>,
'update_rpcs' : ActorMethod<[Array<RpcApi>], undefined>,
}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];
52 changes: 41 additions & 11 deletions assets/evm_route/service.did.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
export const idlFactory = ({ IDL }) => {
const HttpHeader = IDL.Record({ 'value' : IDL.Text, 'name' : IDL.Text });
const RpcApi = IDL.Record({
'url' : IDL.Text,
'headers' : IDL.Opt(IDL.Vec(HttpHeader)),
});
const EvmTxType = IDL.Variant({ 'Eip1559' : IDL.Null, 'Legacy' : IDL.Null });
const Network = IDL.Variant({
'mainnet' : IDL.Null,
'local' : IDL.Null,
'testnet' : IDL.Null,
});
const InitArgs = IDL.Record({
'evm_chain_id' : IDL.Nat64,
'admin' : IDL.Principal,
'hub_principal' : IDL.Principal,
'rpcs' : IDL.Vec(RpcApi),
'evm_tx_type' : EvmTxType,
'network' : Network,
'fee_token_id' : IDL.Text,
'block_interval_secs' : IDL.Nat64,
'chain_id' : IDL.Text,
'rpc_url' : IDL.Text,
'admins' : IDL.Vec(IDL.Principal),
'evm_rpc_canister_addr' : IDL.Principal,
'scan_start_height' : IDL.Nat64,
'port_addr' : IDL.Opt(IDL.Text),
});
const Result = IDL.Variant({ 'Ok' : IDL.Null, 'Err' : IDL.Text });
const ChainState = IDL.Variant({
'Active' : IDL.Null,
'Deactive' : IDL.Null,
Expand All @@ -32,7 +42,12 @@ export const idlFactory = ({ IDL }) => {
'chain_type' : ChainType,
'contract_address' : IDL.Opt(IDL.Text),
});
const TxAction = IDL.Variant({ 'Redeem' : IDL.Null, 'Transfer' : IDL.Null });
const TxAction = IDL.Variant({
'Burn' : IDL.Null,
'Redeem' : IDL.Null,
'Mint' : IDL.Null,
'Transfer' : IDL.Null,
});
const TicketType = IDL.Variant({
'Resubmit' : IDL.Null,
'Normal' : IDL.Null,
Expand Down Expand Up @@ -69,6 +84,10 @@ export const idlFactory = ({ IDL }) => {
'headers' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
'status_code' : IDL.Nat16,
});
const MetricsStatus = IDL.Record({
'chainkey_addr_balance' : IDL.Nat,
'latest_scan_interval_secs' : IDL.Nat64,
});
const MintTokenStatus = IDL.Variant({
'Finalized' : IDL.Record({ 'tx_hash' : IDL.Text }),
'Unknown' : IDL.Null,
Expand Down Expand Up @@ -122,26 +141,22 @@ export const idlFactory = ({ IDL }) => {
});
const EcdsaCurve = IDL.Variant({ 'secp256k1' : IDL.Null });
const EcdsaKeyId = IDL.Record({ 'name' : IDL.Text, 'curve' : EcdsaCurve });
const HttpHeader = IDL.Record({ 'value' : IDL.Text, 'name' : IDL.Text });
const RpcApi = IDL.Record({
'url' : IDL.Text,
'headers' : IDL.Opt(IDL.Vec(HttpHeader)),
});
const StateProfile = IDL.Record({
'next_consume_ticket_seq' : IDL.Nat64,
'evm_chain_id' : IDL.Nat64,
'admin' : IDL.Principal,
'omnity_port_contract' : IDL.Vec(IDL.Nat8),
'next_consume_directive_seq' : IDL.Nat64,
'hub_principal' : IDL.Principal,
'key_id' : EcdsaKeyId,
'token_contracts' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
'next_directive_seq' : IDL.Nat64,
'evm_tx_type' : EvmTxType,
'pubkey' : IDL.Vec(IDL.Nat8),
'start_scan_height' : IDL.Nat64,
'key_derivation_path' : IDL.Vec(IDL.Vec(IDL.Nat8)),
'omnity_chain_id' : IDL.Text,
'tokens' : IDL.Vec(IDL.Tuple(IDL.Text, Token)),
'admins' : IDL.Vec(IDL.Principal),
'target_chain_factor' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Nat)),
'evm_rpc_addr' : IDL.Principal,
'counterparties' : IDL.Vec(IDL.Tuple(IDL.Text, Chain)),
Expand All @@ -151,6 +166,7 @@ export const idlFactory = ({ IDL }) => {
'fee_token_factor' : IDL.Opt(IDL.Nat),
});
return IDL.Service({
'generate_ticket' : IDL.Func([IDL.Text], [Result], []),
'get_chain_list' : IDL.Func([], [IDL.Vec(Chain)], ['query']),
'get_fee' : IDL.Func([IDL.Text], [IDL.Opt(IDL.Nat64)], ['query']),
'get_ticket' : IDL.Func(
Expand All @@ -160,6 +176,7 @@ export const idlFactory = ({ IDL }) => {
),
'get_token_list' : IDL.Func([], [IDL.Vec(TokenResp)], ['query']),
'http_request' : IDL.Func([HttpRequest], [HttpResponse], ['query']),
'metrics' : IDL.Func([], [MetricsStatus], []),
'mint_token_status' : IDL.Func([IDL.Text], [MintTokenStatus], ['query']),
'pubkey_and_evm_addr' : IDL.Func([], [IDL.Text, IDL.Text], []),
'query_directives' : IDL.Func(
Expand All @@ -185,25 +202,38 @@ export const idlFactory = ({ IDL }) => {
'resend_directive' : IDL.Func([IDL.Nat64], [], []),
'resend_ticket' : IDL.Func([IDL.Nat64], [], []),
'route_state' : IDL.Func([], [StateProfile], ['query']),
'set_port_address' : IDL.Func([IDL.Text], [], []),
'set_scan_height' : IDL.Func([IDL.Nat64], [IDL.Opt(IDL.Nat64)], []),
'update_admins' : IDL.Func([IDL.Vec(IDL.Principal)], [], []),
'update_consume_directive_seq' : IDL.Func([IDL.Nat64], [], []),
'update_rpcs' : IDL.Func([IDL.Vec(RpcApi)], [], []),
});
};
export const init = ({ IDL }) => {
const HttpHeader = IDL.Record({ 'value' : IDL.Text, 'name' : IDL.Text });
const RpcApi = IDL.Record({
'url' : IDL.Text,
'headers' : IDL.Opt(IDL.Vec(HttpHeader)),
});
const EvmTxType = IDL.Variant({ 'Eip1559' : IDL.Null, 'Legacy' : IDL.Null });
const Network = IDL.Variant({
'mainnet' : IDL.Null,
'local' : IDL.Null,
'testnet' : IDL.Null,
});
const InitArgs = IDL.Record({
'evm_chain_id' : IDL.Nat64,
'admin' : IDL.Principal,
'hub_principal' : IDL.Principal,
'rpcs' : IDL.Vec(RpcApi),
'evm_tx_type' : EvmTxType,
'network' : Network,
'fee_token_id' : IDL.Text,
'block_interval_secs' : IDL.Nat64,
'chain_id' : IDL.Text,
'rpc_url' : IDL.Text,
'admins' : IDL.Vec(IDL.Principal),
'evm_rpc_canister_addr' : IDL.Principal,
'scan_start_height' : IDL.Nat64,
'port_addr' : IDL.Opt(IDL.Text),
});
return [InitArgs];
};
16 changes: 7 additions & 9 deletions dfx.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"dfx": "0.17.0",
"canisters": {
"icrc1_ledger_canister": {
"type": "custom",
"candid": "icrc1_ledger.did",
"wasm": "icrc1_ledger.wasm.gz"
},
"icp_ledger_canister": {
"type": "custom",
"candid": "https://raw.githubusercontent.com/dfinity/ic/ac971e7b4c851b89b312bee812f6de542ed907c5/rs/rosetta-api/icp_ledger/ledger.did",
Expand Down Expand Up @@ -109,21 +114,14 @@
}
},
"defaults": {
"bitcoin": {
"enabled": true,
"nodes": [
"127.0.0.1:18444"
],
"log_level": "info"
},
"build": {
"packtool": "",
"args": ""
}
},
"networks": {
"local": {
"bind": "localhost:4943",
"bind": "127.0.0.1:4943",
"type": "ephemeral",
"replica": {
"subnet_type": "system"
Expand All @@ -132,4 +130,4 @@
},
"output_env_file": ".env",
"version": 1
}
}
Loading

0 comments on commit a456077

Please sign in to comment.