UNPKG

@dfinity/cketh

Version:

A library for interfacing with ckETH.

3 lines (2 loc) 19.9 kB
import{Canister as de,createServices as _e,toNullable as L}from"@dfinity/utils";var D=({IDL:e})=>{let r=e.Variant({Safe:e.Null,Finalized:e.Null,Latest:e.Null}),t=e.Record({deposit_with_subaccount_helper_contract_address:e.Opt(e.Text),next_transaction_nonce:e.Opt(e.Nat),evm_rpc_id:e.Opt(e.Principal),ledger_suite_orchestrator_id:e.Opt(e.Principal),erc20_helper_contract_address:e.Opt(e.Text),last_erc20_scraped_block_number:e.Opt(e.Nat),ethereum_contract_address:e.Opt(e.Text),minimum_withdrawal_amount:e.Opt(e.Nat),last_deposit_with_subaccount_scraped_block_number:e.Opt(e.Nat),ethereum_block_height:e.Opt(r)}),c=e.Variant({Mainnet:e.Null,Sepolia:e.Null}),a=e.Record({ethereum_network:c,last_scraped_block_number:e.Nat,ecdsa_key_name:e.Text,next_transaction_nonce:e.Nat,evm_rpc_id:e.Opt(e.Principal),ledger_id:e.Principal,ethereum_contract_address:e.Opt(e.Text),minimum_withdrawal_amount:e.Nat,ethereum_block_height:r}),i=e.Variant({UpgradeArg:t,InitArg:a}),u=e.Record({ckerc20_ledger_id:e.Principal,chain_id:e.Nat,address:e.Text,ckerc20_token_symbol:e.Text}),d=e.Record({ckerc20_ledger_id:e.Principal}),k=e.Record({max_priority_fee_per_gas:e.Nat,max_fee_per_gas:e.Nat,max_transaction_fee:e.Nat,timestamp:e.Opt(e.Nat64),gas_limit:e.Nat}),w=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),g=e.Variant({controllers:e.Null,public:e.Null,allowed_viewers:e.Vec(e.Principal)}),R=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),reserved_cycles_limit:e.Nat,log_visibility:g,wasm_memory_limit:e.Nat,memory_allocation:e.Nat,compute_allocation:e.Nat}),f=e.Record({response_payload_bytes_total:e.Nat,num_instructions_total:e.Nat,num_calls_total:e.Nat,request_payload_bytes_total:e.Nat}),O=e.Record({status:w,memory_size:e.Nat,cycles:e.Nat,settings:R,query_stats:f,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8)),reserved_cycles:e.Nat}),n=e.Vec(e.Nat8),o=e.Record({transaction_hash:e.Text,log_index:e.Nat}),p=e.Record({destination:e.Text,value:e.Nat,max_priority_fee_per_gas:e.Nat,data:e.Vec(e.Nat8),max_fee_per_gas:e.Nat,chain_id:e.Nat,nonce:e.Nat,gas_limit:e.Nat,access_list:e.Vec(e.Record({storage_keys:e.Vec(e.Vec(e.Nat8)),address:e.Text}))}),y=e.Variant({CkErc20:e.Record({cketh_ledger_burn_index:e.Nat,ledger_id:e.Principal,ckerc20_ledger_burn_index:e.Nat}),CkEth:e.Record({ledger_burn_index:e.Nat})}),E=e.Record({effective_gas_price:e.Nat,status:e.Variant({Success:e.Null,Failure:e.Null}),transaction_hash:e.Text,block_hash:e.Text,block_number:e.Nat,gas_used:e.Nat}),P=e.Record({timestamp:e.Nat64,payload:e.Variant({SkippedBlock:e.Record({block_number:e.Nat,contract_address:e.Opt(e.Text)}),AcceptedErc20Deposit:e.Record({principal:e.Principal,transaction_hash:e.Text,value:e.Nat,log_index:e.Nat,subaccount:e.Opt(n),block_number:e.Nat,erc20_contract_address:e.Text,from_address:e.Text}),SignedTransaction:e.Record({raw_transaction:e.Text,withdrawal_id:e.Nat}),Upgrade:t,Init:a,AddedCkErc20Token:e.Record({ckerc20_ledger_id:e.Principal,chain_id:e.Nat,address:e.Text,ckerc20_token_symbol:e.Text}),SyncedDepositWithSubaccountToBlock:e.Record({block_number:e.Nat}),QuarantinedDeposit:e.Record({event_source:o}),SyncedToBlock:e.Record({block_number:e.Nat}),AcceptedDeposit:e.Record({principal:e.Principal,transaction_hash:e.Text,value:e.Nat,log_index:e.Nat,subaccount:e.Opt(n),block_number:e.Nat,from_address:e.Text}),ReplacedTransaction:e.Record({withdrawal_id:e.Nat,transaction:p}),QuarantinedReimbursement:e.Record({index:y}),MintedCkEth:e.Record({event_source:o,mint_block_index:e.Nat}),ReimbursedEthWithdrawal:e.Record({transaction_hash:e.Opt(e.Text),withdrawal_id:e.Nat,reimbursed_amount:e.Nat,reimbursed_in_block:e.Nat}),FailedErc20WithdrawalRequest:e.Record({to:e.Principal,withdrawal_id:e.Nat,reimbursed_amount:e.Nat,to_subaccount:e.Opt(e.Vec(e.Nat8))}),ReimbursedErc20Withdrawal:e.Record({burn_in_block:e.Nat,transaction_hash:e.Opt(e.Text),withdrawal_id:e.Nat,reimbursed_amount:e.Nat,ledger_id:e.Principal,reimbursed_in_block:e.Nat}),MintedCkErc20:e.Record({event_source:o,erc20_contract_address:e.Text,mint_block_index:e.Nat,ckerc20_token_symbol:e.Text}),CreatedTransaction:e.Record({withdrawal_id:e.Nat,transaction:p}),InvalidDeposit:e.Record({event_source:o,reason:e.Text}),SyncedErc20ToBlock:e.Record({block_number:e.Nat}),AcceptedErc20WithdrawalRequest:e.Record({cketh_ledger_burn_index:e.Nat,destination:e.Text,ckerc20_ledger_id:e.Principal,withdrawal_amount:e.Nat,from:e.Principal,created_at:e.Nat64,from_subaccount:e.Opt(e.Vec(e.Nat8)),erc20_contract_address:e.Text,ckerc20_ledger_burn_index:e.Nat,max_transaction_fee:e.Nat}),AcceptedEthWithdrawalRequest:e.Record({ledger_burn_index:e.Nat,destination:e.Text,withdrawal_amount:e.Nat,from:e.Principal,created_at:e.Opt(e.Nat64),from_subaccount:e.Opt(e.Vec(e.Nat8))}),FinalizedTransaction:e.Record({withdrawal_id:e.Nat,transaction_receipt:E})})}),m=e.Record({erc20_contract_address:e.Text,ledger_canister_id:e.Principal,ckerc20_token_symbol:e.Text}),v=e.Record({max_priority_fee_per_gas:e.Nat,max_fee_per_gas:e.Nat,timestamp:e.Nat64}),V=e.Record({deposit_with_subaccount_helper_contract_address:e.Opt(e.Text),eth_balance:e.Opt(e.Nat),eth_helper_contract_address:e.Opt(e.Text),last_observed_block_number:e.Opt(e.Nat),evm_rpc_id:e.Opt(e.Principal),erc20_helper_contract_address:e.Opt(e.Text),last_erc20_scraped_block_number:e.Opt(e.Nat),supported_ckerc20_tokens:e.Opt(e.Vec(m)),last_gas_fee_estimate:e.Opt(v),cketh_ledger_id:e.Opt(e.Principal),smart_contract_address:e.Opt(e.Text),last_eth_scraped_block_number:e.Opt(e.Nat),minimum_withdrawal_amount:e.Opt(e.Nat),erc20_balances:e.Opt(e.Vec(e.Record({balance:e.Nat,erc20_contract_address:e.Text}))),minter_address:e.Opt(e.Text),last_deposit_with_subaccount_scraped_block_number:e.Opt(e.Nat),ethereum_block_height:e.Opt(r)}),_=e.Record({transaction_hash:e.Text}),N=e.Variant({Success:e.Record({transaction_hash:e.Text,effective_transaction_fee:e.Opt(e.Nat)}),Reimbursed:e.Record({transaction_hash:e.Text,reimbursed_amount:e.Nat,reimbursed_in_block:e.Nat}),PendingReimbursement:_}),S=e.Variant({NotFound:e.Null,TxFinalized:N,TxSent:_,TxCreated:e.Null,Pending:e.Null}),A=e.Record({ckerc20_ledger_id:e.Principal,recipient:e.Text,from_cketh_subaccount:e.Opt(n),from_ckerc20_subaccount:e.Opt(n),amount:e.Nat}),F=e.Record({ckerc20_block_index:e.Nat,cketh_block_index:e.Nat}),h=e.Variant({TemporarilyUnavailable:e.Text,InsufficientAllowance:e.Record({token_symbol:e.Text,ledger_id:e.Principal,allowance:e.Nat,failed_burn_amount:e.Nat}),AmountTooLow:e.Record({minimum_burn_amount:e.Nat,token_symbol:e.Text,ledger_id:e.Principal,failed_burn_amount:e.Nat}),InsufficientFunds:e.Record({balance:e.Nat,token_symbol:e.Text,ledger_id:e.Principal,failed_burn_amount:e.Nat})}),C=e.Variant({TokenNotSupported:e.Record({supported_tokens:e.Vec(m)}),TemporarilyUnavailable:e.Text,CkErc20LedgerError:e.Record({error:h,cketh_block_index:e.Nat}),CkEthLedgerError:e.Record({error:h}),RecipientAddressBlocked:e.Record({address:e.Text})}),W=e.Record({recipient:e.Text,from_subaccount:e.Opt(n),amount:e.Nat}),B=e.Record({block_index:e.Nat}),U=e.Variant({TemporarilyUnavailable:e.Text,InsufficientAllowance:e.Record({allowance:e.Nat}),AmountTooLow:e.Record({min_withdrawal_amount:e.Nat}),RecipientAddressBlocked:e.Record({address:e.Text}),InsufficientFunds:e.Record({balance:e.Nat})}),q=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),M=e.Variant({ByRecipient:e.Text,BySenderAccount:q,ByWithdrawalId:e.Nat64}),z=e.Variant({TxFinalized:N,TxSent:_,TxCreated:e.Null,Pending:e.Null}),Q=e.Record({status:z,token_symbol:e.Text,withdrawal_amount:e.Nat,withdrawal_id:e.Nat64,from:e.Principal,from_subaccount:e.Opt(e.Vec(e.Nat8)),max_transaction_fee:e.Opt(e.Nat),recipient_address:e.Text});return e.Service({add_ckerc20_token:e.Func([u],[],[]),eip_1559_transaction_price:e.Func([e.Opt(d)],[k],[]),get_canister_status:e.Func([],[O],[]),get_events:e.Func([e.Record({start:e.Nat64,length:e.Nat64})],[e.Record({total_event_count:e.Nat64,events:e.Vec(P)})],[]),get_minter_info:e.Func([],[V],[]),is_address_blocked:e.Func([e.Text],[e.Bool],[]),minter_address:e.Func([],[e.Text],[]),retrieve_eth_status:e.Func([e.Nat64],[S],[]),smart_contract_address:e.Func([],[e.Text],[]),withdraw_erc20:e.Func([A],[e.Variant({Ok:F,Err:C})],[]),withdraw_eth:e.Func([W],[e.Variant({Ok:B,Err:U})],[]),withdrawal_status:e.Func([M],[e.Vec(Q)],[])})};var ee=({IDL:e})=>{let r=e.Variant({Safe:e.Null,Finalized:e.Null,Latest:e.Null}),t=e.Record({deposit_with_subaccount_helper_contract_address:e.Opt(e.Text),next_transaction_nonce:e.Opt(e.Nat),evm_rpc_id:e.Opt(e.Principal),ledger_suite_orchestrator_id:e.Opt(e.Principal),erc20_helper_contract_address:e.Opt(e.Text),last_erc20_scraped_block_number:e.Opt(e.Nat),ethereum_contract_address:e.Opt(e.Text),minimum_withdrawal_amount:e.Opt(e.Nat),last_deposit_with_subaccount_scraped_block_number:e.Opt(e.Nat),ethereum_block_height:e.Opt(r)}),c=e.Variant({Mainnet:e.Null,Sepolia:e.Null}),a=e.Record({ethereum_network:c,last_scraped_block_number:e.Nat,ecdsa_key_name:e.Text,next_transaction_nonce:e.Nat,evm_rpc_id:e.Opt(e.Principal),ledger_id:e.Principal,ethereum_contract_address:e.Opt(e.Text),minimum_withdrawal_amount:e.Nat,ethereum_block_height:r}),i=e.Variant({UpgradeArg:t,InitArg:a}),u=e.Record({ckerc20_ledger_id:e.Principal,chain_id:e.Nat,address:e.Text,ckerc20_token_symbol:e.Text}),d=e.Record({ckerc20_ledger_id:e.Principal}),k=e.Record({max_priority_fee_per_gas:e.Nat,max_fee_per_gas:e.Nat,max_transaction_fee:e.Nat,timestamp:e.Opt(e.Nat64),gas_limit:e.Nat}),w=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),g=e.Variant({controllers:e.Null,public:e.Null,allowed_viewers:e.Vec(e.Principal)}),R=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),reserved_cycles_limit:e.Nat,log_visibility:g,wasm_memory_limit:e.Nat,memory_allocation:e.Nat,compute_allocation:e.Nat}),f=e.Record({response_payload_bytes_total:e.Nat,num_instructions_total:e.Nat,num_calls_total:e.Nat,request_payload_bytes_total:e.Nat}),O=e.Record({status:w,memory_size:e.Nat,cycles:e.Nat,settings:R,query_stats:f,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8)),reserved_cycles:e.Nat}),n=e.Vec(e.Nat8),o=e.Record({transaction_hash:e.Text,log_index:e.Nat}),p=e.Record({destination:e.Text,value:e.Nat,max_priority_fee_per_gas:e.Nat,data:e.Vec(e.Nat8),max_fee_per_gas:e.Nat,chain_id:e.Nat,nonce:e.Nat,gas_limit:e.Nat,access_list:e.Vec(e.Record({storage_keys:e.Vec(e.Vec(e.Nat8)),address:e.Text}))}),y=e.Variant({CkErc20:e.Record({cketh_ledger_burn_index:e.Nat,ledger_id:e.Principal,ckerc20_ledger_burn_index:e.Nat}),CkEth:e.Record({ledger_burn_index:e.Nat})}),E=e.Record({effective_gas_price:e.Nat,status:e.Variant({Success:e.Null,Failure:e.Null}),transaction_hash:e.Text,block_hash:e.Text,block_number:e.Nat,gas_used:e.Nat}),P=e.Record({timestamp:e.Nat64,payload:e.Variant({SkippedBlock:e.Record({block_number:e.Nat,contract_address:e.Opt(e.Text)}),AcceptedErc20Deposit:e.Record({principal:e.Principal,transaction_hash:e.Text,value:e.Nat,log_index:e.Nat,subaccount:e.Opt(n),block_number:e.Nat,erc20_contract_address:e.Text,from_address:e.Text}),SignedTransaction:e.Record({raw_transaction:e.Text,withdrawal_id:e.Nat}),Upgrade:t,Init:a,AddedCkErc20Token:e.Record({ckerc20_ledger_id:e.Principal,chain_id:e.Nat,address:e.Text,ckerc20_token_symbol:e.Text}),SyncedDepositWithSubaccountToBlock:e.Record({block_number:e.Nat}),QuarantinedDeposit:e.Record({event_source:o}),SyncedToBlock:e.Record({block_number:e.Nat}),AcceptedDeposit:e.Record({principal:e.Principal,transaction_hash:e.Text,value:e.Nat,log_index:e.Nat,subaccount:e.Opt(n),block_number:e.Nat,from_address:e.Text}),ReplacedTransaction:e.Record({withdrawal_id:e.Nat,transaction:p}),QuarantinedReimbursement:e.Record({index:y}),MintedCkEth:e.Record({event_source:o,mint_block_index:e.Nat}),ReimbursedEthWithdrawal:e.Record({transaction_hash:e.Opt(e.Text),withdrawal_id:e.Nat,reimbursed_amount:e.Nat,reimbursed_in_block:e.Nat}),FailedErc20WithdrawalRequest:e.Record({to:e.Principal,withdrawal_id:e.Nat,reimbursed_amount:e.Nat,to_subaccount:e.Opt(e.Vec(e.Nat8))}),ReimbursedErc20Withdrawal:e.Record({burn_in_block:e.Nat,transaction_hash:e.Opt(e.Text),withdrawal_id:e.Nat,reimbursed_amount:e.Nat,ledger_id:e.Principal,reimbursed_in_block:e.Nat}),MintedCkErc20:e.Record({event_source:o,erc20_contract_address:e.Text,mint_block_index:e.Nat,ckerc20_token_symbol:e.Text}),CreatedTransaction:e.Record({withdrawal_id:e.Nat,transaction:p}),InvalidDeposit:e.Record({event_source:o,reason:e.Text}),SyncedErc20ToBlock:e.Record({block_number:e.Nat}),AcceptedErc20WithdrawalRequest:e.Record({cketh_ledger_burn_index:e.Nat,destination:e.Text,ckerc20_ledger_id:e.Principal,withdrawal_amount:e.Nat,from:e.Principal,created_at:e.Nat64,from_subaccount:e.Opt(e.Vec(e.Nat8)),erc20_contract_address:e.Text,ckerc20_ledger_burn_index:e.Nat,max_transaction_fee:e.Nat}),AcceptedEthWithdrawalRequest:e.Record({ledger_burn_index:e.Nat,destination:e.Text,withdrawal_amount:e.Nat,from:e.Principal,created_at:e.Opt(e.Nat64),from_subaccount:e.Opt(e.Vec(e.Nat8))}),FinalizedTransaction:e.Record({withdrawal_id:e.Nat,transaction_receipt:E})})}),m=e.Record({erc20_contract_address:e.Text,ledger_canister_id:e.Principal,ckerc20_token_symbol:e.Text}),v=e.Record({max_priority_fee_per_gas:e.Nat,max_fee_per_gas:e.Nat,timestamp:e.Nat64}),V=e.Record({deposit_with_subaccount_helper_contract_address:e.Opt(e.Text),eth_balance:e.Opt(e.Nat),eth_helper_contract_address:e.Opt(e.Text),last_observed_block_number:e.Opt(e.Nat),evm_rpc_id:e.Opt(e.Principal),erc20_helper_contract_address:e.Opt(e.Text),last_erc20_scraped_block_number:e.Opt(e.Nat),supported_ckerc20_tokens:e.Opt(e.Vec(m)),last_gas_fee_estimate:e.Opt(v),cketh_ledger_id:e.Opt(e.Principal),smart_contract_address:e.Opt(e.Text),last_eth_scraped_block_number:e.Opt(e.Nat),minimum_withdrawal_amount:e.Opt(e.Nat),erc20_balances:e.Opt(e.Vec(e.Record({balance:e.Nat,erc20_contract_address:e.Text}))),minter_address:e.Opt(e.Text),last_deposit_with_subaccount_scraped_block_number:e.Opt(e.Nat),ethereum_block_height:e.Opt(r)}),_=e.Record({transaction_hash:e.Text}),N=e.Variant({Success:e.Record({transaction_hash:e.Text,effective_transaction_fee:e.Opt(e.Nat)}),Reimbursed:e.Record({transaction_hash:e.Text,reimbursed_amount:e.Nat,reimbursed_in_block:e.Nat}),PendingReimbursement:_}),S=e.Variant({NotFound:e.Null,TxFinalized:N,TxSent:_,TxCreated:e.Null,Pending:e.Null}),A=e.Record({ckerc20_ledger_id:e.Principal,recipient:e.Text,from_cketh_subaccount:e.Opt(n),from_ckerc20_subaccount:e.Opt(n),amount:e.Nat}),F=e.Record({ckerc20_block_index:e.Nat,cketh_block_index:e.Nat}),h=e.Variant({TemporarilyUnavailable:e.Text,InsufficientAllowance:e.Record({token_symbol:e.Text,ledger_id:e.Principal,allowance:e.Nat,failed_burn_amount:e.Nat}),AmountTooLow:e.Record({minimum_burn_amount:e.Nat,token_symbol:e.Text,ledger_id:e.Principal,failed_burn_amount:e.Nat}),InsufficientFunds:e.Record({balance:e.Nat,token_symbol:e.Text,ledger_id:e.Principal,failed_burn_amount:e.Nat})}),C=e.Variant({TokenNotSupported:e.Record({supported_tokens:e.Vec(m)}),TemporarilyUnavailable:e.Text,CkErc20LedgerError:e.Record({error:h,cketh_block_index:e.Nat}),CkEthLedgerError:e.Record({error:h}),RecipientAddressBlocked:e.Record({address:e.Text})}),W=e.Record({recipient:e.Text,from_subaccount:e.Opt(n),amount:e.Nat}),B=e.Record({block_index:e.Nat}),U=e.Variant({TemporarilyUnavailable:e.Text,InsufficientAllowance:e.Record({allowance:e.Nat}),AmountTooLow:e.Record({min_withdrawal_amount:e.Nat}),RecipientAddressBlocked:e.Record({address:e.Text}),InsufficientFunds:e.Record({balance:e.Nat})}),q=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),M=e.Variant({ByRecipient:e.Text,BySenderAccount:q,ByWithdrawalId:e.Nat64}),z=e.Variant({TxFinalized:N,TxSent:_,TxCreated:e.Null,Pending:e.Null}),Q=e.Record({status:z,token_symbol:e.Text,withdrawal_amount:e.Nat,withdrawal_id:e.Nat64,from:e.Principal,from_subaccount:e.Opt(e.Vec(e.Nat8)),max_transaction_fee:e.Opt(e.Nat),recipient_address:e.Text});return e.Service({add_ckerc20_token:e.Func([u],[],[]),eip_1559_transaction_price:e.Func([e.Opt(d)],[k],["query"]),get_canister_status:e.Func([],[O],[]),get_events:e.Func([e.Record({start:e.Nat64,length:e.Nat64})],[e.Record({total_event_count:e.Nat64,events:e.Vec(P)})],["query"]),get_minter_info:e.Func([],[V],["query"]),is_address_blocked:e.Func([e.Text],[e.Bool],["query"]),minter_address:e.Func([],[e.Text],[]),retrieve_eth_status:e.Func([e.Nat64],[S],[]),smart_contract_address:e.Func([],[e.Text],["query"]),withdraw_erc20:e.Func([A],[e.Variant({Ok:F,Err:C})],[]),withdraw_eth:e.Func([W],[e.Variant({Ok:B,Err:U})],[]),withdrawal_status:e.Func([M],[e.Vec(Q)],["query"])})};import{nonNullish as ie}from"@dfinity/utils";var b=class extends Error{details;constructor({msg:r,details:t}){super(r),this.details=t}},H=class extends Error{},s=class extends b{},x=class extends H{},G=class extends s{},j=class extends s{},J=class extends s{},T=class extends s{},K=class extends s{},te=class extends Error{},l=class extends b{},X=class extends l{},Y=class extends l{},Z=class extends l{},$=class extends l{},I=class extends l{},re=e=>"TemporarilyUnavailable"in e?new x(e.TemporarilyUnavailable):"InsufficientAllowance"in e?new j({details:e.InsufficientAllowance.allowance}):"AmountTooLow"in e?new J({details:e.AmountTooLow.min_withdrawal_amount}):"RecipientAddressBlocked"in e?new T({details:e.RecipientAddressBlocked.address}):"InsufficientFunds"in e?new G({details:e.InsufficientFunds.balance}):new s({msg:"Unsupported response type in minter.withdrawEth",details:e}),ae=e=>{if("TemporarilyUnavailable"in e)return new x(e.TemporarilyUnavailable);if("RecipientAddressBlocked"in e)return new T({details:e.RecipientAddressBlocked.address});if("TokenNotSupported"in e)return new K({details:e.TokenNotSupported.supported_tokens});let r=({Err:t,ckEthBlockIndex:c})=>{let a=i=>({error:i,ckEthBlockIndex:c});return"TemporarilyUnavailable"in t?new Y({msg:t.TemporarilyUnavailable,...ie(c)&&{details:{ckEthBlockIndex:c}}}):"InsufficientAllowance"in t?new Z({details:a(t.InsufficientAllowance)}):"AmountTooLow"in t?new $({details:a(t.AmountTooLow)}):"InsufficientFunds"in t?new I({details:a(t.InsufficientFunds)}):new X({msg:"Unsupported response type in ledger for minter.withdrawErc20",details:a(t)})};return"CkErc20LedgerError"in e?r({Err:e.CkErc20LedgerError.error,ckEthBlockIndex:e.CkErc20LedgerError.cketh_block_index}):"CkEthLedgerError"in e?r({Err:e.CkEthLedgerError.error}):new s({msg:"Unsupported response type in minter.withdrawErc20",details:e})};import{isNullish as oe,toNullable as se}from"@dfinity/utils";var ce=({ckErc20LedgerId:e})=>se(oe(e)?void 0:{ckerc20_ledger_id:e});var ne=class e extends de{static create(r){let{service:t,certifiedService:c,canisterId:a}=_e({options:r,idlFactory:ee,certifiedIdlFactory:D});return new e(a,t,c)}getSmartContractAddress=({certified:r}={})=>{let{smart_contract_address:t}=this.caller({certified:r});return t()};withdrawEth=async({address:r,fromSubaccount:t,...c})=>{let{withdraw_eth:a}=this.caller({certified:!0}),i=await a({recipient:r,from_subaccount:L(t),...c});if("Err"in i)throw re(i.Err);return i.Ok};withdrawErc20=async({address:r,ledgerCanisterId:t,fromCkEthSubaccount:c,fromCkErc20Subaccount:a,...i})=>{let{withdraw_erc20:u}=this.caller({certified:!0}),d=await u({recipient:r,ckerc20_ledger_id:t,from_cketh_subaccount:L(c),from_ckerc20_subaccount:L(a),...i});if("Err"in d)throw ae(d.Err);return d.Ok};eip1559TransactionPrice=({certified:r,...t})=>{let{eip_1559_transaction_price:c}=this.caller({certified:r});return c(ce(t))};retrieveEthStatus=r=>{let{retrieve_eth_status:t}=this.caller({certified:!0});return t(r)};getMinterInfo=({certified:r})=>{let{get_minter_info:t}=this.caller({certified:r});return t()}};export{b as a,H as b,s as c,x as d,G as e,j as f,J as g,T as h,K as i,te as j,l as k,X as l,Y as m,Z as n,$ as o,I as p,re as q,ae as r,ne as s}; //# sourceMappingURL=chunk-N5XIETXK.js.map