@dfinity/ledger-icrc 4.0.4 → 4.1.1
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.
- package/README.md +30 -15
- package/dist/candid/icrc_index-ng.did +1 -1
- package/dist/candid/icrc_ledger.did +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/index.cjs.js.map +4 -4
- package/dist/esm/{chunk-62KIKAXV.js → chunk-BYKVMTGO.js} +2 -2
- package/dist/esm/{chunk-JYCAM7UJ.js → chunk-WTMDWX2C.js} +2 -2
- package/dist/esm/chunk-YO5OUZGG.js +2 -0
- package/dist/esm/chunk-YO5OUZGG.js.map +7 -0
- package/dist/esm/{chunk-22YW5TYY.js → chunk-ZMWODXAU.js} +2 -2
- package/dist/esm/chunk-ZMWODXAU.js.map +7 -0
- package/dist/esm/index-ng.canister.js +1 -1
- package/dist/esm/index.canister.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/ledger.canister.js +1 -1
- package/dist/types/converters/converters.d.ts +16 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/ledger.canister.d.ts +10 -2
- package/package.json +1 -1
- package/dist/esm/chunk-22YW5TYY.js.map +0 -7
- package/dist/esm/chunk-OJD6CVD7.js +0 -2
- package/dist/esm/chunk-OJD6CVD7.js.map +0 -7
- /package/dist/esm/{chunk-62KIKAXV.js.map → chunk-BYKVMTGO.js.map} +0 -0
- /package/dist/esm/{chunk-JYCAM7UJ.js.map → chunk-WTMDWX2C.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as _,e as R}from"./chunk-YO5OUZGG.js";import{Canister as T,createServices as A}from"@dfinity/utils";var f=({IDL:t})=>{let c=t.Record({ledger_id:t.Principal}),r=t.Nat,e=t.Record({owner:t.Principal,subaccount:t.Opt(t.Vec(t.Nat8))}),n=t.Record({max_results:t.Nat,start:t.Opt(r),account:e}),o=t.Record({from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat,spender:t.Opt(e)}),s=t.Record({to:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat}),i=t.Record({fee:t.Opt(t.Nat),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat,expected_allowance:t.Opt(t.Nat),expires_at:t.Opt(t.Nat64),spender:e}),p=t.Record({to:e,fee:t.Opt(t.Nat),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat,spender:t.Opt(e)}),d=t.Record({burn:t.Opt(o),kind:t.Text,mint:t.Opt(s),approve:t.Opt(i),timestamp:t.Nat64,transfer:t.Opt(p)}),m=t.Record({id:r,transaction:d}),u=t.Record({transactions:t.Vec(m),oldest_tx_id:t.Opt(r)}),O=t.Record({message:t.Text}),l=t.Variant({Ok:u,Err:O}),a=t.Vec(t.Nat8),N=t.Record({owner:t.Principal,start:t.Opt(a)});return t.Service({get_account_transactions:t.Func([n],[l],[]),ledger_id:t.Func([],[t.Principal],[]),list_subaccounts:t.Func([N],[t.Vec(a)],[])})};var g=({IDL:t})=>{let c=t.Record({ledger_id:t.Principal}),r=t.Nat,e=t.Record({owner:t.Principal,subaccount:t.Opt(t.Vec(t.Nat8))}),n=t.Record({max_results:t.Nat,start:t.Opt(r),account:e}),o=t.Record({from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat,spender:t.Opt(e)}),s=t.Record({to:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat}),i=t.Record({fee:t.Opt(t.Nat),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat,expected_allowance:t.Opt(t.Nat),expires_at:t.Opt(t.Nat64),spender:e}),p=t.Record({to:e,fee:t.Opt(t.Nat),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat,spender:t.Opt(e)}),d=t.Record({burn:t.Opt(o),kind:t.Text,mint:t.Opt(s),approve:t.Opt(i),timestamp:t.Nat64,transfer:t.Opt(p)}),m=t.Record({id:r,transaction:d}),u=t.Record({transactions:t.Vec(m),oldest_tx_id:t.Opt(r)}),O=t.Record({message:t.Text}),l=t.Variant({Ok:u,Err:O}),a=t.Vec(t.Nat8),N=t.Record({owner:t.Principal,start:t.Opt(a)});return t.Service({get_account_transactions:t.Func([n],[l],[]),ledger_id:t.Func([],[t.Principal],["query"]),list_subaccounts:t.Func([N],[t.Vec(a)],["query"])})};var x=class t extends T{static create(c){let{service:r,certifiedService:e,canisterId:n}=A({options:c,idlFactory:g,certifiedIdlFactory:f});return new t(n,r,e)}getTransactions=async c=>{let r=await this.caller({certified:!0}).get_account_transactions(_(c));if("Err"in r)throw new R(r.Err.message);return r.Ok};ledgerId=c=>{let{ledger_id:r}=this.caller(c);return r()}};export{x as a};
|
|
2
|
+
//# sourceMappingURL=chunk-BYKVMTGO.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as k}from"./chunk-F74MWPN7.js";import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as k}from"./chunk-F74MWPN7.js";import{c as v,d as P,e as S}from"./chunk-YO5OUZGG.js";import{createServices as B}from"@dfinity/utils";var F=({IDL:t})=>{let r=t.Rec(),a=t.Record({ledger_id:t.Opt(t.Principal),retrieve_blocks_from_ledger_interval_seconds:t.Opt(t.Nat64)}),o=t.Record({ledger_id:t.Principal,retrieve_blocks_from_ledger_interval_seconds:t.Opt(t.Nat64)}),i=t.Variant({Upgrade:a,Init:o}),n=t.Nat,s=t.Vec(t.Nat8),e=t.Record({owner:t.Principal,subaccount:t.Opt(s)}),d=t.Record({max_results:t.Nat,start:t.Opt(n),account:e}),c=t.Nat,p=t.Record({from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:c,spender:t.Opt(e)}),l=t.Record({to:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:c}),u=t.Record({fee:t.Opt(c),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:c,expected_allowance:t.Opt(c),expires_at:t.Opt(t.Nat64),spender:e}),_=t.Record({to:e,fee:t.Opt(c),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:c,spender:t.Opt(e)}),m=t.Record({burn:t.Opt(p),kind:t.Text,mint:t.Opt(l),approve:t.Opt(u),timestamp:t.Nat64,transfer:t.Opt(_)}),g=t.Record({id:n,transaction:m}),O=t.Record({balance:c,transactions:t.Vec(g),oldest_tx_id:t.Opt(n)}),N=t.Record({message:t.Text}),R=t.Variant({Ok:O,Err:N}),f=t.Record({start:t.Nat,length:t.Nat}),x=t.Vec(t.Tuple(t.Text,r));r.fill(t.Variant({Int:t.Int,Map:x,Nat:t.Nat,Nat64:t.Nat64,Blob:t.Vec(t.Nat8),Text:t.Text,Array:t.Vec(r)}));let T=r,b=t.Record({blocks:t.Vec(T),chain_length:t.Nat64}),V=t.Record({ranges:t.Vec(t.Tuple(e,t.Vec(t.Tuple(n,n))))}),A=t.Record({owner:t.Principal,start:t.Opt(s)}),y=t.Record({num_blocks_synced:n});return t.Service({get_account_transactions:t.Func([d],[R],[]),get_blocks:t.Func([f],[b],[]),get_fee_collectors_ranges:t.Func([],[V],[]),icrc1_balance_of:t.Func([e],[c],[]),ledger_id:t.Func([],[t.Principal],[]),list_subaccounts:t.Func([A],[t.Vec(s)],[]),status:t.Func([],[y],["query"])})};var G=({IDL:t})=>{let r=t.Rec(),a=t.Record({ledger_id:t.Opt(t.Principal),retrieve_blocks_from_ledger_interval_seconds:t.Opt(t.Nat64)}),o=t.Record({ledger_id:t.Principal,retrieve_blocks_from_ledger_interval_seconds:t.Opt(t.Nat64)}),i=t.Variant({Upgrade:a,Init:o}),n=t.Nat,s=t.Vec(t.Nat8),e=t.Record({owner:t.Principal,subaccount:t.Opt(s)}),d=t.Record({max_results:t.Nat,start:t.Opt(n),account:e}),c=t.Nat,p=t.Record({from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:c,spender:t.Opt(e)}),l=t.Record({to:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:c}),u=t.Record({fee:t.Opt(c),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:c,expected_allowance:t.Opt(c),expires_at:t.Opt(t.Nat64),spender:e}),_=t.Record({to:e,fee:t.Opt(c),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:c,spender:t.Opt(e)}),m=t.Record({burn:t.Opt(p),kind:t.Text,mint:t.Opt(l),approve:t.Opt(u),timestamp:t.Nat64,transfer:t.Opt(_)}),g=t.Record({id:n,transaction:m}),O=t.Record({balance:c,transactions:t.Vec(g),oldest_tx_id:t.Opt(n)}),N=t.Record({message:t.Text}),R=t.Variant({Ok:O,Err:N}),f=t.Record({start:t.Nat,length:t.Nat}),x=t.Vec(t.Tuple(t.Text,r));r.fill(t.Variant({Int:t.Int,Map:x,Nat:t.Nat,Nat64:t.Nat64,Blob:t.Vec(t.Nat8),Text:t.Text,Array:t.Vec(r)}));let T=r,b=t.Record({blocks:t.Vec(T),chain_length:t.Nat64}),V=t.Record({ranges:t.Vec(t.Tuple(e,t.Vec(t.Tuple(n,n))))}),A=t.Record({owner:t.Principal,start:t.Opt(s)}),y=t.Record({num_blocks_synced:n});return t.Service({get_account_transactions:t.Func([d],[R],["query"]),get_blocks:t.Func([f],[b],["query"]),get_fee_collectors_ranges:t.Func([],[V],["query"]),icrc1_balance_of:t.Func([e],[c],["query"]),ledger_id:t.Func([],[t.Principal],["query"]),list_subaccounts:t.Func([A],[t.Vec(s)],["query"]),status:t.Func([],[y],["query"])})};var h=class t extends k{static create(r){let{service:a,certifiedService:o,canisterId:i}=B({options:r,idlFactory:G,certifiedIdlFactory:F});return new t(i,a,o)}getTransactions=async({certified:r,...a})=>{let o=await this.caller({certified:r}).get_account_transactions(v(a));if("Err"in o)throw new S(o.Err.message);return o.Ok};ledgerId=r=>{let{ledger_id:a}=this.caller(r);return a()};status=r=>this.caller(r).status();listSubaccounts=({certified:r,...a})=>this.caller({certified:r}).list_subaccounts(P(a))};export{h as a};
|
|
2
|
+
//# sourceMappingURL=chunk-WTMDWX2C.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{fromNullable as a,nonNullish as u,toNullable as e}from"@dfinity/utils";var m=({owner:t,subaccount:c})=>{let o=a(c);return{owner:t,...u(o)?{subaccount:o}:{}}},r=({owner:t,subaccount:c})=>({owner:t,subaccount:e(c)});import{toNullable as n}from"@dfinity/utils";var l=({account:t,max_results:c,start:o})=>({account:r(t),max_results:c,start:n(o)}),b=({owner:t,start:c})=>({owner:t,start:n(c)});var s=class extends Error{};export{m as a,r as b,l as c,b as d,s as e};
|
|
2
|
+
//# sourceMappingURL=chunk-YO5OUZGG.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/converters/converters.ts", "../../src/converters/index.converters.ts", "../../src/errors/index.errors.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 { 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", "export class IndexError extends Error {}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,gBAAAA,EAAc,cAAAC,EAAY,cAAAC,MAAkB,iBAU9C,IAAMC,EAAoB,CAAC,CAChC,MAAAC,EACA,WAAYC,CACd,IAA4B,CAC1B,IAAMC,EAAaN,EAAaK,CAAkB,EAElD,MAAO,CACL,MAAAD,EACA,GAAIH,EAAWK,CAAU,EAAI,CAAE,WAAAA,CAAW,EAAI,CAAC,CACjD,CACF,EAQaC,EAAkB,CAAC,CAC9B,MAAAH,EACA,WAAAE,CACF,KAA6B,CAC3B,MAAAF,EACA,WAAYF,EAAWI,CAAU,CACnC,GClCA,OAAS,cAAAE,MAAkB,iBAOpB,IAAMC,EAAwB,CAAC,CACpC,QAAAC,EACA,YAAAC,EACA,MAAAC,CACF,KAAiE,CAC/D,QAASC,EAAgBH,CAAO,EAChC,YAAAC,EACA,MAAOG,EAAWF,CAAK,CACzB,GAEaG,EAA0B,CAAC,CACtC,MAAAC,EACA,MAAAJ,CACF,KAAmD,CACjD,MAAAI,EACA,MAAOF,EAAWF,CAAK,CACzB,GCvBO,IAAMK,EAAN,cAAyB,KAAM,CAAC",
|
|
6
|
+
"names": ["fromNullable", "nonNullish", "toNullable", "fromCandidAccount", "owner", "nullableSubaccount", "subaccount", "toCandidAccount", "toNullable", "toGetTransactionsArgs", "account", "max_results", "start", "toCandidAccount", "toNullable", "toListSubaccountsParams", "owner", "IndexError"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Canister as Pe,createServices as ve,toNullable as we}from"@dfinity/utils";var Oe=({IDL:e})=>{let t=e.Rec(),c=e.Rec(),n=e.Rec(),l=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)}),_=e.Variant({Int:e.Int,Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text}),d=e.Vec(e.Nat8),r=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),y=e.Variant({SetTo:r,Unset:e.Null}),N=e.Record({icrc2:e.Bool}),h=e.Record({change_archive_options:e.Opt(l),token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat),metadata:e.Opt(e.Vec(e.Tuple(e.Text,_))),change_fee_collector:e.Opt(y),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Opt(e.Text),feature_flags:e.Opt(N)}),b=e.Record({decimals:e.Opt(e.Nat8),token_symbol:e.Text,transfer_fee:e.Nat,metadata:e.Vec(e.Tuple(e.Text,_)),minting_account:r,initial_balances:e.Vec(e.Tuple(r,e.Nat)),fee_collector_account:e.Opt(r),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(N)}),ke=e.Variant({Upgrade:e.Opt(h),Init:b}),s=e.Nat,F=e.Record({block_range_end:s,canister_id:e.Principal,block_range_start:s}),p=e.Record({start:s,length:e.Nat}),k=e.Vec(e.Tuple(e.Text,n));n.fill(e.Variant({Int:e.Int,Map:k,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(n)}));let O=n,A=e.Record({blocks:e.Vec(O)}),P=e.Func([p],[A],[]),v=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),first_index:s,blocks:e.Vec(O),chain_length:e.Nat64,archived_blocks:e.Vec(e.Record({callback:P,start:s,length:e.Nat}))}),w=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),hash_tree:e.Vec(e.Nat8)}),m=e.Nat,x=e.Record({start:m,length:e.Nat}),a=e.Nat64,B=e.Record({from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:e.Nat,spender:e.Opt(r)}),C=e.Record({to:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:e.Nat}),G=e.Record({fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(a),spender:r}),E=e.Record({to:r,fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:e.Nat,spender:e.Opt(r)}),R=e.Record({burn:e.Opt(B),kind:e.Text,mint:e.Opt(C),approve:e.Opt(G),timestamp:a,transfer:e.Opt(E)}),q=e.Record({transactions:e.Vec(R)}),M=e.Func([x],[q],[]),S=e.Record({first_index:m,log_length:e.Nat,transactions:e.Vec(R),archived_transactions:e.Vec(e.Record({callback:M,start:m,length:e.Nat}))}),U=e.Record({take:e.Opt(e.Nat),prev_spender:e.Opt(r),from_account:e.Opt(r)}),z=e.Record({from_account:r,to_spender:r,allowance:e.Nat,expires_at:e.Opt(e.Nat64)}),Q=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),AccessDenied:e.Record({reason:e.Text})}),J=e.Variant({Ok:e.Vec(z),Err:Q}),$=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),IndexPrincipalNotSet:e.Null}),j=e.Variant({Ok:e.Principal,Err:$}),o=e.Nat,H=e.Record({url:e.Text,name:e.Text}),K=e.Record({to:r,fee:e.Opt(o),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(d),created_at_time:e.Opt(a),amount:o}),W=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:o}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:o}),CreatedInFuture:e.Record({ledger_time:a}),TooOld:e.Null,InsufficientFunds:e.Record({balance:o})}),X=e.Variant({Ok:s,Err:W}),T=e.Record({utc_offset_minutes:e.Opt(e.Int16),language:e.Text}),Y=e.Record({metadata:T,device_spec:e.Opt(e.Variant({GenericDisplay:e.Null,FieldsDisplay:e.Null}))}),Z=e.Record({arg:e.Vec(e.Nat8),method:e.Text,user_preferences:Y}),I=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})}),D=e.Record({fields:e.Vec(e.Tuple(e.Text,I)),intent:e.Text}),L=e.Variant({FieldsDisplayMessage:D,GenericDisplayMessage:e.Text}),ee=e.Record({metadata:T,consent_message:L}),u=e.Record({description:e.Text}),te=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),InsufficientPayment:u,UnsupportedCanisterCall:u,ConsentMessageUnavailable:u}),re=e.Variant({Ok:ee,Err:te}),ce=e.Record({account:r,spender:r}),ae=e.Record({allowance:e.Nat,expires_at:e.Opt(a)}),ne=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(a),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(a),spender:r}),oe=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:a}),TooOld:e.Null,Expired:e.Record({ledger_time:a}),InsufficientFunds:e.Record({balance:e.Nat})}),se=e.Variant({Ok:s,Err:oe}),ie=e.Record({to:r,fee:e.Opt(o),spender_subaccount:e.Opt(d),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:o}),le=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,InsufficientAllowance:e.Record({allowance:o}),BadBurn:e.Record({min_burn_amount:o}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:o}),CreatedInFuture:e.Record({ledger_time:a}),TooOld:e.Null,InsufficientFunds:e.Record({balance:o})}),pe=e.Variant({Ok:s,Err:le}),_e=e.Record({from:e.Opt(e.Principal)}),de=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(p),callback:e.Func([e.Vec(p)],[t],["query"])}))}));let me=e.Record({certificate:e.Vec(e.Nat8),hash_tree:e.Vec(e.Nat8)});return e.Service({archives:e.Func([],[e.Vec(F)],[]),get_blocks:e.Func([p],[v],[]),get_data_certificate:e.Func([],[w],[]),get_transactions:e.Func([x],[S],[]),icrc103_get_allowances:e.Func([U],[J],[]),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([r],[o],[]),icrc1_decimals:e.Func([],[e.Nat8],[]),icrc1_fee:e.Func([],[o],[]),icrc1_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,_))],[]),icrc1_minting_account:e.Func([],[e.Opt(r)],[]),icrc1_name:e.Func([],[e.Text],[]),icrc1_supported_standards:e.Func([],[e.Vec(H)],[]),icrc1_symbol:e.Func([],[e.Text],[]),icrc1_total_supply:e.Func([],[o],[]),icrc1_transfer:e.Func([K],[X],[]),icrc21_canister_call_consent_message:e.Func([Z],[re],[]),icrc2_allowance:e.Func([ce],[ae],[]),icrc2_approve:e.Func([ne],[se],[]),icrc2_transfer_from:e.Func([ie],[pe],[]),icrc3_get_archives:e.Func([_e],[de],[]),icrc3_get_blocks:e.Func([e.Vec(p)],[t],[]),icrc3_get_tip_certificate:e.Func([],[e.Opt(me)],[]),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 xe=({IDL:e})=>{let t=e.Rec(),c=e.Rec(),n=e.Rec(),l=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)}),_=e.Variant({Int:e.Int,Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text}),d=e.Vec(e.Nat8),r=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),y=e.Variant({SetTo:r,Unset:e.Null}),N=e.Record({icrc2:e.Bool}),h=e.Record({change_archive_options:e.Opt(l),token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat),metadata:e.Opt(e.Vec(e.Tuple(e.Text,_))),change_fee_collector:e.Opt(y),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Opt(e.Text),feature_flags:e.Opt(N)}),b=e.Record({decimals:e.Opt(e.Nat8),token_symbol:e.Text,transfer_fee:e.Nat,metadata:e.Vec(e.Tuple(e.Text,_)),minting_account:r,initial_balances:e.Vec(e.Tuple(r,e.Nat)),fee_collector_account:e.Opt(r),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(N)}),ke=e.Variant({Upgrade:e.Opt(h),Init:b}),s=e.Nat,F=e.Record({block_range_end:s,canister_id:e.Principal,block_range_start:s}),p=e.Record({start:s,length:e.Nat}),k=e.Vec(e.Tuple(e.Text,n));n.fill(e.Variant({Int:e.Int,Map:k,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(n)}));let O=n,A=e.Record({blocks:e.Vec(O)}),P=e.Func([p],[A],["query"]),v=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),first_index:s,blocks:e.Vec(O),chain_length:e.Nat64,archived_blocks:e.Vec(e.Record({callback:P,start:s,length:e.Nat}))}),w=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),hash_tree:e.Vec(e.Nat8)}),m=e.Nat,x=e.Record({start:m,length:e.Nat}),a=e.Nat64,B=e.Record({from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:e.Nat,spender:e.Opt(r)}),C=e.Record({to:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:e.Nat}),G=e.Record({fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(a),spender:r}),E=e.Record({to:r,fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:e.Nat,spender:e.Opt(r)}),R=e.Record({burn:e.Opt(B),kind:e.Text,mint:e.Opt(C),approve:e.Opt(G),timestamp:a,transfer:e.Opt(E)}),q=e.Record({transactions:e.Vec(R)}),M=e.Func([x],[q],["query"]),S=e.Record({first_index:m,log_length:e.Nat,transactions:e.Vec(R),archived_transactions:e.Vec(e.Record({callback:M,start:m,length:e.Nat}))}),U=e.Record({take:e.Opt(e.Nat),prev_spender:e.Opt(r),from_account:e.Opt(r)}),z=e.Record({from_account:r,to_spender:r,allowance:e.Nat,expires_at:e.Opt(e.Nat64)}),Q=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),AccessDenied:e.Record({reason:e.Text})}),J=e.Variant({Ok:e.Vec(z),Err:Q}),$=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),IndexPrincipalNotSet:e.Null}),j=e.Variant({Ok:e.Principal,Err:$}),o=e.Nat,H=e.Record({url:e.Text,name:e.Text}),K=e.Record({to:r,fee:e.Opt(o),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(d),created_at_time:e.Opt(a),amount:o}),W=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:o}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:o}),CreatedInFuture:e.Record({ledger_time:a}),TooOld:e.Null,InsufficientFunds:e.Record({balance:o})}),X=e.Variant({Ok:s,Err:W}),T=e.Record({utc_offset_minutes:e.Opt(e.Int16),language:e.Text}),Y=e.Record({metadata:T,device_spec:e.Opt(e.Variant({GenericDisplay:e.Null,FieldsDisplay:e.Null}))}),Z=e.Record({arg:e.Vec(e.Nat8),method:e.Text,user_preferences:Y}),I=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})}),D=e.Record({fields:e.Vec(e.Tuple(e.Text,I)),intent:e.Text}),L=e.Variant({FieldsDisplayMessage:D,GenericDisplayMessage:e.Text}),ee=e.Record({metadata:T,consent_message:L}),u=e.Record({description:e.Text}),te=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),InsufficientPayment:u,UnsupportedCanisterCall:u,ConsentMessageUnavailable:u}),re=e.Variant({Ok:ee,Err:te}),ce=e.Record({account:r,spender:r}),ae=e.Record({allowance:e.Nat,expires_at:e.Opt(a)}),ne=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(a),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(a),spender:r}),oe=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:a}),TooOld:e.Null,Expired:e.Record({ledger_time:a}),InsufficientFunds:e.Record({balance:e.Nat})}),se=e.Variant({Ok:s,Err:oe}),ie=e.Record({to:r,fee:e.Opt(o),spender_subaccount:e.Opt(d),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:o}),le=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,InsufficientAllowance:e.Record({allowance:o}),BadBurn:e.Record({min_burn_amount:o}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:o}),CreatedInFuture:e.Record({ledger_time:a}),TooOld:e.Null,InsufficientFunds:e.Record({balance:o})}),pe=e.Variant({Ok:s,Err:le}),_e=e.Record({from:e.Opt(e.Principal)}),de=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(p),callback:e.Func([e.Vec(p)],[t],["query"])}))}));let me=e.Record({certificate:e.Vec(e.Nat8),hash_tree:e.Vec(e.Nat8)});return e.Service({archives:e.Func([],[e.Vec(F)],["query"]),get_blocks:e.Func([p],[v],["query"]),get_data_certificate:e.Func([],[w],["query"]),get_transactions:e.Func([x],[S],["query"]),icrc103_get_allowances:e.Func([U],[J],["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([r],[o],["query"]),icrc1_decimals:e.Func([],[e.Nat8],["query"]),icrc1_fee:e.Func([],[o],["query"]),icrc1_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,_))],["query"]),icrc1_minting_account:e.Func([],[e.Opt(r)],["query"]),icrc1_name:e.Func([],[e.Text],["query"]),icrc1_supported_standards:e.Func([],[e.Vec(H)],["query"]),icrc1_symbol:e.Func([],[e.Text],["query"]),icrc1_total_supply:e.Func([],[o],["query"]),icrc1_transfer:e.Func([K],[X],[]),icrc21_canister_call_consent_message:e.Func([Z],[re],[]),icrc2_allowance:e.Func([ce],[ae],["query"]),icrc2_approve:e.Func([ne],[se],[]),icrc2_transfer_from:e.Func([ie],[pe],[]),icrc3_get_archives:e.Func([_e],[de],["query"]),icrc3_get_blocks:e.Func([e.Vec(p)],[t],["query"]),icrc3_get_tip_certificate:e.Func([],[e.Opt(me)],["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"])})};import{isNullish as Ae,toNullable as i}from"@dfinity/utils";var Re=({from_subaccount:e,fee:t,created_at_time:c,memo:n,...l})=>({...l,fee:i(t),memo:i(n),from_subaccount:i(e),created_at_time:i(c)}),Te=({spender_subaccount:e,fee:t,created_at_time:c,memo:n,...l})=>({...l,fee:i(t),memo:i(n),spender_subaccount:i(e),created_at_time:i(c)}),Ve=({fee:e,created_at_time:t,memo:c,from_subaccount:n,expected_allowance:l,expires_at:_,...d})=>({...d,fee:i(e),memo:i(c),from_subaccount:i(n),created_at_time:i(t),expected_allowance:i(l),expires_at:i(_)}),ye=({userPreferences:{metadata:{utcOffsetMinutes:e,language:t},deriveSpec:c},...n})=>({...n,user_preferences:{metadata:{language:t,utc_offset_minutes:i(e)},device_spec:Ae(c)?i():i("GenericDisplay"in c?{GenericDisplay:null}:{FieldsDisplay:null})}});var g=class extends Error{errorType;constructor({msg:t,errorType:c}){super(t),this.errorType=c}},V=class extends Error{constructor(c,n){super();this.message=c;this.error_code=n}},f=class extends Error{},ue=class extends f{},ge=class extends f{},fe=class extends f{},he=e=>"GenericError"in e?new V(e.GenericError.description,e.GenericError.error_code):"InsufficientPayment"in e?new ue(e.InsufficientPayment.description):"UnsupportedCanisterCall"in e?new ge(e.UnsupportedCanisterCall.description):"ConsentMessageUnavailable"in e?new fe(e.ConsentMessageUnavailable.description):new f(`Unknown error type ${JSON.stringify(e)}`),Ne=class extends Error{},be=e=>"IndexPrincipalNotSet"in e?new Ne("Index principal is not set for this ledger canister."):new V(e.GenericError.description,e.GenericError.error_code);var Fe=class e extends Pe{static create(t){let{service:c,certifiedService:n,canisterId:l}=ve({options:t,idlFactory:xe,certifiedIdlFactory:Oe});return new e(l,c,n)}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:we(t.subaccount)});transfer=async t=>{let c=await this.caller({certified:!0}).icrc1_transfer(Re(t));if("Err"in c)throw new g({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(Te(t));if("Err"in c)throw new g({errorType:c.Err,msg:"Failed to transfer from"});return c.Ok};approve=async t=>{let c=await this.caller({certified:!0}).icrc2_approve(Ve(t));if("Err"in c)throw new g({errorType:c.Err,msg:"Failed to entitle the spender to transfer the amount"});return c.Ok};allowance=t=>{let{certified:c,...n}=t;return this.caller({certified:c}).icrc2_allowance({...n})};consentMessage=async t=>{let{icrc21_canister_call_consent_message:c}=this.caller({certified:!0}),n=await c(ye(t));if("Err"in n)throw he(n.Err);return n.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),n=await c();if("Err"in n)throw be(n.Err);return n.Ok};icrc1SupportedStandards=t=>this.caller(t).icrc1_supported_standards();icrc10SupportedStandards=t=>this.caller(t).icrc10_supported_standards()};export{Re as a,Te as b,Ve as c,ye as d,g as e,V as f,f as g,ue as h,ge as i,fe as j,he as k,Ne as l,be as m,Fe as n};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{Canister as Pe,createServices as ve,toNullable as we}from"@dfinity/utils";var Oe=({IDL:e})=>{let t=e.Rec(),c=e.Rec(),n=e.Rec(),l=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)}),_=e.Variant({Int:e.Int,Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text}),d=e.Vec(e.Nat8),r=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),y=e.Variant({SetTo:r,Unset:e.Null}),N=e.Record({icrc2:e.Bool}),h=e.Record({change_archive_options:e.Opt(l),token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat),metadata:e.Opt(e.Vec(e.Tuple(e.Text,_))),change_fee_collector:e.Opt(y),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Opt(e.Text),feature_flags:e.Opt(N)}),b=e.Record({decimals:e.Opt(e.Nat8),token_symbol:e.Text,transfer_fee:e.Nat,metadata:e.Vec(e.Tuple(e.Text,_)),minting_account:r,initial_balances:e.Vec(e.Tuple(r,e.Nat)),fee_collector_account:e.Opt(r),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(N)}),ke=e.Variant({Upgrade:e.Opt(h),Init:b}),s=e.Nat,F=e.Record({block_range_end:s,canister_id:e.Principal,block_range_start:s}),p=e.Record({start:s,length:e.Nat}),k=e.Vec(e.Tuple(e.Text,n));n.fill(e.Variant({Int:e.Int,Map:k,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(n)}));let O=n,A=e.Record({blocks:e.Vec(O)}),P=e.Func([p],[A],[]),v=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),first_index:s,blocks:e.Vec(O),chain_length:e.Nat64,archived_blocks:e.Vec(e.Record({callback:P,start:s,length:e.Nat}))}),w=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),hash_tree:e.Vec(e.Nat8)}),m=e.Nat,x=e.Record({start:m,length:e.Nat}),a=e.Nat64,B=e.Record({from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:e.Nat,spender:e.Opt(r)}),C=e.Record({to:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:e.Nat}),G=e.Record({fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(a),spender:r}),E=e.Record({to:r,fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:e.Nat,spender:e.Opt(r)}),R=e.Record({burn:e.Opt(B),kind:e.Text,mint:e.Opt(C),approve:e.Opt(G),timestamp:a,transfer:e.Opt(E)}),M=e.Record({transactions:e.Vec(R)}),q=e.Func([x],[M],[]),S=e.Record({first_index:m,log_length:e.Nat,transactions:e.Vec(R),archived_transactions:e.Vec(e.Record({callback:q,start:m,length:e.Nat}))}),U=e.Record({take:e.Opt(e.Nat),prev_spender:e.Opt(r),from_account:e.Opt(r)}),z=e.Record({from_account:r,to_spender:r,allowance:e.Nat,expires_at:e.Opt(e.Nat64)}),Q=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),AccessDenied:e.Record({reason:e.Text})}),J=e.Variant({Ok:e.Vec(z),Err:Q}),$=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),IndexPrincipalNotSet:e.Null}),j=e.Variant({Ok:e.Principal,Err:$}),o=e.Nat,H=e.Record({url:e.Text,name:e.Text}),K=e.Record({to:r,fee:e.Opt(o),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(d),created_at_time:e.Opt(a),amount:o}),W=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:o}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:o}),CreatedInFuture:e.Record({ledger_time:a}),TooOld:e.Null,InsufficientFunds:e.Record({balance:o})}),X=e.Variant({Ok:s,Err:W}),T=e.Record({utc_offset_minutes:e.Opt(e.Int16),language:e.Text}),Y=e.Record({metadata:T,device_spec:e.Opt(e.Variant({GenericDisplay:e.Null,FieldsDisplay:e.Null}))}),Z=e.Record({arg:e.Vec(e.Nat8),method:e.Text,user_preferences:Y}),I=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})}),D=e.Record({fields:e.Vec(e.Tuple(e.Text,I)),intent:e.Text}),L=e.Variant({FieldsDisplayMessage:D,GenericDisplayMessage:e.Text}),ee=e.Record({metadata:T,consent_message:L}),u=e.Record({description:e.Text}),te=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),InsufficientPayment:u,UnsupportedCanisterCall:u,ConsentMessageUnavailable:u}),re=e.Variant({Ok:ee,Err:te}),ce=e.Record({account:r,spender:r}),ae=e.Record({allowance:e.Nat,expires_at:e.Opt(a)}),ne=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(a),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(a),spender:r}),oe=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:a}),TooOld:e.Null,Expired:e.Record({ledger_time:a}),InsufficientFunds:e.Record({balance:e.Nat})}),se=e.Variant({Ok:s,Err:oe}),ie=e.Record({to:r,fee:e.Opt(o),spender_subaccount:e.Opt(d),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:o}),le=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,InsufficientAllowance:e.Record({allowance:o}),BadBurn:e.Record({min_burn_amount:o}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:o}),CreatedInFuture:e.Record({ledger_time:a}),TooOld:e.Null,InsufficientFunds:e.Record({balance:o})}),pe=e.Variant({Ok:s,Err:le}),_e=e.Record({from:e.Opt(e.Principal)}),de=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(p),callback:e.Func([e.Vec(p)],[t],["query"])}))}));let me=e.Record({certificate:e.Vec(e.Nat8),hash_tree:e.Vec(e.Nat8)});return e.Service({archives:e.Func([],[e.Vec(F)],[]),get_blocks:e.Func([p],[v],[]),get_data_certificate:e.Func([],[w],[]),get_transactions:e.Func([x],[S],[]),icrc103_get_allowances:e.Func([U],[J],[]),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([r],[o],[]),icrc1_decimals:e.Func([],[e.Nat8],[]),icrc1_fee:e.Func([],[o],[]),icrc1_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,_))],[]),icrc1_minting_account:e.Func([],[e.Opt(r)],[]),icrc1_name:e.Func([],[e.Text],[]),icrc1_supported_standards:e.Func([],[e.Vec(H)],[]),icrc1_symbol:e.Func([],[e.Text],[]),icrc1_total_supply:e.Func([],[o],[]),icrc1_transfer:e.Func([K],[X],[]),icrc21_canister_call_consent_message:e.Func([Z],[re],[]),icrc2_allowance:e.Func([ce],[ae],[]),icrc2_approve:e.Func([ne],[se],[]),icrc2_transfer_from:e.Func([ie],[pe],[]),icrc3_get_archives:e.Func([_e],[de],[]),icrc3_get_blocks:e.Func([e.Vec(p)],[t],[]),icrc3_get_tip_certificate:e.Func([],[e.Opt(me)],[]),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 xe=({IDL:e})=>{let t=e.Rec(),c=e.Rec(),n=e.Rec(),l=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)}),_=e.Variant({Int:e.Int,Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text}),d=e.Vec(e.Nat8),r=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),y=e.Variant({SetTo:r,Unset:e.Null}),N=e.Record({icrc2:e.Bool}),h=e.Record({change_archive_options:e.Opt(l),token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat),metadata:e.Opt(e.Vec(e.Tuple(e.Text,_))),change_fee_collector:e.Opt(y),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Opt(e.Text),feature_flags:e.Opt(N)}),b=e.Record({decimals:e.Opt(e.Nat8),token_symbol:e.Text,transfer_fee:e.Nat,metadata:e.Vec(e.Tuple(e.Text,_)),minting_account:r,initial_balances:e.Vec(e.Tuple(r,e.Nat)),fee_collector_account:e.Opt(r),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(N)}),ke=e.Variant({Upgrade:e.Opt(h),Init:b}),s=e.Nat,F=e.Record({block_range_end:s,canister_id:e.Principal,block_range_start:s}),p=e.Record({start:s,length:e.Nat}),k=e.Vec(e.Tuple(e.Text,n));n.fill(e.Variant({Int:e.Int,Map:k,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(n)}));let O=n,A=e.Record({blocks:e.Vec(O)}),P=e.Func([p],[A],["query"]),v=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),first_index:s,blocks:e.Vec(O),chain_length:e.Nat64,archived_blocks:e.Vec(e.Record({callback:P,start:s,length:e.Nat}))}),w=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),hash_tree:e.Vec(e.Nat8)}),m=e.Nat,x=e.Record({start:m,length:e.Nat}),a=e.Nat64,B=e.Record({from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:e.Nat,spender:e.Opt(r)}),C=e.Record({to:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:e.Nat}),G=e.Record({fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(a),spender:r}),E=e.Record({to:r,fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:e.Nat,spender:e.Opt(r)}),R=e.Record({burn:e.Opt(B),kind:e.Text,mint:e.Opt(C),approve:e.Opt(G),timestamp:a,transfer:e.Opt(E)}),M=e.Record({transactions:e.Vec(R)}),q=e.Func([x],[M],["query"]),S=e.Record({first_index:m,log_length:e.Nat,transactions:e.Vec(R),archived_transactions:e.Vec(e.Record({callback:q,start:m,length:e.Nat}))}),U=e.Record({take:e.Opt(e.Nat),prev_spender:e.Opt(r),from_account:e.Opt(r)}),z=e.Record({from_account:r,to_spender:r,allowance:e.Nat,expires_at:e.Opt(e.Nat64)}),Q=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),AccessDenied:e.Record({reason:e.Text})}),J=e.Variant({Ok:e.Vec(z),Err:Q}),$=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),IndexPrincipalNotSet:e.Null}),j=e.Variant({Ok:e.Principal,Err:$}),o=e.Nat,H=e.Record({url:e.Text,name:e.Text}),K=e.Record({to:r,fee:e.Opt(o),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(d),created_at_time:e.Opt(a),amount:o}),W=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:o}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:o}),CreatedInFuture:e.Record({ledger_time:a}),TooOld:e.Null,InsufficientFunds:e.Record({balance:o})}),X=e.Variant({Ok:s,Err:W}),T=e.Record({utc_offset_minutes:e.Opt(e.Int16),language:e.Text}),Y=e.Record({metadata:T,device_spec:e.Opt(e.Variant({GenericDisplay:e.Null,FieldsDisplay:e.Null}))}),Z=e.Record({arg:e.Vec(e.Nat8),method:e.Text,user_preferences:Y}),I=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})}),D=e.Record({fields:e.Vec(e.Tuple(e.Text,I)),intent:e.Text}),L=e.Variant({FieldsDisplayMessage:D,GenericDisplayMessage:e.Text}),ee=e.Record({metadata:T,consent_message:L}),u=e.Record({description:e.Text}),te=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),InsufficientPayment:u,UnsupportedCanisterCall:u,ConsentMessageUnavailable:u}),re=e.Variant({Ok:ee,Err:te}),ce=e.Record({account:r,spender:r}),ae=e.Record({allowance:e.Nat,expires_at:e.Opt(a)}),ne=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(a),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(a),spender:r}),oe=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:a}),TooOld:e.Null,Expired:e.Record({ledger_time:a}),InsufficientFunds:e.Record({balance:e.Nat})}),se=e.Variant({Ok:s,Err:oe}),ie=e.Record({to:r,fee:e.Opt(o),spender_subaccount:e.Opt(d),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:o}),le=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,InsufficientAllowance:e.Record({allowance:o}),BadBurn:e.Record({min_burn_amount:o}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:o}),CreatedInFuture:e.Record({ledger_time:a}),TooOld:e.Null,InsufficientFunds:e.Record({balance:o})}),pe=e.Variant({Ok:s,Err:le}),_e=e.Record({from:e.Opt(e.Principal)}),de=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(p),callback:e.Func([e.Vec(p)],[t],["query"])}))}));let me=e.Record({certificate:e.Vec(e.Nat8),hash_tree:e.Vec(e.Nat8)});return e.Service({archives:e.Func([],[e.Vec(F)],["query"]),get_blocks:e.Func([p],[v],["query"]),get_data_certificate:e.Func([],[w],["query"]),get_transactions:e.Func([x],[S],["query"]),icrc103_get_allowances:e.Func([U],[J],["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([r],[o],["query"]),icrc1_decimals:e.Func([],[e.Nat8],["query"]),icrc1_fee:e.Func([],[o],["query"]),icrc1_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,_))],["query"]),icrc1_minting_account:e.Func([],[e.Opt(r)],["query"]),icrc1_name:e.Func([],[e.Text],["query"]),icrc1_supported_standards:e.Func([],[e.Vec(H)],["query"]),icrc1_symbol:e.Func([],[e.Text],["query"]),icrc1_total_supply:e.Func([],[o],["query"]),icrc1_transfer:e.Func([K],[X],[]),icrc21_canister_call_consent_message:e.Func([Z],[re],[]),icrc2_allowance:e.Func([ce],[ae],["query"]),icrc2_approve:e.Func([ne],[se],[]),icrc2_transfer_from:e.Func([ie],[pe],[]),icrc3_get_archives:e.Func([_e],[de],["query"]),icrc3_get_blocks:e.Func([e.Vec(p)],[t],["query"]),icrc3_get_tip_certificate:e.Func([],[e.Opt(me)],["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"])})};import{isNullish as Ae,toNullable as i}from"@dfinity/utils";var Re=({from_subaccount:e,fee:t,created_at_time:c,memo:n,...l})=>({...l,fee:i(t),memo:i(n),from_subaccount:i(e),created_at_time:i(c)}),Te=({spender_subaccount:e,fee:t,created_at_time:c,memo:n,...l})=>({...l,fee:i(t),memo:i(n),spender_subaccount:i(e),created_at_time:i(c)}),Ve=({fee:e,created_at_time:t,memo:c,from_subaccount:n,expected_allowance:l,expires_at:_,...d})=>({...d,fee:i(e),memo:i(c),from_subaccount:i(n),created_at_time:i(t),expected_allowance:i(l),expires_at:i(_)}),ye=({userPreferences:{metadata:{utcOffsetMinutes:e,language:t},deriveSpec:c},...n})=>({...n,user_preferences:{metadata:{language:t,utc_offset_minutes:i(e)},device_spec:Ae(c)?i():i("GenericDisplay"in c?{GenericDisplay:null}:{FieldsDisplay:null})}});var g=class extends Error{errorType;constructor({msg:t,errorType:c}){super(t),this.errorType=c}},V=class extends Error{constructor(c,n){super();this.message=c;this.error_code=n}},f=class extends Error{},ue=class extends f{},ge=class extends f{},fe=class extends f{},he=e=>"GenericError"in e?new V(e.GenericError.description,e.GenericError.error_code):"InsufficientPayment"in e?new ue(e.InsufficientPayment.description):"UnsupportedCanisterCall"in e?new ge(e.UnsupportedCanisterCall.description):"ConsentMessageUnavailable"in e?new fe(e.ConsentMessageUnavailable.description):new f(`Unknown error type ${JSON.stringify(e)}`),Ne=class extends Error{},be=e=>"IndexPrincipalNotSet"in e?new Ne("Index principal is not set for this ledger canister."):new V(e.GenericError.description,e.GenericError.error_code);var Fe=class e extends Pe{static create(t){let{service:c,certifiedService:n,canisterId:l}=ve({options:t,idlFactory:xe,certifiedIdlFactory:Oe});return new e(l,c,n)}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:we(t.subaccount)});transfer=async t=>{let c=await this.caller({certified:!0}).icrc1_transfer(Re(t));if("Err"in c)throw new g({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(Te(t));if("Err"in c)throw new g({errorType:c.Err,msg:"Failed to transfer from"});return c.Ok};approve=async t=>{let c=await this.caller({certified:!0}).icrc2_approve(Ve(t));if("Err"in c)throw new g({errorType:c.Err,msg:"Failed to entitle the spender to transfer the amount"});return c.Ok};allowance=t=>{let{certified:c,...n}=t;return this.caller({certified:c}).icrc2_allowance({...n})};consentMessage=async t=>{let{icrc21_canister_call_consent_message:c}=this.caller({certified:!0}),n=await c(ye(t));if("Err"in n)throw he(n.Err);return n.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),n=await c();if("Err"in n)throw be(n.Err);return n.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()};export{Re as a,Te as b,Ve as c,ye as d,g as e,V as f,f as g,ue as h,ge as i,fe as j,he as k,Ne as l,be as m,Fe as n};
|
|
2
|
+
//# sourceMappingURL=chunk-ZMWODXAU.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ledger.canister.ts", "../../candid/icrc_ledger.certified.idl.js", "../../candid/icrc_ledger.idl.js", "../../src/converters/ledger.converters.ts", "../../src/errors/ledger.errors.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Principal } from \"@dfinity/principal\";\nimport {\n Canister,\n createServices,\n toNullable,\n type Nullable,\n type QueryParams,\n} from \"@dfinity/utils\";\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", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/ledger-icrc/candid/icrc_ledger.did */\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 '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 '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 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(\n [TransferFromArgs],\n [TransferFromResult],\n [],\n ),\n 'icrc3_get_archives' : IDL.Func([GetArchivesArgs], [GetArchivesResult], []),\n 'icrc3_get_blocks' : IDL.Func(\n [IDL.Vec(GetBlocksArgs)],\n [GetBlocksResult],\n [],\n ),\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};\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 return [LedgerArg];\n};\n", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/ledger-icrc/candid/icrc_ledger.did */\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 '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 '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 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(\n [TransferFromArgs],\n [TransferFromResult],\n [],\n ),\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};\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 return [LedgerArg];\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", "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"],
|
|
5
|
+
"mappings": "AACA,OACE,YAAAA,GACA,kBAAAC,GACA,cAAAC,OAGK,iBCNA,IAAMC,GAAa,CAAC,CAAE,IAAAC,CAAI,IAAM,CACrC,IAAMC,EAAkBD,EAAI,IAAI,EAC1BE,EAAaF,EAAI,IAAI,EACrBG,EAAQH,EAAI,IAAI,EAChBI,EAAuBJ,EAAI,OAAO,CACtC,sBAA0BA,EAAI,IAAIA,EAAI,KAAK,EAC3C,8BAAkCA,EAAI,IAAIA,EAAI,KAAK,EACnD,kBAAsBA,EAAI,IAAIA,EAAI,KAAK,EACvC,oBAAwBA,EAAI,IAAIA,EAAI,IAAIA,EAAI,SAAS,CAAC,EACtD,uBAA2BA,EAAI,IAAIA,EAAI,KAAK,EAC5C,4BAAgCA,EAAI,IAAIA,EAAI,KAAK,EACjD,2BAA+BA,EAAI,IAAIA,EAAI,KAAK,EAChD,cAAkBA,EAAI,IAAIA,EAAI,SAAS,CACzC,CAAC,EACKK,EAAgBL,EAAI,QAAQ,CAChC,IAAQA,EAAI,IACZ,IAAQA,EAAI,IACZ,KAASA,EAAI,IAAIA,EAAI,IAAI,EACzB,KAASA,EAAI,IACf,CAAC,EACKM,EAAaN,EAAI,IAAIA,EAAI,IAAI,EAC7BO,EAAUP,EAAI,OAAO,CACzB,MAAUA,EAAI,UACd,WAAeA,EAAI,IAAIM,CAAU,CACnC,CAAC,EACKE,EAAqBR,EAAI,QAAQ,CACrC,MAAUO,EACV,MAAUP,EAAI,IAChB,CAAC,EACKS,EAAeT,EAAI,OAAO,CAAE,MAAUA,EAAI,IAAK,CAAC,EAChDU,EAAcV,EAAI,OAAO,CAC7B,uBAA2BA,EAAI,IAAII,CAAoB,EACvD,aAAiBJ,EAAI,IAAIA,EAAI,IAAI,EACj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EAEpDE,EAAW,MAAMU,EAA4B,EAEnD,GAAI,QAASV,EACX,MAAMW,GAAiCX,EAAS,GAAG,EAGrD,OAAOA,EAAS,EAClB,EASA,wBAA2BF,GACzB,KAAK,OAAOA,CAAM,EAAE,0BAA0B,EAShD,yBACEA,GAEA,KAAK,OAAOA,CAAM,EAAE,2BAA2B,EASjD,kBAAqBA,GACnB,KAAK,OAAOA,CAAM,EAAE,sBAAsB,CAC9C",
|
|
6
|
+
"names": ["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", "isNullish", "toNullable", "toTransferArg", "from_subaccount", "fee", "created_at_time", "memo", "rest", "toTransferFromArgs", "spender_subaccount", "toApproveArgs", "expected_allowance", "expires_at", "toIcrc21ConsentMessageArgs", "utcOffsetMinutes", "language", "deriveSpec", "IcrcTransferError", "msg", "errorType", "GenericError", "message", "error_code", "ConsentMessageError", "InsufficientPaymentError", "UnsupportedCanisterCallError", "ConsentMessageUnavailableError", "mapIcrc21ConsentMessageError", "rawError", "IndexPrincipalNotSetError", "mapIcrc106GetIndexPrincipalError", "err", "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"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-WTMDWX2C.js";import"./chunk-F74MWPN7.js";import"./chunk-YO5OUZGG.js";export{a as IcrcIndexNgCanister};
|
|
2
2
|
//# sourceMappingURL=index-ng.canister.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-BYKVMTGO.js";import"./chunk-YO5OUZGG.js";export{a as IcrcIndexCanister};
|
|
2
2
|
//# sourceMappingURL=index.canister.js.map
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as f}from"./chunk-
|
|
1
|
+
import{a as f}from"./chunk-WTMDWX2C.js";import"./chunk-F74MWPN7.js";import{a as x}from"./chunk-BYKVMTGO.js";import{a as M,b as N,e as S}from"./chunk-YO5OUZGG.js";import{a as C,b as B,c as L,d as w,e as G,f as O,g as V,h as F,i as P,j as R,k as U,l as _,m as H,n as l}from"./chunk-ZMWODXAU.js";var p=(e=>(e.SYMBOL="icrc1:symbol",e.NAME="icrc1:name",e.DECIMALS="icrc1:decimals",e.FEE="icrc1:fee",e.LOGO="icrc1:logo",e))(p||{});import{Principal as m}from"@dfinity/principal";import{bigEndianCrc32 as I,encodeBase32 as T,hexStringToUint8Array as g,isNullish as d,nonNullish as i,notEmptyString as A,uint8ArrayToHexString as k}from"@dfinity/utils";var y=64,D=({owner:t,subaccount:n})=>{if(d(n))return t.toText();let r=(c=>c.replace(/^0+/,""))(k(Uint8Array.from(n)));return r.length===0?t.toText():`${t.toText()}-${u({owner:t,subaccount:n})}.${r}`},u=({owner:t,subaccount:n})=>{let o=I(Uint8Array.from([...t.toUint8Array(),...n]));return T(o)},X=t=>{let[n,o,...r]=t.split(".");if(!A(n))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(d(o))return{owner:m.fromText(t)};let[c,...e]=n.split("-").reverse(),a=e.reverse().join("-"),s={owner:m.fromText(a),subaccount:g(o.padStart(y,"0"))};if(u(s)!==c)throw new Error("Invalid account. Invalid checksum.");return s},Y=t=>{let n=t.reduce((r,[c,e])=>{switch(c){case"icrc1:symbol":r={...r,..."Text"in e&&{symbol:e.Text}};break;case"icrc1:name":r={...r,..."Text"in e&&{name:e.Text}};break;case"icrc1:fee":r={...r,..."Nat"in e&&{fee:e.Nat}};break;case"icrc1:decimals":r={...r,..."Nat"in e&&{decimals:Number(e.Nat)}};break;case"icrc1:logo":r={...r,..."Text"in e&&{icon:e.Text}}}return r},{});if((r=>i(r.symbol)&&i(r.name)&&i(r.fee)&&i(r.decimals))(n))return n};import{isNullish as b,nonNullish as E}from"@dfinity/utils";var J=t=>{let n=/^([a-zA-Z]+):([A-Za-z0-9:\-.]+).*?(?:[?&](?:amount|value)=(\d+(?:\.\d+)?))?$/,o=t.match(n);if(b(o))return;let[r,c,e,a]=o;return{token:c,identifier:e,...E(a)&&!isNaN(parseFloat(a))&&{amount:parseFloat(a)}}};export{V as ConsentMessageError,R as ConsentMessageUnavailableError,O as GenericError,x as IcrcIndexCanister,f as IcrcIndexNgCanister,l as IcrcLedgerCanister,p as IcrcMetadataResponseEntries,G as IcrcTransferError,S as IndexError,_ as IndexPrincipalNotSetError,F as InsufficientPaymentError,P as UnsupportedCanisterCallError,X as decodeIcrcAccount,J as decodePayment,D as encodeIcrcAccount,M as fromCandidAccount,H as mapIcrc106GetIndexPrincipalError,U as mapIcrc21ConsentMessageError,Y as mapTokenMetadata,L as toApproveArgs,N as toCandidAccount,w as toIcrc21ConsentMessageArgs,C as toTransferArg,B as toTransferFromArgs};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/types/ledger.responses.ts", "../../src/utils/ledger.utils.ts", "../../src/utils/payment.utils.ts"],
|
|
4
4
|
"sourcesContent": ["import type { Principal } from \"@dfinity/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 { Principal } from \"@dfinity/principal\";\nimport {\n bigEndianCrc32,\n encodeBase32,\n hexStringToUint8Array,\n isNullish,\n nonNullish,\n notEmptyString,\n uint8ArrayToHexString,\n} from \"@dfinity/utils\";\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": "
|
|
5
|
+
"mappings": "qSAIO,IAAKA,OACVA,EAAA,OAAS,eACTA,EAAA,KAAO,aACPA,EAAA,SAAW,iBACXA,EAAA,IAAM,YACNA,EAAA,KAAO,aALGA,OAAA,ICJZ,OAAS,aAAAC,MAAiB,qBAC1B,OACE,kBAAAC,EACA,gBAAAC,EACA,yBAAAC,EACA,aAAAC,EACA,cAAAC,EACA,kBAAAC,EACA,yBAAAC,MACK,iBAQP,IAAMC,EAA4B,GASrBC,EAAoB,CAAC,CAChC,MAAAC,EACA,WAAAC,CACF,IAA2B,CACzB,GAAIC,EAAUD,CAAU,EACtB,OAAOD,EAAM,OAAO,EAKtB,IAAMG,GAFsBC,GAAyBA,EAAK,QAAQ,MAAO,EAAE,GAGzEC,EAAsB,WAAW,KAAKJ,CAAU,CAAC,CACnD,EAEA,OAAIE,EAAe,SAAW,EACrBH,EAAM,OAAO,EAGf,GAAGA,EAAM,OAAO,CAAC,IAAIM,EAAU,CACpC,MAAAN,EACA,WAAAC,CACF,CAAC,CAAC,IAAIE,CAAc,EACtB,EAEMG,EAAY,CAAC,CAAE,MAAAN,EAAO,WAAAC,CAAW,IAAqC,CAC1E,IAAMM,EAAMC,EACV,WAAW,KAAK,CAAC,GAAGR,EAAM,aAAa,EAAG,GAAGC,CAAU,CAAC,CAC1D,EAEA,OAAOQ,EAAaF,CAAG,CACzB,EAUaG,EAAqBC,GAAuC,CACvE,GAAM,CAACC,EAA2BC,EAAe,GAAGC,CAAU,EAC5DH,EAAc,MAAM,GAAG,EAEzB,GAAI,CAACI,EAAeH,CAAyB,EAC3C,MAAM,IAAI,MAAM,sCAAsC,EAGxD,GAAIE,EAAW,OAAS,EACtB,MAAM,IAAI,MACR,oEACF,EAGF,GAAIZ,EAAUW,CAAa,EACzB,MAAO,CACL,MAAOG,E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K,EAC9B,GAAIJ,EAAUK,CAAK,EACjB,OAGF,GAAM,CAACC,EAAGC,EAAOC,EAAYC,CAAM,EAAIJ,EAEvC,MAAO,CACL,MAAAE,EACA,WAAAC,EACA,GAAIP,EAAWQ,CAAM,GACnB,CAAC,MAAM,WAAWA,CAAM,CAAC,GAAK,CAAE,OAAQ,WAAWA,CAAM,CAAE,CAC/D,CACF",
|
|
6
6
|
"names": ["IcrcMetadataResponseEntries", "Principal", "bigEndianCrc32", "encodeBase32", "hexStringToUint8Array", "isNullish", "nonNullish", "notEmptyString", "uint8ArrayToHexString", "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"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as a}from"./chunk-
|
|
1
|
+
import{n as a}from"./chunk-ZMWODXAU.js";export{a as IcrcLedgerCanister};
|
|
2
2
|
//# sourceMappingURL=ledger.canister.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Account } from "../../candid/icrc_ledger";
|
|
2
|
+
import type { IcrcAccount } from "../types/ledger.responses";
|
|
3
|
+
/**
|
|
4
|
+
* Converts a Candid Account object to an IcrcAccount, effectively transforming nullable properties into nullish ones.
|
|
5
|
+
*
|
|
6
|
+
* @param {Account} - The Candid Account object to convert.
|
|
7
|
+
* @return {IcrcAccount} - The converted IcrcAccount object.
|
|
8
|
+
*/
|
|
9
|
+
export declare const fromCandidAccount: ({ owner, subaccount: nullableSubaccount, }: Account) => IcrcAccount;
|
|
10
|
+
/**
|
|
11
|
+
* Converts an IcrcAccount to a Candid Account object, effectively transforming nullish properties into nullable ones.
|
|
12
|
+
*
|
|
13
|
+
* @param {IcrcAccount} - The IcrcAccount object to convert.
|
|
14
|
+
* @return {Account} - The converted Candid Account object.
|
|
15
|
+
*/
|
|
16
|
+
export declare const toCandidAccount: ({ owner, subaccount, }: IcrcAccount) => Account;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export type { ICRC3Value as Icrc3Value, Allowance as IcrcAllowance, ApproveError as IcrcApproveError, BlockIndex as IcrcBlockIndex, 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";
|
|
1
|
+
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";
|
|
2
|
+
export * from "./converters/converters";
|
|
2
3
|
export * from "./converters/ledger.converters";
|
|
3
4
|
export * from "./errors/index.errors";
|
|
4
5
|
export * from "./errors/ledger.errors";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Principal } from "@dfinity/principal";
|
|
2
|
-
import { Canister, type QueryParams } from "@dfinity/utils";
|
|
3
|
-
import type { Allowance, BlockIndex, GetBlocksResult, icrc21_consent_info, _SERVICE as IcrcLedgerService, StandardRecord, Tokens } from "../candid/icrc_ledger";
|
|
2
|
+
import { Canister, type Nullable, type QueryParams } from "@dfinity/utils";
|
|
3
|
+
import type { Account, Allowance, BlockIndex, GetBlocksResult, icrc21_consent_info, _SERVICE as IcrcLedgerService, StandardRecord, Tokens } from "../candid/icrc_ledger";
|
|
4
4
|
import type { IcrcLedgerCanisterOptions } from "./types/canister.options";
|
|
5
5
|
import type { AllowanceParams, ApproveParams, BalanceParams, GetBlocksParams, Icrc21ConsentMessageParams, TransferFromParams, TransferParams } from "./types/ledger.params";
|
|
6
6
|
import type { IcrcTokenMetadataResponse } from "./types/ledger.responses";
|
|
@@ -116,4 +116,12 @@ export declare class IcrcLedgerCanister extends Canister<IcrcLedgerService> {
|
|
|
116
116
|
url: string;
|
|
117
117
|
name: string;
|
|
118
118
|
}[]>;
|
|
119
|
+
/**
|
|
120
|
+
* Returns the minting account of the Ledger canister.
|
|
121
|
+
*
|
|
122
|
+
* @link: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/README.md#icrc1_minting_account
|
|
123
|
+
*
|
|
124
|
+
* @returns {Promise<Nullable<Account>>} The minting account as a Nullable object.
|
|
125
|
+
*/
|
|
126
|
+
getMintingAccount: (params: QueryParams) => Promise<Nullable<Account>>;
|
|
119
127
|
}
|