@dfinity/ledger-icrc 6.0.1 → 7.0.0-next-2025-12-11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/index.d.ts +23 -17
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +4 -4
  4. package/dist/index.mjs +1 -1
  5. package/dist/index.mjs.map +4 -4
  6. package/package.json +4 -5
  7. package/dist/candid/icrc_index-ng.certified.idl.d.ts +0 -2
  8. package/dist/candid/icrc_index-ng.certified.idl.js +0 -151
  9. package/dist/candid/icrc_index-ng.d.ts +0 -154
  10. package/dist/candid/icrc_index-ng.did +0 -156
  11. package/dist/candid/icrc_index-ng.idl.d.ts +0 -2
  12. package/dist/candid/icrc_index-ng.idl.js +0 -151
  13. package/dist/candid/icrc_index.certified.idl.d.ts +0 -2
  14. package/dist/candid/icrc_index.certified.idl.js +0 -99
  15. package/dist/candid/icrc_index.d.ts +0 -108
  16. package/dist/candid/icrc_index.did +0 -98
  17. package/dist/candid/icrc_index.idl.d.ts +0 -2
  18. package/dist/candid/icrc_index.idl.js +0 -99
  19. package/dist/candid/icrc_ledger.certified.idl.d.ts +0 -2
  20. package/dist/candid/icrc_ledger.certified.idl.js +0 -525
  21. package/dist/candid/icrc_ledger.d.ts +0 -590
  22. package/dist/candid/icrc_ledger.did +0 -579
  23. package/dist/candid/icrc_ledger.idl.d.ts +0 -2
  24. package/dist/candid/icrc_ledger.idl.js +0 -545
  25. package/dist/candid/icrc_nft-ledger.certified.idl.d.ts +0 -2
  26. package/dist/candid/icrc_nft-ledger.certified.idl.js +0 -102
  27. package/dist/candid/icrc_nft-ledger.d.ts +0 -80
  28. package/dist/candid/icrc_nft-ledger.did +0 -67
  29. package/dist/candid/icrc_nft-ledger.idl.d.ts +0 -2
  30. package/dist/candid/icrc_nft-ledger.idl.js +0 -106
  31. package/dist/canister.d.ts +0 -13
  32. package/dist/converters/converters.d.ts +0 -16
  33. package/dist/converters/index.converters.d.ts +0 -6
  34. package/dist/converters/ledger.converters.d.ts +0 -6
  35. package/dist/errors/index.errors.d.ts +0 -2
  36. package/dist/errors/ledger.errors.d.ts +0 -25
  37. package/dist/index-ng.canister.d.ts +0 -43
  38. package/dist/index.canister.d.ts +0 -21
  39. package/dist/ledger.canister.d.ts +0 -127
  40. package/dist/types/canister.options.d.ts +0 -5
  41. package/dist/types/index-ng.params.d.ts +0 -12
  42. package/dist/types/index-ng.types.d.ts +0 -1
  43. package/dist/types/index.params.d.ts +0 -7
  44. package/dist/types/index.types.d.ts +0 -1
  45. package/dist/types/ledger.params.d.ts +0 -109
  46. package/dist/types/ledger.responses.d.ts +0 -24
  47. package/dist/utils/ledger.utils.d.ts +0 -31
  48. package/dist/utils/payment.utils.d.ts +0 -28
package/dist/index.d.ts CHANGED
@@ -1,19 +1,25 @@
1
+ import type { IcrcIndexDid, IcrcLedgerDid } from "@icp-sdk/canisters/ledger/icrc";
2
+ export type Icrc3Value = IcrcLedgerDid.ICRC3Value;
3
+ export type IcrcAllowance = IcrcLedgerDid.Allowance;
4
+ export type IcrcApproveError = IcrcLedgerDid.ApproveError;
5
+ export type IcrcBlockIndex = IcrcLedgerDid.BlockIndex;
6
+ export type IcrcCandidAccount = IcrcLedgerDid.Account;
7
+ export type IcrcGetBlocksArgs = IcrcLedgerDid.GetBlocksArgs;
8
+ export type IcrcGetBlocksResult = IcrcLedgerDid.GetBlocksResult;
9
+ export type IcrcStandardRecord = IcrcLedgerDid.StandardRecord;
10
+ export type IcrcSubaccount = IcrcLedgerDid.Subaccount;
11
+ export type IcrcTimestamp = IcrcLedgerDid.Timestamp;
12
+ export type IcrcTokens = IcrcLedgerDid.Tokens;
13
+ export type IcrcTransferArg = IcrcLedgerDid.TransferArg;
14
+ export type IcrcTransferFromError = IcrcLedgerDid.TransferFromError;
15
+ export type IcrcTransferVariantError = IcrcLedgerDid.TransferError;
16
+ export type IcrcValue = IcrcLedgerDid.Value;
17
+ export type IcrcIndexNgGetTransactions = IcrcIndexDid.GetTransactions;
18
+ export type IcrcIndexNgTransaction = IcrcIndexDid.Transaction;
19
+ export type IcrcIndexNgTransactionWithId = IcrcIndexDid.TransactionWithId;
20
+ export type IcrcNgStatus = IcrcIndexDid.Status;
21
+ export type IcrcNgTxId = IcrcIndexDid.BlockIndex;
1
22
  /**
2
- * @module api/ledger/icrc
23
+ * @deprecated Use "@icp-sdk/canisters/ledger/icrc" directly instead
3
24
  */
4
- export type { ICRC3Value as Icrc3Value, Allowance as IcrcAllowance, ApproveError as IcrcApproveError, BlockIndex as IcrcBlockIndex, Account as IcrcCandidAccount, GetBlocksArgs as IcrcGetBlocksArgs, GetBlocksResult as IcrcGetBlocksResult, StandardRecord as IcrcStandardRecord, Subaccount as IcrcSubaccount, Timestamp as IcrcTimestamp, Tokens as IcrcTokens, TransferArg as IcrcTransferArg, TransferFromError as IcrcTransferFromError, TransferError as IcrcTransferVariantError, Value as IcrcValue, } from "./candid/icrc_ledger";
5
- export * from "./converters/converters";
6
- export * from "./converters/ledger.converters";
7
- export * from "./errors/index.errors";
8
- export * from "./errors/ledger.errors";
9
- export { IcrcIndexNgCanister } from "./index-ng.canister";
10
- export { IcrcIndexCanister } from "./index.canister";
11
- export { IcrcLedgerCanister } from "./ledger.canister";
12
- export type * from "./types/index-ng.params";
13
- export type * from "./types/index-ng.types";
14
- export type * from "./types/index.params";
15
- export type * from "./types/index.types";
16
- export * from "./types/ledger.params";
17
- export * from "./types/ledger.responses";
18
- export * from "./utils/ledger.utils";
19
- export * from "./utils/payment.utils";
25
+ export * from "@icp-sdk/canisters/ledger/icrc";
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{fromNullable as Ze,nonNullish as Xe,toNullable as Ye}from"@dfinity/utils";var _t=({owner:e,subaccount:t})=>{let c=Ze(t);return{owner:e,...Xe(c)?{subaccount:c}:{}}},ke=({owner:e,subaccount:t})=>({owner:e,subaccount:Ye(t)});import{isNullish as je,toNullable as m}from"@dfinity/utils";var he=({from_subaccount:e,fee:t,created_at_time:c,memo:r,...i})=>({...i,fee:m(t),memo:m(r),from_subaccount:m(e),created_at_time:m(c)}),Fe=({spender_subaccount:e,fee:t,created_at_time:c,memo:r,...i})=>({...i,fee:m(t),memo:m(r),spender_subaccount:m(e),created_at_time:m(c)}),Pe=({fee:e,created_at_time:t,memo:c,from_subaccount:r,expected_allowance:i,expires_at:n,...d})=>({...d,fee:m(e),memo:m(c),from_subaccount:m(r),created_at_time:m(t),expected_allowance:m(i),expires_at:m(n)}),ve=({userPreferences:{metadata:{utcOffsetMinutes:e,language:t},deriveSpec:c},...r})=>({...r,user_preferences:{metadata:{language:t,utc_offset_minutes:m(e)},device_spec:je(c)?m():m("GenericDisplay"in c?{GenericDisplay:null}:{FieldsDisplay:null})}});var P=class extends Error{};var v=class extends Error{errorType;constructor({msg:t,errorType:c}){super(t),this.errorType=c}},w=class extends Error{constructor(c,r){super();this.message=c;this.error_code=r}},G=class extends Error{},xe=class extends G{},Te=class extends G{},Re=class extends G{},Ge=e=>"GenericError"in e?new w(e.GenericError.description,e.GenericError.error_code):"InsufficientPayment"in e?new xe(e.InsufficientPayment.description):"UnsupportedCanisterCall"in e?new Te(e.UnsupportedCanisterCall.description):"ConsentMessageUnavailable"in e?new Re(e.ConsentMessageUnavailable.description):new G(`Unknown error type ${JSON.stringify(e)}`),ye=class extends Error{},Se=e=>"IndexPrincipalNotSet"in e?new ye("Index principal is not set for this ledger canister."):new w(e.GenericError.description,e.GenericError.error_code);import{createServices as Ie}from"@dfinity/utils";var Ee=({IDL:e})=>{let t=e.Rec(),c=e.Record({ledger_id:e.Opt(e.Principal),retrieve_blocks_from_ledger_interval_seconds:e.Opt(e.Nat64)}),r=e.Record({ledger_id:e.Principal,retrieve_blocks_from_ledger_interval_seconds:e.Opt(e.Nat64)}),i=e.Variant({Upgrade:c,Init:r}),n=e.Nat,d=e.Vec(e.Nat8),a=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),g=e.Record({max_results:e.Nat,start:e.Opt(n),account:a}),p=e.Nat,f=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,spender:e.Opt(a)}),N=e.Record({to:a,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p}),x=e.Record({fee:e.Opt(p),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,expected_allowance:e.Opt(p),expires_at:e.Opt(e.Nat64),spender:a}),s=e.Record({to:a,fee:e.Opt(p),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,spender:e.Opt(a)}),u=e.Record({burn:e.Opt(f),kind:e.Text,mint:e.Opt(N),approve:e.Opt(x),timestamp:e.Nat64,transfer:e.Opt(s)}),_=e.Record({id:n,transaction:u}),y=e.Record({balance:p,transactions:e.Vec(_),oldest_tx_id:e.Opt(n)}),T=e.Record({message:e.Text}),V=e.Variant({Ok:y,Err:T}),b=e.Record({start:e.Nat,length:e.Nat}),A=e.Vec(e.Tuple(e.Text,t));t.fill(e.Variant({Int:e.Int,Map:A,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(t)}));let k=t,O=e.Record({blocks:e.Vec(k),chain_length:e.Nat64}),R=e.Record({ranges:e.Vec(e.Tuple(a,e.Vec(e.Tuple(n,n))))}),o=e.Record({owner:e.Principal,start:e.Opt(d)}),h=e.Record({num_blocks_synced:n});return e.Service({get_account_transactions:e.Func([g],[V],[]),get_blocks:e.Func([b],[O],[]),get_fee_collectors_ranges:e.Func([],[R],[]),icrc1_balance_of:e.Func([a],[p],[]),ledger_id:e.Func([],[e.Principal],[]),list_subaccounts:e.Func([o],[e.Vec(d)],[]),status:e.Func([],[h],["query"])})};var we=({IDL:e})=>{let t=e.Rec(),c=e.Record({ledger_id:e.Opt(e.Principal),retrieve_blocks_from_ledger_interval_seconds:e.Opt(e.Nat64)}),r=e.Record({ledger_id:e.Principal,retrieve_blocks_from_ledger_interval_seconds:e.Opt(e.Nat64)}),i=e.Variant({Upgrade:c,Init:r}),n=e.Nat,d=e.Vec(e.Nat8),a=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),g=e.Record({max_results:e.Nat,start:e.Opt(n),account:a}),p=e.Nat,f=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,spender:e.Opt(a)}),N=e.Record({to:a,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p}),x=e.Record({fee:e.Opt(p),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,expected_allowance:e.Opt(p),expires_at:e.Opt(e.Nat64),spender:a}),s=e.Record({to:a,fee:e.Opt(p),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,spender:e.Opt(a)}),u=e.Record({burn:e.Opt(f),kind:e.Text,mint:e.Opt(N),approve:e.Opt(x),timestamp:e.Nat64,transfer:e.Opt(s)}),_=e.Record({id:n,transaction:u}),y=e.Record({balance:p,transactions:e.Vec(_),oldest_tx_id:e.Opt(n)}),T=e.Record({message:e.Text}),V=e.Variant({Ok:y,Err:T}),b=e.Record({start:e.Nat,length:e.Nat}),A=e.Vec(e.Tuple(e.Text,t));t.fill(e.Variant({Int:e.Int,Map:A,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(t)}));let k=t,O=e.Record({blocks:e.Vec(k),chain_length:e.Nat64}),R=e.Record({ranges:e.Vec(e.Tuple(a,e.Vec(e.Tuple(n,n))))}),o=e.Record({owner:e.Principal,start:e.Opt(d)}),h=e.Record({num_blocks_synced:n});return e.Service({get_account_transactions:e.Func([g],[V],["query"]),get_blocks:e.Func([b],[O],["query"]),get_fee_collectors_ranges:e.Func([],[R],["query"]),icrc1_balance_of:e.Func([a],[p],["query"]),ledger_id:e.Func([],[e.Principal],["query"]),list_subaccounts:e.Func([o],[e.Vec(d)],["query"]),status:e.Func([],[h],["query"])})};import{Canister as Je,toNullable as Ke}from"@dfinity/utils";var B=class extends Je{balance=t=>this.caller({certified:t.certified}).icrc1_balance_of({owner:t.owner,subaccount:Ke(t.subaccount)})};import{toNullable as Be}from"@dfinity/utils";var C=({account:e,max_results:t,start:c})=>({account:ke(e),max_results:t,start:Be(c)}),Ce=({owner:e,start:t})=>({owner:e,start:Be(t)});var Ve=class e extends B{static create(t){let{service:c,certifiedService:r,canisterId:i}=Ie({options:t,idlFactory:we,certifiedIdlFactory:Ee});return new e(i,c,r)}getTransactions=async({certified:t,...c})=>{let r=await this.caller({certified:t}).get_account_transactions(C(c));if("Err"in r)throw new P(r.Err.message);return r.Ok};ledgerId=t=>{let{ledger_id:c}=this.caller(t);return c()};status=t=>this.caller(t).status();listSubaccounts=({certified:t,...c})=>this.caller({certified:t}).list_subaccounts(Ce(c))};import{Canister as Le,createServices as De}from"@dfinity/utils";var Me=({IDL:e})=>{let t=e.Record({ledger_id:e.Principal}),c=e.Nat,r=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),i=e.Record({max_results:e.Nat,start:e.Opt(c),account:r}),n=e.Record({from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,spender:e.Opt(r)}),d=e.Record({to:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat}),a=e.Record({fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(e.Nat64),spender:r}),g=e.Record({to:r,fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,spender:e.Opt(r)}),p=e.Record({burn:e.Opt(n),kind:e.Text,mint:e.Opt(d),approve:e.Opt(a),timestamp:e.Nat64,transfer:e.Opt(g)}),f=e.Record({id:c,transaction:p}),N=e.Record({transactions:e.Vec(f),oldest_tx_id:e.Opt(c)}),x=e.Record({message:e.Text}),s=e.Variant({Ok:N,Err:x}),u=e.Vec(e.Nat8),_=e.Record({owner:e.Principal,start:e.Opt(u)});return e.Service({get_account_transactions:e.Func([i],[s],[]),ledger_id:e.Func([],[e.Principal],[]),list_subaccounts:e.Func([_],[e.Vec(u)],[])})};var qe=({IDL:e})=>{let t=e.Record({ledger_id:e.Principal}),c=e.Nat,r=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),i=e.Record({max_results:e.Nat,start:e.Opt(c),account:r}),n=e.Record({from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,spender:e.Opt(r)}),d=e.Record({to:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat}),a=e.Record({fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(e.Nat64),spender:r}),g=e.Record({to:r,fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,spender:e.Opt(r)}),p=e.Record({burn:e.Opt(n),kind:e.Text,mint:e.Opt(d),approve:e.Opt(a),timestamp:e.Nat64,transfer:e.Opt(g)}),f=e.Record({id:c,transaction:p}),N=e.Record({transactions:e.Vec(f),oldest_tx_id:e.Opt(c)}),x=e.Record({message:e.Text}),s=e.Variant({Ok:N,Err:x}),u=e.Vec(e.Nat8),_=e.Record({owner:e.Principal,start:e.Opt(u)});return e.Service({get_account_transactions:e.Func([i],[s],[]),ledger_id:e.Func([],[e.Principal],["query"]),list_subaccounts:e.Func([_],[e.Vec(u)],["query"])})};var be=class e extends Le{static create(t){let{service:c,certifiedService:r,canisterId:i}=De({options:t,idlFactory:qe,certifiedIdlFactory:Me});return new e(i,c,r)}getTransactions=async t=>{let c=await this.caller({certified:!0}).get_account_transactions(C(t));if("Err"in c)throw new P(c.Err.message);return c.Ok};ledgerId=t=>{let{ledger_id:c}=this.caller(t);return c()}};import{Canister as et,createServices as tt,toNullable as rt}from"@dfinity/utils";var Ue=({IDL:e})=>{let t=e.Rec(),c=e.Rec(),r=e.Rec(),i=e.Record({num_blocks_to_archive:e.Opt(e.Nat64),max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Opt(e.Nat64),more_controller_ids:e.Opt(e.Vec(e.Principal)),max_message_size_bytes:e.Opt(e.Nat64),cycles_for_archive_creation:e.Opt(e.Nat64),node_max_memory_size_bytes:e.Opt(e.Nat64),controller_id:e.Opt(e.Principal)}),n=e.Variant({Int:e.Int,Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text}),d=e.Vec(e.Nat8),a=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),g=e.Variant({SetTo:a,Unset:e.Null}),p=e.Record({icrc2:e.Bool}),f=e.Record({change_archive_options:e.Opt(i),token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat),metadata:e.Opt(e.Vec(e.Tuple(e.Text,n))),change_fee_collector:e.Opt(g),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Opt(e.Text),feature_flags:e.Opt(p)}),N=e.Record({decimals:e.Opt(e.Nat8),token_symbol:e.Text,transfer_fee:e.Nat,metadata:e.Vec(e.Tuple(e.Text,n)),minting_account:a,initial_balances:e.Vec(e.Tuple(a,e.Nat)),fee_collector_account:e.Opt(a),archive_options:e.Record({num_blocks_to_archive:e.Nat64,max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Nat64,more_controller_ids:e.Opt(e.Vec(e.Principal)),max_message_size_bytes:e.Opt(e.Nat64),cycles_for_archive_creation:e.Opt(e.Nat64),node_max_memory_size_bytes:e.Opt(e.Nat64),controller_id:e.Principal}),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Text,feature_flags:e.Opt(p)}),x=e.Variant({Upgrade:e.Opt(f),Init:N}),s=e.Nat,u=e.Record({block_range_end:s,canister_id:e.Principal,block_range_start:s}),_=e.Record({start:s,length:e.Nat}),y=e.Vec(e.Tuple(e.Text,r));r.fill(e.Variant({Int:e.Int,Map:y,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(r)}));let T=r,V=e.Record({blocks:e.Vec(T)}),b=e.Func([_],[V],[]),A=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),first_index:s,blocks:e.Vec(T),chain_length:e.Nat64,archived_blocks:e.Vec(e.Record({callback:b,start:s,length:e.Nat}))}),k=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),hash_tree:e.Vec(e.Nat8)}),O=e.Nat,R=e.Record({start:O,length:e.Nat}),o=e.Nat64,h=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,spender:e.Opt(a)}),q=e.Record({to:a,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat}),U=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(o),spender:a}),z=e.Record({to:a,fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,spender:e.Opt(a)}),S=e.Record({burn:e.Opt(h),kind:e.Text,mint:e.Opt(q),approve:e.Opt(U),timestamp:o,transfer:e.Opt(z)}),Q=e.Record({transactions:e.Vec(S)}),$=e.Func([R],[Q],[]),H=e.Record({first_index:O,log_length:e.Nat,transactions:e.Vec(S),archived_transactions:e.Vec(e.Record({callback:$,start:O,length:e.Nat}))}),W=e.Record({take:e.Opt(e.Nat),prev_spender:e.Opt(a),from_account:e.Opt(a)}),Z=e.Record({from_account:a,to_spender:a,allowance:e.Nat,expires_at:e.Opt(e.Nat64)}),X=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),AccessDenied:e.Record({reason:e.Text})}),Y=e.Variant({Ok:e.Vec(Z),Err:X}),j=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),IndexPrincipalNotSet:e.Null}),J=e.Variant({Ok:e.Principal,Err:j}),l=e.Nat,K=e.Record({url:e.Text,name:e.Text}),I=e.Record({to:a,fee:e.Opt(l),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(d),created_at_time:e.Opt(o),amount:l}),L=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:l}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:l}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,InsufficientFunds:e.Record({balance:l})}),D=e.Variant({Ok:s,Err:L}),E=e.Record({utc_offset_minutes:e.Opt(e.Int16),language:e.Text}),ee=e.Record({metadata:E,device_spec:e.Opt(e.Variant({GenericDisplay:e.Null,FieldsDisplay:e.Null}))}),te=e.Record({arg:e.Vec(e.Nat8),method:e.Text,user_preferences:ee}),re=e.Variant({Text:e.Record({content:e.Text}),TokenAmount:e.Record({decimals:e.Nat8,amount:e.Nat64,symbol:e.Text}),TimestampSeconds:e.Record({amount:e.Nat64}),DurationSeconds:e.Record({amount:e.Nat64})}),ce=e.Record({fields:e.Vec(e.Tuple(e.Text,re)),intent:e.Text}),ae=e.Variant({FieldsDisplayMessage:ce,GenericDisplayMessage:e.Text}),ne=e.Record({metadata:E,consent_message:ae}),F=e.Record({description:e.Text}),oe=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),InsufficientPayment:F,UnsupportedCanisterCall:F,ConsentMessageUnavailable:F}),se=e.Variant({Ok:ne,Err:oe}),ie=e.Record({account:a,spender:a}),pe=e.Record({allowance:e.Nat,expires_at:e.Opt(o)}),le=e.Record({fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(o),spender:a}),de=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:e.Nat}),AllowanceChanged:e.Record({current_allowance:e.Nat}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,Expired:e.Record({ledger_time:o}),InsufficientFunds:e.Record({balance:e.Nat})}),_e=e.Variant({Ok:s,Err:de}),me=e.Record({to:a,fee:e.Opt(l),spender_subaccount:e.Opt(d),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:l}),ue=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,InsufficientAllowance:e.Record({allowance:l}),BadBurn:e.Record({min_burn_amount:l}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:l}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,InsufficientFunds:e.Record({balance:l})}),ge=e.Variant({Ok:s,Err:ue}),fe=e.Record({from:e.Opt(e.Principal)}),Ne=e.Vec(e.Record({end:e.Nat,canister_id:e.Principal,start:e.Nat}));c.fill(e.Variant({Int:e.Int,Map:e.Vec(e.Tuple(e.Text,c)),Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(c)})),t.fill(e.Record({log_length:e.Nat,blocks:e.Vec(e.Record({id:e.Nat,block:c})),archived_blocks:e.Vec(e.Record({args:e.Vec(_),callback:e.Func([e.Vec(_)],[t],["query"])}))}));let Oe=e.Record({certificate:e.Vec(e.Nat8),hash_tree:e.Vec(e.Nat8)});return e.Service({archives:e.Func([],[e.Vec(u)],[]),get_blocks:e.Func([_],[A],[]),get_data_certificate:e.Func([],[k],[]),get_transactions:e.Func([R],[H],[]),icrc103_get_allowances:e.Func([W],[Y],[]),icrc106_get_index_principal:e.Func([],[J],[]),icrc10_supported_standards:e.Func([],[e.Vec(e.Record({url:e.Text,name:e.Text}))],[]),icrc1_balance_of:e.Func([a],[l],[]),icrc1_decimals:e.Func([],[e.Nat8],[]),icrc1_fee:e.Func([],[l],[]),icrc1_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,n))],[]),icrc1_minting_account:e.Func([],[e.Opt(a)],[]),icrc1_name:e.Func([],[e.Text],[]),icrc1_supported_standards:e.Func([],[e.Vec(K)],[]),icrc1_symbol:e.Func([],[e.Text],[]),icrc1_total_supply:e.Func([],[l],[]),icrc1_transfer:e.Func([I],[D],[]),icrc21_canister_call_consent_message:e.Func([te],[se],[]),icrc2_allowance:e.Func([ie],[pe],[]),icrc2_approve:e.Func([le],[_e],[]),icrc2_transfer_from:e.Func([me],[ge],[]),icrc3_get_archives:e.Func([fe],[Ne],[]),icrc3_get_blocks:e.Func([e.Vec(_)],[t],[]),icrc3_get_tip_certificate:e.Func([],[e.Opt(Oe)],[]),icrc3_supported_block_types:e.Func([],[e.Vec(e.Record({url:e.Text,block_type:e.Text}))],[]),is_ledger_ready:e.Func([],[e.Bool],["query"])})};var ze=({IDL:e})=>{let t=e.Rec(),c=e.Rec(),r=e.Rec(),i=e.Record({num_blocks_to_archive:e.Opt(e.Nat64),max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Opt(e.Nat64),more_controller_ids:e.Opt(e.Vec(e.Principal)),max_message_size_bytes:e.Opt(e.Nat64),cycles_for_archive_creation:e.Opt(e.Nat64),node_max_memory_size_bytes:e.Opt(e.Nat64),controller_id:e.Opt(e.Principal)}),n=e.Variant({Int:e.Int,Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text}),d=e.Vec(e.Nat8),a=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),g=e.Variant({SetTo:a,Unset:e.Null}),p=e.Record({icrc2:e.Bool}),f=e.Record({change_archive_options:e.Opt(i),token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat),metadata:e.Opt(e.Vec(e.Tuple(e.Text,n))),change_fee_collector:e.Opt(g),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Opt(e.Text),feature_flags:e.Opt(p)}),N=e.Record({decimals:e.Opt(e.Nat8),token_symbol:e.Text,transfer_fee:e.Nat,metadata:e.Vec(e.Tuple(e.Text,n)),minting_account:a,initial_balances:e.Vec(e.Tuple(a,e.Nat)),fee_collector_account:e.Opt(a),archive_options:e.Record({num_blocks_to_archive:e.Nat64,max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Nat64,more_controller_ids:e.Opt(e.Vec(e.Principal)),max_message_size_bytes:e.Opt(e.Nat64),cycles_for_archive_creation:e.Opt(e.Nat64),node_max_memory_size_bytes:e.Opt(e.Nat64),controller_id:e.Principal}),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Text,feature_flags:e.Opt(p)}),x=e.Variant({Upgrade:e.Opt(f),Init:N}),s=e.Nat,u=e.Record({block_range_end:s,canister_id:e.Principal,block_range_start:s}),_=e.Record({start:s,length:e.Nat}),y=e.Vec(e.Tuple(e.Text,r));r.fill(e.Variant({Int:e.Int,Map:y,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(r)}));let T=r,V=e.Record({blocks:e.Vec(T)}),b=e.Func([_],[V],["query"]),A=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),first_index:s,blocks:e.Vec(T),chain_length:e.Nat64,archived_blocks:e.Vec(e.Record({callback:b,start:s,length:e.Nat}))}),k=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),hash_tree:e.Vec(e.Nat8)}),O=e.Nat,R=e.Record({start:O,length:e.Nat}),o=e.Nat64,h=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,spender:e.Opt(a)}),q=e.Record({to:a,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat}),U=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(o),spender:a}),z=e.Record({to:a,fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,spender:e.Opt(a)}),S=e.Record({burn:e.Opt(h),kind:e.Text,mint:e.Opt(q),approve:e.Opt(U),timestamp:o,transfer:e.Opt(z)}),Q=e.Record({transactions:e.Vec(S)}),$=e.Func([R],[Q],["query"]),H=e.Record({first_index:O,log_length:e.Nat,transactions:e.Vec(S),archived_transactions:e.Vec(e.Record({callback:$,start:O,length:e.Nat}))}),W=e.Record({take:e.Opt(e.Nat),prev_spender:e.Opt(a),from_account:e.Opt(a)}),Z=e.Record({from_account:a,to_spender:a,allowance:e.Nat,expires_at:e.Opt(e.Nat64)}),X=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),AccessDenied:e.Record({reason:e.Text})}),Y=e.Variant({Ok:e.Vec(Z),Err:X}),j=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),IndexPrincipalNotSet:e.Null}),J=e.Variant({Ok:e.Principal,Err:j}),l=e.Nat,K=e.Record({url:e.Text,name:e.Text}),I=e.Record({to:a,fee:e.Opt(l),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(d),created_at_time:e.Opt(o),amount:l}),L=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:l}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:l}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,InsufficientFunds:e.Record({balance:l})}),D=e.Variant({Ok:s,Err:L}),E=e.Record({utc_offset_minutes:e.Opt(e.Int16),language:e.Text}),ee=e.Record({metadata:E,device_spec:e.Opt(e.Variant({GenericDisplay:e.Null,FieldsDisplay:e.Null}))}),te=e.Record({arg:e.Vec(e.Nat8),method:e.Text,user_preferences:ee}),re=e.Variant({Text:e.Record({content:e.Text}),TokenAmount:e.Record({decimals:e.Nat8,amount:e.Nat64,symbol:e.Text}),TimestampSeconds:e.Record({amount:e.Nat64}),DurationSeconds:e.Record({amount:e.Nat64})}),ce=e.Record({fields:e.Vec(e.Tuple(e.Text,re)),intent:e.Text}),ae=e.Variant({FieldsDisplayMessage:ce,GenericDisplayMessage:e.Text}),ne=e.Record({metadata:E,consent_message:ae}),F=e.Record({description:e.Text}),oe=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),InsufficientPayment:F,UnsupportedCanisterCall:F,ConsentMessageUnavailable:F}),se=e.Variant({Ok:ne,Err:oe}),ie=e.Record({account:a,spender:a}),pe=e.Record({allowance:e.Nat,expires_at:e.Opt(o)}),le=e.Record({fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(o),spender:a}),de=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:e.Nat}),AllowanceChanged:e.Record({current_allowance:e.Nat}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,Expired:e.Record({ledger_time:o}),InsufficientFunds:e.Record({balance:e.Nat})}),_e=e.Variant({Ok:s,Err:de}),me=e.Record({to:a,fee:e.Opt(l),spender_subaccount:e.Opt(d),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:l}),ue=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,InsufficientAllowance:e.Record({allowance:l}),BadBurn:e.Record({min_burn_amount:l}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:l}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,InsufficientFunds:e.Record({balance:l})}),ge=e.Variant({Ok:s,Err:ue}),fe=e.Record({from:e.Opt(e.Principal)}),Ne=e.Vec(e.Record({end:e.Nat,canister_id:e.Principal,start:e.Nat}));c.fill(e.Variant({Int:e.Int,Map:e.Vec(e.Tuple(e.Text,c)),Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(c)})),t.fill(e.Record({log_length:e.Nat,blocks:e.Vec(e.Record({id:e.Nat,block:c})),archived_blocks:e.Vec(e.Record({args:e.Vec(_),callback:e.Func([e.Vec(_)],[t],["query"])}))}));let Oe=e.Record({certificate:e.Vec(e.Nat8),hash_tree:e.Vec(e.Nat8)});return e.Service({archives:e.Func([],[e.Vec(u)],["query"]),get_blocks:e.Func([_],[A],["query"]),get_data_certificate:e.Func([],[k],["query"]),get_transactions:e.Func([R],[H],["query"]),icrc103_get_allowances:e.Func([W],[Y],["query"]),icrc106_get_index_principal:e.Func([],[J],["query"]),icrc10_supported_standards:e.Func([],[e.Vec(e.Record({url:e.Text,name:e.Text}))],["query"]),icrc1_balance_of:e.Func([a],[l],["query"]),icrc1_decimals:e.Func([],[e.Nat8],["query"]),icrc1_fee:e.Func([],[l],["query"]),icrc1_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,n))],["query"]),icrc1_minting_account:e.Func([],[e.Opt(a)],["query"]),icrc1_name:e.Func([],[e.Text],["query"]),icrc1_supported_standards:e.Func([],[e.Vec(K)],["query"]),icrc1_symbol:e.Func([],[e.Text],["query"]),icrc1_total_supply:e.Func([],[l],["query"]),icrc1_transfer:e.Func([I],[D],[]),icrc21_canister_call_consent_message:e.Func([te],[se],[]),icrc2_allowance:e.Func([ie],[pe],["query"]),icrc2_approve:e.Func([le],[_e],[]),icrc2_transfer_from:e.Func([me],[ge],[]),icrc3_get_archives:e.Func([fe],[Ne],["query"]),icrc3_get_blocks:e.Func([e.Vec(_)],[t],["query"]),icrc3_get_tip_certificate:e.Func([],[e.Opt(Oe)],["query"]),icrc3_supported_block_types:e.Func([],[e.Vec(e.Record({url:e.Text,block_type:e.Text}))],["query"]),is_ledger_ready:e.Func([],[e.Bool],["query"])})};var Ae=class e extends et{static create(t){let{service:c,certifiedService:r,canisterId:i}=tt({options:t,idlFactory:ze,certifiedIdlFactory:Ue});return new e(i,c,r)}metadata=t=>this.caller(t).icrc1_metadata();transactionFee=t=>this.caller(t).icrc1_fee();balance=t=>this.caller({certified:t.certified}).icrc1_balance_of({owner:t.owner,subaccount:rt(t.subaccount)});transfer=async t=>{let c=await this.caller({certified:!0}).icrc1_transfer(he(t));if("Err"in c)throw new v({errorType:c.Err,msg:"Failed to transfer"});return c.Ok};totalTokensSupply=t=>this.caller(t).icrc1_total_supply();transferFrom=async t=>{let c=await this.caller({certified:!0}).icrc2_transfer_from(Fe(t));if("Err"in c)throw new v({errorType:c.Err,msg:"Failed to transfer from"});return c.Ok};approve=async t=>{let c=await this.caller({certified:!0}).icrc2_approve(Pe(t));if("Err"in c)throw new v({errorType:c.Err,msg:"Failed to entitle the spender to transfer the amount"});return c.Ok};allowance=t=>{let{certified:c,...r}=t;return this.caller({certified:c}).icrc2_allowance({...r})};consentMessage=async t=>{let{icrc21_canister_call_consent_message:c}=this.caller({certified:!0}),r=await c(ve(t));if("Err"in r)throw Ge(r.Err);return r.Ok};getBlocks=t=>this.caller({certified:t.certified}).icrc3_get_blocks(t.args);getIndexPrincipal=async t=>{let{icrc106_get_index_principal:c}=this.caller(t),r=await c();if("Err"in r)throw Se(r.Err);return r.Ok};icrc1SupportedStandards=t=>this.caller(t).icrc1_supported_standards();icrc10SupportedStandards=t=>this.caller(t).icrc10_supported_standards();getMintingAccount=t=>this.caller(t).icrc1_minting_account()};var Qe=(n=>(n.SYMBOL="icrc1:symbol",n.NAME="icrc1:name",n.DECIMALS="icrc1:decimals",n.FEE="icrc1:fee",n.LOGO="icrc1:logo",n))(Qe||{});import{bigEndianCrc32 as ct,encodeBase32 as at,hexStringToUint8Array as nt,isNullish as He,nonNullish as M,notEmptyString as ot,uint8ArrayToHexString as st}from"@dfinity/utils";import{Principal as $e}from"@icp-sdk/core/principal";var it=64,Lt=({owner:e,subaccount:t})=>{if(He(t))return e.toText();let r=(i=>i.replace(/^0+/,""))(st(Uint8Array.from(t)));return r.length===0?e.toText():`${e.toText()}-${We({owner:e,subaccount:t})}.${r}`},We=({owner:e,subaccount:t})=>{let c=ct(Uint8Array.from([...e.toUint8Array(),...t]));return at(c)},Dt=e=>{let[t,c,...r]=e.split(".");if(!ot(t))throw new Error("Invalid account. No string provided.");if(r.length>0)throw new Error("Invalid account string format. Expected at most one '.' separator.");if(He(c))return{owner:$e.fromText(e)};let[i,...n]=t.split("-").reverse(),d=n.reverse().join("-"),a={owner:$e.fromText(d),subaccount:nt(c.padStart(it,"0"))};if(We(a)!==i)throw new Error("Invalid account. Invalid checksum.");return a},er=e=>{let t=e.reduce((r,[i,n])=>{switch(i){case"icrc1:symbol":r={...r,..."Text"in n&&{symbol:n.Text}};break;case"icrc1:name":r={...r,..."Text"in n&&{name:n.Text}};break;case"icrc1:fee":r={...r,..."Nat"in n&&{fee:n.Nat}};break;case"icrc1:decimals":r={...r,..."Nat"in n&&{decimals:Number(n.Nat)}};break;case"icrc1:logo":r={...r,..."Text"in n&&{icon:n.Text}}}return r},{});if((r=>M(r.symbol)&&M(r.name)&&M(r.fee)&&M(r.decimals))(t))return t};import{isNullish as pt,nonNullish as lt}from"@dfinity/utils";var cr=e=>{let t=/^([a-zA-Z]+):([A-Za-z0-9:\-.]+).*?(?:[?&](?:amount|value)=(\d+(?:\.\d+)?))?$/,c=e.match(t);if(pt(c))return;let[r,i,n,d]=c;return{token:i,identifier:n,...lt(d)&&!isNaN(parseFloat(d))&&{amount:parseFloat(d)}}};export{G as ConsentMessageError,Re as ConsentMessageUnavailableError,w as GenericError,be as IcrcIndexCanister,Ve as IcrcIndexNgCanister,Ae as IcrcLedgerCanister,Qe as IcrcMetadataResponseEntries,v as IcrcTransferError,P as IndexError,ye as IndexPrincipalNotSetError,xe as InsufficientPaymentError,Te as UnsupportedCanisterCallError,Dt as decodeIcrcAccount,cr as decodePayment,Lt as encodeIcrcAccount,_t as fromCandidAccount,Se as mapIcrc106GetIndexPrincipalError,Ge as mapIcrc21ConsentMessageError,er as mapTokenMetadata,Pe as toApproveArgs,ke as toCandidAccount,ve as toIcrc21ConsentMessageArgs,he as toTransferArg,Fe as toTransferFromArgs};
1
+ export*from"@icp-sdk/canisters/ledger/icrc";
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/converters/converters.ts", "../src/converters/ledger.converters.ts", "../src/errors/index.errors.ts", "../src/errors/ledger.errors.ts", "../src/index-ng.canister.ts", "../src/candid/icrc_index-ng.certified.idl.js", "../src/candid/icrc_index-ng.idl.js", "../src/canister.ts", "../src/converters/index.converters.ts", "../src/index.canister.ts", "../src/candid/icrc_index.certified.idl.js", "../src/candid/icrc_index.idl.js", "../src/ledger.canister.ts", "../src/candid/icrc_ledger.certified.idl.js", "../src/candid/icrc_ledger.idl.js", "../src/types/ledger.responses.ts", "../src/utils/ledger.utils.ts", "../src/utils/payment.utils.ts"],
4
- "sourcesContent": ["import { fromNullable, nonNullish, toNullable } from \"@dfinity/utils\";\nimport type { Account } from \"../candid/icrc_ledger\";\nimport type { IcrcAccount } from \"../types/ledger.responses\";\n\n/**\n * Converts a Candid Account object to an IcrcAccount, effectively transforming nullable properties into nullish ones.\n *\n * @param {Account} - The Candid Account object to convert.\n * @return {IcrcAccount} - The converted IcrcAccount object.\n */\nexport const fromCandidAccount = ({\n owner,\n subaccount: nullableSubaccount,\n}: Account): IcrcAccount => {\n const subaccount = fromNullable(nullableSubaccount);\n\n return {\n owner,\n ...(nonNullish(subaccount) ? { subaccount } : {}),\n };\n};\n\n/**\n * Converts an IcrcAccount to a Candid Account object, effectively transforming nullish properties into nullable ones.\n *\n * @param {IcrcAccount} - The IcrcAccount object to convert.\n * @return {Account} - The converted Candid Account object.\n */\nexport const toCandidAccount = ({\n owner,\n subaccount,\n}: IcrcAccount): Account => ({\n owner,\n subaccount: toNullable(subaccount),\n});\n", "import { isNullish, toNullable } from \"@dfinity/utils\";\nimport type {\n ApproveArgs,\n icrc21_consent_message_request as ConsentMessageArgs,\n TransferArg,\n TransferFromArgs,\n} from \"../candid/icrc_ledger\";\nimport type {\n ApproveParams,\n Icrc21ConsentMessageParams,\n TransferFromParams,\n TransferParams,\n} from \"../types/ledger.params\";\n\n// WARNING: When using the ICRC-1 interface of the ICP ledger, there is no\n// relationship between the memo and the icrc1Memo of a transaction. The ICRC-1\n// interface simply cannot set the memo field and the non-ICRC-1 interface\n// cannot set the icrc1Memo field, even though the icrc1Memo field is called\n// just \"memo\" in canister method params.\nexport const toTransferArg = ({\n from_subaccount,\n fee,\n created_at_time,\n memo,\n ...rest\n}: TransferParams): TransferArg => ({\n ...rest,\n fee: toNullable(fee),\n memo: toNullable(memo),\n from_subaccount: toNullable(from_subaccount),\n created_at_time: toNullable(created_at_time),\n});\n\nexport const toTransferFromArgs = ({\n spender_subaccount,\n fee,\n created_at_time,\n memo,\n ...rest\n}: TransferFromParams): TransferFromArgs => ({\n ...rest,\n fee: toNullable(fee),\n memo: toNullable(memo),\n spender_subaccount: toNullable(spender_subaccount),\n created_at_time: toNullable(created_at_time),\n});\n\nexport const toApproveArgs = ({\n fee,\n created_at_time,\n memo,\n from_subaccount,\n expected_allowance,\n expires_at,\n ...rest\n}: ApproveParams): ApproveArgs => ({\n ...rest,\n fee: toNullable(fee),\n memo: toNullable(memo),\n from_subaccount: toNullable(from_subaccount),\n created_at_time: toNullable(created_at_time),\n expected_allowance: toNullable(expected_allowance),\n expires_at: toNullable(expires_at),\n});\n\nexport const toIcrc21ConsentMessageArgs = ({\n userPreferences: {\n metadata: { utcOffsetMinutes, language },\n deriveSpec,\n },\n ...rest\n}: Icrc21ConsentMessageParams): ConsentMessageArgs => ({\n ...rest,\n user_preferences: {\n metadata: {\n language,\n utc_offset_minutes: toNullable(utcOffsetMinutes),\n },\n device_spec: isNullish(deriveSpec)\n ? toNullable()\n : toNullable(\n \"GenericDisplay\" in deriveSpec\n ? { GenericDisplay: null }\n : {\n FieldsDisplay: null,\n },\n ),\n },\n});\n", "export class IndexError extends Error {}\n", "import type {\n GetIndexPrincipalError,\n icrc21_error as Icrc21RawError,\n} from \"../candid/icrc_ledger\";\n\nexport class IcrcTransferError<T> extends Error {\n public errorType: T;\n constructor({ msg, errorType }: { msg?: string; errorType: T }) {\n super(msg);\n this.errorType = errorType;\n }\n}\n\nexport class GenericError extends Error {\n constructor(\n public readonly message: string,\n public readonly error_code: bigint,\n ) {\n super();\n }\n}\n\nexport class ConsentMessageError extends Error {}\n\nexport class InsufficientPaymentError extends ConsentMessageError {}\nexport class UnsupportedCanisterCallError extends ConsentMessageError {}\nexport class ConsentMessageUnavailableError extends ConsentMessageError {}\n\nexport const mapIcrc21ConsentMessageError = (\n rawError: Icrc21RawError,\n): ConsentMessageError => {\n if (\"GenericError\" in rawError) {\n return new GenericError(\n rawError.GenericError.description,\n rawError.GenericError.error_code,\n );\n }\n\n if (\"InsufficientPayment\" in rawError) {\n return new InsufficientPaymentError(\n rawError.InsufficientPayment.description,\n );\n }\n\n if (\"UnsupportedCanisterCall\" in rawError) {\n return new UnsupportedCanisterCallError(\n rawError.UnsupportedCanisterCall.description,\n );\n }\n if (\"ConsentMessageUnavailable\" in rawError) {\n return new ConsentMessageUnavailableError(\n rawError.ConsentMessageUnavailable.description,\n );\n }\n\n // Edge case\n return new ConsentMessageError(\n `Unknown error type ${JSON.stringify(rawError)}`,\n );\n};\n\nexport class IndexPrincipalNotSetError extends Error {}\n\nexport const mapIcrc106GetIndexPrincipalError = (\n err: GetIndexPrincipalError,\n) => {\n if (\"IndexPrincipalNotSet\" in err) {\n return new IndexPrincipalNotSetError(\n \"Index principal is not set for this ledger canister.\",\n );\n }\n\n return new GenericError(\n err.GenericError.description,\n err.GenericError.error_code,\n );\n};\n", "import { createServices, type QueryParams } from \"@dfinity/utils\";\nimport type { Principal } from \"@icp-sdk/core/principal\";\nimport type { SubAccount } from \"./candid/icrc_index\";\nimport type {\n GetTransactions,\n _SERVICE as IcrcIndexNgService,\n Status,\n} from \"./candid/icrc_index-ng\";\nimport { idlFactory as certifiedIdlFactory } from \"./candid/icrc_index-ng.certified.idl\";\nimport { idlFactory } from \"./candid/icrc_index-ng.idl\";\nimport { IcrcCanister } from \"./canister\";\nimport {\n toGetTransactionsArgs,\n toListSubaccountsParams,\n} from \"./converters/index.converters\";\nimport { IndexError } from \"./errors/index.errors\";\nimport type { IcrcLedgerCanisterOptions } from \"./types/canister.options\";\nimport type {\n GetIndexNgAccountTransactionsParams,\n ListSubaccountsParams,\n} from \"./types/index-ng.params\";\n\nexport class IcrcIndexNgCanister extends IcrcCanister<IcrcIndexNgService> {\n static create(options: IcrcLedgerCanisterOptions<IcrcIndexNgService>) {\n const { service, certifiedService, canisterId } =\n createServices<IcrcIndexNgService>({\n options,\n idlFactory,\n certifiedIdlFactory,\n });\n\n return new IcrcIndexNgCanister(canisterId, service, certifiedService);\n }\n\n /**\n * Get the transactions of an account\n *\n * Always certified.\n * `get_account_transactions` needs to be called with an update\n * because the index canisters makes a call to the ledger canister to get the transaction data.\n * Index Canister only holds the transactions ids in state, not the whole transaction data.\n */\n /**\n * Get the transactions of an account.\n *\n * @param {GetAccountTransactionsParams} params The parameters to get the transactions of an account.\n * @returns {Promise<GetTransactions>} The list of transactions and further related information of the given account.\n */\n getTransactions = async ({\n certified,\n ...rest\n }: GetIndexNgAccountTransactionsParams): Promise<GetTransactions> => {\n const response = await this.caller({\n certified,\n }).get_account_transactions(toGetTransactionsArgs(rest));\n\n if (\"Err\" in response) {\n throw new IndexError(response.Err.message);\n }\n\n return response.Ok;\n };\n\n /**\n * Returns the ledger canister ID related to the index canister.\n */\n ledgerId = (params: QueryParams): Promise<Principal> => {\n const { ledger_id } = this.caller(params);\n return ledger_id();\n };\n\n /**\n * Returns the status of the index canister.\n *\n * @param {QueryParams} params The parameters to get the status of the index canister.\n * @returns {Promise<Status>} The status of the index canister.\n */\n status = (params: QueryParams): Promise<Status> =>\n this.caller(params).status();\n\n /**\n * Returns the list of subaccounts for a given owner.\n *\n * @param {ListSubaccountsParams} params The parameters to get the list of subaccounts.\n * @returns {Promise<Array<SubAccount>>} The list of subaccounts.\n */\n listSubaccounts = ({\n certified,\n ...rest\n }: ListSubaccountsParams): Promise<Array<SubAccount>> =>\n this.caller({ certified }).list_subaccounts(toListSubaccountsParams(rest));\n}\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n const Value = IDL.Rec();\n const UpgradeArg = IDL.Record({\n ledger_id: IDL.Opt(IDL.Principal),\n retrieve_blocks_from_ledger_interval_seconds: IDL.Opt(IDL.Nat64),\n });\n const InitArg = IDL.Record({\n ledger_id: IDL.Principal,\n retrieve_blocks_from_ledger_interval_seconds: IDL.Opt(IDL.Nat64),\n });\n const IndexArg = IDL.Variant({ Upgrade: UpgradeArg, Init: InitArg });\n const BlockIndex = IDL.Nat;\n const SubAccount = IDL.Vec(IDL.Nat8);\n const Account = IDL.Record({\n owner: IDL.Principal,\n subaccount: IDL.Opt(SubAccount),\n });\n const GetAccountTransactionsArgs = IDL.Record({\n max_results: IDL.Nat,\n start: IDL.Opt(BlockIndex),\n account: Account,\n });\n const Tokens = IDL.Nat;\n const Burn = IDL.Record({\n fee: IDL.Opt(IDL.Nat),\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(IDL.Nat64),\n amount: Tokens,\n spender: IDL.Opt(Account),\n });\n const Mint = IDL.Record({\n to: Account,\n fee: IDL.Opt(IDL.Nat),\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(IDL.Nat64),\n amount: Tokens,\n });\n const Approve = IDL.Record({\n fee: IDL.Opt(Tokens),\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(IDL.Nat64),\n amount: Tokens,\n expected_allowance: IDL.Opt(Tokens),\n expires_at: IDL.Opt(IDL.Nat64),\n spender: Account,\n });\n const Transfer = IDL.Record({\n to: Account,\n fee: IDL.Opt(Tokens),\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(IDL.Nat64),\n amount: Tokens,\n spender: IDL.Opt(Account),\n });\n const Transaction = IDL.Record({\n burn: IDL.Opt(Burn),\n kind: IDL.Text,\n mint: IDL.Opt(Mint),\n approve: IDL.Opt(Approve),\n timestamp: IDL.Nat64,\n transfer: IDL.Opt(Transfer),\n });\n const TransactionWithId = IDL.Record({\n id: BlockIndex,\n transaction: Transaction,\n });\n const GetTransactions = IDL.Record({\n balance: Tokens,\n transactions: IDL.Vec(TransactionWithId),\n oldest_tx_id: IDL.Opt(BlockIndex),\n });\n const GetTransactionsErr = IDL.Record({ message: IDL.Text });\n const GetTransactionsResult = IDL.Variant({\n Ok: GetTransactions,\n Err: GetTransactionsErr,\n });\n const GetBlocksRequest = IDL.Record({\n start: IDL.Nat,\n length: IDL.Nat,\n });\n const Map = IDL.Vec(IDL.Tuple(IDL.Text, Value));\n Value.fill(\n IDL.Variant({\n Int: IDL.Int,\n Map: Map,\n Nat: IDL.Nat,\n Nat64: IDL.Nat64,\n Blob: IDL.Vec(IDL.Nat8),\n Text: IDL.Text,\n Array: IDL.Vec(Value),\n }),\n );\n const Block = Value;\n const GetBlocksResponse = IDL.Record({\n blocks: IDL.Vec(Block),\n chain_length: IDL.Nat64,\n });\n const FeeCollectorRanges = IDL.Record({\n ranges: IDL.Vec(\n IDL.Tuple(Account, IDL.Vec(IDL.Tuple(BlockIndex, BlockIndex))),\n ),\n });\n const ListSubaccountsArgs = IDL.Record({\n owner: IDL.Principal,\n start: IDL.Opt(SubAccount),\n });\n const Status = IDL.Record({ num_blocks_synced: BlockIndex });\n\n return IDL.Service({\n get_account_transactions: IDL.Func(\n [GetAccountTransactionsArgs],\n [GetTransactionsResult],\n [],\n ),\n get_blocks: IDL.Func([GetBlocksRequest], [GetBlocksResponse], []),\n get_fee_collectors_ranges: IDL.Func([], [FeeCollectorRanges], []),\n icrc1_balance_of: IDL.Func([Account], [Tokens], []),\n ledger_id: IDL.Func([], [IDL.Principal], []),\n list_subaccounts: IDL.Func(\n [ListSubaccountsArgs],\n [IDL.Vec(SubAccount)],\n [],\n ),\n status: IDL.Func([], [Status], [\"query\"]),\n });\n};\n\nexport const init = ({ IDL }) => {\n const UpgradeArg = IDL.Record({\n ledger_id: IDL.Opt(IDL.Principal),\n retrieve_blocks_from_ledger_interval_seconds: IDL.Opt(IDL.Nat64),\n });\n const InitArg = IDL.Record({\n ledger_id: IDL.Principal,\n retrieve_blocks_from_ledger_interval_seconds: IDL.Opt(IDL.Nat64),\n });\n const IndexArg = IDL.Variant({ Upgrade: UpgradeArg, Init: InitArg });\n\n return [IDL.Opt(IndexArg)];\n};\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n const Value = IDL.Rec();\n const UpgradeArg = IDL.Record({\n ledger_id: IDL.Opt(IDL.Principal),\n retrieve_blocks_from_ledger_interval_seconds: IDL.Opt(IDL.Nat64),\n });\n const InitArg = IDL.Record({\n ledger_id: IDL.Principal,\n retrieve_blocks_from_ledger_interval_seconds: IDL.Opt(IDL.Nat64),\n });\n const IndexArg = IDL.Variant({ Upgrade: UpgradeArg, Init: InitArg });\n const BlockIndex = IDL.Nat;\n const SubAccount = IDL.Vec(IDL.Nat8);\n const Account = IDL.Record({\n owner: IDL.Principal,\n subaccount: IDL.Opt(SubAccount),\n });\n const GetAccountTransactionsArgs = IDL.Record({\n max_results: IDL.Nat,\n start: IDL.Opt(BlockIndex),\n account: Account,\n });\n const Tokens = IDL.Nat;\n const Burn = IDL.Record({\n fee: IDL.Opt(IDL.Nat),\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(IDL.Nat64),\n amount: Tokens,\n spender: IDL.Opt(Account),\n });\n const Mint = IDL.Record({\n to: Account,\n fee: IDL.Opt(IDL.Nat),\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(IDL.Nat64),\n amount: Tokens,\n });\n const Approve = IDL.Record({\n fee: IDL.Opt(Tokens),\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(IDL.Nat64),\n amount: Tokens,\n expected_allowance: IDL.Opt(Tokens),\n expires_at: IDL.Opt(IDL.Nat64),\n spender: Account,\n });\n const Transfer = IDL.Record({\n to: Account,\n fee: IDL.Opt(Tokens),\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(IDL.Nat64),\n amount: Tokens,\n spender: IDL.Opt(Account),\n });\n const Transaction = IDL.Record({\n burn: IDL.Opt(Burn),\n kind: IDL.Text,\n mint: IDL.Opt(Mint),\n approve: IDL.Opt(Approve),\n timestamp: IDL.Nat64,\n transfer: IDL.Opt(Transfer),\n });\n const TransactionWithId = IDL.Record({\n id: BlockIndex,\n transaction: Transaction,\n });\n const GetTransactions = IDL.Record({\n balance: Tokens,\n transactions: IDL.Vec(TransactionWithId),\n oldest_tx_id: IDL.Opt(BlockIndex),\n });\n const GetTransactionsErr = IDL.Record({ message: IDL.Text });\n const GetTransactionsResult = IDL.Variant({\n Ok: GetTransactions,\n Err: GetTransactionsErr,\n });\n const GetBlocksRequest = IDL.Record({\n start: IDL.Nat,\n length: IDL.Nat,\n });\n const Map = IDL.Vec(IDL.Tuple(IDL.Text, Value));\n Value.fill(\n IDL.Variant({\n Int: IDL.Int,\n Map: Map,\n Nat: IDL.Nat,\n Nat64: IDL.Nat64,\n Blob: IDL.Vec(IDL.Nat8),\n Text: IDL.Text,\n Array: IDL.Vec(Value),\n }),\n );\n const Block = Value;\n const GetBlocksResponse = IDL.Record({\n blocks: IDL.Vec(Block),\n chain_length: IDL.Nat64,\n });\n const FeeCollectorRanges = IDL.Record({\n ranges: IDL.Vec(\n IDL.Tuple(Account, IDL.Vec(IDL.Tuple(BlockIndex, BlockIndex))),\n ),\n });\n const ListSubaccountsArgs = IDL.Record({\n owner: IDL.Principal,\n start: IDL.Opt(SubAccount),\n });\n const Status = IDL.Record({ num_blocks_synced: BlockIndex });\n\n return IDL.Service({\n get_account_transactions: IDL.Func(\n [GetAccountTransactionsArgs],\n [GetTransactionsResult],\n [\"query\"],\n ),\n get_blocks: IDL.Func([GetBlocksRequest], [GetBlocksResponse], [\"query\"]),\n get_fee_collectors_ranges: IDL.Func([], [FeeCollectorRanges], [\"query\"]),\n icrc1_balance_of: IDL.Func([Account], [Tokens], [\"query\"]),\n ledger_id: IDL.Func([], [IDL.Principal], [\"query\"]),\n list_subaccounts: IDL.Func(\n [ListSubaccountsArgs],\n [IDL.Vec(SubAccount)],\n [\"query\"],\n ),\n status: IDL.Func([], [Status], [\"query\"]),\n });\n};\n\nexport const init = ({ IDL }) => {\n const UpgradeArg = IDL.Record({\n ledger_id: IDL.Opt(IDL.Principal),\n retrieve_blocks_from_ledger_interval_seconds: IDL.Opt(IDL.Nat64),\n });\n const InitArg = IDL.Record({\n ledger_id: IDL.Principal,\n retrieve_blocks_from_ledger_interval_seconds: IDL.Opt(IDL.Nat64),\n });\n const IndexArg = IDL.Variant({ Upgrade: UpgradeArg, Init: InitArg });\n\n return [IDL.Opt(IndexArg)];\n};\n", "import { Canister, toNullable } from \"@dfinity/utils\";\nimport type { _SERVICE as IcrcIndexNgService } from \"./candid/icrc_index-ng\";\nimport type {\n _SERVICE as IcrcLedgerService,\n Tokens,\n} from \"./candid/icrc_ledger\";\nimport type { BalanceParams } from \"./types/ledger.params\";\n\nexport abstract class IcrcCanister<\n T extends IcrcLedgerService | IcrcIndexNgService,\n> extends Canister<T> {\n /**\n * Returns the balance for a given account provided as owner and with optional subaccount.\n *\n * @param {BalanceParams} params The parameters to get the balance of an account.\n * @returns {Promise<Tokens>} The balance of the given account.\n */\n balance = (params: BalanceParams): Promise<Tokens> =>\n this.caller({ certified: params.certified }).icrc1_balance_of({\n owner: params.owner,\n subaccount: toNullable(params.subaccount),\n });\n}\n", "import { toNullable } from \"@dfinity/utils\";\nimport type { GetAccountTransactionsArgs } from \"../candid/icrc_index\";\nimport type { ListSubaccountsArgs } from \"../candid/icrc_index-ng\";\nimport type { ListSubaccountsParams } from \"../types/index-ng.params\";\nimport type { GetAccountTransactionsParams } from \"../types/index.params\";\nimport { toCandidAccount } from \"./converters\";\n\nexport const toGetTransactionsArgs = ({\n account,\n max_results,\n start,\n}: GetAccountTransactionsParams): GetAccountTransactionsArgs => ({\n account: toCandidAccount(account),\n max_results,\n start: toNullable(start),\n});\n\nexport const toListSubaccountsParams = ({\n owner,\n start,\n}: ListSubaccountsParams): ListSubaccountsArgs => ({\n owner,\n start: toNullable(start),\n});\n", "import { Canister, createServices, type QueryParams } from \"@dfinity/utils\";\nimport type { Principal } from \"@icp-sdk/core/principal\";\nimport type {\n GetTransactions,\n _SERVICE as IcrcIndexService,\n} from \"./candid/icrc_index\";\nimport { idlFactory as certifiedIdlFactory } from \"./candid/icrc_index.certified.idl\";\nimport { idlFactory } from \"./candid/icrc_index.idl\";\nimport { toGetTransactionsArgs } from \"./converters/index.converters\";\nimport { IndexError } from \"./errors/index.errors\";\nimport type { IcrcLedgerCanisterOptions } from \"./types/canister.options\";\nimport type { GetAccountTransactionsParams } from \"./types/index.params\";\n\nexport class IcrcIndexCanister extends Canister<IcrcIndexService> {\n static create(options: IcrcLedgerCanisterOptions<IcrcIndexService>) {\n const { service, certifiedService, canisterId } =\n createServices<IcrcIndexService>({\n options,\n idlFactory,\n certifiedIdlFactory,\n });\n\n return new IcrcIndexCanister(canisterId, service, certifiedService);\n }\n\n /**\n * Get the transactions of an account\n *\n * Always certified.\n * `get_account_transactions` needs to be called with an update\n * because the index canisters makes a call to the ledger canister to get the transaction data.\n * Index Canister only holds the transactions ids in state, not the whole transaction data.\n */\n getTransactions = async (\n params: GetAccountTransactionsParams,\n ): Promise<GetTransactions> => {\n const response = await this.caller({\n certified: true,\n }).get_account_transactions(toGetTransactionsArgs(params));\n\n if (\"Err\" in response) {\n throw new IndexError(response.Err.message);\n }\n\n return response.Ok;\n };\n\n /**\n * Returns the ledger canister ID related to the index canister.\n */\n ledgerId = (params: QueryParams): Promise<Principal> => {\n const { ledger_id } = this.caller(params);\n return ledger_id();\n };\n}\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n const InitArgs = IDL.Record({ ledger_id: IDL.Principal });\n const TxId = IDL.Nat;\n const Account = IDL.Record({\n owner: IDL.Principal,\n subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),\n });\n const GetAccountTransactionsArgs = IDL.Record({\n max_results: IDL.Nat,\n start: IDL.Opt(TxId),\n account: Account,\n });\n const Burn = IDL.Record({\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(IDL.Nat64),\n amount: IDL.Nat,\n spender: IDL.Opt(Account),\n });\n const Mint = IDL.Record({\n to: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(IDL.Nat64),\n amount: IDL.Nat,\n });\n const Approve = IDL.Record({\n fee: IDL.Opt(IDL.Nat),\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(IDL.Nat64),\n amount: IDL.Nat,\n expected_allowance: IDL.Opt(IDL.Nat),\n expires_at: IDL.Opt(IDL.Nat64),\n spender: Account,\n });\n const Transfer = IDL.Record({\n to: Account,\n fee: IDL.Opt(IDL.Nat),\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(IDL.Nat64),\n amount: IDL.Nat,\n spender: IDL.Opt(Account),\n });\n const Transaction = IDL.Record({\n burn: IDL.Opt(Burn),\n kind: IDL.Text,\n mint: IDL.Opt(Mint),\n approve: IDL.Opt(Approve),\n timestamp: IDL.Nat64,\n transfer: IDL.Opt(Transfer),\n });\n const TransactionWithId = IDL.Record({\n id: TxId,\n transaction: Transaction,\n });\n const GetTransactions = IDL.Record({\n transactions: IDL.Vec(TransactionWithId),\n oldest_tx_id: IDL.Opt(TxId),\n });\n const GetTransactionsErr = IDL.Record({ message: IDL.Text });\n const GetTransactionsResult = IDL.Variant({\n Ok: GetTransactions,\n Err: GetTransactionsErr,\n });\n const SubAccount = IDL.Vec(IDL.Nat8);\n const ListSubaccountsArgs = IDL.Record({\n owner: IDL.Principal,\n start: IDL.Opt(SubAccount),\n });\n\n return IDL.Service({\n get_account_transactions: IDL.Func(\n [GetAccountTransactionsArgs],\n [GetTransactionsResult],\n [],\n ),\n ledger_id: IDL.Func([], [IDL.Principal], []),\n list_subaccounts: IDL.Func(\n [ListSubaccountsArgs],\n [IDL.Vec(SubAccount)],\n [],\n ),\n });\n};\n\nexport const init = ({ IDL }) => {\n const InitArgs = IDL.Record({ ledger_id: IDL.Principal });\n\n return [InitArgs];\n};\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n const InitArgs = IDL.Record({ ledger_id: IDL.Principal });\n const TxId = IDL.Nat;\n const Account = IDL.Record({\n owner: IDL.Principal,\n subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),\n });\n const GetAccountTransactionsArgs = IDL.Record({\n max_results: IDL.Nat,\n start: IDL.Opt(TxId),\n account: Account,\n });\n const Burn = IDL.Record({\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(IDL.Nat64),\n amount: IDL.Nat,\n spender: IDL.Opt(Account),\n });\n const Mint = IDL.Record({\n to: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(IDL.Nat64),\n amount: IDL.Nat,\n });\n const Approve = IDL.Record({\n fee: IDL.Opt(IDL.Nat),\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(IDL.Nat64),\n amount: IDL.Nat,\n expected_allowance: IDL.Opt(IDL.Nat),\n expires_at: IDL.Opt(IDL.Nat64),\n spender: Account,\n });\n const Transfer = IDL.Record({\n to: Account,\n fee: IDL.Opt(IDL.Nat),\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(IDL.Nat64),\n amount: IDL.Nat,\n spender: IDL.Opt(Account),\n });\n const Transaction = IDL.Record({\n burn: IDL.Opt(Burn),\n kind: IDL.Text,\n mint: IDL.Opt(Mint),\n approve: IDL.Opt(Approve),\n timestamp: IDL.Nat64,\n transfer: IDL.Opt(Transfer),\n });\n const TransactionWithId = IDL.Record({\n id: TxId,\n transaction: Transaction,\n });\n const GetTransactions = IDL.Record({\n transactions: IDL.Vec(TransactionWithId),\n oldest_tx_id: IDL.Opt(TxId),\n });\n const GetTransactionsErr = IDL.Record({ message: IDL.Text });\n const GetTransactionsResult = IDL.Variant({\n Ok: GetTransactions,\n Err: GetTransactionsErr,\n });\n const SubAccount = IDL.Vec(IDL.Nat8);\n const ListSubaccountsArgs = IDL.Record({\n owner: IDL.Principal,\n start: IDL.Opt(SubAccount),\n });\n\n return IDL.Service({\n get_account_transactions: IDL.Func(\n [GetAccountTransactionsArgs],\n [GetTransactionsResult],\n [],\n ),\n ledger_id: IDL.Func([], [IDL.Principal], [\"query\"]),\n list_subaccounts: IDL.Func(\n [ListSubaccountsArgs],\n [IDL.Vec(SubAccount)],\n [\"query\"],\n ),\n });\n};\n\nexport const init = ({ IDL }) => {\n const InitArgs = IDL.Record({ ledger_id: IDL.Principal });\n\n return [InitArgs];\n};\n", "import {\n Canister,\n createServices,\n toNullable,\n type Nullable,\n type QueryParams,\n} from \"@dfinity/utils\";\nimport type { Principal } from \"@icp-sdk/core/principal\";\nimport type {\n Account,\n Allowance,\n BlockIndex,\n GetBlocksResult,\n icrc21_consent_info,\n _SERVICE as IcrcLedgerService,\n StandardRecord,\n Tokens,\n} from \"./candid/icrc_ledger\";\nimport { idlFactory as certifiedIdlFactory } from \"./candid/icrc_ledger.certified.idl\";\nimport { idlFactory } from \"./candid/icrc_ledger.idl\";\nimport {\n toApproveArgs,\n toIcrc21ConsentMessageArgs,\n toTransferArg,\n toTransferFromArgs,\n} from \"./converters/ledger.converters\";\nimport {\n IcrcTransferError,\n mapIcrc106GetIndexPrincipalError,\n mapIcrc21ConsentMessageError,\n} from \"./errors/ledger.errors\";\nimport type { IcrcLedgerCanisterOptions } from \"./types/canister.options\";\nimport type {\n AllowanceParams,\n ApproveParams,\n BalanceParams,\n GetBlocksParams,\n Icrc21ConsentMessageParams,\n TransferFromParams,\n TransferParams,\n} from \"./types/ledger.params\";\nimport type { IcrcTokenMetadataResponse } from \"./types/ledger.responses\";\n\nexport class IcrcLedgerCanister extends Canister<IcrcLedgerService> {\n static create(options: IcrcLedgerCanisterOptions<IcrcLedgerService>) {\n const { service, certifiedService, canisterId } =\n createServices<IcrcLedgerService>({\n options,\n idlFactory,\n certifiedIdlFactory,\n });\n\n return new IcrcLedgerCanister(canisterId, service, certifiedService);\n }\n\n /**\n * The token metadata (name, symbol, etc.).\n */\n metadata = (params: QueryParams): Promise<IcrcTokenMetadataResponse> =>\n this.caller(params).icrc1_metadata();\n\n /**\n * The ledger transaction fees.\n *\n * @returns {Tokens} The ledger transaction fees in Tokens\n */\n transactionFee = (params: QueryParams): Promise<Tokens> =>\n this.caller(params).icrc1_fee();\n\n /**\n * Returns the balance for a given account provided as owner and with optional subaccount.\n *\n * @param {BalanceParams} params The parameters to get the balance of an account.\n * @returns {Promise<Tokens>} The balance of the given account.\n */\n balance = (params: BalanceParams): Promise<Tokens> =>\n this.caller({ certified: params.certified }).icrc1_balance_of({\n owner: params.owner,\n subaccount: toNullable(params.subaccount),\n });\n\n /**\n * Transfers tokens from the sender to the given account.\n *\n * @param {TransferArg} params The parameters to transfer tokens.\n *\n * @throws {IcrcTransferError} If the transfer fails.\n */\n transfer = async (params: TransferParams): Promise<BlockIndex> => {\n const response = await this.caller({ certified: true }).icrc1_transfer(\n toTransferArg(params),\n );\n if (\"Err\" in response) {\n throw new IcrcTransferError({\n errorType: response.Err,\n msg: \"Failed to transfer\",\n });\n }\n return response.Ok;\n };\n\n /**\n * Returns the total supply of tokens.\n */\n totalTokensSupply = (params: QueryParams): Promise<Tokens> =>\n this.caller(params).icrc1_total_supply();\n\n /**\n * Transfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.\n *\n * Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from\n *\n * @param {TransferFromParams} params The parameters to transfer tokens from to.\n *\n * @throws {IcrcTransferError} If the transfer from fails.\n */\n transferFrom = async (params: TransferFromParams): Promise<BlockIndex> => {\n const response = await this.caller({ certified: true }).icrc2_transfer_from(\n toTransferFromArgs(params),\n );\n if (\"Err\" in response) {\n throw new IcrcTransferError({\n errorType: response.Err,\n msg: \"Failed to transfer from\",\n });\n }\n return response.Ok;\n };\n\n /**\n * This method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.\n *\n * Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve\n *\n * @param {ApproveParams} params The parameters to approve.\n *\n * @throws {IcrcTransferError} If the approval fails.\n */\n approve = async (params: ApproveParams): Promise<BlockIndex> => {\n const response = await this.caller({ certified: true }).icrc2_approve(\n toApproveArgs(params),\n );\n if (\"Err\" in response) {\n throw new IcrcTransferError({\n errorType: response.Err,\n msg: \"Failed to entitle the spender to transfer the amount\",\n });\n }\n return response.Ok;\n };\n\n /**\n * Returns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.\n *\n * Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance\n *\n * @param {AllowanceParams} params The parameters to call the allowance.\n *\n * @returns {Allowance} The token allowance. If there is no active approval, the ledger MUST return `{ allowance = 0; expires_at = null }`.\n */\n allowance = (params: AllowanceParams): Promise<Allowance> => {\n const { certified, ...rest } = params;\n return this.caller({ certified }).icrc2_allowance({ ...rest });\n };\n\n /**\n * Fetches the consent message for a specified canister call, intended to provide a human-readable message that helps users make informed decisions.\n *\n * @link: https://github.com/dfinity/wg-identity-authentication/blob/main/topics/ICRC-21/icrc_21_consent_msg.md\n *\n * @param {Icrc21ConsentMessageParams} params - The request parameters containing the method name, arguments, and consent preferences (e.g., language).\n * @returns {Promise<icrc21_consent_info>} - A promise that resolves to the consent message response, which includes the consent message in the specified language and other related information.\n *\n * @throws {InsufficientPaymentError} - This error is reserved for future use, in case payment extensions are introduced. For example, if consent messages, which are currently free, begin to require payments.\n * @throws {UnsupportedCanisterCallError} - If the specified canister call is not supported.\n * @throws {ConsentMessageUnavailableError} - If there is no consent message available.\n * @throws {GenericError} - For any other generic errors.\n */\n consentMessage = async (\n params: Icrc21ConsentMessageParams,\n ): Promise<icrc21_consent_info> => {\n const { icrc21_canister_call_consent_message } = this.caller({\n certified: true,\n });\n\n const response = await icrc21_canister_call_consent_message(\n toIcrc21ConsentMessageArgs(params),\n );\n\n if (\"Err\" in response) {\n throw mapIcrc21ConsentMessageError(response.Err);\n }\n\n return response.Ok;\n };\n\n /**\n * Fetches the blocks information from the ledger canister,\n *\n * @param {GetBlocksParams} params The parameters to get the blocks.\n * @returns {Promise<GetBlocksResult>} The list of blocks.\n */\n getBlocks = (params: GetBlocksParams): Promise<GetBlocksResult> =>\n this.caller({ certified: params.certified }).icrc3_get_blocks(params.args);\n\n /**\n * Returns the principal of the index canister for the ledger, if one was defined as such.\n *\n * @link: https://github.com/dfinity/ICRC/blob/main/ICRCs/ICRC-106/ICRC-106.md\n *\n * @returns {Promise<Principal>} The principal of the index canister.\n *\n * @throws {GenericError} - For any errors that occur while fetching the index principal.\n * @throws {IndexPrincipalNotSetError} - If the index principal was not set for the ledger canister.\n */\n getIndexPrincipal = async (params: QueryParams): Promise<Principal> => {\n const { icrc106_get_index_principal } = this.caller(params);\n\n const response = await icrc106_get_index_principal();\n\n if (\"Err\" in response) {\n throw mapIcrc106GetIndexPrincipalError(response.Err);\n }\n\n return response.Ok;\n };\n\n /**\n * Returns the list of standards this ledger supports by using icrc1_supported_standards.\n *\n * @link: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/README.md#icrc1_supported_standards\n *\n * @returns {Promise<StandardRecord[]>} The list of standards.\n */\n icrc1SupportedStandards = (params: QueryParams): Promise<StandardRecord[]> =>\n this.caller(params).icrc1_supported_standards();\n\n /**\n * Returns the list of standards this ledger supports by using icrc10_supported_standards.\n *\n * @link: https://github.com/dfinity/ICRC/blob/main/ICRCs/ICRC-10/ICRC-10.md#icrc10_supported_standards\n *\n * @returns {Promise<{ url: string; name: string }[]>} The list of standards.\n */\n icrc10SupportedStandards = (\n params: QueryParams,\n ): Promise<{ url: string; name: string }[]> =>\n this.caller(params).icrc10_supported_standards();\n\n /**\n * Returns the minting account of the Ledger canister.\n *\n * @link: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/README.md#icrc1_minting_account\n *\n * @returns {Promise<Nullable<Account>>} The minting account as a Nullable object.\n */\n getMintingAccount = (params: QueryParams): Promise<Nullable<Account>> =>\n this.caller(params).icrc1_minting_account();\n}\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n const GetBlocksResult = IDL.Rec();\n const ICRC3Value = IDL.Rec();\n const Value = IDL.Rec();\n const ChangeArchiveOptions = IDL.Record({\n num_blocks_to_archive: IDL.Opt(IDL.Nat64),\n max_transactions_per_response: IDL.Opt(IDL.Nat64),\n trigger_threshold: IDL.Opt(IDL.Nat64),\n more_controller_ids: IDL.Opt(IDL.Vec(IDL.Principal)),\n max_message_size_bytes: IDL.Opt(IDL.Nat64),\n cycles_for_archive_creation: IDL.Opt(IDL.Nat64),\n node_max_memory_size_bytes: IDL.Opt(IDL.Nat64),\n controller_id: IDL.Opt(IDL.Principal),\n });\n const MetadataValue = IDL.Variant({\n Int: IDL.Int,\n Nat: IDL.Nat,\n Blob: IDL.Vec(IDL.Nat8),\n Text: IDL.Text,\n });\n const Subaccount = IDL.Vec(IDL.Nat8);\n const Account = IDL.Record({\n owner: IDL.Principal,\n subaccount: IDL.Opt(Subaccount),\n });\n const ChangeFeeCollector = IDL.Variant({\n SetTo: Account,\n Unset: IDL.Null,\n });\n const FeatureFlags = IDL.Record({ icrc2: IDL.Bool });\n const UpgradeArgs = IDL.Record({\n change_archive_options: IDL.Opt(ChangeArchiveOptions),\n token_symbol: IDL.Opt(IDL.Text),\n transfer_fee: IDL.Opt(IDL.Nat),\n metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue))),\n change_fee_collector: IDL.Opt(ChangeFeeCollector),\n max_memo_length: IDL.Opt(IDL.Nat16),\n index_principal: IDL.Opt(IDL.Principal),\n token_name: IDL.Opt(IDL.Text),\n feature_flags: IDL.Opt(FeatureFlags),\n });\n const InitArgs = IDL.Record({\n decimals: IDL.Opt(IDL.Nat8),\n token_symbol: IDL.Text,\n transfer_fee: IDL.Nat,\n metadata: IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue)),\n minting_account: Account,\n initial_balances: IDL.Vec(IDL.Tuple(Account, IDL.Nat)),\n fee_collector_account: IDL.Opt(Account),\n archive_options: IDL.Record({\n num_blocks_to_archive: IDL.Nat64,\n max_transactions_per_response: IDL.Opt(IDL.Nat64),\n trigger_threshold: IDL.Nat64,\n more_controller_ids: IDL.Opt(IDL.Vec(IDL.Principal)),\n max_message_size_bytes: IDL.Opt(IDL.Nat64),\n cycles_for_archive_creation: IDL.Opt(IDL.Nat64),\n node_max_memory_size_bytes: IDL.Opt(IDL.Nat64),\n controller_id: IDL.Principal,\n }),\n max_memo_length: IDL.Opt(IDL.Nat16),\n index_principal: IDL.Opt(IDL.Principal),\n token_name: IDL.Text,\n feature_flags: IDL.Opt(FeatureFlags),\n });\n const LedgerArg = IDL.Variant({\n Upgrade: IDL.Opt(UpgradeArgs),\n Init: InitArgs,\n });\n const BlockIndex = IDL.Nat;\n const ArchiveInfo = IDL.Record({\n block_range_end: BlockIndex,\n canister_id: IDL.Principal,\n block_range_start: BlockIndex,\n });\n const GetBlocksArgs = IDL.Record({\n start: BlockIndex,\n length: IDL.Nat,\n });\n const Map = IDL.Vec(IDL.Tuple(IDL.Text, Value));\n Value.fill(\n IDL.Variant({\n Int: IDL.Int,\n Map: Map,\n Nat: IDL.Nat,\n Nat64: IDL.Nat64,\n Blob: IDL.Vec(IDL.Nat8),\n Text: IDL.Text,\n Array: IDL.Vec(Value),\n }),\n );\n const Block = Value;\n const BlockRange = IDL.Record({ blocks: IDL.Vec(Block) });\n const QueryBlockArchiveFn = IDL.Func([GetBlocksArgs], [BlockRange], []);\n const GetBlocksResponse = IDL.Record({\n certificate: IDL.Opt(IDL.Vec(IDL.Nat8)),\n first_index: BlockIndex,\n blocks: IDL.Vec(Block),\n chain_length: IDL.Nat64,\n archived_blocks: IDL.Vec(\n IDL.Record({\n callback: QueryBlockArchiveFn,\n start: BlockIndex,\n length: IDL.Nat,\n }),\n ),\n });\n const DataCertificate = IDL.Record({\n certificate: IDL.Opt(IDL.Vec(IDL.Nat8)),\n hash_tree: IDL.Vec(IDL.Nat8),\n });\n const TxIndex = IDL.Nat;\n const GetTransactionsRequest = IDL.Record({\n start: TxIndex,\n length: IDL.Nat,\n });\n const Timestamp = IDL.Nat64;\n const Burn = IDL.Record({\n fee: IDL.Opt(IDL.Nat),\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(Timestamp),\n amount: IDL.Nat,\n spender: IDL.Opt(Account),\n });\n const Mint = IDL.Record({\n to: Account,\n fee: IDL.Opt(IDL.Nat),\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(Timestamp),\n amount: IDL.Nat,\n });\n const Approve = IDL.Record({\n fee: IDL.Opt(IDL.Nat),\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(Timestamp),\n amount: IDL.Nat,\n expected_allowance: IDL.Opt(IDL.Nat),\n expires_at: IDL.Opt(Timestamp),\n spender: Account,\n });\n const Transfer = IDL.Record({\n to: Account,\n fee: IDL.Opt(IDL.Nat),\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(Timestamp),\n amount: IDL.Nat,\n spender: IDL.Opt(Account),\n });\n const Transaction = IDL.Record({\n burn: IDL.Opt(Burn),\n kind: IDL.Text,\n mint: IDL.Opt(Mint),\n approve: IDL.Opt(Approve),\n timestamp: Timestamp,\n transfer: IDL.Opt(Transfer),\n });\n const TransactionRange = IDL.Record({\n transactions: IDL.Vec(Transaction),\n });\n const QueryArchiveFn = IDL.Func(\n [GetTransactionsRequest],\n [TransactionRange],\n [],\n );\n const GetTransactionsResponse = IDL.Record({\n first_index: TxIndex,\n log_length: IDL.Nat,\n transactions: IDL.Vec(Transaction),\n archived_transactions: IDL.Vec(\n IDL.Record({\n callback: QueryArchiveFn,\n start: TxIndex,\n length: IDL.Nat,\n }),\n ),\n });\n const GetAllowancesArgs = IDL.Record({\n take: IDL.Opt(IDL.Nat),\n prev_spender: IDL.Opt(Account),\n from_account: IDL.Opt(Account),\n });\n const Allowance103 = IDL.Record({\n from_account: Account,\n to_spender: Account,\n allowance: IDL.Nat,\n expires_at: IDL.Opt(IDL.Nat64),\n });\n const GetAllowancesError = IDL.Variant({\n GenericError: IDL.Record({\n message: IDL.Text,\n error_code: IDL.Nat,\n }),\n AccessDenied: IDL.Record({ reason: IDL.Text }),\n });\n const icrc103_get_allowances_response = IDL.Variant({\n Ok: IDL.Vec(Allowance103),\n Err: GetAllowancesError,\n });\n const GetIndexPrincipalError = IDL.Variant({\n GenericError: IDL.Record({\n description: IDL.Text,\n error_code: IDL.Nat,\n }),\n IndexPrincipalNotSet: IDL.Null,\n });\n const GetIndexPrincipalResult = IDL.Variant({\n Ok: IDL.Principal,\n Err: GetIndexPrincipalError,\n });\n const Tokens = IDL.Nat;\n const StandardRecord = IDL.Record({ url: IDL.Text, name: IDL.Text });\n const TransferArg = IDL.Record({\n to: Account,\n fee: IDL.Opt(Tokens),\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n from_subaccount: IDL.Opt(Subaccount),\n created_at_time: IDL.Opt(Timestamp),\n amount: Tokens,\n });\n const TransferError = IDL.Variant({\n GenericError: IDL.Record({\n message: IDL.Text,\n error_code: IDL.Nat,\n }),\n TemporarilyUnavailable: IDL.Null,\n BadBurn: IDL.Record({ min_burn_amount: Tokens }),\n Duplicate: IDL.Record({ duplicate_of: BlockIndex }),\n BadFee: IDL.Record({ expected_fee: Tokens }),\n CreatedInFuture: IDL.Record({ ledger_time: Timestamp }),\n TooOld: IDL.Null,\n InsufficientFunds: IDL.Record({ balance: Tokens }),\n });\n const TransferResult = IDL.Variant({\n Ok: BlockIndex,\n Err: TransferError,\n });\n const icrc21_consent_message_metadata = IDL.Record({\n utc_offset_minutes: IDL.Opt(IDL.Int16),\n language: IDL.Text,\n });\n const icrc21_consent_message_spec = IDL.Record({\n metadata: icrc21_consent_message_metadata,\n device_spec: IDL.Opt(\n IDL.Variant({ GenericDisplay: IDL.Null, FieldsDisplay: IDL.Null }),\n ),\n });\n const icrc21_consent_message_request = IDL.Record({\n arg: IDL.Vec(IDL.Nat8),\n method: IDL.Text,\n user_preferences: icrc21_consent_message_spec,\n });\n const Icrc21Value = IDL.Variant({\n Text: IDL.Record({ content: IDL.Text }),\n TokenAmount: IDL.Record({\n decimals: IDL.Nat8,\n amount: IDL.Nat64,\n symbol: IDL.Text,\n }),\n TimestampSeconds: IDL.Record({ amount: IDL.Nat64 }),\n DurationSeconds: IDL.Record({ amount: IDL.Nat64 }),\n });\n const FieldsDisplay = IDL.Record({\n fields: IDL.Vec(IDL.Tuple(IDL.Text, Icrc21Value)),\n intent: IDL.Text,\n });\n const icrc21_consent_message = IDL.Variant({\n FieldsDisplayMessage: FieldsDisplay,\n GenericDisplayMessage: IDL.Text,\n });\n const icrc21_consent_info = IDL.Record({\n metadata: icrc21_consent_message_metadata,\n consent_message: icrc21_consent_message,\n });\n const icrc21_error_info = IDL.Record({ description: IDL.Text });\n const icrc21_error = IDL.Variant({\n GenericError: IDL.Record({\n description: IDL.Text,\n error_code: IDL.Nat,\n }),\n InsufficientPayment: icrc21_error_info,\n UnsupportedCanisterCall: icrc21_error_info,\n ConsentMessageUnavailable: icrc21_error_info,\n });\n const icrc21_consent_message_response = IDL.Variant({\n Ok: icrc21_consent_info,\n Err: icrc21_error,\n });\n const AllowanceArgs = IDL.Record({\n account: Account,\n spender: Account,\n });\n const Allowance = IDL.Record({\n allowance: IDL.Nat,\n expires_at: IDL.Opt(Timestamp),\n });\n const ApproveArgs = IDL.Record({\n fee: IDL.Opt(IDL.Nat),\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n from_subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(Timestamp),\n amount: IDL.Nat,\n expected_allowance: IDL.Opt(IDL.Nat),\n expires_at: IDL.Opt(Timestamp),\n spender: Account,\n });\n const ApproveError = IDL.Variant({\n GenericError: IDL.Record({\n message: IDL.Text,\n error_code: IDL.Nat,\n }),\n TemporarilyUnavailable: IDL.Null,\n Duplicate: IDL.Record({ duplicate_of: BlockIndex }),\n BadFee: IDL.Record({ expected_fee: IDL.Nat }),\n AllowanceChanged: IDL.Record({ current_allowance: IDL.Nat }),\n CreatedInFuture: IDL.Record({ ledger_time: Timestamp }),\n TooOld: IDL.Null,\n Expired: IDL.Record({ ledger_time: Timestamp }),\n InsufficientFunds: IDL.Record({ balance: IDL.Nat }),\n });\n const ApproveResult = IDL.Variant({\n Ok: BlockIndex,\n Err: ApproveError,\n });\n const TransferFromArgs = IDL.Record({\n to: Account,\n fee: IDL.Opt(Tokens),\n spender_subaccount: IDL.Opt(Subaccount),\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(Timestamp),\n amount: Tokens,\n });\n const TransferFromError = IDL.Variant({\n GenericError: IDL.Record({\n message: IDL.Text,\n error_code: IDL.Nat,\n }),\n TemporarilyUnavailable: IDL.Null,\n InsufficientAllowance: IDL.Record({ allowance: Tokens }),\n BadBurn: IDL.Record({ min_burn_amount: Tokens }),\n Duplicate: IDL.Record({ duplicate_of: BlockIndex }),\n BadFee: IDL.Record({ expected_fee: Tokens }),\n CreatedInFuture: IDL.Record({ ledger_time: Timestamp }),\n TooOld: IDL.Null,\n InsufficientFunds: IDL.Record({ balance: Tokens }),\n });\n const TransferFromResult = IDL.Variant({\n Ok: BlockIndex,\n Err: TransferFromError,\n });\n const GetArchivesArgs = IDL.Record({ from: IDL.Opt(IDL.Principal) });\n const GetArchivesResult = IDL.Vec(\n IDL.Record({\n end: IDL.Nat,\n canister_id: IDL.Principal,\n start: IDL.Nat,\n }),\n );\n ICRC3Value.fill(\n IDL.Variant({\n Int: IDL.Int,\n Map: IDL.Vec(IDL.Tuple(IDL.Text, ICRC3Value)),\n Nat: IDL.Nat,\n Blob: IDL.Vec(IDL.Nat8),\n Text: IDL.Text,\n Array: IDL.Vec(ICRC3Value),\n }),\n );\n GetBlocksResult.fill(\n IDL.Record({\n log_length: IDL.Nat,\n blocks: IDL.Vec(IDL.Record({ id: IDL.Nat, block: ICRC3Value })),\n archived_blocks: IDL.Vec(\n IDL.Record({\n args: IDL.Vec(GetBlocksArgs),\n callback: IDL.Func(\n [IDL.Vec(GetBlocksArgs)],\n [GetBlocksResult],\n [\"query\"],\n ),\n }),\n ),\n }),\n );\n const ICRC3DataCertificate = IDL.Record({\n certificate: IDL.Vec(IDL.Nat8),\n hash_tree: IDL.Vec(IDL.Nat8),\n });\n\n return IDL.Service({\n archives: IDL.Func([], [IDL.Vec(ArchiveInfo)], []),\n get_blocks: IDL.Func([GetBlocksArgs], [GetBlocksResponse], []),\n get_data_certificate: IDL.Func([], [DataCertificate], []),\n get_transactions: IDL.Func(\n [GetTransactionsRequest],\n [GetTransactionsResponse],\n [],\n ),\n icrc103_get_allowances: IDL.Func(\n [GetAllowancesArgs],\n [icrc103_get_allowances_response],\n [],\n ),\n icrc106_get_index_principal: IDL.Func([], [GetIndexPrincipalResult], []),\n icrc10_supported_standards: IDL.Func(\n [],\n [IDL.Vec(IDL.Record({ url: IDL.Text, name: IDL.Text }))],\n [],\n ),\n icrc1_balance_of: IDL.Func([Account], [Tokens], []),\n icrc1_decimals: IDL.Func([], [IDL.Nat8], []),\n icrc1_fee: IDL.Func([], [Tokens], []),\n icrc1_metadata: IDL.Func(\n [],\n [IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue))],\n [],\n ),\n icrc1_minting_account: IDL.Func([], [IDL.Opt(Account)], []),\n icrc1_name: IDL.Func([], [IDL.Text], []),\n icrc1_supported_standards: IDL.Func([], [IDL.Vec(StandardRecord)], []),\n icrc1_symbol: IDL.Func([], [IDL.Text], []),\n icrc1_total_supply: IDL.Func([], [Tokens], []),\n icrc1_transfer: IDL.Func([TransferArg], [TransferResult], []),\n icrc21_canister_call_consent_message: IDL.Func(\n [icrc21_consent_message_request],\n [icrc21_consent_message_response],\n [],\n ),\n icrc2_allowance: IDL.Func([AllowanceArgs], [Allowance], []),\n icrc2_approve: IDL.Func([ApproveArgs], [ApproveResult], []),\n icrc2_transfer_from: IDL.Func([TransferFromArgs], [TransferFromResult], []),\n icrc3_get_archives: IDL.Func([GetArchivesArgs], [GetArchivesResult], []),\n icrc3_get_blocks: IDL.Func([IDL.Vec(GetBlocksArgs)], [GetBlocksResult], []),\n icrc3_get_tip_certificate: IDL.Func(\n [],\n [IDL.Opt(ICRC3DataCertificate)],\n [],\n ),\n icrc3_supported_block_types: IDL.Func(\n [],\n [IDL.Vec(IDL.Record({ url: IDL.Text, block_type: IDL.Text }))],\n [],\n ),\n is_ledger_ready: IDL.Func([], [IDL.Bool], [\"query\"]),\n });\n};\n\nexport const init = ({ IDL }) => {\n const ChangeArchiveOptions = IDL.Record({\n num_blocks_to_archive: IDL.Opt(IDL.Nat64),\n max_transactions_per_response: IDL.Opt(IDL.Nat64),\n trigger_threshold: IDL.Opt(IDL.Nat64),\n more_controller_ids: IDL.Opt(IDL.Vec(IDL.Principal)),\n max_message_size_bytes: IDL.Opt(IDL.Nat64),\n cycles_for_archive_creation: IDL.Opt(IDL.Nat64),\n node_max_memory_size_bytes: IDL.Opt(IDL.Nat64),\n controller_id: IDL.Opt(IDL.Principal),\n });\n const MetadataValue = IDL.Variant({\n Int: IDL.Int,\n Nat: IDL.Nat,\n Blob: IDL.Vec(IDL.Nat8),\n Text: IDL.Text,\n });\n const Subaccount = IDL.Vec(IDL.Nat8);\n const Account = IDL.Record({\n owner: IDL.Principal,\n subaccount: IDL.Opt(Subaccount),\n });\n const ChangeFeeCollector = IDL.Variant({\n SetTo: Account,\n Unset: IDL.Null,\n });\n const FeatureFlags = IDL.Record({ icrc2: IDL.Bool });\n const UpgradeArgs = IDL.Record({\n change_archive_options: IDL.Opt(ChangeArchiveOptions),\n token_symbol: IDL.Opt(IDL.Text),\n transfer_fee: IDL.Opt(IDL.Nat),\n metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue))),\n change_fee_collector: IDL.Opt(ChangeFeeCollector),\n max_memo_length: IDL.Opt(IDL.Nat16),\n index_principal: IDL.Opt(IDL.Principal),\n token_name: IDL.Opt(IDL.Text),\n feature_flags: IDL.Opt(FeatureFlags),\n });\n const InitArgs = IDL.Record({\n decimals: IDL.Opt(IDL.Nat8),\n token_symbol: IDL.Text,\n transfer_fee: IDL.Nat,\n metadata: IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue)),\n minting_account: Account,\n initial_balances: IDL.Vec(IDL.Tuple(Account, IDL.Nat)),\n fee_collector_account: IDL.Opt(Account),\n archive_options: IDL.Record({\n num_blocks_to_archive: IDL.Nat64,\n max_transactions_per_response: IDL.Opt(IDL.Nat64),\n trigger_threshold: IDL.Nat64,\n more_controller_ids: IDL.Opt(IDL.Vec(IDL.Principal)),\n max_message_size_bytes: IDL.Opt(IDL.Nat64),\n cycles_for_archive_creation: IDL.Opt(IDL.Nat64),\n node_max_memory_size_bytes: IDL.Opt(IDL.Nat64),\n controller_id: IDL.Principal,\n }),\n max_memo_length: IDL.Opt(IDL.Nat16),\n index_principal: IDL.Opt(IDL.Principal),\n token_name: IDL.Text,\n feature_flags: IDL.Opt(FeatureFlags),\n });\n const LedgerArg = IDL.Variant({\n Upgrade: IDL.Opt(UpgradeArgs),\n Init: InitArgs,\n });\n\n return [LedgerArg];\n};\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n const GetBlocksResult = IDL.Rec();\n const ICRC3Value = IDL.Rec();\n const Value = IDL.Rec();\n const ChangeArchiveOptions = IDL.Record({\n num_blocks_to_archive: IDL.Opt(IDL.Nat64),\n max_transactions_per_response: IDL.Opt(IDL.Nat64),\n trigger_threshold: IDL.Opt(IDL.Nat64),\n more_controller_ids: IDL.Opt(IDL.Vec(IDL.Principal)),\n max_message_size_bytes: IDL.Opt(IDL.Nat64),\n cycles_for_archive_creation: IDL.Opt(IDL.Nat64),\n node_max_memory_size_bytes: IDL.Opt(IDL.Nat64),\n controller_id: IDL.Opt(IDL.Principal),\n });\n const MetadataValue = IDL.Variant({\n Int: IDL.Int,\n Nat: IDL.Nat,\n Blob: IDL.Vec(IDL.Nat8),\n Text: IDL.Text,\n });\n const Subaccount = IDL.Vec(IDL.Nat8);\n const Account = IDL.Record({\n owner: IDL.Principal,\n subaccount: IDL.Opt(Subaccount),\n });\n const ChangeFeeCollector = IDL.Variant({\n SetTo: Account,\n Unset: IDL.Null,\n });\n const FeatureFlags = IDL.Record({ icrc2: IDL.Bool });\n const UpgradeArgs = IDL.Record({\n change_archive_options: IDL.Opt(ChangeArchiveOptions),\n token_symbol: IDL.Opt(IDL.Text),\n transfer_fee: IDL.Opt(IDL.Nat),\n metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue))),\n change_fee_collector: IDL.Opt(ChangeFeeCollector),\n max_memo_length: IDL.Opt(IDL.Nat16),\n index_principal: IDL.Opt(IDL.Principal),\n token_name: IDL.Opt(IDL.Text),\n feature_flags: IDL.Opt(FeatureFlags),\n });\n const InitArgs = IDL.Record({\n decimals: IDL.Opt(IDL.Nat8),\n token_symbol: IDL.Text,\n transfer_fee: IDL.Nat,\n metadata: IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue)),\n minting_account: Account,\n initial_balances: IDL.Vec(IDL.Tuple(Account, IDL.Nat)),\n fee_collector_account: IDL.Opt(Account),\n archive_options: IDL.Record({\n num_blocks_to_archive: IDL.Nat64,\n max_transactions_per_response: IDL.Opt(IDL.Nat64),\n trigger_threshold: IDL.Nat64,\n more_controller_ids: IDL.Opt(IDL.Vec(IDL.Principal)),\n max_message_size_bytes: IDL.Opt(IDL.Nat64),\n cycles_for_archive_creation: IDL.Opt(IDL.Nat64),\n node_max_memory_size_bytes: IDL.Opt(IDL.Nat64),\n controller_id: IDL.Principal,\n }),\n max_memo_length: IDL.Opt(IDL.Nat16),\n index_principal: IDL.Opt(IDL.Principal),\n token_name: IDL.Text,\n feature_flags: IDL.Opt(FeatureFlags),\n });\n const LedgerArg = IDL.Variant({\n Upgrade: IDL.Opt(UpgradeArgs),\n Init: InitArgs,\n });\n const BlockIndex = IDL.Nat;\n const ArchiveInfo = IDL.Record({\n block_range_end: BlockIndex,\n canister_id: IDL.Principal,\n block_range_start: BlockIndex,\n });\n const GetBlocksArgs = IDL.Record({\n start: BlockIndex,\n length: IDL.Nat,\n });\n const Map = IDL.Vec(IDL.Tuple(IDL.Text, Value));\n Value.fill(\n IDL.Variant({\n Int: IDL.Int,\n Map: Map,\n Nat: IDL.Nat,\n Nat64: IDL.Nat64,\n Blob: IDL.Vec(IDL.Nat8),\n Text: IDL.Text,\n Array: IDL.Vec(Value),\n }),\n );\n const Block = Value;\n const BlockRange = IDL.Record({ blocks: IDL.Vec(Block) });\n const QueryBlockArchiveFn = IDL.Func(\n [GetBlocksArgs],\n [BlockRange],\n [\"query\"],\n );\n const GetBlocksResponse = IDL.Record({\n certificate: IDL.Opt(IDL.Vec(IDL.Nat8)),\n first_index: BlockIndex,\n blocks: IDL.Vec(Block),\n chain_length: IDL.Nat64,\n archived_blocks: IDL.Vec(\n IDL.Record({\n callback: QueryBlockArchiveFn,\n start: BlockIndex,\n length: IDL.Nat,\n }),\n ),\n });\n const DataCertificate = IDL.Record({\n certificate: IDL.Opt(IDL.Vec(IDL.Nat8)),\n hash_tree: IDL.Vec(IDL.Nat8),\n });\n const TxIndex = IDL.Nat;\n const GetTransactionsRequest = IDL.Record({\n start: TxIndex,\n length: IDL.Nat,\n });\n const Timestamp = IDL.Nat64;\n const Burn = IDL.Record({\n fee: IDL.Opt(IDL.Nat),\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(Timestamp),\n amount: IDL.Nat,\n spender: IDL.Opt(Account),\n });\n const Mint = IDL.Record({\n to: Account,\n fee: IDL.Opt(IDL.Nat),\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(Timestamp),\n amount: IDL.Nat,\n });\n const Approve = IDL.Record({\n fee: IDL.Opt(IDL.Nat),\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(Timestamp),\n amount: IDL.Nat,\n expected_allowance: IDL.Opt(IDL.Nat),\n expires_at: IDL.Opt(Timestamp),\n spender: Account,\n });\n const Transfer = IDL.Record({\n to: Account,\n fee: IDL.Opt(IDL.Nat),\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(Timestamp),\n amount: IDL.Nat,\n spender: IDL.Opt(Account),\n });\n const Transaction = IDL.Record({\n burn: IDL.Opt(Burn),\n kind: IDL.Text,\n mint: IDL.Opt(Mint),\n approve: IDL.Opt(Approve),\n timestamp: Timestamp,\n transfer: IDL.Opt(Transfer),\n });\n const TransactionRange = IDL.Record({\n transactions: IDL.Vec(Transaction),\n });\n const QueryArchiveFn = IDL.Func(\n [GetTransactionsRequest],\n [TransactionRange],\n [\"query\"],\n );\n const GetTransactionsResponse = IDL.Record({\n first_index: TxIndex,\n log_length: IDL.Nat,\n transactions: IDL.Vec(Transaction),\n archived_transactions: IDL.Vec(\n IDL.Record({\n callback: QueryArchiveFn,\n start: TxIndex,\n length: IDL.Nat,\n }),\n ),\n });\n const GetAllowancesArgs = IDL.Record({\n take: IDL.Opt(IDL.Nat),\n prev_spender: IDL.Opt(Account),\n from_account: IDL.Opt(Account),\n });\n const Allowance103 = IDL.Record({\n from_account: Account,\n to_spender: Account,\n allowance: IDL.Nat,\n expires_at: IDL.Opt(IDL.Nat64),\n });\n const GetAllowancesError = IDL.Variant({\n GenericError: IDL.Record({\n message: IDL.Text,\n error_code: IDL.Nat,\n }),\n AccessDenied: IDL.Record({ reason: IDL.Text }),\n });\n const icrc103_get_allowances_response = IDL.Variant({\n Ok: IDL.Vec(Allowance103),\n Err: GetAllowancesError,\n });\n const GetIndexPrincipalError = IDL.Variant({\n GenericError: IDL.Record({\n description: IDL.Text,\n error_code: IDL.Nat,\n }),\n IndexPrincipalNotSet: IDL.Null,\n });\n const GetIndexPrincipalResult = IDL.Variant({\n Ok: IDL.Principal,\n Err: GetIndexPrincipalError,\n });\n const Tokens = IDL.Nat;\n const StandardRecord = IDL.Record({ url: IDL.Text, name: IDL.Text });\n const TransferArg = IDL.Record({\n to: Account,\n fee: IDL.Opt(Tokens),\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n from_subaccount: IDL.Opt(Subaccount),\n created_at_time: IDL.Opt(Timestamp),\n amount: Tokens,\n });\n const TransferError = IDL.Variant({\n GenericError: IDL.Record({\n message: IDL.Text,\n error_code: IDL.Nat,\n }),\n TemporarilyUnavailable: IDL.Null,\n BadBurn: IDL.Record({ min_burn_amount: Tokens }),\n Duplicate: IDL.Record({ duplicate_of: BlockIndex }),\n BadFee: IDL.Record({ expected_fee: Tokens }),\n CreatedInFuture: IDL.Record({ ledger_time: Timestamp }),\n TooOld: IDL.Null,\n InsufficientFunds: IDL.Record({ balance: Tokens }),\n });\n const TransferResult = IDL.Variant({\n Ok: BlockIndex,\n Err: TransferError,\n });\n const icrc21_consent_message_metadata = IDL.Record({\n utc_offset_minutes: IDL.Opt(IDL.Int16),\n language: IDL.Text,\n });\n const icrc21_consent_message_spec = IDL.Record({\n metadata: icrc21_consent_message_metadata,\n device_spec: IDL.Opt(\n IDL.Variant({ GenericDisplay: IDL.Null, FieldsDisplay: IDL.Null }),\n ),\n });\n const icrc21_consent_message_request = IDL.Record({\n arg: IDL.Vec(IDL.Nat8),\n method: IDL.Text,\n user_preferences: icrc21_consent_message_spec,\n });\n const Icrc21Value = IDL.Variant({\n Text: IDL.Record({ content: IDL.Text }),\n TokenAmount: IDL.Record({\n decimals: IDL.Nat8,\n amount: IDL.Nat64,\n symbol: IDL.Text,\n }),\n TimestampSeconds: IDL.Record({ amount: IDL.Nat64 }),\n DurationSeconds: IDL.Record({ amount: IDL.Nat64 }),\n });\n const FieldsDisplay = IDL.Record({\n fields: IDL.Vec(IDL.Tuple(IDL.Text, Icrc21Value)),\n intent: IDL.Text,\n });\n const icrc21_consent_message = IDL.Variant({\n FieldsDisplayMessage: FieldsDisplay,\n GenericDisplayMessage: IDL.Text,\n });\n const icrc21_consent_info = IDL.Record({\n metadata: icrc21_consent_message_metadata,\n consent_message: icrc21_consent_message,\n });\n const icrc21_error_info = IDL.Record({ description: IDL.Text });\n const icrc21_error = IDL.Variant({\n GenericError: IDL.Record({\n description: IDL.Text,\n error_code: IDL.Nat,\n }),\n InsufficientPayment: icrc21_error_info,\n UnsupportedCanisterCall: icrc21_error_info,\n ConsentMessageUnavailable: icrc21_error_info,\n });\n const icrc21_consent_message_response = IDL.Variant({\n Ok: icrc21_consent_info,\n Err: icrc21_error,\n });\n const AllowanceArgs = IDL.Record({\n account: Account,\n spender: Account,\n });\n const Allowance = IDL.Record({\n allowance: IDL.Nat,\n expires_at: IDL.Opt(Timestamp),\n });\n const ApproveArgs = IDL.Record({\n fee: IDL.Opt(IDL.Nat),\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n from_subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(Timestamp),\n amount: IDL.Nat,\n expected_allowance: IDL.Opt(IDL.Nat),\n expires_at: IDL.Opt(Timestamp),\n spender: Account,\n });\n const ApproveError = IDL.Variant({\n GenericError: IDL.Record({\n message: IDL.Text,\n error_code: IDL.Nat,\n }),\n TemporarilyUnavailable: IDL.Null,\n Duplicate: IDL.Record({ duplicate_of: BlockIndex }),\n BadFee: IDL.Record({ expected_fee: IDL.Nat }),\n AllowanceChanged: IDL.Record({ current_allowance: IDL.Nat }),\n CreatedInFuture: IDL.Record({ ledger_time: Timestamp }),\n TooOld: IDL.Null,\n Expired: IDL.Record({ ledger_time: Timestamp }),\n InsufficientFunds: IDL.Record({ balance: IDL.Nat }),\n });\n const ApproveResult = IDL.Variant({\n Ok: BlockIndex,\n Err: ApproveError,\n });\n const TransferFromArgs = IDL.Record({\n to: Account,\n fee: IDL.Opt(Tokens),\n spender_subaccount: IDL.Opt(Subaccount),\n from: Account,\n memo: IDL.Opt(IDL.Vec(IDL.Nat8)),\n created_at_time: IDL.Opt(Timestamp),\n amount: Tokens,\n });\n const TransferFromError = IDL.Variant({\n GenericError: IDL.Record({\n message: IDL.Text,\n error_code: IDL.Nat,\n }),\n TemporarilyUnavailable: IDL.Null,\n InsufficientAllowance: IDL.Record({ allowance: Tokens }),\n BadBurn: IDL.Record({ min_burn_amount: Tokens }),\n Duplicate: IDL.Record({ duplicate_of: BlockIndex }),\n BadFee: IDL.Record({ expected_fee: Tokens }),\n CreatedInFuture: IDL.Record({ ledger_time: Timestamp }),\n TooOld: IDL.Null,\n InsufficientFunds: IDL.Record({ balance: Tokens }),\n });\n const TransferFromResult = IDL.Variant({\n Ok: BlockIndex,\n Err: TransferFromError,\n });\n const GetArchivesArgs = IDL.Record({ from: IDL.Opt(IDL.Principal) });\n const GetArchivesResult = IDL.Vec(\n IDL.Record({\n end: IDL.Nat,\n canister_id: IDL.Principal,\n start: IDL.Nat,\n }),\n );\n ICRC3Value.fill(\n IDL.Variant({\n Int: IDL.Int,\n Map: IDL.Vec(IDL.Tuple(IDL.Text, ICRC3Value)),\n Nat: IDL.Nat,\n Blob: IDL.Vec(IDL.Nat8),\n Text: IDL.Text,\n Array: IDL.Vec(ICRC3Value),\n }),\n );\n GetBlocksResult.fill(\n IDL.Record({\n log_length: IDL.Nat,\n blocks: IDL.Vec(IDL.Record({ id: IDL.Nat, block: ICRC3Value })),\n archived_blocks: IDL.Vec(\n IDL.Record({\n args: IDL.Vec(GetBlocksArgs),\n callback: IDL.Func(\n [IDL.Vec(GetBlocksArgs)],\n [GetBlocksResult],\n [\"query\"],\n ),\n }),\n ),\n }),\n );\n const ICRC3DataCertificate = IDL.Record({\n certificate: IDL.Vec(IDL.Nat8),\n hash_tree: IDL.Vec(IDL.Nat8),\n });\n\n return IDL.Service({\n archives: IDL.Func([], [IDL.Vec(ArchiveInfo)], [\"query\"]),\n get_blocks: IDL.Func([GetBlocksArgs], [GetBlocksResponse], [\"query\"]),\n get_data_certificate: IDL.Func([], [DataCertificate], [\"query\"]),\n get_transactions: IDL.Func(\n [GetTransactionsRequest],\n [GetTransactionsResponse],\n [\"query\"],\n ),\n icrc103_get_allowances: IDL.Func(\n [GetAllowancesArgs],\n [icrc103_get_allowances_response],\n [\"query\"],\n ),\n icrc106_get_index_principal: IDL.Func(\n [],\n [GetIndexPrincipalResult],\n [\"query\"],\n ),\n icrc10_supported_standards: IDL.Func(\n [],\n [IDL.Vec(IDL.Record({ url: IDL.Text, name: IDL.Text }))],\n [\"query\"],\n ),\n icrc1_balance_of: IDL.Func([Account], [Tokens], [\"query\"]),\n icrc1_decimals: IDL.Func([], [IDL.Nat8], [\"query\"]),\n icrc1_fee: IDL.Func([], [Tokens], [\"query\"]),\n icrc1_metadata: IDL.Func(\n [],\n [IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue))],\n [\"query\"],\n ),\n icrc1_minting_account: IDL.Func([], [IDL.Opt(Account)], [\"query\"]),\n icrc1_name: IDL.Func([], [IDL.Text], [\"query\"]),\n icrc1_supported_standards: IDL.Func(\n [],\n [IDL.Vec(StandardRecord)],\n [\"query\"],\n ),\n icrc1_symbol: IDL.Func([], [IDL.Text], [\"query\"]),\n icrc1_total_supply: IDL.Func([], [Tokens], [\"query\"]),\n icrc1_transfer: IDL.Func([TransferArg], [TransferResult], []),\n icrc21_canister_call_consent_message: IDL.Func(\n [icrc21_consent_message_request],\n [icrc21_consent_message_response],\n [],\n ),\n icrc2_allowance: IDL.Func([AllowanceArgs], [Allowance], [\"query\"]),\n icrc2_approve: IDL.Func([ApproveArgs], [ApproveResult], []),\n icrc2_transfer_from: IDL.Func([TransferFromArgs], [TransferFromResult], []),\n icrc3_get_archives: IDL.Func(\n [GetArchivesArgs],\n [GetArchivesResult],\n [\"query\"],\n ),\n icrc3_get_blocks: IDL.Func(\n [IDL.Vec(GetBlocksArgs)],\n [GetBlocksResult],\n [\"query\"],\n ),\n icrc3_get_tip_certificate: IDL.Func(\n [],\n [IDL.Opt(ICRC3DataCertificate)],\n [\"query\"],\n ),\n icrc3_supported_block_types: IDL.Func(\n [],\n [IDL.Vec(IDL.Record({ url: IDL.Text, block_type: IDL.Text }))],\n [\"query\"],\n ),\n is_ledger_ready: IDL.Func([], [IDL.Bool], [\"query\"]),\n });\n};\n\nexport const init = ({ IDL }) => {\n const ChangeArchiveOptions = IDL.Record({\n num_blocks_to_archive: IDL.Opt(IDL.Nat64),\n max_transactions_per_response: IDL.Opt(IDL.Nat64),\n trigger_threshold: IDL.Opt(IDL.Nat64),\n more_controller_ids: IDL.Opt(IDL.Vec(IDL.Principal)),\n max_message_size_bytes: IDL.Opt(IDL.Nat64),\n cycles_for_archive_creation: IDL.Opt(IDL.Nat64),\n node_max_memory_size_bytes: IDL.Opt(IDL.Nat64),\n controller_id: IDL.Opt(IDL.Principal),\n });\n const MetadataValue = IDL.Variant({\n Int: IDL.Int,\n Nat: IDL.Nat,\n Blob: IDL.Vec(IDL.Nat8),\n Text: IDL.Text,\n });\n const Subaccount = IDL.Vec(IDL.Nat8);\n const Account = IDL.Record({\n owner: IDL.Principal,\n subaccount: IDL.Opt(Subaccount),\n });\n const ChangeFeeCollector = IDL.Variant({\n SetTo: Account,\n Unset: IDL.Null,\n });\n const FeatureFlags = IDL.Record({ icrc2: IDL.Bool });\n const UpgradeArgs = IDL.Record({\n change_archive_options: IDL.Opt(ChangeArchiveOptions),\n token_symbol: IDL.Opt(IDL.Text),\n transfer_fee: IDL.Opt(IDL.Nat),\n metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue))),\n change_fee_collector: IDL.Opt(ChangeFeeCollector),\n max_memo_length: IDL.Opt(IDL.Nat16),\n index_principal: IDL.Opt(IDL.Principal),\n token_name: IDL.Opt(IDL.Text),\n feature_flags: IDL.Opt(FeatureFlags),\n });\n const InitArgs = IDL.Record({\n decimals: IDL.Opt(IDL.Nat8),\n token_symbol: IDL.Text,\n transfer_fee: IDL.Nat,\n metadata: IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue)),\n minting_account: Account,\n initial_balances: IDL.Vec(IDL.Tuple(Account, IDL.Nat)),\n fee_collector_account: IDL.Opt(Account),\n archive_options: IDL.Record({\n num_blocks_to_archive: IDL.Nat64,\n max_transactions_per_response: IDL.Opt(IDL.Nat64),\n trigger_threshold: IDL.Nat64,\n more_controller_ids: IDL.Opt(IDL.Vec(IDL.Principal)),\n max_message_size_bytes: IDL.Opt(IDL.Nat64),\n cycles_for_archive_creation: IDL.Opt(IDL.Nat64),\n node_max_memory_size_bytes: IDL.Opt(IDL.Nat64),\n controller_id: IDL.Principal,\n }),\n max_memo_length: IDL.Opt(IDL.Nat16),\n index_principal: IDL.Opt(IDL.Principal),\n token_name: IDL.Text,\n feature_flags: IDL.Opt(FeatureFlags),\n });\n const LedgerArg = IDL.Variant({\n Upgrade: IDL.Opt(UpgradeArgs),\n Init: InitArgs,\n });\n\n return [LedgerArg];\n};\n", "import type { Principal } from \"@icp-sdk/core/principal\";\nimport type { Subaccount, Value } from \"../candid/icrc_ledger\";\n\n// Source: https://github.com/dfinity/icrc-1#standard-metadata-entries\nexport enum IcrcMetadataResponseEntries {\n SYMBOL = \"icrc1:symbol\",\n NAME = \"icrc1:name\",\n DECIMALS = \"icrc1:decimals\",\n FEE = \"icrc1:fee\",\n LOGO = \"icrc1:logo\",\n}\n\nexport type IcrcTokenMetadataResponse = [\n string | IcrcMetadataResponseEntries,\n Value,\n][];\n\nexport interface IcrcAccount {\n owner: Principal;\n subaccount?: Subaccount;\n}\n\nexport interface IcrcTokenMetadata {\n name: string;\n symbol: string;\n fee: bigint;\n decimals: number;\n icon?: string;\n}\n", "import {\n bigEndianCrc32,\n encodeBase32,\n hexStringToUint8Array,\n isNullish,\n nonNullish,\n notEmptyString,\n uint8ArrayToHexString,\n} from \"@dfinity/utils\";\nimport { Principal } from \"@icp-sdk/core/principal\";\nimport {\n IcrcMetadataResponseEntries,\n type IcrcAccount,\n type IcrcTokenMetadata,\n type IcrcTokenMetadataResponse,\n} from \"../types/ledger.responses\";\n\nconst MAX_SUBACCOUNT_HEX_LENGTH = 64;\n\n/**\n * Encodes an Icrc-1 account compatible into a string.\n * Formatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n *\n * @param account { owner: Principal, subaccount?: Uint8Array }\n * @returns string\n */\nexport const encodeIcrcAccount = ({\n owner,\n subaccount,\n}: IcrcAccount): string => {\n if (isNullish(subaccount)) {\n return owner.toText();\n }\n\n const removeLeadingZeros = (text: string): string => text.replace(/^0+/, \"\");\n\n const subaccountText = removeLeadingZeros(\n uint8ArrayToHexString(Uint8Array.from(subaccount)),\n );\n\n if (subaccountText.length === 0) {\n return owner.toText();\n }\n\n return `${owner.toText()}-${encodeCrc({\n owner,\n subaccount,\n })}.${subaccountText}`;\n};\n\nconst encodeCrc = ({ owner, subaccount }: Required<IcrcAccount>): string => {\n const crc = bigEndianCrc32(\n Uint8Array.from([...owner.toUint8Array(), ...subaccount]),\n );\n\n return encodeBase32(crc);\n};\n\n/**\n * Decodes a string into an Icrc-1 compatible account.\n * Formatting Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/TextualEncoding.md\n *\n * @param accountString string\n * @throws Error if the string is not a valid Icrc-1 account\n * @returns IcrcAccount { owner: Principal, subaccount?: Uint8Array }\n */\nexport const decodeIcrcAccount = (accountString: string): IcrcAccount => {\n const [principalAndMaybeCheckSum, subaccountHex, ...unexpected] =\n accountString.split(\".\");\n\n if (!notEmptyString(principalAndMaybeCheckSum)) {\n throw new Error(\"Invalid account. No string provided.\");\n }\n\n if (unexpected.length > 0) {\n throw new Error(\n \"Invalid account string format. Expected at most one '.' separator.\",\n );\n }\n\n if (isNullish(subaccountHex)) {\n return {\n owner: Principal.fromText(accountString),\n };\n }\n\n const [checksum, ...rest] = principalAndMaybeCheckSum.split(\"-\").reverse();\n const principalText = rest.reverse().join(\"-\");\n\n const account = {\n owner: Principal.fromText(principalText),\n subaccount: hexStringToUint8Array(\n subaccountHex.padStart(MAX_SUBACCOUNT_HEX_LENGTH, \"0\"),\n ),\n };\n\n const crcText = encodeCrc(account);\n\n if (crcText !== checksum) {\n throw new Error(\"Invalid account. Invalid checksum.\");\n }\n\n return account;\n};\n\n/**\n * Maps the token metadata information from a ledger response into a structured record.\n *\n * This utility processes an array of metadata key-value pairs provided by the ledger\n * and extracts specific fields, such as symbol, name, fee, decimals, and logo. It then\n * constructs a `IcrcTokenMetadata` record. If any required fields are missing,\n * the function returns `undefined`.\n *\n * @param {IcrcTokenMetadataResponse} response - An array of key-value pairs representing token metadata.\n *\n * @returns {IcrcTokenMetadata | undefined} - A structured metadata record or `undefined` if required fields are missing.\n */\nexport const mapTokenMetadata = (\n response: IcrcTokenMetadataResponse,\n): IcrcTokenMetadata | undefined => {\n const nullishToken = response.reduce<Partial<IcrcTokenMetadata>>(\n (acc, [key, value]) => {\n switch (key) {\n case IcrcMetadataResponseEntries.SYMBOL:\n acc = { ...acc, ...(\"Text\" in value && { symbol: value.Text }) };\n break;\n case IcrcMetadataResponseEntries.NAME:\n acc = { ...acc, ...(\"Text\" in value && { name: value.Text }) };\n break;\n case IcrcMetadataResponseEntries.FEE:\n acc = { ...acc, ...(\"Nat\" in value && { fee: value.Nat }) };\n break;\n case IcrcMetadataResponseEntries.DECIMALS:\n acc = {\n ...acc,\n ...(\"Nat\" in value && { decimals: Number(value.Nat) }),\n };\n break;\n case IcrcMetadataResponseEntries.LOGO:\n acc = { ...acc, ...(\"Text\" in value && { icon: value.Text }) };\n }\n\n return acc;\n },\n {},\n );\n\n const isIcrcTokenMetadata = (\n arg: Partial<IcrcTokenMetadata>,\n ): arg is IcrcTokenMetadata =>\n nonNullish(arg.symbol) &&\n nonNullish(arg.name) &&\n nonNullish(arg.fee) &&\n nonNullish(arg.decimals);\n\n if (!isIcrcTokenMetadata(nullishToken)) {\n return undefined;\n }\n\n return nullishToken;\n};\n", "import { isNullish, nonNullish } from \"@dfinity/utils\";\n\n/**\n * \uD83D\uDC40 This feature is currently in draft. You can find more information about it at https://github.com/dfinity/ICRC/issues/22.\n *\n * A naive implementation of a payment parser. Given a code, the function attempts to extract a token name, account identifier (textual representation), and an optional amount.\n *\n * If the code doesn't match the expected pattern, `undefined` is returned for simplicity.\n * Similarly, if an optional amount is provided but it's not a valid number, the parser will not throw an exception and returns `undefined`.\n *\n * Please note that this function doesn't perform any validity checks on the extracted information.\n * It does not verify if the token is known or if the identifier is a valid address.\n *\n * ```\n * urn = token \":\" address [ \"?\" params]\n * token = [ ckbtc / icp / chat / bitcoin / ethereum ... ]\n * address = STRING\n * params = param [ \"&\" params ]\n * param = [ amountparam ]\n * amountparam = \"amount=\" *digit [ \".\" *digit ]\n * ```\n *\n * @param code string\n * @returns { token: string; identifier: string; amount?: number } | undefined\n */\nexport const decodePayment = (\n code: string,\n): { token: string; identifier: string; amount?: number } | undefined => {\n const regex =\n /^([a-zA-Z]+):([A-Za-z0-9:\\-.]+).*?(?:[?&](?:amount|value)=(\\d+(?:\\.\\d+)?))?$/;\n\n const match = code.match(regex);\n if (isNullish(match)) {\n return undefined;\n }\n\n const [_, token, identifier, amount] = match;\n\n return {\n token,\n identifier,\n ...(nonNullish(amount) &&\n !isNaN(parseFloat(amount)) && { amount: parseFloat(amount) }),\n };\n};\n"],
5
- "mappings": "AAAA,OAAS,gBAAAA,GAAc,cAAAC,GAAY,cAAAC,OAAkB,iBAU9C,IAAMC,GAAoB,CAAC,CAChC,MAAAC,EACA,WAAYC,CACd,IAA4B,CAC1B,IAAMC,EAAaN,GAAaK,CAAkB,EAElD,MAAO,CACL,MAAAD,EACA,GAAIH,GAAWK,CAAU,EAAI,CAAE,WAAAA,CAAW,EAAI,CAAC,CACjD,CACF,EAQaC,GAAkB,CAAC,CAC9B,MAAAH,EACA,WAAAE,CACF,KAA6B,CAC3B,MAAAF,EACA,WAAYF,GAAWI,CAAU,CACnC,GClCA,OAAS,aAAAE,GAAW,cAAAC,MAAkB,iBAmB/B,IAAMC,GAAgB,CAAC,CAC5B,gBAAAC,EACA,IAAAC,EACA,gBAAAC,EACA,KAAAC,EACA,GAAGC,CACL,KAAoC,CAClC,GAAGA,EACH,IAAKN,EAAWG,CAAG,EACnB,KAAMH,EAAWK,CAAI,EACrB,gBAAiBL,EAAWE,CAAe,EAC3C,gBAAiBF,EAAWI,CAAe,CAC7C,GAEaG,GAAqB,CAAC,CACjC,mBAAAC,EACA,IAAAL,EACA,gBAAAC,EACA,KAAAC,EACA,GAAGC,CACL,KAA6C,CAC3C,GAAGA,EACH,IAAKN,EAAWG,CAAG,EACnB,KAAMH,EAAWK,CAAI,EACrB,mBAAoBL,EAAWQ,CAAkB,EACjD,gBAAiBR,EAAWI,CAAe,CAC7C,GAEaK,GAAgB,CAAC,CAC5B,IAA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CAAG,EAC1D,MACF,qBACEF,EAAM,CACJ,GAAGA,EACH,GAAI,QAASE,GAAS,CAAE,SAAU,OAAOA,EAAM,GAAG,CAAE,CACtD,EACA,MACF,iBACEF,EAAM,CAAE,GAAGA,EAAK,GAAI,SAAUE,GAAS,CAAE,KAAMA,EAAM,IAAK,CAAG,CACjE,CAEA,OAAOF,CACT,EACA,CAAC,CACH,EAUA,IAPEG,GAEAC,EAAWD,EAAI,MAAM,GACrBC,EAAWD,EAAI,IAAI,GACnBC,EAAWD,EAAI,GAAG,GAClBC,EAAWD,EAAI,QAAQ,GAEAJ,CAAY,EAIrC,OAAOA,CACT,EChKA,OAAS,aAAAM,GAAW,cAAAC,OAAkB,iBAyB/B,IAAMC,GACXC,GACuE,CACvE,IAAMC,EACJ,+EAEIC,EAAQF,EAAK,MAAMC,CAAK,EAC9B,GAAIJ,GAAUK,CAAK,EACjB,OAGF,GAAM,CAACC,EAAGC,EAAOC,EAAYC,CAAM,EAAIJ,EAEvC,MAAO,CACL,MAAAE,EACA,WAAAC,EACA,GAAIP,GAAWQ,CAAM,GACnB,CAAC,MAAM,WAAWA,CAAM,CAAC,GAAK,CAAE,OAAQ,WAAWA,CAAM,CAAE,CAC/D,CACF",
6
- "names": ["fromNullable", "nonNullish", "toNullable", "fromCandidAccount", "owner", "nullableSubaccount", "subaccount", "toCandidAccount", "isNullish", "toNullable", "toTransferArg", "from_subaccount", "fee", "created_at_time", "memo", "rest", "toTransferFromArgs", "spender_subaccount", "toApproveArgs", "expected_allowance", "expires_at", "toIcrc21ConsentMessageArgs", "utcOffsetMinutes", "language", "deriveSpec", "IndexError", "IcrcTransferError", "msg", "errorType", "GenericError", "message", "error_code", "ConsentMessageError", "InsufficientPaymentError", "UnsupportedCanisterCallError", "ConsentMessageUnavailableError", "mapIcrc21ConsentMessageError", "rawError", "IndexPrincipalNotSetError", "mapIcrc106GetIndexPrincipalError", "err", "createServices", "idlFactory", "IDL", "Value", "UpgradeArg", "InitArg", "IndexArg", "BlockIndex", "SubAccount", "Account", "GetAccountTransactionsArgs", "Tokens", "Burn", "Mint", "Approve", "Transfer", "Transaction", "TransactionWithId", "GetTransactions", "GetTransactionsErr", "GetTransactionsResult", "GetBlocksRequest", "Map", "Block", "GetBlocksResponse", "FeeCollectorRanges", "ListSubaccountsArgs", "Status", "idlFactory", "IDL", "Value", "UpgradeArg", "InitArg", "IndexArg", "BlockIndex", "SubAccount", "Account", "GetAccountTransactionsArgs", "Tokens", "Burn", "Mint", "Approve", "Transfer", "Transaction", "TransactionWithId", "GetTransactions", "GetTransactionsErr", "GetTransactionsResult", "GetBlocksRequest", "Map", "Block", "GetBlocksResponse", "FeeCollectorRanges", "ListSubaccountsArgs", "Status", "Canister", "toNullable", "IcrcCanister", "params", "toNullable", "toGetTransactionsArgs", "account", "max_results", "start", "toCandidAccount", "toNullable", "toListSubaccountsParams", "owner", "IcrcIndexNgCanister", "_IcrcIndexNgCanister", "IcrcCanister", "options", "service", "certifiedService", "canisterId", "createServices", "idlFactory", "certified", "rest", "response", "toGetTransactionsArgs", "IndexError", "params", "ledger_id", "toListSubaccountsParams", "Canister", "createServices", "idlFactory", "IDL", "InitArgs", "TxId", "Account", "GetAccountTransactionsArgs", "Burn", "Mint", "Approve", "Transfer", "Transaction", "TransactionWithId", "GetTransactions", "GetTransactionsErr", "GetTransactionsResult", "SubAccount", "ListSubaccountsArgs", "idlFactory", "IDL", "InitArgs", "TxId", "Account", "GetAccountTransactionsArgs", "Burn", "Mint", "Approve", "Transfer", "Transaction", "TransactionWithId", "GetTransactions", "GetTransactionsErr", "GetTransactionsResult", "SubAccount", "ListSubaccountsArgs", "IcrcIndexCanister", "_IcrcIndexCanister", "Canister", "options", "service", "certifiedService", "canisterId", "createServices", "idlFactory", "params", "response", "toGetTransactionsArgs", "IndexError", "ledger_id", "Canister", "createServices", "toNullable", "idlFactory", "IDL", "GetBlocksResult", "ICRC3Value", "Value", "ChangeArchiveOptions", "MetadataValue", "Subaccount", "Account", "ChangeFeeCollector", "FeatureFlags", "UpgradeArgs", "InitArgs", "LedgerArg", "BlockIndex", "ArchiveInfo", "GetBlocksArgs", "Map", "Block", "BlockRange", "QueryBlockArchiveFn", "GetBlocksResponse", "DataCertificate", "TxIndex", "GetTransactionsRequest", "Timestamp", "Burn", "Mint", "Approve", "Transfer", "Transaction", "TransactionRange", "QueryArchiveFn", "GetTransactionsResponse", "GetAllowancesArgs", "Allowance103", "GetAllowancesError", "icrc103_get_allowances_response", "GetIndexPrincipalError", "GetIndexPrincipalResult", "Tokens", "StandardRecord", "TransferArg", "TransferError", "TransferResult", "icrc21_consent_message_metadata", "icrc21_consent_message_spec", "icrc21_consent_message_request", "Icrc21Value", "FieldsDisplay", "icrc21_consent_message", "icrc21_consent_info", "icrc21_error_info", "icrc21_error", "icrc21_consent_message_response", "AllowanceArgs", "Allowance", "ApproveArgs", "ApproveError", "ApproveResult", "TransferFromArgs", "TransferFromError", "TransferFromResult", "GetArchivesArgs", "GetArchivesResult", "ICRC3DataCertificate", "idlFactory", "IDL", "GetBlocksResult", "ICRC3Value", "Value", "ChangeArchiveOptions", "MetadataValue", "Subaccount", "Account", "ChangeFeeCollector", "FeatureFlags", "UpgradeArgs", "InitArgs", "LedgerArg", "BlockIndex", "ArchiveInfo", "GetBlocksArgs", "Map", "Block", "BlockRange", "QueryBlockArchiveFn", "GetBlocksResponse", "DataCertificate", "TxIndex", "GetTransactionsRequest", "Timestamp", "Burn", "Mint", "Approve", "Transfer", "Transaction", "TransactionRange", "QueryArchiveFn", "GetTransactionsResponse", "GetAllowancesArgs", "Allowance103", "GetAllowancesError", "icrc103_get_allowances_response", "GetIndexPrincipalError", "GetIndexPrincipalResult", "Tokens", "StandardRecord", "TransferArg", "TransferError", "TransferResult", "icrc21_consent_message_metadata", "icrc21_consent_message_spec", "icrc21_consent_message_request", "Icrc21Value", "FieldsDisplay", "icrc21_consent_message", "icrc21_consent_info", "icrc21_error_info", "icrc21_error", "icrc21_consent_message_response", "AllowanceArgs", "Allowance", "ApproveArgs", "ApproveError", "ApproveResult", "TransferFromArgs", "TransferFromError", "TransferFromResult", "GetArchivesArgs", "GetArchivesResult", "ICRC3DataCertificate", "IcrcLedgerCanister", "_IcrcLedgerCanister", "Canister", "options", "service", "certifiedService", "canisterId", "createServices", "idlFactory", "params", "toNullable", "response", "toTransferArg", "IcrcTransferError", "toTransferFromArgs", "toApproveArgs", "certified", "rest", "icrc21_canister_call_consent_message", "toIcrc21ConsentMessageArgs", "mapIcrc21ConsentMessageError", "icrc106_get_index_principal", "mapIcrc106GetIndexPrincipalError", "IcrcMetadataResponseEntries", "bigEndianCrc32", "encodeBase32", "hexStringToUint8Array", "isNullish", "nonNullish", "notEmptyString", "uint8ArrayToHexString", "Principal", "MAX_SUBACCOUNT_HEX_LENGTH", "encodeIcrcAccount", "owner", "subaccount", "isNullish", "subaccountText", "text", "uint8ArrayToHexString", "encodeCrc", "crc", "bigEndianCrc32", "encodeBase32", "decodeIcrcAccount", "accountString", "principalAndMaybeCheckSum", "subaccountHex", "unexpected", "notEmptyString", "Principal", "checksum", "rest", "principalText", "account", "hexStringToUint8Array", "mapTokenMetadata", "response", "nullishToken", "acc", "key", "value", "arg", "nonNullish", "isNullish", "nonNullish", "decodePayment", "code", "regex", "match", "_", "token", "identifier", "amount"]
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["import type {\n IcrcIndexDid,\n IcrcLedgerDid,\n} from \"@icp-sdk/canisters/ledger/icrc\";\n\nexport type Icrc3Value = IcrcLedgerDid.ICRC3Value;\nexport type IcrcAllowance = IcrcLedgerDid.Allowance;\nexport type IcrcApproveError = IcrcLedgerDid.ApproveError;\nexport type IcrcBlockIndex = IcrcLedgerDid.BlockIndex;\nexport type IcrcCandidAccount = IcrcLedgerDid.Account;\nexport type IcrcGetBlocksArgs = IcrcLedgerDid.GetBlocksArgs;\nexport type IcrcGetBlocksResult = IcrcLedgerDid.GetBlocksResult;\nexport type IcrcStandardRecord = IcrcLedgerDid.StandardRecord;\nexport type IcrcSubaccount = IcrcLedgerDid.Subaccount;\nexport type IcrcTimestamp = IcrcLedgerDid.Timestamp;\nexport type IcrcTokens = IcrcLedgerDid.Tokens;\nexport type IcrcTransferArg = IcrcLedgerDid.TransferArg;\nexport type IcrcTransferFromError = IcrcLedgerDid.TransferFromError;\nexport type IcrcTransferVariantError = IcrcLedgerDid.TransferError;\nexport type IcrcValue = IcrcLedgerDid.Value;\n\nexport type IcrcIndexNgGetTransactions = IcrcIndexDid.GetTransactions;\nexport type IcrcIndexNgTransaction = IcrcIndexDid.Transaction;\nexport type IcrcIndexNgTransactionWithId = IcrcIndexDid.TransactionWithId;\nexport type IcrcNgStatus = IcrcIndexDid.Status;\nexport type IcrcNgTxId = IcrcIndexDid.BlockIndex;\n\n/**\n * @deprecated Use \"@icp-sdk/canisters/ledger/icrc\" directly instead\n */\nexport * from \"@icp-sdk/canisters/ledger/icrc\";\n"],
5
+ "mappings": "AA8BA,WAAc",
6
+ "names": []
7
7
  }
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  import { createRequire as topLevelCreateRequire } from 'module';
2
2
  const require = topLevelCreateRequire(import.meta.url);
3
- import{fromNullable as Ze,nonNullish as Xe,toNullable as Ye}from"@dfinity/utils";var _t=({owner:e,subaccount:t})=>{let c=Ze(t);return{owner:e,...Xe(c)?{subaccount:c}:{}}},ke=({owner:e,subaccount:t})=>({owner:e,subaccount:Ye(t)});import{isNullish as je,toNullable as m}from"@dfinity/utils";var he=({from_subaccount:e,fee:t,created_at_time:c,memo:r,...i})=>({...i,fee:m(t),memo:m(r),from_subaccount:m(e),created_at_time:m(c)}),Fe=({spender_subaccount:e,fee:t,created_at_time:c,memo:r,...i})=>({...i,fee:m(t),memo:m(r),spender_subaccount:m(e),created_at_time:m(c)}),Pe=({fee:e,created_at_time:t,memo:c,from_subaccount:r,expected_allowance:i,expires_at:n,...d})=>({...d,fee:m(e),memo:m(c),from_subaccount:m(r),created_at_time:m(t),expected_allowance:m(i),expires_at:m(n)}),ve=({userPreferences:{metadata:{utcOffsetMinutes:e,language:t},deriveSpec:c},...r})=>({...r,user_preferences:{metadata:{language:t,utc_offset_minutes:m(e)},device_spec:je(c)?m():m("GenericDisplay"in c?{GenericDisplay:null}:{FieldsDisplay:null})}});var P=class extends Error{};var v=class extends Error{errorType;constructor({msg:t,errorType:c}){super(t),this.errorType=c}},w=class extends Error{constructor(c,r){super();this.message=c;this.error_code=r}},G=class extends Error{},xe=class extends G{},Te=class extends G{},Re=class extends G{},Ge=e=>"GenericError"in e?new w(e.GenericError.description,e.GenericError.error_code):"InsufficientPayment"in e?new xe(e.InsufficientPayment.description):"UnsupportedCanisterCall"in e?new Te(e.UnsupportedCanisterCall.description):"ConsentMessageUnavailable"in e?new Re(e.ConsentMessageUnavailable.description):new G(`Unknown error type ${JSON.stringify(e)}`),ye=class extends Error{},Se=e=>"IndexPrincipalNotSet"in e?new ye("Index principal is not set for this ledger canister."):new w(e.GenericError.description,e.GenericError.error_code);import{createServices as Ie}from"@dfinity/utils";var Ee=({IDL:e})=>{let t=e.Rec(),c=e.Record({ledger_id:e.Opt(e.Principal),retrieve_blocks_from_ledger_interval_seconds:e.Opt(e.Nat64)}),r=e.Record({ledger_id:e.Principal,retrieve_blocks_from_ledger_interval_seconds:e.Opt(e.Nat64)}),i=e.Variant({Upgrade:c,Init:r}),n=e.Nat,d=e.Vec(e.Nat8),a=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),g=e.Record({max_results:e.Nat,start:e.Opt(n),account:a}),p=e.Nat,f=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,spender:e.Opt(a)}),N=e.Record({to:a,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p}),x=e.Record({fee:e.Opt(p),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,expected_allowance:e.Opt(p),expires_at:e.Opt(e.Nat64),spender:a}),s=e.Record({to:a,fee:e.Opt(p),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,spender:e.Opt(a)}),u=e.Record({burn:e.Opt(f),kind:e.Text,mint:e.Opt(N),approve:e.Opt(x),timestamp:e.Nat64,transfer:e.Opt(s)}),_=e.Record({id:n,transaction:u}),y=e.Record({balance:p,transactions:e.Vec(_),oldest_tx_id:e.Opt(n)}),T=e.Record({message:e.Text}),V=e.Variant({Ok:y,Err:T}),b=e.Record({start:e.Nat,length:e.Nat}),A=e.Vec(e.Tuple(e.Text,t));t.fill(e.Variant({Int:e.Int,Map:A,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(t)}));let k=t,O=e.Record({blocks:e.Vec(k),chain_length:e.Nat64}),R=e.Record({ranges:e.Vec(e.Tuple(a,e.Vec(e.Tuple(n,n))))}),o=e.Record({owner:e.Principal,start:e.Opt(d)}),h=e.Record({num_blocks_synced:n});return e.Service({get_account_transactions:e.Func([g],[V],[]),get_blocks:e.Func([b],[O],[]),get_fee_collectors_ranges:e.Func([],[R],[]),icrc1_balance_of:e.Func([a],[p],[]),ledger_id:e.Func([],[e.Principal],[]),list_subaccounts:e.Func([o],[e.Vec(d)],[]),status:e.Func([],[h],["query"])})};var we=({IDL:e})=>{let t=e.Rec(),c=e.Record({ledger_id:e.Opt(e.Principal),retrieve_blocks_from_ledger_interval_seconds:e.Opt(e.Nat64)}),r=e.Record({ledger_id:e.Principal,retrieve_blocks_from_ledger_interval_seconds:e.Opt(e.Nat64)}),i=e.Variant({Upgrade:c,Init:r}),n=e.Nat,d=e.Vec(e.Nat8),a=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),g=e.Record({max_results:e.Nat,start:e.Opt(n),account:a}),p=e.Nat,f=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,spender:e.Opt(a)}),N=e.Record({to:a,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p}),x=e.Record({fee:e.Opt(p),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,expected_allowance:e.Opt(p),expires_at:e.Opt(e.Nat64),spender:a}),s=e.Record({to:a,fee:e.Opt(p),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,spender:e.Opt(a)}),u=e.Record({burn:e.Opt(f),kind:e.Text,mint:e.Opt(N),approve:e.Opt(x),timestamp:e.Nat64,transfer:e.Opt(s)}),_=e.Record({id:n,transaction:u}),y=e.Record({balance:p,transactions:e.Vec(_),oldest_tx_id:e.Opt(n)}),T=e.Record({message:e.Text}),V=e.Variant({Ok:y,Err:T}),b=e.Record({start:e.Nat,length:e.Nat}),A=e.Vec(e.Tuple(e.Text,t));t.fill(e.Variant({Int:e.Int,Map:A,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(t)}));let k=t,O=e.Record({blocks:e.Vec(k),chain_length:e.Nat64}),R=e.Record({ranges:e.Vec(e.Tuple(a,e.Vec(e.Tuple(n,n))))}),o=e.Record({owner:e.Principal,start:e.Opt(d)}),h=e.Record({num_blocks_synced:n});return e.Service({get_account_transactions:e.Func([g],[V],["query"]),get_blocks:e.Func([b],[O],["query"]),get_fee_collectors_ranges:e.Func([],[R],["query"]),icrc1_balance_of:e.Func([a],[p],["query"]),ledger_id:e.Func([],[e.Principal],["query"]),list_subaccounts:e.Func([o],[e.Vec(d)],["query"]),status:e.Func([],[h],["query"])})};import{Canister as Je,toNullable as Ke}from"@dfinity/utils";var B=class extends Je{balance=t=>this.caller({certified:t.certified}).icrc1_balance_of({owner:t.owner,subaccount:Ke(t.subaccount)})};import{toNullable as Be}from"@dfinity/utils";var C=({account:e,max_results:t,start:c})=>({account:ke(e),max_results:t,start:Be(c)}),Ce=({owner:e,start:t})=>({owner:e,start:Be(t)});var Ve=class e extends B{static create(t){let{service:c,certifiedService:r,canisterId:i}=Ie({options:t,idlFactory:we,certifiedIdlFactory:Ee});return new e(i,c,r)}getTransactions=async({certified:t,...c})=>{let r=await this.caller({certified:t}).get_account_transactions(C(c));if("Err"in r)throw new P(r.Err.message);return r.Ok};ledgerId=t=>{let{ledger_id:c}=this.caller(t);return c()};status=t=>this.caller(t).status();listSubaccounts=({certified:t,...c})=>this.caller({certified:t}).list_subaccounts(Ce(c))};import{Canister as Le,createServices as De}from"@dfinity/utils";var Me=({IDL:e})=>{let t=e.Record({ledger_id:e.Principal}),c=e.Nat,r=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),i=e.Record({max_results:e.Nat,start:e.Opt(c),account:r}),n=e.Record({from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,spender:e.Opt(r)}),d=e.Record({to:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat}),a=e.Record({fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(e.Nat64),spender:r}),g=e.Record({to:r,fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,spender:e.Opt(r)}),p=e.Record({burn:e.Opt(n),kind:e.Text,mint:e.Opt(d),approve:e.Opt(a),timestamp:e.Nat64,transfer:e.Opt(g)}),f=e.Record({id:c,transaction:p}),N=e.Record({transactions:e.Vec(f),oldest_tx_id:e.Opt(c)}),x=e.Record({message:e.Text}),s=e.Variant({Ok:N,Err:x}),u=e.Vec(e.Nat8),_=e.Record({owner:e.Principal,start:e.Opt(u)});return e.Service({get_account_transactions:e.Func([i],[s],[]),ledger_id:e.Func([],[e.Principal],[]),list_subaccounts:e.Func([_],[e.Vec(u)],[])})};var qe=({IDL:e})=>{let t=e.Record({ledger_id:e.Principal}),c=e.Nat,r=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),i=e.Record({max_results:e.Nat,start:e.Opt(c),account:r}),n=e.Record({from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,spender:e.Opt(r)}),d=e.Record({to:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat}),a=e.Record({fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(e.Nat64),spender:r}),g=e.Record({to:r,fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,spender:e.Opt(r)}),p=e.Record({burn:e.Opt(n),kind:e.Text,mint:e.Opt(d),approve:e.Opt(a),timestamp:e.Nat64,transfer:e.Opt(g)}),f=e.Record({id:c,transaction:p}),N=e.Record({transactions:e.Vec(f),oldest_tx_id:e.Opt(c)}),x=e.Record({message:e.Text}),s=e.Variant({Ok:N,Err:x}),u=e.Vec(e.Nat8),_=e.Record({owner:e.Principal,start:e.Opt(u)});return e.Service({get_account_transactions:e.Func([i],[s],[]),ledger_id:e.Func([],[e.Principal],["query"]),list_subaccounts:e.Func([_],[e.Vec(u)],["query"])})};var be=class e extends Le{static create(t){let{service:c,certifiedService:r,canisterId:i}=De({options:t,idlFactory:qe,certifiedIdlFactory:Me});return new e(i,c,r)}getTransactions=async t=>{let c=await this.caller({certified:!0}).get_account_transactions(C(t));if("Err"in c)throw new P(c.Err.message);return c.Ok};ledgerId=t=>{let{ledger_id:c}=this.caller(t);return c()}};import{Canister as et,createServices as tt,toNullable as rt}from"@dfinity/utils";var Ue=({IDL:e})=>{let t=e.Rec(),c=e.Rec(),r=e.Rec(),i=e.Record({num_blocks_to_archive:e.Opt(e.Nat64),max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Opt(e.Nat64),more_controller_ids:e.Opt(e.Vec(e.Principal)),max_message_size_bytes:e.Opt(e.Nat64),cycles_for_archive_creation:e.Opt(e.Nat64),node_max_memory_size_bytes:e.Opt(e.Nat64),controller_id:e.Opt(e.Principal)}),n=e.Variant({Int:e.Int,Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text}),d=e.Vec(e.Nat8),a=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),g=e.Variant({SetTo:a,Unset:e.Null}),p=e.Record({icrc2:e.Bool}),f=e.Record({change_archive_options:e.Opt(i),token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat),metadata:e.Opt(e.Vec(e.Tuple(e.Text,n))),change_fee_collector:e.Opt(g),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Opt(e.Text),feature_flags:e.Opt(p)}),N=e.Record({decimals:e.Opt(e.Nat8),token_symbol:e.Text,transfer_fee:e.Nat,metadata:e.Vec(e.Tuple(e.Text,n)),minting_account:a,initial_balances:e.Vec(e.Tuple(a,e.Nat)),fee_collector_account:e.Opt(a),archive_options:e.Record({num_blocks_to_archive:e.Nat64,max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Nat64,more_controller_ids:e.Opt(e.Vec(e.Principal)),max_message_size_bytes:e.Opt(e.Nat64),cycles_for_archive_creation:e.Opt(e.Nat64),node_max_memory_size_bytes:e.Opt(e.Nat64),controller_id:e.Principal}),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Text,feature_flags:e.Opt(p)}),x=e.Variant({Upgrade:e.Opt(f),Init:N}),s=e.Nat,u=e.Record({block_range_end:s,canister_id:e.Principal,block_range_start:s}),_=e.Record({start:s,length:e.Nat}),y=e.Vec(e.Tuple(e.Text,r));r.fill(e.Variant({Int:e.Int,Map:y,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(r)}));let T=r,V=e.Record({blocks:e.Vec(T)}),b=e.Func([_],[V],[]),A=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),first_index:s,blocks:e.Vec(T),chain_length:e.Nat64,archived_blocks:e.Vec(e.Record({callback:b,start:s,length:e.Nat}))}),k=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),hash_tree:e.Vec(e.Nat8)}),O=e.Nat,R=e.Record({start:O,length:e.Nat}),o=e.Nat64,h=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,spender:e.Opt(a)}),q=e.Record({to:a,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat}),U=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(o),spender:a}),z=e.Record({to:a,fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,spender:e.Opt(a)}),S=e.Record({burn:e.Opt(h),kind:e.Text,mint:e.Opt(q),approve:e.Opt(U),timestamp:o,transfer:e.Opt(z)}),Q=e.Record({transactions:e.Vec(S)}),$=e.Func([R],[Q],[]),H=e.Record({first_index:O,log_length:e.Nat,transactions:e.Vec(S),archived_transactions:e.Vec(e.Record({callback:$,start:O,length:e.Nat}))}),W=e.Record({take:e.Opt(e.Nat),prev_spender:e.Opt(a),from_account:e.Opt(a)}),Z=e.Record({from_account:a,to_spender:a,allowance:e.Nat,expires_at:e.Opt(e.Nat64)}),X=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),AccessDenied:e.Record({reason:e.Text})}),Y=e.Variant({Ok:e.Vec(Z),Err:X}),j=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),IndexPrincipalNotSet:e.Null}),J=e.Variant({Ok:e.Principal,Err:j}),l=e.Nat,K=e.Record({url:e.Text,name:e.Text}),I=e.Record({to:a,fee:e.Opt(l),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(d),created_at_time:e.Opt(o),amount:l}),L=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:l}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:l}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,InsufficientFunds:e.Record({balance:l})}),D=e.Variant({Ok:s,Err:L}),E=e.Record({utc_offset_minutes:e.Opt(e.Int16),language:e.Text}),ee=e.Record({metadata:E,device_spec:e.Opt(e.Variant({GenericDisplay:e.Null,FieldsDisplay:e.Null}))}),te=e.Record({arg:e.Vec(e.Nat8),method:e.Text,user_preferences:ee}),re=e.Variant({Text:e.Record({content:e.Text}),TokenAmount:e.Record({decimals:e.Nat8,amount:e.Nat64,symbol:e.Text}),TimestampSeconds:e.Record({amount:e.Nat64}),DurationSeconds:e.Record({amount:e.Nat64})}),ce=e.Record({fields:e.Vec(e.Tuple(e.Text,re)),intent:e.Text}),ae=e.Variant({FieldsDisplayMessage:ce,GenericDisplayMessage:e.Text}),ne=e.Record({metadata:E,consent_message:ae}),F=e.Record({description:e.Text}),oe=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),InsufficientPayment:F,UnsupportedCanisterCall:F,ConsentMessageUnavailable:F}),se=e.Variant({Ok:ne,Err:oe}),ie=e.Record({account:a,spender:a}),pe=e.Record({allowance:e.Nat,expires_at:e.Opt(o)}),le=e.Record({fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(o),spender:a}),de=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:e.Nat}),AllowanceChanged:e.Record({current_allowance:e.Nat}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,Expired:e.Record({ledger_time:o}),InsufficientFunds:e.Record({balance:e.Nat})}),_e=e.Variant({Ok:s,Err:de}),me=e.Record({to:a,fee:e.Opt(l),spender_subaccount:e.Opt(d),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:l}),ue=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,InsufficientAllowance:e.Record({allowance:l}),BadBurn:e.Record({min_burn_amount:l}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:l}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,InsufficientFunds:e.Record({balance:l})}),ge=e.Variant({Ok:s,Err:ue}),fe=e.Record({from:e.Opt(e.Principal)}),Ne=e.Vec(e.Record({end:e.Nat,canister_id:e.Principal,start:e.Nat}));c.fill(e.Variant({Int:e.Int,Map:e.Vec(e.Tuple(e.Text,c)),Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(c)})),t.fill(e.Record({log_length:e.Nat,blocks:e.Vec(e.Record({id:e.Nat,block:c})),archived_blocks:e.Vec(e.Record({args:e.Vec(_),callback:e.Func([e.Vec(_)],[t],["query"])}))}));let Oe=e.Record({certificate:e.Vec(e.Nat8),hash_tree:e.Vec(e.Nat8)});return e.Service({archives:e.Func([],[e.Vec(u)],[]),get_blocks:e.Func([_],[A],[]),get_data_certificate:e.Func([],[k],[]),get_transactions:e.Func([R],[H],[]),icrc103_get_allowances:e.Func([W],[Y],[]),icrc106_get_index_principal:e.Func([],[J],[]),icrc10_supported_standards:e.Func([],[e.Vec(e.Record({url:e.Text,name:e.Text}))],[]),icrc1_balance_of:e.Func([a],[l],[]),icrc1_decimals:e.Func([],[e.Nat8],[]),icrc1_fee:e.Func([],[l],[]),icrc1_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,n))],[]),icrc1_minting_account:e.Func([],[e.Opt(a)],[]),icrc1_name:e.Func([],[e.Text],[]),icrc1_supported_standards:e.Func([],[e.Vec(K)],[]),icrc1_symbol:e.Func([],[e.Text],[]),icrc1_total_supply:e.Func([],[l],[]),icrc1_transfer:e.Func([I],[D],[]),icrc21_canister_call_consent_message:e.Func([te],[se],[]),icrc2_allowance:e.Func([ie],[pe],[]),icrc2_approve:e.Func([le],[_e],[]),icrc2_transfer_from:e.Func([me],[ge],[]),icrc3_get_archives:e.Func([fe],[Ne],[]),icrc3_get_blocks:e.Func([e.Vec(_)],[t],[]),icrc3_get_tip_certificate:e.Func([],[e.Opt(Oe)],[]),icrc3_supported_block_types:e.Func([],[e.Vec(e.Record({url:e.Text,block_type:e.Text}))],[]),is_ledger_ready:e.Func([],[e.Bool],["query"])})};var ze=({IDL:e})=>{let t=e.Rec(),c=e.Rec(),r=e.Rec(),i=e.Record({num_blocks_to_archive:e.Opt(e.Nat64),max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Opt(e.Nat64),more_controller_ids:e.Opt(e.Vec(e.Principal)),max_message_size_bytes:e.Opt(e.Nat64),cycles_for_archive_creation:e.Opt(e.Nat64),node_max_memory_size_bytes:e.Opt(e.Nat64),controller_id:e.Opt(e.Principal)}),n=e.Variant({Int:e.Int,Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text}),d=e.Vec(e.Nat8),a=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),g=e.Variant({SetTo:a,Unset:e.Null}),p=e.Record({icrc2:e.Bool}),f=e.Record({change_archive_options:e.Opt(i),token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat),metadata:e.Opt(e.Vec(e.Tuple(e.Text,n))),change_fee_collector:e.Opt(g),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Opt(e.Text),feature_flags:e.Opt(p)}),N=e.Record({decimals:e.Opt(e.Nat8),token_symbol:e.Text,transfer_fee:e.Nat,metadata:e.Vec(e.Tuple(e.Text,n)),minting_account:a,initial_balances:e.Vec(e.Tuple(a,e.Nat)),fee_collector_account:e.Opt(a),archive_options:e.Record({num_blocks_to_archive:e.Nat64,max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Nat64,more_controller_ids:e.Opt(e.Vec(e.Principal)),max_message_size_bytes:e.Opt(e.Nat64),cycles_for_archive_creation:e.Opt(e.Nat64),node_max_memory_size_bytes:e.Opt(e.Nat64),controller_id:e.Principal}),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Text,feature_flags:e.Opt(p)}),x=e.Variant({Upgrade:e.Opt(f),Init:N}),s=e.Nat,u=e.Record({block_range_end:s,canister_id:e.Principal,block_range_start:s}),_=e.Record({start:s,length:e.Nat}),y=e.Vec(e.Tuple(e.Text,r));r.fill(e.Variant({Int:e.Int,Map:y,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(r)}));let T=r,V=e.Record({blocks:e.Vec(T)}),b=e.Func([_],[V],["query"]),A=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),first_index:s,blocks:e.Vec(T),chain_length:e.Nat64,archived_blocks:e.Vec(e.Record({callback:b,start:s,length:e.Nat}))}),k=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),hash_tree:e.Vec(e.Nat8)}),O=e.Nat,R=e.Record({start:O,length:e.Nat}),o=e.Nat64,h=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,spender:e.Opt(a)}),q=e.Record({to:a,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat}),U=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(o),spender:a}),z=e.Record({to:a,fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,spender:e.Opt(a)}),S=e.Record({burn:e.Opt(h),kind:e.Text,mint:e.Opt(q),approve:e.Opt(U),timestamp:o,transfer:e.Opt(z)}),Q=e.Record({transactions:e.Vec(S)}),$=e.Func([R],[Q],["query"]),H=e.Record({first_index:O,log_length:e.Nat,transactions:e.Vec(S),archived_transactions:e.Vec(e.Record({callback:$,start:O,length:e.Nat}))}),W=e.Record({take:e.Opt(e.Nat),prev_spender:e.Opt(a),from_account:e.Opt(a)}),Z=e.Record({from_account:a,to_spender:a,allowance:e.Nat,expires_at:e.Opt(e.Nat64)}),X=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),AccessDenied:e.Record({reason:e.Text})}),Y=e.Variant({Ok:e.Vec(Z),Err:X}),j=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),IndexPrincipalNotSet:e.Null}),J=e.Variant({Ok:e.Principal,Err:j}),l=e.Nat,K=e.Record({url:e.Text,name:e.Text}),I=e.Record({to:a,fee:e.Opt(l),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(d),created_at_time:e.Opt(o),amount:l}),L=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:l}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:l}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,InsufficientFunds:e.Record({balance:l})}),D=e.Variant({Ok:s,Err:L}),E=e.Record({utc_offset_minutes:e.Opt(e.Int16),language:e.Text}),ee=e.Record({metadata:E,device_spec:e.Opt(e.Variant({GenericDisplay:e.Null,FieldsDisplay:e.Null}))}),te=e.Record({arg:e.Vec(e.Nat8),method:e.Text,user_preferences:ee}),re=e.Variant({Text:e.Record({content:e.Text}),TokenAmount:e.Record({decimals:e.Nat8,amount:e.Nat64,symbol:e.Text}),TimestampSeconds:e.Record({amount:e.Nat64}),DurationSeconds:e.Record({amount:e.Nat64})}),ce=e.Record({fields:e.Vec(e.Tuple(e.Text,re)),intent:e.Text}),ae=e.Variant({FieldsDisplayMessage:ce,GenericDisplayMessage:e.Text}),ne=e.Record({metadata:E,consent_message:ae}),F=e.Record({description:e.Text}),oe=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),InsufficientPayment:F,UnsupportedCanisterCall:F,ConsentMessageUnavailable:F}),se=e.Variant({Ok:ne,Err:oe}),ie=e.Record({account:a,spender:a}),pe=e.Record({allowance:e.Nat,expires_at:e.Opt(o)}),le=e.Record({fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(o),spender:a}),de=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:e.Nat}),AllowanceChanged:e.Record({current_allowance:e.Nat}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,Expired:e.Record({ledger_time:o}),InsufficientFunds:e.Record({balance:e.Nat})}),_e=e.Variant({Ok:s,Err:de}),me=e.Record({to:a,fee:e.Opt(l),spender_subaccount:e.Opt(d),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:l}),ue=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,InsufficientAllowance:e.Record({allowance:l}),BadBurn:e.Record({min_burn_amount:l}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:l}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,InsufficientFunds:e.Record({balance:l})}),ge=e.Variant({Ok:s,Err:ue}),fe=e.Record({from:e.Opt(e.Principal)}),Ne=e.Vec(e.Record({end:e.Nat,canister_id:e.Principal,start:e.Nat}));c.fill(e.Variant({Int:e.Int,Map:e.Vec(e.Tuple(e.Text,c)),Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(c)})),t.fill(e.Record({log_length:e.Nat,blocks:e.Vec(e.Record({id:e.Nat,block:c})),archived_blocks:e.Vec(e.Record({args:e.Vec(_),callback:e.Func([e.Vec(_)],[t],["query"])}))}));let Oe=e.Record({certificate:e.Vec(e.Nat8),hash_tree:e.Vec(e.Nat8)});return e.Service({archives:e.Func([],[e.Vec(u)],["query"]),get_blocks:e.Func([_],[A],["query"]),get_data_certificate:e.Func([],[k],["query"]),get_transactions:e.Func([R],[H],["query"]),icrc103_get_allowances:e.Func([W],[Y],["query"]),icrc106_get_index_principal:e.Func([],[J],["query"]),icrc10_supported_standards:e.Func([],[e.Vec(e.Record({url:e.Text,name:e.Text}))],["query"]),icrc1_balance_of:e.Func([a],[l],["query"]),icrc1_decimals:e.Func([],[e.Nat8],["query"]),icrc1_fee:e.Func([],[l],["query"]),icrc1_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,n))],["query"]),icrc1_minting_account:e.Func([],[e.Opt(a)],["query"]),icrc1_name:e.Func([],[e.Text],["query"]),icrc1_supported_standards:e.Func([],[e.Vec(K)],["query"]),icrc1_symbol:e.Func([],[e.Text],["query"]),icrc1_total_supply:e.Func([],[l],["query"]),icrc1_transfer:e.Func([I],[D],[]),icrc21_canister_call_consent_message:e.Func([te],[se],[]),icrc2_allowance:e.Func([ie],[pe],["query"]),icrc2_approve:e.Func([le],[_e],[]),icrc2_transfer_from:e.Func([me],[ge],[]),icrc3_get_archives:e.Func([fe],[Ne],["query"]),icrc3_get_blocks:e.Func([e.Vec(_)],[t],["query"]),icrc3_get_tip_certificate:e.Func([],[e.Opt(Oe)],["query"]),icrc3_supported_block_types:e.Func([],[e.Vec(e.Record({url:e.Text,block_type:e.Text}))],["query"]),is_ledger_ready:e.Func([],[e.Bool],["query"])})};var Ae=class e extends et{static create(t){let{service:c,certifiedService:r,canisterId:i}=tt({options:t,idlFactory:ze,certifiedIdlFactory:Ue});return new e(i,c,r)}metadata=t=>this.caller(t).icrc1_metadata();transactionFee=t=>this.caller(t).icrc1_fee();balance=t=>this.caller({certified:t.certified}).icrc1_balance_of({owner:t.owner,subaccount:rt(t.subaccount)});transfer=async t=>{let c=await this.caller({certified:!0}).icrc1_transfer(he(t));if("Err"in c)throw new v({errorType:c.Err,msg:"Failed to transfer"});return c.Ok};totalTokensSupply=t=>this.caller(t).icrc1_total_supply();transferFrom=async t=>{let c=await this.caller({certified:!0}).icrc2_transfer_from(Fe(t));if("Err"in c)throw new v({errorType:c.Err,msg:"Failed to transfer from"});return c.Ok};approve=async t=>{let c=await this.caller({certified:!0}).icrc2_approve(Pe(t));if("Err"in c)throw new v({errorType:c.Err,msg:"Failed to entitle the spender to transfer the amount"});return c.Ok};allowance=t=>{let{certified:c,...r}=t;return this.caller({certified:c}).icrc2_allowance({...r})};consentMessage=async t=>{let{icrc21_canister_call_consent_message:c}=this.caller({certified:!0}),r=await c(ve(t));if("Err"in r)throw Ge(r.Err);return r.Ok};getBlocks=t=>this.caller({certified:t.certified}).icrc3_get_blocks(t.args);getIndexPrincipal=async t=>{let{icrc106_get_index_principal:c}=this.caller(t),r=await c();if("Err"in r)throw Se(r.Err);return r.Ok};icrc1SupportedStandards=t=>this.caller(t).icrc1_supported_standards();icrc10SupportedStandards=t=>this.caller(t).icrc10_supported_standards();getMintingAccount=t=>this.caller(t).icrc1_minting_account()};var Qe=(n=>(n.SYMBOL="icrc1:symbol",n.NAME="icrc1:name",n.DECIMALS="icrc1:decimals",n.FEE="icrc1:fee",n.LOGO="icrc1:logo",n))(Qe||{});import{bigEndianCrc32 as ct,encodeBase32 as at,hexStringToUint8Array as nt,isNullish as He,nonNullish as M,notEmptyString as ot,uint8ArrayToHexString as st}from"@dfinity/utils";import{Principal as $e}from"@icp-sdk/core/principal";var it=64,Lt=({owner:e,subaccount:t})=>{if(He(t))return e.toText();let r=(i=>i.replace(/^0+/,""))(st(Uint8Array.from(t)));return r.length===0?e.toText():`${e.toText()}-${We({owner:e,subaccount:t})}.${r}`},We=({owner:e,subaccount:t})=>{let c=ct(Uint8Array.from([...e.toUint8Array(),...t]));return at(c)},Dt=e=>{let[t,c,...r]=e.split(".");if(!ot(t))throw new Error("Invalid account. No string provided.");if(r.length>0)throw new Error("Invalid account string format. Expected at most one '.' separator.");if(He(c))return{owner:$e.fromText(e)};let[i,...n]=t.split("-").reverse(),d=n.reverse().join("-"),a={owner:$e.fromText(d),subaccount:nt(c.padStart(it,"0"))};if(We(a)!==i)throw new Error("Invalid account. Invalid checksum.");return a},er=e=>{let t=e.reduce((r,[i,n])=>{switch(i){case"icrc1:symbol":r={...r,..."Text"in n&&{symbol:n.Text}};break;case"icrc1:name":r={...r,..."Text"in n&&{name:n.Text}};break;case"icrc1:fee":r={...r,..."Nat"in n&&{fee:n.Nat}};break;case"icrc1:decimals":r={...r,..."Nat"in n&&{decimals:Number(n.Nat)}};break;case"icrc1:logo":r={...r,..."Text"in n&&{icon:n.Text}}}return r},{});if((r=>M(r.symbol)&&M(r.name)&&M(r.fee)&&M(r.decimals))(t))return t};import{isNullish as pt,nonNullish as lt}from"@dfinity/utils";var cr=e=>{let t=/^([a-zA-Z]+):([A-Za-z0-9:\-.]+).*?(?:[?&](?:amount|value)=(\d+(?:\.\d+)?))?$/,c=e.match(t);if(pt(c))return;let[r,i,n,d]=c;return{token:i,identifier:n,...lt(d)&&!isNaN(parseFloat(d))&&{amount:parseFloat(d)}}};export{G as ConsentMessageError,Re as ConsentMessageUnavailableError,w as GenericError,be as IcrcIndexCanister,Ve as IcrcIndexNgCanister,Ae as IcrcLedgerCanister,Qe as IcrcMetadataResponseEntries,v as IcrcTransferError,P as IndexError,ye as IndexPrincipalNotSetError,xe as InsufficientPaymentError,Te as UnsupportedCanisterCallError,Dt as decodeIcrcAccount,cr as decodePayment,Lt as encodeIcrcAccount,_t as fromCandidAccount,Se as mapIcrc106GetIndexPrincipalError,Ge as mapIcrc21ConsentMessageError,er as mapTokenMetadata,Pe as toApproveArgs,ke as toCandidAccount,ve as toIcrc21ConsentMessageArgs,he as toTransferArg,Fe as toTransferFromArgs};
3
+ export*from"@icp-sdk/canisters/ledger/icrc";
4
4
  //# sourceMappingURL=index.mjs.map