@dfinity/ledger-icrc 2.1.0 → 2.1.1-next-2024-01-30
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/dist/candid/icrc_index.did +1 -1
- package/dist/candid/icrc_ledger.certified.idl.js +6 -0
- package/dist/candid/icrc_ledger.d.ts +6 -0
- package/dist/candid/icrc_ledger.did +8 -1
- package/dist/candid/icrc_ledger.idl.js +6 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/index.cjs.js.map +3 -3
- package/dist/esm/chunk-SEWDUW4T.js +2 -0
- package/dist/esm/chunk-SEWDUW4T.js.map +7 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/ledger.canister.js +1 -1
- package/package.json +6 -6
- package/dist/esm/chunk-DXWXHYEN.js +0 -2
- package/dist/esm/chunk-DXWXHYEN.js.map +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated from IC repo commit
|
|
1
|
+
// Generated from IC repo commit 044cfd5 (2024-01-25 tags: release-2024-01-25_14-09+p2p-con) 'rs/rosetta-api/icrc1/index/index.did' by import-candid
|
|
2
2
|
type TxId = nat;
|
|
3
3
|
|
|
4
4
|
type Account = record { owner : principal; subaccount : opt blob };
|
|
@@ -56,6 +56,11 @@ export const idlFactory = ({ IDL }) => {
|
|
|
56
56
|
'Init' : InitArgs,
|
|
57
57
|
});
|
|
58
58
|
const BlockIndex = IDL.Nat;
|
|
59
|
+
const ArchiveInfo = IDL.Record({
|
|
60
|
+
'block_range_end' : BlockIndex,
|
|
61
|
+
'canister_id' : IDL.Principal,
|
|
62
|
+
'block_range_start' : BlockIndex,
|
|
63
|
+
});
|
|
59
64
|
const GetBlocksArgs = IDL.Record({
|
|
60
65
|
'start' : BlockIndex,
|
|
61
66
|
'length' : IDL.Nat,
|
|
@@ -249,6 +254,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
249
254
|
'Err' : TransferFromError,
|
|
250
255
|
});
|
|
251
256
|
return IDL.Service({
|
|
257
|
+
'archives' : IDL.Func([], [IDL.Vec(ArchiveInfo)], []),
|
|
252
258
|
'get_blocks' : IDL.Func([GetBlocksArgs], [GetBlocksResponse], []),
|
|
253
259
|
'get_data_certificate' : IDL.Func([], [DataCertificate], []),
|
|
254
260
|
'get_transactions' : IDL.Func(
|
|
@@ -46,6 +46,11 @@ export type ApproveError =
|
|
|
46
46
|
| { Expired: { ledger_time: Timestamp } }
|
|
47
47
|
| { InsufficientFunds: { balance: bigint } };
|
|
48
48
|
export type ApproveResult = { Ok: BlockIndex } | { Err: ApproveError };
|
|
49
|
+
export interface ArchiveInfo {
|
|
50
|
+
block_range_end: BlockIndex;
|
|
51
|
+
canister_id: Principal;
|
|
52
|
+
block_range_start: BlockIndex;
|
|
53
|
+
}
|
|
49
54
|
export type Block = Value;
|
|
50
55
|
export type BlockIndex = bigint;
|
|
51
56
|
export interface BlockRange {
|
|
@@ -240,6 +245,7 @@ export type Value =
|
|
|
240
245
|
| { Text: string }
|
|
241
246
|
| { Array: Array<Value> };
|
|
242
247
|
export interface _SERVICE {
|
|
248
|
+
archives: ActorMethod<[], Array<ArchiveInfo>>;
|
|
243
249
|
get_blocks: ActorMethod<[GetBlocksArgs], GetBlocksResponse>;
|
|
244
250
|
get_data_certificate: ActorMethod<[], DataCertificate>;
|
|
245
251
|
get_transactions: ActorMethod<
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated from IC repo commit
|
|
1
|
+
// Generated from IC repo commit 044cfd5 (2024-01-25 tags: release-2024-01-25_14-09+p2p-con) 'rs/rosetta-api/icrc1/ledger/ledger.did' by import-candid
|
|
2
2
|
type BlockIndex = nat;
|
|
3
3
|
type Subaccount = blob;
|
|
4
4
|
// Number of nanoseconds since the UNIX epoch in UTC timezone.
|
|
@@ -358,7 +358,14 @@ type TransferFromError = variant {
|
|
|
358
358
|
GenericError : record { error_code : nat; message : text };
|
|
359
359
|
};
|
|
360
360
|
|
|
361
|
+
type ArchiveInfo = record {
|
|
362
|
+
canister_id: principal;
|
|
363
|
+
block_range_start: BlockIndex;
|
|
364
|
+
block_range_end: BlockIndex;
|
|
365
|
+
};
|
|
366
|
+
|
|
361
367
|
service : (ledger_arg : LedgerArg) -> {
|
|
368
|
+
archives : () -> (vec ArchiveInfo) query;
|
|
362
369
|
get_transactions : (GetTransactionsRequest) -> (GetTransactionsResponse) query;
|
|
363
370
|
get_blocks : (GetBlocksArgs) -> (GetBlocksResponse) query;
|
|
364
371
|
get_data_certificate : () -> (DataCertificate) query;
|
|
@@ -56,6 +56,11 @@ export const idlFactory = ({ IDL }) => {
|
|
|
56
56
|
'Init' : InitArgs,
|
|
57
57
|
});
|
|
58
58
|
const BlockIndex = IDL.Nat;
|
|
59
|
+
const ArchiveInfo = IDL.Record({
|
|
60
|
+
'block_range_end' : BlockIndex,
|
|
61
|
+
'canister_id' : IDL.Principal,
|
|
62
|
+
'block_range_start' : BlockIndex,
|
|
63
|
+
});
|
|
59
64
|
const GetBlocksArgs = IDL.Record({
|
|
60
65
|
'start' : BlockIndex,
|
|
61
66
|
'length' : IDL.Nat,
|
|
@@ -253,6 +258,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
253
258
|
'Err' : TransferFromError,
|
|
254
259
|
});
|
|
255
260
|
return IDL.Service({
|
|
261
|
+
'archives' : IDL.Func([], [IDL.Vec(ArchiveInfo)], ['query']),
|
|
256
262
|
'get_blocks' : IDL.Func([GetBlocksArgs], [GetBlocksResponse], ['query']),
|
|
257
263
|
'get_data_certificate' : IDL.Func([], [DataCertificate], ['query']),
|
|
258
264
|
'get_transactions' : IDL.Func(
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var I=Object.defineProperty;var lt=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var dt=Object.prototype.hasOwnProperty;var ut=(t,a)=>{for(var c in a)I(t,c,{get:a[c],enumerable:!0})},_t=(t,a,c,r)=>{if(a&&typeof a=="object"||typeof a=="function")for(let e of mt(a))!dt.call(t,e)&&e!==c&&I(t,e,{get:()=>a[e],enumerable:!(r=lt(a,e))||r.enumerable});return t};var ft=t=>_t(I({},"__esModule",{value:!0}),t);var Rt={};ut(Rt,{IcrcIndexCanister:()=>F,IcrcLedgerCanister:()=>v,IcrcMetadataResponseEntries:()=>it,IcrcTransferError:()=>x,IndexError:()=>b,decodeIcrcAccount:()=>gt,decodePayment:()=>xt,encodeIcrcAccount:()=>Tt});module.exports=ft(Rt);var b=class extends Error{};var x=class extends Error{constructor({msg:c,errorType:r}){super(c);this.errorType=r}};var h=require("@dfinity/utils");var tt=({IDL:t})=>{let a=t.Record({ledger_id:t.Principal}),c=t.Nat,r=t.Record({owner:t.Principal,subaccount:t.Opt(t.Vec(t.Nat8))}),e=t.Record({max_results:t.Nat,start:t.Opt(c),account:r}),s=t.Record({from:r,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat,spender:t.Opt(r)}),p=t.Record({to:r,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat}),f=t.Record({fee:t.Opt(t.Nat),from:r,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:r}),N=t.Record({to:r,fee:t.Opt(t.Nat),from:r,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat,spender:t.Opt(r)}),y=t.Record({burn:t.Opt(s),kind:t.Text,mint:t.Opt(p),approve:t.Opt(f),timestamp:t.Nat64,transfer:t.Opt(N)}),i=t.Record({id:c,transaction:y}),d=t.Record({transactions:t.Vec(i),oldest_tx_id:t.Opt(c)}),O=t.Record({message:t.Text}),u=t.Variant({Ok:d,Err:O}),_=t.Vec(t.Nat8),T=t.Record({owner:t.Principal,start:t.Opt(_)});return t.Service({get_account_transactions:t.Func([e],[u],[]),ledger_id:t.Func([],[t.Principal],[]),list_subaccounts:t.Func([T],[t.Vec(_)],[])})};var et=({IDL:t})=>{let a=t.Record({ledger_id:t.Principal}),c=t.Nat,r=t.Record({owner:t.Principal,subaccount:t.Opt(t.Vec(t.Nat8))}),e=t.Record({max_results:t.Nat,start:t.Opt(c),account:r}),s=t.Record({from:r,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat,spender:t.Opt(r)}),p=t.Record({to:r,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat}),f=t.Record({fee:t.Opt(t.Nat),from:r,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:r}),N=t.Record({to:r,fee:t.Opt(t.Nat),from:r,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat,spender:t.Opt(r)}),y=t.Record({burn:t.Opt(s),kind:t.Text,mint:t.Opt(p),approve:t.Opt(f),timestamp:t.Nat64,transfer:t.Opt(N)}),i=t.Record({id:c,transaction:y}),d=t.Record({transactions:t.Vec(i),oldest_tx_id:t.Opt(c)}),O=t.Record({message:t.Text}),u=t.Variant({Ok:d,Err:O}),_=t.Vec(t.Nat8),T=t.Record({owner:t.Principal,start:t.Opt(_)});return t.Service({get_account_transactions:t.Func([e],[u],[]),ledger_id:t.Func([],[t.Principal],["query"]),list_subaccounts:t.Func([T],[t.Vec(_)],["query"])})};var L=require("@dfinity/utils"),Nt=({owner:t,subaccount:a})=>({owner:t,subaccount:(0,L.toNullable)(a)}),rt=({account:t,max_results:a,start:c})=>({account:Nt(t),max_results:a,start:(0,L.toNullable)(c)});var F=class t extends h.Canister{constructor(){super(...arguments);this.getTransactions=async c=>{let r=await this.caller({certified:!0}).get_account_transactions(rt(c));if("Err"in r)throw new b(r.Err.message);return r.Ok}}static create(c){let{service:r,certifiedService:e,canisterId:s}=(0,h.createServices)({options:c,idlFactory:et,certifiedIdlFactory:tt});return new t(s,r,e)}};var R=require("@dfinity/utils");var ct=({IDL:t})=>{let a=t.Rec(),c=t.Variant({Int:t.Int,Nat:t.Nat,Blob:t.Vec(t.Nat8),Text:t.Text}),r=t.Vec(t.Nat8),e=t.Record({owner:t.Principal,subaccount:t.Opt(r)}),s=t.Variant({SetTo:e,Unset:t.Null}),p=t.Record({icrc2:t.Bool}),f=t.Record({token_symbol:t.Opt(t.Text),transfer_fee:t.Opt(t.Nat),metadata:t.Opt(t.Vec(t.Tuple(t.Text,c))),maximum_number_of_accounts:t.Opt(t.Nat64),accounts_overflow_trim_quantity:t.Opt(t.Nat64),change_fee_collector:t.Opt(s),max_memo_length:t.Opt(t.Nat16),token_name:t.Opt(t.Text),feature_flags:t.Opt(p)}),N=t.Record({decimals:t.Opt(t.Nat8),token_symbol:t.Text,transfer_fee:t.Nat,metadata:t.Vec(t.Tuple(t.Text,c)),minting_account:e,initial_balances:t.Vec(t.Tuple(e,t.Nat)),maximum_number_of_accounts:t.Opt(t.Nat64),accounts_overflow_trim_quantity:t.Opt(t.Nat64),fee_collector_account:t.Opt(e),archive_options:t.Record({num_blocks_to_archive:t.Nat64,max_transactions_per_response:t.Opt(t.Nat64),trigger_threshold:t.Nat64,max_message_size_bytes:t.Opt(t.Nat64),cycles_for_archive_creation:t.Opt(t.Nat64),node_max_memory_size_bytes:t.Opt(t.Nat64),controller_id:t.Principal}),max_memo_length:t.Opt(t.Nat16),token_name:t.Text,feature_flags:t.Opt(p)}),y=t.Variant({Upgrade:t.Opt(f),Init:N}),i=t.Nat,d=t.Record({start:i,length:t.Nat}),O=t.Vec(t.Tuple(t.Text,a));a.fill(t.Variant({Int:t.Int,Map:O,Nat:t.Nat,Nat64:t.Nat64,Blob:t.Vec(t.Nat8),Text:t.Text,Array:t.Vec(a)}));let u=a,_=t.Record({blocks:t.Vec(u)}),T=t.Func([d],[_],[]),w=t.Record({certificate:t.Opt(t.Vec(t.Nat8)),first_index:i,blocks:t.Vec(u),chain_length:t.Nat64,archived_blocks:t.Vec(t.Record({callback:T,start:i,length:t.Nat}))}),P=t.Record({certificate:t.Opt(t.Vec(t.Nat8)),hash_tree:t.Vec(t.Nat8)}),g=t.Nat,A=t.Record({start:g,length:t.Nat}),o=t.Nat64,B=t.Record({from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat,spender:t.Opt(e)}),E=t.Record({to:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat}),S=t.Record({fee:t.Opt(t.Nat),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat,expected_allowance:t.Opt(t.Nat),expires_at:t.Opt(o),spender:e}),G=t.Record({to:e,fee:t.Opt(t.Nat),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat,spender:t.Opt(e)}),V=t.Record({burn:t.Opt(B),kind:t.Text,mint:t.Opt(E),approve:t.Opt(S),timestamp:o,transfer:t.Opt(G)}),C=t.Record({transactions:t.Vec(V)}),q=t.Func([A],[C],[]),U=t.Record({first_index:g,log_length:t.Nat,transactions:t.Vec(V),archived_transactions:t.Vec(t.Record({callback:q,start:g,length:t.Nat}))}),n=t.Nat,M=t.Record({url:t.Text,name:t.Text}),z=t.Record({to:e,fee:t.Opt(n),memo:t.Opt(t.Vec(t.Nat8)),from_subaccount:t.Opt(r),created_at_time:t.Opt(o),amount:n}),Q=t.Variant({GenericError:t.Record({message:t.Text,error_code:t.Nat}),TemporarilyUnavailable:t.Null,BadBurn:t.Record({min_burn_amount:n}),Duplicate:t.Record({duplicate_of:i}),BadFee:t.Record({expected_fee:n}),CreatedInFuture:t.Record({ledger_time:o}),TooOld:t.Null,InsufficientFunds:t.Record({balance:n})}),H=t.Variant({Ok:i,Err:Q}),W=t.Record({account:e,spender:e}),Z=t.Record({allowance:t.Nat,expires_at:t.Opt(o)}),$=t.Record({fee:t.Opt(t.Nat),memo:t.Opt(t.Vec(t.Nat8)),from_subaccount:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat,expected_allowance:t.Opt(t.Nat),expires_at:t.Opt(o),spender:e}),X=t.Variant({GenericError:t.Record({message:t.Text,error_code:t.Nat}),TemporarilyUnavailable:t.Null,Duplicate:t.Record({duplicate_of:i}),BadFee:t.Record({expected_fee:t.Nat}),AllowanceChanged:t.Record({current_allowance:t.Nat}),CreatedInFuture:t.Record({ledger_time:o}),TooOld:t.Null,Expired:t.Record({ledger_time:o}),InsufficientFunds:t.Record({balance:t.Nat})}),j=t.Variant({Ok:i,Err:X}),Y=t.Record({to:e,fee:t.Opt(n),spender_subaccount:t.Opt(r),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:n}),J=t.Variant({GenericError:t.Record({message:t.Text,error_code:t.Nat}),TemporarilyUnavailable:t.Null,InsufficientAllowance:t.Record({allowance:n}),BadBurn:t.Record({min_burn_amount:n}),Duplicate:t.Record({duplicate_of:i}),BadFee:t.Record({expected_fee:n}),CreatedInFuture:t.Record({ledger_time:o}),TooOld:t.Null,InsufficientFunds:t.Record({balance:n})}),K=t.Variant({Ok:i,Err:J});return t.Service({get_blocks:t.Func([d],[w],[]),get_data_certificate:t.Func([],[P],[]),get_transactions:t.Func([A],[U],[]),icrc1_balance_of:t.Func([e],[n],[]),icrc1_decimals:t.Func([],[t.Nat8],[]),icrc1_fee:t.Func([],[n],[]),icrc1_metadata:t.Func([],[t.Vec(t.Tuple(t.Text,c))],[]),icrc1_minting_account:t.Func([],[t.Opt(e)],[]),icrc1_name:t.Func([],[t.Text],[]),icrc1_supported_standards:t.Func([],[t.Vec(M)],[]),icrc1_symbol:t.Func([],[t.Text],[]),icrc1_total_supply:t.Func([],[n],[]),icrc1_transfer:t.Func([z],[H],[]),icrc2_allowance:t.Func([W],[Z],[]),icrc2_approve:t.Func([$],[j],[]),icrc2_transfer_from:t.Func([Y],[K],[])})};var at=({IDL:t})=>{let a=t.Rec(),c=t.Variant({Int:t.Int,Nat:t.Nat,Blob:t.Vec(t.Nat8),Text:t.Text}),r=t.Vec(t.Nat8),e=t.Record({owner:t.Principal,subaccount:t.Opt(r)}),s=t.Variant({SetTo:e,Unset:t.Null}),p=t.Record({icrc2:t.Bool}),f=t.Record({token_symbol:t.Opt(t.Text),transfer_fee:t.Opt(t.Nat),metadata:t.Opt(t.Vec(t.Tuple(t.Text,c))),maximum_number_of_accounts:t.Opt(t.Nat64),accounts_overflow_trim_quantity:t.Opt(t.Nat64),change_fee_collector:t.Opt(s),max_memo_length:t.Opt(t.Nat16),token_name:t.Opt(t.Text),feature_flags:t.Opt(p)}),N=t.Record({decimals:t.Opt(t.Nat8),token_symbol:t.Text,transfer_fee:t.Nat,metadata:t.Vec(t.Tuple(t.Text,c)),minting_account:e,initial_balances:t.Vec(t.Tuple(e,t.Nat)),maximum_number_of_accounts:t.Opt(t.Nat64),accounts_overflow_trim_quantity:t.Opt(t.Nat64),fee_collector_account:t.Opt(e),archive_options:t.Record({num_blocks_to_archive:t.Nat64,max_transactions_per_response:t.Opt(t.Nat64),trigger_threshold:t.Nat64,max_message_size_bytes:t.Opt(t.Nat64),cycles_for_archive_creation:t.Opt(t.Nat64),node_max_memory_size_bytes:t.Opt(t.Nat64),controller_id:t.Principal}),max_memo_length:t.Opt(t.Nat16),token_name:t.Text,feature_flags:t.Opt(p)}),y=t.Variant({Upgrade:t.Opt(f),Init:N}),i=t.Nat,d=t.Record({start:i,length:t.Nat}),O=t.Vec(t.Tuple(t.Text,a));a.fill(t.Variant({Int:t.Int,Map:O,Nat:t.Nat,Nat64:t.Nat64,Blob:t.Vec(t.Nat8),Text:t.Text,Array:t.Vec(a)}));let u=a,_=t.Record({blocks:t.Vec(u)}),T=t.Func([d],[_],["query"]),w=t.Record({certificate:t.Opt(t.Vec(t.Nat8)),first_index:i,blocks:t.Vec(u),chain_length:t.Nat64,archived_blocks:t.Vec(t.Record({callback:T,start:i,length:t.Nat}))}),P=t.Record({certificate:t.Opt(t.Vec(t.Nat8)),hash_tree:t.Vec(t.Nat8)}),g=t.Nat,A=t.Record({start:g,length:t.Nat}),o=t.Nat64,B=t.Record({from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat,spender:t.Opt(e)}),E=t.Record({to:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat}),S=t.Record({fee:t.Opt(t.Nat),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat,expected_allowance:t.Opt(t.Nat),expires_at:t.Opt(o),spender:e}),G=t.Record({to:e,fee:t.Opt(t.Nat),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat,spender:t.Opt(e)}),V=t.Record({burn:t.Opt(B),kind:t.Text,mint:t.Opt(E),approve:t.Opt(S),timestamp:o,transfer:t.Opt(G)}),C=t.Record({transactions:t.Vec(V)}),q=t.Func([A],[C],["query"]),U=t.Record({first_index:g,log_length:t.Nat,transactions:t.Vec(V),archived_transactions:t.Vec(t.Record({callback:q,start:g,length:t.Nat}))}),n=t.Nat,M=t.Record({url:t.Text,name:t.Text}),z=t.Record({to:e,fee:t.Opt(n),memo:t.Opt(t.Vec(t.Nat8)),from_subaccount:t.Opt(r),created_at_time:t.Opt(o),amount:n}),Q=t.Variant({GenericError:t.Record({message:t.Text,error_code:t.Nat}),TemporarilyUnavailable:t.Null,BadBurn:t.Record({min_burn_amount:n}),Duplicate:t.Record({duplicate_of:i}),BadFee:t.Record({expected_fee:n}),CreatedInFuture:t.Record({ledger_time:o}),TooOld:t.Null,InsufficientFunds:t.Record({balance:n})}),H=t.Variant({Ok:i,Err:Q}),W=t.Record({account:e,spender:e}),Z=t.Record({allowance:t.Nat,expires_at:t.Opt(o)}),$=t.Record({fee:t.Opt(t.Nat),memo:t.Opt(t.Vec(t.Nat8)),from_subaccount:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat,expected_allowance:t.Opt(t.Nat),expires_at:t.Opt(o),spender:e}),X=t.Variant({GenericError:t.Record({message:t.Text,error_code:t.Nat}),TemporarilyUnavailable:t.Null,Duplicate:t.Record({duplicate_of:i}),BadFee:t.Record({expected_fee:t.Nat}),AllowanceChanged:t.Record({current_allowance:t.Nat}),CreatedInFuture:t.Record({ledger_time:o}),TooOld:t.Null,Expired:t.Record({ledger_time:o}),InsufficientFunds:t.Record({balance:t.Nat})}),j=t.Variant({Ok:i,Err:X}),Y=t.Record({to:e,fee:t.Opt(n),spender_subaccount:t.Opt(r),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:n}),J=t.Variant({GenericError:t.Record({message:t.Text,error_code:t.Nat}),TemporarilyUnavailable:t.Null,InsufficientAllowance:t.Record({allowance:n}),BadBurn:t.Record({min_burn_amount:n}),Duplicate:t.Record({duplicate_of:i}),BadFee:t.Record({expected_fee:n}),CreatedInFuture:t.Record({ledger_time:o}),TooOld:t.Null,InsufficientFunds:t.Record({balance:n})}),K=t.Variant({Ok:i,Err:J});return t.Service({get_blocks:t.Func([d],[w],["query"]),get_data_certificate:t.Func([],[P],["query"]),get_transactions:t.Func([A],[U],["query"]),icrc1_balance_of:t.Func([e],[n],["query"]),icrc1_decimals:t.Func([],[t.Nat8],["query"]),icrc1_fee:t.Func([],[n],["query"]),icrc1_metadata:t.Func([],[t.Vec(t.Tuple(t.Text,c))],["query"]),icrc1_minting_account:t.Func([],[t.Opt(e)],["query"]),icrc1_name:t.Func([],[t.Text],["query"]),icrc1_supported_standards:t.Func([],[t.Vec(M)],["query"]),icrc1_symbol:t.Func([],[t.Text],["query"]),icrc1_total_supply:t.Func([],[n],["query"]),icrc1_transfer:t.Func([z],[H],[]),icrc2_allowance:t.Func([W],[Z],["query"]),icrc2_approve:t.Func([$],[j],[]),icrc2_transfer_from:t.Func([Y],[K],[])})};var l=require("@dfinity/utils"),ot=({from_subaccount:t,fee:a,created_at_time:c,memo:r,...e})=>({...e,fee:(0,l.toNullable)(a),memo:(0,l.toNullable)(r),from_subaccount:(0,l.toNullable)(t),created_at_time:(0,l.toNullable)(c)}),nt=({spender_subaccount:t,fee:a,created_at_time:c,memo:r,...e})=>({...e,fee:(0,l.toNullable)(a),memo:(0,l.toNullable)(r),spender_subaccount:(0,l.toNullable)(t),created_at_time:(0,l.toNullable)(c)}),st=({fee:t,created_at_time:a,memo:c,from_subaccount:r,expected_allowance:e,expires_at:s,...p})=>({...p,fee:(0,l.toNullable)(t),memo:(0,l.toNullable)(c),from_subaccount:(0,l.toNullable)(r),created_at_time:(0,l.toNullable)(a),expected_allowance:(0,l.toNullable)(e),expires_at:(0,l.toNullable)(s)});var v=class t extends R.Canister{constructor(){super(...arguments);this.metadata=c=>this.caller(c).icrc1_metadata();this.transactionFee=c=>this.caller(c).icrc1_fee();this.balance=c=>this.caller({certified:c.certified}).icrc1_balance_of({owner:c.owner,subaccount:(0,R.toNullable)(c.subaccount)});this.transfer=async c=>{let r=await this.caller({certified:!0}).icrc1_transfer(ot(c));if("Err"in r)throw new x({errorType:r.Err,msg:"Failed to transfer"});return r.Ok};this.totalTokensSupply=c=>this.caller(c).icrc1_total_supply();this.transferFrom=async c=>{let r=await this.caller({certified:!0}).icrc2_transfer_from(nt(c));if("Err"in r)throw new x({errorType:r.Err,msg:"Failed to transfer from"});return r.Ok};this.approve=async c=>{let r=await this.caller({certified:!0}).icrc2_approve(st(c));if("Err"in r)throw new x({errorType:r.Err,msg:"Failed to entitle the spender to transfer the amount"});return r.Ok};this.allowance=async c=>{let{certified:r,...e}=c;return this.caller({certified:r}).icrc2_allowance({...e})}}static create(c){let{service:r,certifiedService:e,canisterId:s}=(0,R.createServices)({options:c,idlFactory:at,certifiedIdlFactory:ct});return new t(s,r,e)}};var it=(s=>(s.SYMBOL="icrc1:symbol",s.NAME="icrc1:name",s.DECIMALS="icrc1:decimals",s.FEE="icrc1:fee",s.LOGO="icrc1:logo",s))(it||{});var D=require("@dfinity/principal"),m=require("@dfinity/utils"),Ot=64,Tt=({owner:t,subaccount:a})=>{if((0,m.isNullish)(a))return t.toText();let r=(e=>e.replace(/^0+/,""))((0,m.uint8ArrayToHexString)(Uint8Array.from(a)));return r.length===0?t.toText():`${t.toText()}-${pt({owner:t,subaccount:a})}.${r}`},pt=({owner:t,subaccount:a})=>{let c=(0,m.bigEndianCrc32)(Uint8Array.from([...t.toUint8Array(),...a]));return(0,m.encodeBase32)(c)},gt=t=>{let[a,c]=t.split(".");if(!(0,m.notEmptyString)(a))throw new Error("Invalid account. No string provided.");if((0,m.isNullish)(c))return{owner:D.Principal.fromText(t)};let[r,...e]=a.split("-").reverse(),s=e.reverse().join("-"),p={owner:D.Principal.fromText(s),subaccount:(0,m.hexStringToUint8Array)(c.padStart(Ot,"0"))};if(pt(p)!==r)throw new Error("Invalid account. Invalid checksum.");return p};var k=require("@dfinity/utils"),xt=t=>{let a=/^([a-zA-Z]+):([A-Za-z0-9:\-.]+).*?(?:[?&](?:amount|value)=(\d+(?:\.\d+)?))?$/,c=t.match(a);if((0,k.isNullish)(c))return;let[r,e,s,p]=c;return{token:e,identifier:s,...(0,k.nonNullish)(p)&&!isNaN(parseFloat(p))&&{amount:parseFloat(p)}}};0&&(module.exports={IcrcIndexCanister,IcrcLedgerCanister,IcrcMetadataResponseEntries,IcrcTransferError,IndexError,decodeIcrcAccount,decodePayment,encodeIcrcAccount});
|
|
1
|
+
"use strict";var L=Object.defineProperty;var mt=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var ut=Object.prototype.hasOwnProperty;var _t=(t,a)=>{for(var c in a)L(t,c,{get:a[c],enumerable:!0})},ft=(t,a,c,r)=>{if(a&&typeof a=="object"||typeof a=="function")for(let e of dt(a))!ut.call(t,e)&&e!==c&&L(t,e,{get:()=>a[e],enumerable:!(r=mt(a,e))||r.enumerable});return t};var Nt=t=>ft(L({},"__esModule",{value:!0}),t);var yt={};_t(yt,{IcrcIndexCanister:()=>F,IcrcLedgerCanister:()=>v,IcrcMetadataResponseEntries:()=>pt,IcrcTransferError:()=>x,IndexError:()=>b,decodeIcrcAccount:()=>xt,decodePayment:()=>Rt,encodeIcrcAccount:()=>Tt});module.exports=Nt(yt);var b=class extends Error{};var x=class extends Error{constructor({msg:c,errorType:r}){super(c);this.errorType=r}};var h=require("@dfinity/utils");var et=({IDL:t})=>{let a=t.Record({ledger_id:t.Principal}),c=t.Nat,r=t.Record({owner:t.Principal,subaccount:t.Opt(t.Vec(t.Nat8))}),e=t.Record({max_results:t.Nat,start:t.Opt(c),account:r}),i=t.Record({from:r,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat,spender:t.Opt(r)}),p=t.Record({to:r,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat}),_=t.Record({fee:t.Opt(t.Nat),from:r,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:r}),f=t.Record({to:r,fee:t.Opt(t.Nat),from:r,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat,spender:t.Opt(r)}),y=t.Record({burn:t.Opt(i),kind:t.Text,mint:t.Opt(p),approve:t.Opt(_),timestamp:t.Nat64,transfer:t.Opt(f)}),s=t.Record({id:c,transaction:y}),N=t.Record({transactions:t.Vec(s),oldest_tx_id:t.Opt(c)}),u=t.Record({message:t.Text}),O=t.Variant({Ok:N,Err:u}),d=t.Vec(t.Nat8),g=t.Record({owner:t.Principal,start:t.Opt(d)});return t.Service({get_account_transactions:t.Func([e],[O],[]),ledger_id:t.Func([],[t.Principal],[]),list_subaccounts:t.Func([g],[t.Vec(d)],[])})};var rt=({IDL:t})=>{let a=t.Record({ledger_id:t.Principal}),c=t.Nat,r=t.Record({owner:t.Principal,subaccount:t.Opt(t.Vec(t.Nat8))}),e=t.Record({max_results:t.Nat,start:t.Opt(c),account:r}),i=t.Record({from:r,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat,spender:t.Opt(r)}),p=t.Record({to:r,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat}),_=t.Record({fee:t.Opt(t.Nat),from:r,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:r}),f=t.Record({to:r,fee:t.Opt(t.Nat),from:r,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat,spender:t.Opt(r)}),y=t.Record({burn:t.Opt(i),kind:t.Text,mint:t.Opt(p),approve:t.Opt(_),timestamp:t.Nat64,transfer:t.Opt(f)}),s=t.Record({id:c,transaction:y}),N=t.Record({transactions:t.Vec(s),oldest_tx_id:t.Opt(c)}),u=t.Record({message:t.Text}),O=t.Variant({Ok:N,Err:u}),d=t.Vec(t.Nat8),g=t.Record({owner:t.Principal,start:t.Opt(d)});return t.Service({get_account_transactions:t.Func([e],[O],[]),ledger_id:t.Func([],[t.Principal],["query"]),list_subaccounts:t.Func([g],[t.Vec(d)],["query"])})};var D=require("@dfinity/utils"),Ot=({owner:t,subaccount:a})=>({owner:t,subaccount:(0,D.toNullable)(a)}),ct=({account:t,max_results:a,start:c})=>({account:Ot(t),max_results:a,start:(0,D.toNullable)(c)});var F=class t extends h.Canister{constructor(){super(...arguments);this.getTransactions=async c=>{let r=await this.caller({certified:!0}).get_account_transactions(ct(c));if("Err"in r)throw new b(r.Err.message);return r.Ok}}static create(c){let{service:r,certifiedService:e,canisterId:i}=(0,h.createServices)({options:c,idlFactory:rt,certifiedIdlFactory:et});return new t(i,r,e)}};var R=require("@dfinity/utils");var at=({IDL:t})=>{let a=t.Rec(),c=t.Variant({Int:t.Int,Nat:t.Nat,Blob:t.Vec(t.Nat8),Text:t.Text}),r=t.Vec(t.Nat8),e=t.Record({owner:t.Principal,subaccount:t.Opt(r)}),i=t.Variant({SetTo:e,Unset:t.Null}),p=t.Record({icrc2:t.Bool}),_=t.Record({token_symbol:t.Opt(t.Text),transfer_fee:t.Opt(t.Nat),metadata:t.Opt(t.Vec(t.Tuple(t.Text,c))),maximum_number_of_accounts:t.Opt(t.Nat64),accounts_overflow_trim_quantity:t.Opt(t.Nat64),change_fee_collector:t.Opt(i),max_memo_length:t.Opt(t.Nat16),token_name:t.Opt(t.Text),feature_flags:t.Opt(p)}),f=t.Record({decimals:t.Opt(t.Nat8),token_symbol:t.Text,transfer_fee:t.Nat,metadata:t.Vec(t.Tuple(t.Text,c)),minting_account:e,initial_balances:t.Vec(t.Tuple(e,t.Nat)),maximum_number_of_accounts:t.Opt(t.Nat64),accounts_overflow_trim_quantity:t.Opt(t.Nat64),fee_collector_account:t.Opt(e),archive_options:t.Record({num_blocks_to_archive:t.Nat64,max_transactions_per_response:t.Opt(t.Nat64),trigger_threshold:t.Nat64,max_message_size_bytes:t.Opt(t.Nat64),cycles_for_archive_creation:t.Opt(t.Nat64),node_max_memory_size_bytes:t.Opt(t.Nat64),controller_id:t.Principal}),max_memo_length:t.Opt(t.Nat16),token_name:t.Text,feature_flags:t.Opt(p)}),y=t.Variant({Upgrade:t.Opt(_),Init:f}),s=t.Nat,N=t.Record({block_range_end:s,canister_id:t.Principal,block_range_start:s}),u=t.Record({start:s,length:t.Nat}),O=t.Vec(t.Tuple(t.Text,a));a.fill(t.Variant({Int:t.Int,Map:O,Nat:t.Nat,Nat64:t.Nat64,Blob:t.Vec(t.Nat8),Text:t.Text,Array:t.Vec(a)}));let d=a,g=t.Record({blocks:t.Vec(d)}),w=t.Func([u],[g],[]),P=t.Record({certificate:t.Opt(t.Vec(t.Nat8)),first_index:s,blocks:t.Vec(d),chain_length:t.Nat64,archived_blocks:t.Vec(t.Record({callback:w,start:s,length:t.Nat}))}),B=t.Record({certificate:t.Opt(t.Vec(t.Nat8)),hash_tree:t.Vec(t.Nat8)}),T=t.Nat,A=t.Record({start:T,length:t.Nat}),o=t.Nat64,E=t.Record({from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat,spender:t.Opt(e)}),S=t.Record({to:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat}),G=t.Record({fee:t.Opt(t.Nat),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat,expected_allowance:t.Opt(t.Nat),expires_at:t.Opt(o),spender:e}),C=t.Record({to:e,fee:t.Opt(t.Nat),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat,spender:t.Opt(e)}),V=t.Record({burn:t.Opt(E),kind:t.Text,mint:t.Opt(S),approve:t.Opt(G),timestamp:o,transfer:t.Opt(C)}),q=t.Record({transactions:t.Vec(V)}),U=t.Func([A],[q],[]),M=t.Record({first_index:T,log_length:t.Nat,transactions:t.Vec(V),archived_transactions:t.Vec(t.Record({callback:U,start:T,length:t.Nat}))}),n=t.Nat,z=t.Record({url:t.Text,name:t.Text}),Q=t.Record({to:e,fee:t.Opt(n),memo:t.Opt(t.Vec(t.Nat8)),from_subaccount:t.Opt(r),created_at_time:t.Opt(o),amount:n}),H=t.Variant({GenericError:t.Record({message:t.Text,error_code:t.Nat}),TemporarilyUnavailable:t.Null,BadBurn:t.Record({min_burn_amount:n}),Duplicate:t.Record({duplicate_of:s}),BadFee:t.Record({expected_fee:n}),CreatedInFuture:t.Record({ledger_time:o}),TooOld:t.Null,InsufficientFunds:t.Record({balance:n})}),W=t.Variant({Ok:s,Err:H}),Z=t.Record({account:e,spender:e}),$=t.Record({allowance:t.Nat,expires_at:t.Opt(o)}),X=t.Record({fee:t.Opt(t.Nat),memo:t.Opt(t.Vec(t.Nat8)),from_subaccount:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat,expected_allowance:t.Opt(t.Nat),expires_at:t.Opt(o),spender:e}),j=t.Variant({GenericError:t.Record({message:t.Text,error_code:t.Nat}),TemporarilyUnavailable:t.Null,Duplicate:t.Record({duplicate_of:s}),BadFee:t.Record({expected_fee:t.Nat}),AllowanceChanged:t.Record({current_allowance:t.Nat}),CreatedInFuture:t.Record({ledger_time:o}),TooOld:t.Null,Expired:t.Record({ledger_time:o}),InsufficientFunds:t.Record({balance:t.Nat})}),Y=t.Variant({Ok:s,Err:j}),J=t.Record({to:e,fee:t.Opt(n),spender_subaccount:t.Opt(r),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:n}),K=t.Variant({GenericError:t.Record({message:t.Text,error_code:t.Nat}),TemporarilyUnavailable:t.Null,InsufficientAllowance:t.Record({allowance:n}),BadBurn:t.Record({min_burn_amount:n}),Duplicate:t.Record({duplicate_of:s}),BadFee:t.Record({expected_fee:n}),CreatedInFuture:t.Record({ledger_time:o}),TooOld:t.Null,InsufficientFunds:t.Record({balance:n})}),I=t.Variant({Ok:s,Err:K});return t.Service({archives:t.Func([],[t.Vec(N)],[]),get_blocks:t.Func([u],[P],[]),get_data_certificate:t.Func([],[B],[]),get_transactions:t.Func([A],[M],[]),icrc1_balance_of:t.Func([e],[n],[]),icrc1_decimals:t.Func([],[t.Nat8],[]),icrc1_fee:t.Func([],[n],[]),icrc1_metadata:t.Func([],[t.Vec(t.Tuple(t.Text,c))],[]),icrc1_minting_account:t.Func([],[t.Opt(e)],[]),icrc1_name:t.Func([],[t.Text],[]),icrc1_supported_standards:t.Func([],[t.Vec(z)],[]),icrc1_symbol:t.Func([],[t.Text],[]),icrc1_total_supply:t.Func([],[n],[]),icrc1_transfer:t.Func([Q],[W],[]),icrc2_allowance:t.Func([Z],[$],[]),icrc2_approve:t.Func([X],[Y],[]),icrc2_transfer_from:t.Func([J],[I],[])})};var ot=({IDL:t})=>{let a=t.Rec(),c=t.Variant({Int:t.Int,Nat:t.Nat,Blob:t.Vec(t.Nat8),Text:t.Text}),r=t.Vec(t.Nat8),e=t.Record({owner:t.Principal,subaccount:t.Opt(r)}),i=t.Variant({SetTo:e,Unset:t.Null}),p=t.Record({icrc2:t.Bool}),_=t.Record({token_symbol:t.Opt(t.Text),transfer_fee:t.Opt(t.Nat),metadata:t.Opt(t.Vec(t.Tuple(t.Text,c))),maximum_number_of_accounts:t.Opt(t.Nat64),accounts_overflow_trim_quantity:t.Opt(t.Nat64),change_fee_collector:t.Opt(i),max_memo_length:t.Opt(t.Nat16),token_name:t.Opt(t.Text),feature_flags:t.Opt(p)}),f=t.Record({decimals:t.Opt(t.Nat8),token_symbol:t.Text,transfer_fee:t.Nat,metadata:t.Vec(t.Tuple(t.Text,c)),minting_account:e,initial_balances:t.Vec(t.Tuple(e,t.Nat)),maximum_number_of_accounts:t.Opt(t.Nat64),accounts_overflow_trim_quantity:t.Opt(t.Nat64),fee_collector_account:t.Opt(e),archive_options:t.Record({num_blocks_to_archive:t.Nat64,max_transactions_per_response:t.Opt(t.Nat64),trigger_threshold:t.Nat64,max_message_size_bytes:t.Opt(t.Nat64),cycles_for_archive_creation:t.Opt(t.Nat64),node_max_memory_size_bytes:t.Opt(t.Nat64),controller_id:t.Principal}),max_memo_length:t.Opt(t.Nat16),token_name:t.Text,feature_flags:t.Opt(p)}),y=t.Variant({Upgrade:t.Opt(_),Init:f}),s=t.Nat,N=t.Record({block_range_end:s,canister_id:t.Principal,block_range_start:s}),u=t.Record({start:s,length:t.Nat}),O=t.Vec(t.Tuple(t.Text,a));a.fill(t.Variant({Int:t.Int,Map:O,Nat:t.Nat,Nat64:t.Nat64,Blob:t.Vec(t.Nat8),Text:t.Text,Array:t.Vec(a)}));let d=a,g=t.Record({blocks:t.Vec(d)}),w=t.Func([u],[g],["query"]),P=t.Record({certificate:t.Opt(t.Vec(t.Nat8)),first_index:s,blocks:t.Vec(d),chain_length:t.Nat64,archived_blocks:t.Vec(t.Record({callback:w,start:s,length:t.Nat}))}),B=t.Record({certificate:t.Opt(t.Vec(t.Nat8)),hash_tree:t.Vec(t.Nat8)}),T=t.Nat,A=t.Record({start:T,length:t.Nat}),o=t.Nat64,E=t.Record({from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat,spender:t.Opt(e)}),S=t.Record({to:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat}),G=t.Record({fee:t.Opt(t.Nat),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat,expected_allowance:t.Opt(t.Nat),expires_at:t.Opt(o),spender:e}),C=t.Record({to:e,fee:t.Opt(t.Nat),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat,spender:t.Opt(e)}),V=t.Record({burn:t.Opt(E),kind:t.Text,mint:t.Opt(S),approve:t.Opt(G),timestamp:o,transfer:t.Opt(C)}),q=t.Record({transactions:t.Vec(V)}),U=t.Func([A],[q],["query"]),M=t.Record({first_index:T,log_length:t.Nat,transactions:t.Vec(V),archived_transactions:t.Vec(t.Record({callback:U,start:T,length:t.Nat}))}),n=t.Nat,z=t.Record({url:t.Text,name:t.Text}),Q=t.Record({to:e,fee:t.Opt(n),memo:t.Opt(t.Vec(t.Nat8)),from_subaccount:t.Opt(r),created_at_time:t.Opt(o),amount:n}),H=t.Variant({GenericError:t.Record({message:t.Text,error_code:t.Nat}),TemporarilyUnavailable:t.Null,BadBurn:t.Record({min_burn_amount:n}),Duplicate:t.Record({duplicate_of:s}),BadFee:t.Record({expected_fee:n}),CreatedInFuture:t.Record({ledger_time:o}),TooOld:t.Null,InsufficientFunds:t.Record({balance:n})}),W=t.Variant({Ok:s,Err:H}),Z=t.Record({account:e,spender:e}),$=t.Record({allowance:t.Nat,expires_at:t.Opt(o)}),X=t.Record({fee:t.Opt(t.Nat),memo:t.Opt(t.Vec(t.Nat8)),from_subaccount:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:t.Nat,expected_allowance:t.Opt(t.Nat),expires_at:t.Opt(o),spender:e}),j=t.Variant({GenericError:t.Record({message:t.Text,error_code:t.Nat}),TemporarilyUnavailable:t.Null,Duplicate:t.Record({duplicate_of:s}),BadFee:t.Record({expected_fee:t.Nat}),AllowanceChanged:t.Record({current_allowance:t.Nat}),CreatedInFuture:t.Record({ledger_time:o}),TooOld:t.Null,Expired:t.Record({ledger_time:o}),InsufficientFunds:t.Record({balance:t.Nat})}),Y=t.Variant({Ok:s,Err:j}),J=t.Record({to:e,fee:t.Opt(n),spender_subaccount:t.Opt(r),from:e,memo:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(o),amount:n}),K=t.Variant({GenericError:t.Record({message:t.Text,error_code:t.Nat}),TemporarilyUnavailable:t.Null,InsufficientAllowance:t.Record({allowance:n}),BadBurn:t.Record({min_burn_amount:n}),Duplicate:t.Record({duplicate_of:s}),BadFee:t.Record({expected_fee:n}),CreatedInFuture:t.Record({ledger_time:o}),TooOld:t.Null,InsufficientFunds:t.Record({balance:n})}),I=t.Variant({Ok:s,Err:K});return t.Service({archives:t.Func([],[t.Vec(N)],["query"]),get_blocks:t.Func([u],[P],["query"]),get_data_certificate:t.Func([],[B],["query"]),get_transactions:t.Func([A],[M],["query"]),icrc1_balance_of:t.Func([e],[n],["query"]),icrc1_decimals:t.Func([],[t.Nat8],["query"]),icrc1_fee:t.Func([],[n],["query"]),icrc1_metadata:t.Func([],[t.Vec(t.Tuple(t.Text,c))],["query"]),icrc1_minting_account:t.Func([],[t.Opt(e)],["query"]),icrc1_name:t.Func([],[t.Text],["query"]),icrc1_supported_standards:t.Func([],[t.Vec(z)],["query"]),icrc1_symbol:t.Func([],[t.Text],["query"]),icrc1_total_supply:t.Func([],[n],["query"]),icrc1_transfer:t.Func([Q],[W],[]),icrc2_allowance:t.Func([Z],[$],["query"]),icrc2_approve:t.Func([X],[Y],[]),icrc2_transfer_from:t.Func([J],[I],[])})};var l=require("@dfinity/utils"),nt=({from_subaccount:t,fee:a,created_at_time:c,memo:r,...e})=>({...e,fee:(0,l.toNullable)(a),memo:(0,l.toNullable)(r),from_subaccount:(0,l.toNullable)(t),created_at_time:(0,l.toNullable)(c)}),st=({spender_subaccount:t,fee:a,created_at_time:c,memo:r,...e})=>({...e,fee:(0,l.toNullable)(a),memo:(0,l.toNullable)(r),spender_subaccount:(0,l.toNullable)(t),created_at_time:(0,l.toNullable)(c)}),it=({fee:t,created_at_time:a,memo:c,from_subaccount:r,expected_allowance:e,expires_at:i,...p})=>({...p,fee:(0,l.toNullable)(t),memo:(0,l.toNullable)(c),from_subaccount:(0,l.toNullable)(r),created_at_time:(0,l.toNullable)(a),expected_allowance:(0,l.toNullable)(e),expires_at:(0,l.toNullable)(i)});var v=class t extends R.Canister{constructor(){super(...arguments);this.metadata=c=>this.caller(c).icrc1_metadata();this.transactionFee=c=>this.caller(c).icrc1_fee();this.balance=c=>this.caller({certified:c.certified}).icrc1_balance_of({owner:c.owner,subaccount:(0,R.toNullable)(c.subaccount)});this.transfer=async c=>{let r=await this.caller({certified:!0}).icrc1_transfer(nt(c));if("Err"in r)throw new x({errorType:r.Err,msg:"Failed to transfer"});return r.Ok};this.totalTokensSupply=c=>this.caller(c).icrc1_total_supply();this.transferFrom=async c=>{let r=await this.caller({certified:!0}).icrc2_transfer_from(st(c));if("Err"in r)throw new x({errorType:r.Err,msg:"Failed to transfer from"});return r.Ok};this.approve=async c=>{let r=await this.caller({certified:!0}).icrc2_approve(it(c));if("Err"in r)throw new x({errorType:r.Err,msg:"Failed to entitle the spender to transfer the amount"});return r.Ok};this.allowance=async c=>{let{certified:r,...e}=c;return this.caller({certified:r}).icrc2_allowance({...e})}}static create(c){let{service:r,certifiedService:e,canisterId:i}=(0,R.createServices)({options:c,idlFactory:ot,certifiedIdlFactory:at});return new t(i,r,e)}};var pt=(i=>(i.SYMBOL="icrc1:symbol",i.NAME="icrc1:name",i.DECIMALS="icrc1:decimals",i.FEE="icrc1:fee",i.LOGO="icrc1:logo",i))(pt||{});var tt=require("@dfinity/principal"),m=require("@dfinity/utils"),gt=64,Tt=({owner:t,subaccount:a})=>{if((0,m.isNullish)(a))return t.toText();let r=(e=>e.replace(/^0+/,""))((0,m.uint8ArrayToHexString)(Uint8Array.from(a)));return r.length===0?t.toText():`${t.toText()}-${lt({owner:t,subaccount:a})}.${r}`},lt=({owner:t,subaccount:a})=>{let c=(0,m.bigEndianCrc32)(Uint8Array.from([...t.toUint8Array(),...a]));return(0,m.encodeBase32)(c)},xt=t=>{let[a,c]=t.split(".");if(!(0,m.notEmptyString)(a))throw new Error("Invalid account. No string provided.");if((0,m.isNullish)(c))return{owner:tt.Principal.fromText(t)};let[r,...e]=a.split("-").reverse(),i=e.reverse().join("-"),p={owner:tt.Principal.fromText(i),subaccount:(0,m.hexStringToUint8Array)(c.padStart(gt,"0"))};if(lt(p)!==r)throw new Error("Invalid account. Invalid checksum.");return p};var k=require("@dfinity/utils"),Rt=t=>{let a=/^([a-zA-Z]+):([A-Za-z0-9:\-.]+).*?(?:[?&](?:amount|value)=(\d+(?:\.\d+)?))?$/,c=t.match(a);if((0,k.isNullish)(c))return;let[r,e,i,p]=c;return{token:e,identifier:i,...(0,k.nonNullish)(p)&&!isNaN(parseFloat(p))&&{amount:parseFloat(p)}}};0&&(module.exports={IcrcIndexCanister,IcrcLedgerCanister,IcrcMetadataResponseEntries,IcrcTransferError,IndexError,decodeIcrcAccount,decodePayment,encodeIcrcAccount});
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts", "../../src/errors/index.errors.ts", "../../src/errors/ledger.errors.ts", "../../src/index.canister.ts", "../../candid/icrc_index.certified.idl.js", "../../candid/icrc_index.idl.js", "../../src/converters/index.converters.ts", "../../src/ledger.canister.ts", "../../candid/icrc_ledger.certified.idl.js", "../../candid/icrc_ledger.idl.js", "../../src/converters/ledger.converters.ts", "../../src/types/ledger.responses.ts", "../../src/utils/ledger.utils.ts", "../../src/utils/payment.utils.ts"],
|
|
4
|
-
"sourcesContent": ["export type {\n GetTransactions as IcrcGetTransactions,\n Transaction as IcrcTransaction,\n TransactionWithId as IcrcTransactionWithId,\n TxId as IcrcTxId,\n} from \"../candid/icrc_index\";\nexport type {\n BlockIndex as IcrcBlockIndex,\n Subaccount as IcrcSubaccount,\n Tokens as IcrcTokens,\n TransferArg as IcrcTransferArg,\n TransferError as IcrcTransferVariatError,\n Value as IcrcValue,\n} from \"../candid/icrc_ledger\";\nexport * from \"./errors/index.errors\";\nexport * from \"./errors/ledger.errors\";\nexport { IcrcIndexCanister } from \"./index.canister\";\nexport { IcrcLedgerCanister } from \"./ledger.canister\";\nexport * from \"./types/index.params\";\nexport * from \"./types/ledger.params\";\nexport * from \"./types/ledger.responses\";\nexport * from \"./utils/ledger.utils\";\nexport * from \"./utils/payment.utils\";\n", "export class IndexError extends Error {}\n", "export 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", "import { Canister, createServices } from \"@dfinity/utils\";\nimport type {\n GetTransactions,\n _SERVICE as IcrcIndexService,\n} from \"../candid/icrc_index\";\nimport { idlFactory as certifiedIdlFactory } from \"../candid/icrc_index.certified.idl\";\nimport { idlFactory } from \"../candid/icrc_index.idl\";\nimport { toGetTransactionsArgs } from \"./converters/index.converters\";\nimport { IndexError } from \"./errors/index.errors\";\nimport type { IcrcLedgerCanisterOptions } from \"./types/canister.options\";\nimport type { GetAccountTransactionsParams } from \"./types/index.params\";\n\nexport class IcrcIndexCanister extends Canister<IcrcIndexService> {\n static create(options: IcrcLedgerCanisterOptions<IcrcIndexService>) {\n const { service, certifiedService, canisterId } =\n createServices<IcrcIndexService>({\n options,\n idlFactory,\n certifiedIdlFactory,\n });\n\n return new IcrcIndexCanister(canisterId, service, certifiedService);\n }\n\n /**\n * Get the transactions of an account\n *\n * Always certified.\n * `get_account_transactions` needs to be called with an update\n * because the index canisters makes a call to the ledger canister to get the transaction data.\n * Index Canister only holds the transactions ids in state, not the whole transaction data.\n */\n getTransactions = async (\n params: GetAccountTransactionsParams,\n ): Promise<GetTransactions> => {\n const response = await this.caller({\n certified: true,\n }).get_account_transactions(toGetTransactionsArgs(params));\n\n if (\"Err\" in response) {\n throw new IndexError(response.Err.message);\n }\n\n return response.Ok;\n };\n}\n", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/ledger-icrc/candid/icrc_index.did */\nexport const idlFactory = ({ IDL }) => {\n const InitArgs = IDL.Record({ 'ledger_id' : IDL.Principal });\n const TxId = IDL.Nat;\n const Account = IDL.Record({\n 'owner' : IDL.Principal,\n 'subaccount' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n });\n const GetAccountTransactionsArgs = IDL.Record({\n 'max_results' : IDL.Nat,\n 'start' : IDL.Opt(TxId),\n 'account' : Account,\n });\n const Burn = IDL.Record({\n 'from' : Account,\n 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'created_at_time' : IDL.Opt(IDL.Nat64),\n 'amount' : IDL.Nat,\n 'spender' : IDL.Opt(Account),\n });\n const Mint = IDL.Record({\n 'to' : Account,\n 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'created_at_time' : IDL.Opt(IDL.Nat64),\n 'amount' : IDL.Nat,\n });\n const Approve = IDL.Record({\n 'fee' : IDL.Opt(IDL.Nat),\n 'from' : Account,\n 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'created_at_time' : IDL.Opt(IDL.Nat64),\n 'amount' : IDL.Nat,\n 'expected_allowance' : IDL.Opt(IDL.Nat),\n 'expires_at' : IDL.Opt(IDL.Nat64),\n 'spender' : Account,\n });\n const Transfer = IDL.Record({\n 'to' : Account,\n 'fee' : IDL.Opt(IDL.Nat),\n 'from' : Account,\n 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'created_at_time' : IDL.Opt(IDL.Nat64),\n 'amount' : IDL.Nat,\n 'spender' : IDL.Opt(Account),\n });\n const Transaction = IDL.Record({\n 'burn' : IDL.Opt(Burn),\n 'kind' : IDL.Text,\n 'mint' : IDL.Opt(Mint),\n 'approve' : IDL.Opt(Approve),\n 'timestamp' : IDL.Nat64,\n 'transfer' : IDL.Opt(Transfer),\n });\n const TransactionWithId = IDL.Record({\n 'id' : TxId,\n 'transaction' : Transaction,\n });\n const GetTransactions = IDL.Record({\n 'transactions' : IDL.Vec(TransactionWithId),\n 'oldest_tx_id' : IDL.Opt(TxId),\n });\n const GetTransactionsErr = IDL.Record({ 'message' : IDL.Text });\n const GetTransactionsResult = IDL.Variant({\n 'Ok' : GetTransactions,\n 'Err' : GetTransactionsErr,\n });\n const SubAccount = IDL.Vec(IDL.Nat8);\n const ListSubaccountsArgs = IDL.Record({\n 'owner' : IDL.Principal,\n 'start' : IDL.Opt(SubAccount),\n });\n return IDL.Service({\n 'get_account_transactions' : IDL.Func(\n [GetAccountTransactionsArgs],\n [GetTransactionsResult],\n [],\n ),\n 'ledger_id' : IDL.Func([], [IDL.Principal], []),\n 'list_subaccounts' : IDL.Func(\n [ListSubaccountsArgs],\n [IDL.Vec(SubAccount)],\n [],\n ),\n });\n};\nexport const init = ({ IDL }) => {\n const InitArgs = IDL.Record({ 'ledger_id' : IDL.Principal });\n return [InitArgs];\n};\n", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/ledger-icrc/candid/icrc_index.did */\nexport const idlFactory = ({ IDL }) => {\n const InitArgs = IDL.Record({ 'ledger_id' : IDL.Principal });\n const TxId = IDL.Nat;\n const Account = IDL.Record({\n 'owner' : IDL.Principal,\n 'subaccount' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n });\n const GetAccountTransactionsArgs = IDL.Record({\n 'max_results' : IDL.Nat,\n 'start' : IDL.Opt(TxId),\n 'account' : Account,\n });\n const Burn = IDL.Record({\n 'from' : Account,\n 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'created_at_time' : IDL.Opt(IDL.Nat64),\n 'amount' : IDL.Nat,\n 'spender' : IDL.Opt(Account),\n });\n const Mint = IDL.Record({\n 'to' : Account,\n 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'created_at_time' : IDL.Opt(IDL.Nat64),\n 'amount' : IDL.Nat,\n });\n const Approve = IDL.Record({\n 'fee' : IDL.Opt(IDL.Nat),\n 'from' : Account,\n 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'created_at_time' : IDL.Opt(IDL.Nat64),\n 'amount' : IDL.Nat,\n 'expected_allowance' : IDL.Opt(IDL.Nat),\n 'expires_at' : IDL.Opt(IDL.Nat64),\n 'spender' : Account,\n });\n const Transfer = IDL.Record({\n 'to' : Account,\n 'fee' : IDL.Opt(IDL.Nat),\n 'from' : Account,\n 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'created_at_time' : IDL.Opt(IDL.Nat64),\n 'amount' : IDL.Nat,\n 'spender' : IDL.Opt(Account),\n });\n const Transaction = IDL.Record({\n 'burn' : IDL.Opt(Burn),\n 'kind' : IDL.Text,\n 'mint' : IDL.Opt(Mint),\n 'approve' : IDL.Opt(Approve),\n 'timestamp' : IDL.Nat64,\n 'transfer' : IDL.Opt(Transfer),\n });\n const TransactionWithId = IDL.Record({\n 'id' : TxId,\n 'transaction' : Transaction,\n });\n const GetTransactions = IDL.Record({\n 'transactions' : IDL.Vec(TransactionWithId),\n 'oldest_tx_id' : IDL.Opt(TxId),\n });\n const GetTransactionsErr = IDL.Record({ 'message' : IDL.Text });\n const GetTransactionsResult = IDL.Variant({\n 'Ok' : GetTransactions,\n 'Err' : GetTransactionsErr,\n });\n const SubAccount = IDL.Vec(IDL.Nat8);\n const ListSubaccountsArgs = IDL.Record({\n 'owner' : IDL.Principal,\n 'start' : IDL.Opt(SubAccount),\n });\n return IDL.Service({\n 'get_account_transactions' : IDL.Func(\n [GetAccountTransactionsArgs],\n [GetTransactionsResult],\n [],\n ),\n 'ledger_id' : IDL.Func([], [IDL.Principal], ['query']),\n 'list_subaccounts' : IDL.Func(\n [ListSubaccountsArgs],\n [IDL.Vec(SubAccount)],\n ['query'],\n ),\n });\n};\nexport const init = ({ IDL }) => {\n const InitArgs = IDL.Record({ 'ledger_id' : IDL.Principal });\n return [InitArgs];\n};\n", "import { toNullable } from \"@dfinity/utils\";\nimport type {\n Account,\n GetAccountTransactionsArgs,\n} from \"../../candid/icrc_index\";\nimport type { GetAccountTransactionsParams } from \"../types/index.params\";\nimport type { IcrcAccount } from \"../types/ledger.responses\";\n\nconst toCandidAccount = ({ owner, subaccount }: IcrcAccount): Account => ({\n owner,\n subaccount: toNullable(subaccount),\n});\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", "import type { QueryParams } from \"@dfinity/utils\";\nimport { Canister, createServices, toNullable } from \"@dfinity/utils\";\nimport type {\n Allowance,\n BlockIndex,\n _SERVICE as IcrcLedgerService,\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 toTransferArg,\n toTransferFromArgs,\n} from \"./converters/ledger.converters\";\nimport { IcrcTransferError } from \"./errors/ledger.errors\";\nimport type { IcrcLedgerCanisterOptions } from \"./types/canister.options\";\nimport type {\n AllowanceParams,\n ApproveParams,\n BalanceParams,\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 return this.caller(params).icrc1_total_supply();\n };\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 = async (params: AllowanceParams): Promise<Allowance> => {\n const { certified, ...rest } = params;\n return this.caller({ certified }).icrc2_allowance({ ...rest });\n };\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 Value = IDL.Rec();\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 '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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\n 'change_fee_collector' : IDL.Opt(ChangeFeeCollector),\n 'max_memo_length' : IDL.Opt(IDL.Nat16),\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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\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 '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 '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 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 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 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 return IDL.Service({\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 '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 '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 });\n};\nexport const init = ({ IDL }) => {\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 '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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\n 'change_fee_collector' : IDL.Opt(ChangeFeeCollector),\n 'max_memo_length' : IDL.Opt(IDL.Nat16),\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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\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 '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 '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 Value = IDL.Rec();\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 '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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\n 'change_fee_collector' : IDL.Opt(ChangeFeeCollector),\n 'max_memo_length' : IDL.Opt(IDL.Nat16),\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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\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 '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 '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 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 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 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 return IDL.Service({\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 '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 '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 });\n};\nexport const init = ({ IDL }) => {\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 '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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\n 'change_fee_collector' : IDL.Opt(ChangeFeeCollector),\n 'max_memo_length' : IDL.Opt(IDL.Nat16),\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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\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 '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 '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 { toNullable } from \"@dfinity/utils\";\nimport type {\n ApproveArgs,\n TransferArg,\n TransferFromArgs,\n} from \"../../candid/icrc_ledger\";\nimport type {\n ApproveParams,\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", "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", "import { Principal } from \"@dfinity/principal\";\nimport {\n bigEndianCrc32,\n encodeBase32,\n hexStringToUint8Array,\n isNullish,\n notEmptyString,\n uint8ArrayToHexString,\n} from \"@dfinity/utils\";\nimport type { IcrcAccount } 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] = accountString.split(\".\");\n\n if (!notEmptyString(principalAndMaybeCheckSum)) {\n throw new Error(\"Invalid account. No string provided.\");\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", "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 // eslint-disable-next-line @typescript-eslint/no-unused-vars\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": "mbAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,uBAAAE,EAAA,uBAAAC,EAAA,gCAAAC,GAAA,sBAAAC,EAAA,eAAAC,EAAA,sBAAAC,GAAA,kBAAAC,GAAA,sBAAAC,KAAA,eAAAC,GAAAV,ICAO,IAAMW,EAAN,cAAyB,KAAM,CAAC,ECAhC,IAAMC,EAAN,cAAmC,KAAM,CAE9C,YAAY,CAAE,IAAAC,EAAK,UAAAC,CAAU,EAAmC,CAC9D,MAAMD,CAAG,EACT,KAAK,UAAYC,CACnB,CACF,ECNA,IAAAC,EAAyC,0BCClC,IAAMC,GAAa,CAAC,CAAE,IAAAC,CAAI,IAAM,CACrC,IAAMC,EAAWD,EAAI,OAAO,CAAE,UAAcA,EAAI,SAAU,CAAC,EACr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CACzB,EAUaC,GAAqBC,GAAuC,CACvE,GAAM,CAACC,EAA2BC,CAAa,EAAIF,EAAc,MAAM,GAAG,EAE1E,GAAI,IAAC,kBAAeC,CAAyB,EAC3C,MAAM,IAAI,MAAM,sCAAsC,EAGxD,MAAI,aAAUC,CAAa,EACzB,MAAO,CACL,MAAO,YAAU,SAASF,CAAa,CACzC,EAGF,GAAM,CAACG,EAAU,GAAGC,CAAI,EAAIH,EAA0B,MAAM,GAAG,EAAE,QAAQ,EACnEI,EAAgBD,EAAK,QAAQ,EAAE,KAAK,GAAG,EAEvCE,EAAU,CACd,MAAO,YAAU,SAASD,CAAa,EACvC,cAAY,yBACVH,EAAc,SAASX,GAA2B,GAAG,CACvD,CACF,EAIA,GAFgBM,GAAUS,CAAO,IAEjBH,EACd,MAAM,IAAI,MAAM,oCAAoC,EAGtD,OAAOG,CACT,EC1FA,IAAAC,EAAsC,0BAyBzBC,GACXC,GACuE,CACvE,IAAMC,EACJ,+EAEIC,EAAQF,EAAK,MAAMC,CAAK,EAC9B,MAAI,aAAUC,CAAK,EACjB,OAIF,GAAM,CAACC,EAAGC,EAAOC,EAAYC,CAAM,EAAIJ,EAEvC,MAAO,CACL,MAAAE,EACA,WAAAC,EACA,MAAI,cAAWC,CAAM,GACnB,CAAC,MAAM,WAAWA,CAAM,CAAC,GAAK,CAAE,OAAQ,WAAWA,CAAM,CAAE,CAC/D,CACF",
|
|
6
|
-
"names": ["src_exports", "__export", "IcrcIndexCanister", "IcrcLedgerCanister", "IcrcMetadataResponseEntries", "IcrcTransferError", "IndexError", "decodeIcrcAccount", "decodePayment", "encodeIcrcAccount", "__toCommonJS", "IndexError", "IcrcTransferError", "msg", "errorType", "import_utils", "idlFactory", "IDL", "InitArgs", "TxId", "Account", "GetAccountTransactionsArgs", "Burn", "Mint", "Approve", "Transfer", "Transaction", "TransactionWithId", "GetTransactions", "GetTransactionsErr", "GetTransactionsResult", "SubAccount", "ListSubaccountsArgs", "idlFactory", "IDL", "InitArgs", "TxId", "Account", "GetAccountTransactionsArgs", "Burn", "Mint", "Approve", "Transfer", "Transaction", "TransactionWithId", "GetTransactions", "GetTransactionsErr", "GetTransactionsResult", "SubAccount", "ListSubaccountsArgs", "import_utils", "toCandidAccount", "owner", "subaccount", "toGetTransactionsArgs", "account", "max_results", "start", "IcrcIndexCanister", "_IcrcIndexCanister", "params", "response", "toGetTransactionsArgs", "IndexError", "options", "service", "certifiedService", "canisterId", "idlFactory", "import_utils", "idlFactory", "IDL", "Value", "MetadataValue", "Subaccount", "Account", "ChangeFeeCollector", "FeatureFlags", "UpgradeArgs", "InitArgs", "LedgerArg", "BlockIndex", "GetBlocksArgs", "Map", "Block", "BlockRange", "QueryBlockArchiveFn", "GetBlocksResponse", "DataCertificate", "TxIndex", "GetTransactionsRequest", "Timestamp", "Burn", "Mint", "Approve", "Transfer", "Transaction", "TransactionRange", "QueryArchiveFn", "GetTransactionsResponse", "Tokens", "StandardRecord", "TransferArg", "TransferError", "TransferResult", "AllowanceArgs", "Allowance", "ApproveArgs", "ApproveError", "ApproveResult", "TransferFromArgs", "TransferFromError", "TransferFromResult", "idlFactory", "IDL", "Value", "MetadataValue", "Subaccount", "Account", "ChangeFeeCollector", "FeatureFlags", "UpgradeArgs", "InitArgs", "LedgerArg", "BlockIndex", "GetBlocksArgs", "Map", "Block", "BlockRange", "QueryBlockArchiveFn", "GetBlocksResponse", "DataCertificate", "TxIndex", "GetTransactionsRequest", "Timestamp", "Burn", "Mint", "Approve", "Transfer", "Transaction", "TransactionRange", "QueryArchiveFn", "GetTransactionsResponse", "Tokens", "StandardRecord", "TransferArg", "TransferError", "TransferResult", "AllowanceArgs", "Allowance", "ApproveArgs", "ApproveError", "ApproveResult", "TransferFromArgs", "TransferFromError", "TransferFromResult", "import_utils", "toTransferArg", "from_subaccount", "fee", "created_at_time", "memo", "rest", "toTransferFromArgs", "spender_subaccount", "toApproveArgs", "expected_allowance", "expires_at", "IcrcLedgerCanister", "_IcrcLedgerCanister", "params", "response", "toTransferArg", "IcrcTransferError", "toTransferFromArgs", "toApproveArgs", "certified", "rest", "options", "service", "certifiedService", "canisterId", "idlFactory", "IcrcMetadataResponseEntries", "import_principal", "import_utils", "MAX_SUBACCOUNT_HEX_LENGTH", "encodeIcrcAccount", "owner", "subaccount", "subaccountText", "text", "encodeCrc", "crc", "decodeIcrcAccount", "accountString", "principalAndMaybeCheckSum", "subaccountHex", "checksum", "rest", "principalText", "account", "import_utils", "decodePayment", "code", "regex", "match", "_", "token", "identifier", "amount"]
|
|
4
|
+
"sourcesContent": ["export type {\n GetTransactions as IcrcGetTransactions,\n Transaction as IcrcTransaction,\n TransactionWithId as IcrcTransactionWithId,\n TxId as IcrcTxId,\n} from \"../candid/icrc_index\";\nexport type {\n BlockIndex as IcrcBlockIndex,\n Subaccount as IcrcSubaccount,\n Tokens as IcrcTokens,\n TransferArg as IcrcTransferArg,\n TransferError as IcrcTransferVariatError,\n Value as IcrcValue,\n} from \"../candid/icrc_ledger\";\nexport * from \"./errors/index.errors\";\nexport * from \"./errors/ledger.errors\";\nexport { IcrcIndexCanister } from \"./index.canister\";\nexport { IcrcLedgerCanister } from \"./ledger.canister\";\nexport * from \"./types/index.params\";\nexport * from \"./types/ledger.params\";\nexport * from \"./types/ledger.responses\";\nexport * from \"./utils/ledger.utils\";\nexport * from \"./utils/payment.utils\";\n", "export class IndexError extends Error {}\n", "export 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", "import { Canister, createServices } from \"@dfinity/utils\";\nimport type {\n GetTransactions,\n _SERVICE as IcrcIndexService,\n} from \"../candid/icrc_index\";\nimport { idlFactory as certifiedIdlFactory } from \"../candid/icrc_index.certified.idl\";\nimport { idlFactory } from \"../candid/icrc_index.idl\";\nimport { toGetTransactionsArgs } from \"./converters/index.converters\";\nimport { IndexError } from \"./errors/index.errors\";\nimport type { IcrcLedgerCanisterOptions } from \"./types/canister.options\";\nimport type { GetAccountTransactionsParams } from \"./types/index.params\";\n\nexport class IcrcIndexCanister extends Canister<IcrcIndexService> {\n static create(options: IcrcLedgerCanisterOptions<IcrcIndexService>) {\n const { service, certifiedService, canisterId } =\n createServices<IcrcIndexService>({\n options,\n idlFactory,\n certifiedIdlFactory,\n });\n\n return new IcrcIndexCanister(canisterId, service, certifiedService);\n }\n\n /**\n * Get the transactions of an account\n *\n * Always certified.\n * `get_account_transactions` needs to be called with an update\n * because the index canisters makes a call to the ledger canister to get the transaction data.\n * Index Canister only holds the transactions ids in state, not the whole transaction data.\n */\n getTransactions = async (\n params: GetAccountTransactionsParams,\n ): Promise<GetTransactions> => {\n const response = await this.caller({\n certified: true,\n }).get_account_transactions(toGetTransactionsArgs(params));\n\n if (\"Err\" in response) {\n throw new IndexError(response.Err.message);\n }\n\n return response.Ok;\n };\n}\n", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/ledger-icrc/candid/icrc_index.did */\nexport const idlFactory = ({ IDL }) => {\n const InitArgs = IDL.Record({ 'ledger_id' : IDL.Principal });\n const TxId = IDL.Nat;\n const Account = IDL.Record({\n 'owner' : IDL.Principal,\n 'subaccount' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n });\n const GetAccountTransactionsArgs = IDL.Record({\n 'max_results' : IDL.Nat,\n 'start' : IDL.Opt(TxId),\n 'account' : Account,\n });\n const Burn = IDL.Record({\n 'from' : Account,\n 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'created_at_time' : IDL.Opt(IDL.Nat64),\n 'amount' : IDL.Nat,\n 'spender' : IDL.Opt(Account),\n });\n const Mint = IDL.Record({\n 'to' : Account,\n 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'created_at_time' : IDL.Opt(IDL.Nat64),\n 'amount' : IDL.Nat,\n });\n const Approve = IDL.Record({\n 'fee' : IDL.Opt(IDL.Nat),\n 'from' : Account,\n 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'created_at_time' : IDL.Opt(IDL.Nat64),\n 'amount' : IDL.Nat,\n 'expected_allowance' : IDL.Opt(IDL.Nat),\n 'expires_at' : IDL.Opt(IDL.Nat64),\n 'spender' : Account,\n });\n const Transfer = IDL.Record({\n 'to' : Account,\n 'fee' : IDL.Opt(IDL.Nat),\n 'from' : Account,\n 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'created_at_time' : IDL.Opt(IDL.Nat64),\n 'amount' : IDL.Nat,\n 'spender' : IDL.Opt(Account),\n });\n const Transaction = IDL.Record({\n 'burn' : IDL.Opt(Burn),\n 'kind' : IDL.Text,\n 'mint' : IDL.Opt(Mint),\n 'approve' : IDL.Opt(Approve),\n 'timestamp' : IDL.Nat64,\n 'transfer' : IDL.Opt(Transfer),\n });\n const TransactionWithId = IDL.Record({\n 'id' : TxId,\n 'transaction' : Transaction,\n });\n const GetTransactions = IDL.Record({\n 'transactions' : IDL.Vec(TransactionWithId),\n 'oldest_tx_id' : IDL.Opt(TxId),\n });\n const GetTransactionsErr = IDL.Record({ 'message' : IDL.Text });\n const GetTransactionsResult = IDL.Variant({\n 'Ok' : GetTransactions,\n 'Err' : GetTransactionsErr,\n });\n const SubAccount = IDL.Vec(IDL.Nat8);\n const ListSubaccountsArgs = IDL.Record({\n 'owner' : IDL.Principal,\n 'start' : IDL.Opt(SubAccount),\n });\n return IDL.Service({\n 'get_account_transactions' : IDL.Func(\n [GetAccountTransactionsArgs],\n [GetTransactionsResult],\n [],\n ),\n 'ledger_id' : IDL.Func([], [IDL.Principal], []),\n 'list_subaccounts' : IDL.Func(\n [ListSubaccountsArgs],\n [IDL.Vec(SubAccount)],\n [],\n ),\n });\n};\nexport const init = ({ IDL }) => {\n const InitArgs = IDL.Record({ 'ledger_id' : IDL.Principal });\n return [InitArgs];\n};\n", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/ledger-icrc/candid/icrc_index.did */\nexport const idlFactory = ({ IDL }) => {\n const InitArgs = IDL.Record({ 'ledger_id' : IDL.Principal });\n const TxId = IDL.Nat;\n const Account = IDL.Record({\n 'owner' : IDL.Principal,\n 'subaccount' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n });\n const GetAccountTransactionsArgs = IDL.Record({\n 'max_results' : IDL.Nat,\n 'start' : IDL.Opt(TxId),\n 'account' : Account,\n });\n const Burn = IDL.Record({\n 'from' : Account,\n 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'created_at_time' : IDL.Opt(IDL.Nat64),\n 'amount' : IDL.Nat,\n 'spender' : IDL.Opt(Account),\n });\n const Mint = IDL.Record({\n 'to' : Account,\n 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'created_at_time' : IDL.Opt(IDL.Nat64),\n 'amount' : IDL.Nat,\n });\n const Approve = IDL.Record({\n 'fee' : IDL.Opt(IDL.Nat),\n 'from' : Account,\n 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'created_at_time' : IDL.Opt(IDL.Nat64),\n 'amount' : IDL.Nat,\n 'expected_allowance' : IDL.Opt(IDL.Nat),\n 'expires_at' : IDL.Opt(IDL.Nat64),\n 'spender' : Account,\n });\n const Transfer = IDL.Record({\n 'to' : Account,\n 'fee' : IDL.Opt(IDL.Nat),\n 'from' : Account,\n 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'created_at_time' : IDL.Opt(IDL.Nat64),\n 'amount' : IDL.Nat,\n 'spender' : IDL.Opt(Account),\n });\n const Transaction = IDL.Record({\n 'burn' : IDL.Opt(Burn),\n 'kind' : IDL.Text,\n 'mint' : IDL.Opt(Mint),\n 'approve' : IDL.Opt(Approve),\n 'timestamp' : IDL.Nat64,\n 'transfer' : IDL.Opt(Transfer),\n });\n const TransactionWithId = IDL.Record({\n 'id' : TxId,\n 'transaction' : Transaction,\n });\n const GetTransactions = IDL.Record({\n 'transactions' : IDL.Vec(TransactionWithId),\n 'oldest_tx_id' : IDL.Opt(TxId),\n });\n const GetTransactionsErr = IDL.Record({ 'message' : IDL.Text });\n const GetTransactionsResult = IDL.Variant({\n 'Ok' : GetTransactions,\n 'Err' : GetTransactionsErr,\n });\n const SubAccount = IDL.Vec(IDL.Nat8);\n const ListSubaccountsArgs = IDL.Record({\n 'owner' : IDL.Principal,\n 'start' : IDL.Opt(SubAccount),\n });\n return IDL.Service({\n 'get_account_transactions' : IDL.Func(\n [GetAccountTransactionsArgs],\n [GetTransactionsResult],\n [],\n ),\n 'ledger_id' : IDL.Func([], [IDL.Principal], ['query']),\n 'list_subaccounts' : IDL.Func(\n [ListSubaccountsArgs],\n [IDL.Vec(SubAccount)],\n ['query'],\n ),\n });\n};\nexport const init = ({ IDL }) => {\n const InitArgs = IDL.Record({ 'ledger_id' : IDL.Principal });\n return [InitArgs];\n};\n", "import { toNullable } from \"@dfinity/utils\";\nimport type {\n Account,\n GetAccountTransactionsArgs,\n} from \"../../candid/icrc_index\";\nimport type { GetAccountTransactionsParams } from \"../types/index.params\";\nimport type { IcrcAccount } from \"../types/ledger.responses\";\n\nconst toCandidAccount = ({ owner, subaccount }: IcrcAccount): Account => ({\n owner,\n subaccount: toNullable(subaccount),\n});\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", "import type { QueryParams } from \"@dfinity/utils\";\nimport { Canister, createServices, toNullable } from \"@dfinity/utils\";\nimport type {\n Allowance,\n BlockIndex,\n _SERVICE as IcrcLedgerService,\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 toTransferArg,\n toTransferFromArgs,\n} from \"./converters/ledger.converters\";\nimport { IcrcTransferError } from \"./errors/ledger.errors\";\nimport type { IcrcLedgerCanisterOptions } from \"./types/canister.options\";\nimport type {\n AllowanceParams,\n ApproveParams,\n BalanceParams,\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 return this.caller(params).icrc1_total_supply();\n };\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 = async (params: AllowanceParams): Promise<Allowance> => {\n const { certified, ...rest } = params;\n return this.caller({ certified }).icrc2_allowance({ ...rest });\n };\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 Value = IDL.Rec();\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 '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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\n 'change_fee_collector' : IDL.Opt(ChangeFeeCollector),\n 'max_memo_length' : IDL.Opt(IDL.Nat16),\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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\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 '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 '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 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 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 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 '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 '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 });\n};\nexport const init = ({ IDL }) => {\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 '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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\n 'change_fee_collector' : IDL.Opt(ChangeFeeCollector),\n 'max_memo_length' : IDL.Opt(IDL.Nat16),\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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\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 '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 '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 Value = IDL.Rec();\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 '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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\n 'change_fee_collector' : IDL.Opt(ChangeFeeCollector),\n 'max_memo_length' : IDL.Opt(IDL.Nat16),\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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\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 '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 '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 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 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 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 '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 '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 });\n};\nexport const init = ({ IDL }) => {\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 '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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\n 'change_fee_collector' : IDL.Opt(ChangeFeeCollector),\n 'max_memo_length' : IDL.Opt(IDL.Nat16),\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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\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 '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 '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 { toNullable } from \"@dfinity/utils\";\nimport type {\n ApproveArgs,\n TransferArg,\n TransferFromArgs,\n} from \"../../candid/icrc_ledger\";\nimport type {\n ApproveParams,\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", "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", "import { Principal } from \"@dfinity/principal\";\nimport {\n bigEndianCrc32,\n encodeBase32,\n hexStringToUint8Array,\n isNullish,\n notEmptyString,\n uint8ArrayToHexString,\n} from \"@dfinity/utils\";\nimport type { IcrcAccount } 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] = accountString.split(\".\");\n\n if (!notEmptyString(principalAndMaybeCheckSum)) {\n throw new Error(\"Invalid account. No string provided.\");\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", "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 // eslint-disable-next-line @typescript-eslint/no-unused-vars\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": "mbAAA,IAAAA,GAAA,GAAAC,GAAAD,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c,SAASX,GAA2B,GAAG,CACvD,CACF,EAIA,GAFgBM,GAAUS,CAAO,IAEjBH,EACd,MAAM,IAAI,MAAM,oCAAoC,EAGtD,OAAOG,CACT,EC1FA,IAAAC,EAAsC,0BAyBzBC,GACXC,GACuE,CACvE,IAAMC,EACJ,+EAEIC,EAAQF,EAAK,MAAMC,CAAK,EAC9B,MAAI,aAAUC,CAAK,EACjB,OAIF,GAAM,CAACC,EAAGC,EAAOC,EAAYC,CAAM,EAAIJ,EAEvC,MAAO,CACL,MAAAE,EACA,WAAAC,EACA,MAAI,cAAWC,CAAM,GACnB,CAAC,MAAM,WAAWA,CAAM,CAAC,GAAK,CAAE,OAAQ,WAAWA,CAAM,CAAE,CAC/D,CACF",
|
|
6
|
+
"names": ["src_exports", "__export", "IcrcIndexCanister", "IcrcLedgerCanister", "IcrcMetadataResponseEntries", "IcrcTransferError", "IndexError", "decodeIcrcAccount", "decodePayment", "encodeIcrcAccount", "__toCommonJS", "IndexError", "IcrcTransferError", "msg", "errorType", "import_utils", "idlFactory", "IDL", "InitArgs", "TxId", "Account", "GetAccountTransactionsArgs", "Burn", "Mint", "Approve", "Transfer", "Transaction", "TransactionWithId", "GetTransactions", "GetTransactionsErr", "GetTransactionsResult", "SubAccount", "ListSubaccountsArgs", "idlFactory", "IDL", "InitArgs", "TxId", "Account", "GetAccountTransactionsArgs", "Burn", "Mint", "Approve", "Transfer", "Transaction", "TransactionWithId", "GetTransactions", "GetTransactionsErr", "GetTransactionsResult", "SubAccount", "ListSubaccountsArgs", "import_utils", "toCandidAccount", "owner", "subaccount", "toGetTransactionsArgs", "account", "max_results", "start", "IcrcIndexCanister", "_IcrcIndexCanister", "params", "response", "toGetTransactionsArgs", "IndexError", "options", "service", "certifiedService", "canisterId", "idlFactory", "import_utils", "idlFactory", "IDL", "Value", "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", "Tokens", "StandardRecord", "TransferArg", "TransferError", "TransferResult", "AllowanceArgs", "Allowance", "ApproveArgs", "ApproveError", "ApproveResult", "TransferFromArgs", "TransferFromError", "TransferFromResult", "idlFactory", "IDL", "Value", "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", "Tokens", "StandardRecord", "TransferArg", "TransferError", "TransferResult", "AllowanceArgs", "Allowance", "ApproveArgs", "ApproveError", "ApproveResult", "TransferFromArgs", "TransferFromError", "TransferFromResult", "import_utils", "toTransferArg", "from_subaccount", "fee", "created_at_time", "memo", "rest", "toTransferFromArgs", "spender_subaccount", "toApproveArgs", "expected_allowance", "expires_at", "IcrcLedgerCanister", "_IcrcLedgerCanister", "params", "response", "toTransferArg", "IcrcTransferError", "toTransferFromArgs", "toApproveArgs", "certified", "rest", "options", "service", "certifiedService", "canisterId", "idlFactory", "IcrcMetadataResponseEntries", "import_principal", "import_utils", "MAX_SUBACCOUNT_HEX_LENGTH", "encodeIcrcAccount", "owner", "subaccount", "subaccountText", "text", "encodeCrc", "crc", "decodeIcrcAccount", "accountString", "principalAndMaybeCheckSum", "subaccountHex", "checksum", "rest", "principalText", "account", "import_utils", "decodePayment", "code", "regex", "match", "_", "token", "identifier", "amount"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Canister as I,createServices as L,toNullable as D}from"@dfinity/utils";var J=({IDL:e})=>{let s=e.Rec(),r=e.Variant({Int:e.Int,Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text}),a=e.Vec(e.Nat8),t=e.Record({owner:e.Principal,subaccount:e.Opt(a)}),l=e.Variant({SetTo:t,Unset:e.Null}),p=e.Record({icrc2:e.Bool}),O=e.Record({token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat),metadata:e.Opt(e.Vec(e.Tuple(e.Text,r))),maximum_number_of_accounts:e.Opt(e.Nat64),accounts_overflow_trim_quantity:e.Opt(e.Nat64),change_fee_collector:e.Opt(l),max_memo_length:e.Opt(e.Nat16),token_name:e.Opt(e.Text),feature_flags:e.Opt(p)}),g=e.Record({decimals:e.Opt(e.Nat8),token_symbol:e.Text,transfer_fee:e.Nat,metadata:e.Vec(e.Tuple(e.Text,r)),minting_account:t,initial_balances:e.Vec(e.Tuple(t,e.Nat)),maximum_number_of_accounts:e.Opt(e.Nat64),accounts_overflow_trim_quantity:e.Opt(e.Nat64),fee_collector_account:e.Opt(t),archive_options:e.Record({num_blocks_to_archive:e.Nat64,max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Nat64,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),token_name:e.Text,feature_flags:e.Opt(p)}),$=e.Variant({Upgrade:e.Opt(O),Init:g}),n=e.Nat,T=e.Record({block_range_end:n,canister_id:e.Principal,block_range_start:n}),d=e.Record({start:n,length:e.Nat}),x=e.Vec(e.Tuple(e.Text,s));s.fill(e.Variant({Int:e.Int,Map:x,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(s)}));let u=s,R=e.Record({blocks:e.Vec(u)}),b=e.Func([d],[R],[]),V=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),first_index:n,blocks:e.Vec(u),chain_length:e.Nat64,archived_blocks:e.Vec(e.Record({callback:b,start:n,length:e.Nat}))}),y=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),hash_tree:e.Vec(e.Nat8)}),_=e.Nat,f=e.Record({start:_,length:e.Nat}),c=e.Nat64,F=e.Record({from:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:e.Nat,spender:e.Opt(t)}),h=e.Record({to:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:e.Nat}),A=e.Record({fee:e.Opt(e.Nat),from:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(c),spender:t}),k=e.Record({to:t,fee:e.Opt(e.Nat),from:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:e.Nat,spender:e.Opt(t)}),N=e.Record({burn:e.Opt(F),kind:e.Text,mint:e.Opt(h),approve:e.Opt(A),timestamp:c,transfer:e.Opt(k)}),v=e.Record({transactions:e.Vec(N)}),w=e.Func([f],[v],[]),B=e.Record({first_index:_,log_length:e.Nat,transactions:e.Vec(N),archived_transactions:e.Vec(e.Record({callback:w,start:_,length:e.Nat}))}),o=e.Nat,P=e.Record({url:e.Text,name:e.Text}),E=e.Record({to:t,fee:e.Opt(o),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(a),created_at_time:e.Opt(c),amount:o}),q=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:n}),BadFee:e.Record({expected_fee:o}),CreatedInFuture:e.Record({ledger_time:c}),TooOld:e.Null,InsufficientFunds:e.Record({balance:o})}),C=e.Variant({Ok:n,Err:q}),S=e.Record({account:t,spender:t}),U=e.Record({allowance:e.Nat,expires_at:e.Opt(c)}),G=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(c),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(c),spender:t}),M=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,Duplicate:e.Record({duplicate_of:n}),BadFee:e.Record({expected_fee:e.Nat}),AllowanceChanged:e.Record({current_allowance:e.Nat}),CreatedInFuture:e.Record({ledger_time:c}),TooOld:e.Null,Expired:e.Record({ledger_time:c}),InsufficientFunds:e.Record({balance:e.Nat})}),z=e.Variant({Ok:n,Err:M}),Q=e.Record({to:t,fee:e.Opt(o),spender_subaccount:e.Opt(a),from:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:o}),j=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:n}),BadFee:e.Record({expected_fee:o}),CreatedInFuture:e.Record({ledger_time:c}),TooOld:e.Null,InsufficientFunds:e.Record({balance:o})}),H=e.Variant({Ok:n,Err:j});return e.Service({archives:e.Func([],[e.Vec(T)],[]),get_blocks:e.Func([d],[V],[]),get_data_certificate:e.Func([],[y],[]),get_transactions:e.Func([f],[B],[]),icrc1_balance_of:e.Func([t],[o],[]),icrc1_decimals:e.Func([],[e.Nat8],[]),icrc1_fee:e.Func([],[o],[]),icrc1_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,r))],[]),icrc1_minting_account:e.Func([],[e.Opt(t)],[]),icrc1_name:e.Func([],[e.Text],[]),icrc1_supported_standards:e.Func([],[e.Vec(P)],[]),icrc1_symbol:e.Func([],[e.Text],[]),icrc1_total_supply:e.Func([],[o],[]),icrc1_transfer:e.Func([E],[C],[]),icrc2_allowance:e.Func([S],[U],[]),icrc2_approve:e.Func([G],[z],[]),icrc2_transfer_from:e.Func([Q],[H],[])})};var K=({IDL:e})=>{let s=e.Rec(),r=e.Variant({Int:e.Int,Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text}),a=e.Vec(e.Nat8),t=e.Record({owner:e.Principal,subaccount:e.Opt(a)}),l=e.Variant({SetTo:t,Unset:e.Null}),p=e.Record({icrc2:e.Bool}),O=e.Record({token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat),metadata:e.Opt(e.Vec(e.Tuple(e.Text,r))),maximum_number_of_accounts:e.Opt(e.Nat64),accounts_overflow_trim_quantity:e.Opt(e.Nat64),change_fee_collector:e.Opt(l),max_memo_length:e.Opt(e.Nat16),token_name:e.Opt(e.Text),feature_flags:e.Opt(p)}),g=e.Record({decimals:e.Opt(e.Nat8),token_symbol:e.Text,transfer_fee:e.Nat,metadata:e.Vec(e.Tuple(e.Text,r)),minting_account:t,initial_balances:e.Vec(e.Tuple(t,e.Nat)),maximum_number_of_accounts:e.Opt(e.Nat64),accounts_overflow_trim_quantity:e.Opt(e.Nat64),fee_collector_account:e.Opt(t),archive_options:e.Record({num_blocks_to_archive:e.Nat64,max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Nat64,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),token_name:e.Text,feature_flags:e.Opt(p)}),$=e.Variant({Upgrade:e.Opt(O),Init:g}),n=e.Nat,T=e.Record({block_range_end:n,canister_id:e.Principal,block_range_start:n}),d=e.Record({start:n,length:e.Nat}),x=e.Vec(e.Tuple(e.Text,s));s.fill(e.Variant({Int:e.Int,Map:x,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(s)}));let u=s,R=e.Record({blocks:e.Vec(u)}),b=e.Func([d],[R],["query"]),V=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),first_index:n,blocks:e.Vec(u),chain_length:e.Nat64,archived_blocks:e.Vec(e.Record({callback:b,start:n,length:e.Nat}))}),y=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),hash_tree:e.Vec(e.Nat8)}),_=e.Nat,f=e.Record({start:_,length:e.Nat}),c=e.Nat64,F=e.Record({from:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:e.Nat,spender:e.Opt(t)}),h=e.Record({to:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:e.Nat}),A=e.Record({fee:e.Opt(e.Nat),from:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(c),spender:t}),k=e.Record({to:t,fee:e.Opt(e.Nat),from:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:e.Nat,spender:e.Opt(t)}),N=e.Record({burn:e.Opt(F),kind:e.Text,mint:e.Opt(h),approve:e.Opt(A),timestamp:c,transfer:e.Opt(k)}),v=e.Record({transactions:e.Vec(N)}),w=e.Func([f],[v],["query"]),B=e.Record({first_index:_,log_length:e.Nat,transactions:e.Vec(N),archived_transactions:e.Vec(e.Record({callback:w,start:_,length:e.Nat}))}),o=e.Nat,P=e.Record({url:e.Text,name:e.Text}),E=e.Record({to:t,fee:e.Opt(o),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(a),created_at_time:e.Opt(c),amount:o}),q=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:n}),BadFee:e.Record({expected_fee:o}),CreatedInFuture:e.Record({ledger_time:c}),TooOld:e.Null,InsufficientFunds:e.Record({balance:o})}),C=e.Variant({Ok:n,Err:q}),S=e.Record({account:t,spender:t}),U=e.Record({allowance:e.Nat,expires_at:e.Opt(c)}),G=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(c),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(c),spender:t}),M=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,Duplicate:e.Record({duplicate_of:n}),BadFee:e.Record({expected_fee:e.Nat}),AllowanceChanged:e.Record({current_allowance:e.Nat}),CreatedInFuture:e.Record({ledger_time:c}),TooOld:e.Null,Expired:e.Record({ledger_time:c}),InsufficientFunds:e.Record({balance:e.Nat})}),z=e.Variant({Ok:n,Err:M}),Q=e.Record({to:t,fee:e.Opt(o),spender_subaccount:e.Opt(a),from:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:o}),j=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:n}),BadFee:e.Record({expected_fee:o}),CreatedInFuture:e.Record({ledger_time:c}),TooOld:e.Null,InsufficientFunds:e.Record({balance:o})}),H=e.Variant({Ok:n,Err:j});return e.Service({archives:e.Func([],[e.Vec(T)],["query"]),get_blocks:e.Func([d],[V],["query"]),get_data_certificate:e.Func([],[y],["query"]),get_transactions:e.Func([f],[B],["query"]),icrc1_balance_of:e.Func([t],[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,r))],["query"]),icrc1_minting_account:e.Func([],[e.Opt(t)],["query"]),icrc1_name:e.Func([],[e.Text],["query"]),icrc1_supported_standards:e.Func([],[e.Vec(P)],["query"]),icrc1_symbol:e.Func([],[e.Text],["query"]),icrc1_total_supply:e.Func([],[o],["query"]),icrc1_transfer:e.Func([E],[C],[]),icrc2_allowance:e.Func([S],[U],["query"]),icrc2_approve:e.Func([G],[z],[]),icrc2_transfer_from:e.Func([Q],[H],[])})};import{toNullable as i}from"@dfinity/utils";var W=({from_subaccount:e,fee:s,created_at_time:r,memo:a,...t})=>({...t,fee:i(s),memo:i(a),from_subaccount:i(e),created_at_time:i(r)}),X=({spender_subaccount:e,fee:s,created_at_time:r,memo:a,...t})=>({...t,fee:i(s),memo:i(a),spender_subaccount:i(e),created_at_time:i(r)}),Y=({fee:e,created_at_time:s,memo:r,from_subaccount:a,expected_allowance:t,expires_at:l,...p})=>({...p,fee:i(e),memo:i(r),from_subaccount:i(a),created_at_time:i(s),expected_allowance:i(t),expires_at:i(l)});var m=class extends Error{constructor({msg:r,errorType:a}){super(r);this.errorType=a}};var Z=class e extends I{constructor(){super(...arguments);this.metadata=r=>this.caller(r).icrc1_metadata();this.transactionFee=r=>this.caller(r).icrc1_fee();this.balance=r=>this.caller({certified:r.certified}).icrc1_balance_of({owner:r.owner,subaccount:D(r.subaccount)});this.transfer=async r=>{let a=await this.caller({certified:!0}).icrc1_transfer(W(r));if("Err"in a)throw new m({errorType:a.Err,msg:"Failed to transfer"});return a.Ok};this.totalTokensSupply=r=>this.caller(r).icrc1_total_supply();this.transferFrom=async r=>{let a=await this.caller({certified:!0}).icrc2_transfer_from(X(r));if("Err"in a)throw new m({errorType:a.Err,msg:"Failed to transfer from"});return a.Ok};this.approve=async r=>{let a=await this.caller({certified:!0}).icrc2_approve(Y(r));if("Err"in a)throw new m({errorType:a.Err,msg:"Failed to entitle the spender to transfer the amount"});return a.Ok};this.allowance=async r=>{let{certified:a,...t}=r;return this.caller({certified:a}).icrc2_allowance({...t})}}static create(r){let{service:a,certifiedService:t,canisterId:l}=L({options:r,idlFactory:K,certifiedIdlFactory:J});return new e(l,a,t)}};export{m as a,Z as b};
|
|
2
|
+
//# sourceMappingURL=chunk-SEWDUW4T.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 { QueryParams } from \"@dfinity/utils\";\nimport { Canister, createServices, toNullable } from \"@dfinity/utils\";\nimport type {\n Allowance,\n BlockIndex,\n _SERVICE as IcrcLedgerService,\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 toTransferArg,\n toTransferFromArgs,\n} from \"./converters/ledger.converters\";\nimport { IcrcTransferError } from \"./errors/ledger.errors\";\nimport type { IcrcLedgerCanisterOptions } from \"./types/canister.options\";\nimport type {\n AllowanceParams,\n ApproveParams,\n BalanceParams,\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 return this.caller(params).icrc1_total_supply();\n };\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 = async (params: AllowanceParams): Promise<Allowance> => {\n const { certified, ...rest } = params;\n return this.caller({ certified }).icrc2_allowance({ ...rest });\n };\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 Value = IDL.Rec();\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 '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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\n 'change_fee_collector' : IDL.Opt(ChangeFeeCollector),\n 'max_memo_length' : IDL.Opt(IDL.Nat16),\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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\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 '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 '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 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 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 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 '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 '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 });\n};\nexport const init = ({ IDL }) => {\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 '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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\n 'change_fee_collector' : IDL.Opt(ChangeFeeCollector),\n 'max_memo_length' : IDL.Opt(IDL.Nat16),\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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\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 '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 '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 Value = IDL.Rec();\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 '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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\n 'change_fee_collector' : IDL.Opt(ChangeFeeCollector),\n 'max_memo_length' : IDL.Opt(IDL.Nat16),\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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\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 '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 '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 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 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 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 '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 '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 });\n};\nexport const init = ({ IDL }) => {\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 '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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\n 'change_fee_collector' : IDL.Opt(ChangeFeeCollector),\n 'max_memo_length' : IDL.Opt(IDL.Nat16),\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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\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 '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 '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 { toNullable } from \"@dfinity/utils\";\nimport type {\n ApproveArgs,\n TransferArg,\n TransferFromArgs,\n} from \"../../candid/icrc_ledger\";\nimport type {\n ApproveParams,\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", "export 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"],
|
|
5
|
+
"mappings": "AACA,OAAS,YAAAA,EAAU,kBAAAC,EAAgB,cAAAC,MAAkB,iBCA9C,IAAMC,EAAa,CAAC,CAAE,IAAAC,CAAI,IAAM,CACrC,IAAMC,EAAQD,EAAI,IAAI,EAChBE,EAAgBF,EAAI,QAAQ,CAChC,IAAQA,EAAI,IACZ,IAAQA,EAAI,IACZ,KAASA,EAAI,IAAIA,EAAI,IAAI,EACzB,KAASA,EAAI,IACf,CAAC,EACKG,EAAaH,EAAI,IAAIA,EAAI,IAAI,EAC7BI,EAAUJ,EAAI,OAAO,CACzB,MAAUA,EAAI,UACd,WAAeA,EAAI,IAAIG,CAAU,CACnC,CAAC,EACKE,EAAqBL,EAAI,QAAQ,CACrC,MAAUI,EACV,MAAUJ,EAAI,IAChB,CAAC,EACKM,EAAeN,EAAI,OAAO,CAAE,MAAUA,EAAI,IAAK,CAAC,EAChDO,EAAcP,EAAI,OAAO,CAC7B,aAAiBA,EAAI,IAAIA,EAAI,IAAI,EACjC,aAAiBA,EAAI,IAAIA,EAAI,GAAG,EAChC,SAAaA,EAAI,IAAIA,EAAI,IAAIA,EAAI,MAAMA,EAAI,KAAME,CAAa,CAAC,CAAC,EAChE,2BAA+BF,EAAI,IAAIA,EAAI,KAAK,EAChD,gCAAoCA,EAAI,IAAIA,EAAI,KAAK,EACrD,qBAAyBA,EAAI,IAAIK,CA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AAS,iBAAAC,EAAkB,WAAAC,CAAW,EAC5CC,EAAkC,CAChC,QAAAJ,EACA,WAAAK,EACA,oBAAAA,CACF,CAAC,EAEH,OAAO,IAAIhB,EAAmBc,EAAYF,EAASC,CAAgB,CACrE,CAgHF",
|
|
6
|
+
"names": ["Canister", "createServices", "toNullable", "idlFactory", "IDL", "Value", "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", "Tokens", "StandardRecord", "TransferArg", "TransferError", "TransferResult", "AllowanceArgs", "Allowance", "ApproveArgs", "ApproveError", "ApproveResult", "TransferFromArgs", "TransferFromError", "TransferFromResult", "idlFactory", "IDL", "Value", "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", "Tokens", "StandardRecord", "TransferArg", "TransferError", "TransferResult", "AllowanceArgs", "Allowance", "ApproveArgs", "ApproveError", "ApproveResult", "TransferFromArgs", "TransferFromError", "TransferFromResult", "toNullable", "toTransferArg", "from_subaccount", "fee", "created_at_time", "memo", "rest", "toTransferFromArgs", "spender_subaccount", "toApproveArgs", "expected_allowance", "expires_at", "IcrcTransferError", "msg", "errorType", "IcrcLedgerCanister", "_IcrcLedgerCanister", "Canister", "params", "toNullable", "response", "toTransferArg", "IcrcTransferError", "toTransferFromArgs", "toApproveArgs", "certified", "rest", "options", "service", "certifiedService", "canisterId", "createServices", "idlFactory"]
|
|
7
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as S,b as m}from"./chunk-MJQNXPUY.js";import{a as b,b as p}from"./chunk-
|
|
1
|
+
import{a as S,b as m}from"./chunk-MJQNXPUY.js";import{a as b,b as p}from"./chunk-SEWDUW4T.js";var d=(t=>(t.SYMBOL="icrc1:symbol",t.NAME="icrc1:name",t.DECIMALS="icrc1:decimals",t.FEE="icrc1:fee",t.LOGO="icrc1:logo",t))(d||{});import{Principal as a}from"@dfinity/principal";import{bigEndianCrc32 as f,encodeBase32 as x,hexStringToUint8Array as l,isNullish as s,notEmptyString as T,uint8ArrayToHexString as I}from"@dfinity/utils";var g=64,C=({owner:r,subaccount:c})=>{if(s(c))return r.toText();let n=(i=>i.replace(/^0+/,""))(I(Uint8Array.from(c)));return n.length===0?r.toText():`${r.toText()}-${u({owner:r,subaccount:c})}.${n}`},u=({owner:r,subaccount:c})=>{let e=f(Uint8Array.from([...r.toUint8Array(),...c]));return x(e)},E=r=>{let[c,e]=r.split(".");if(!T(c))throw new Error("Invalid account. No string provided.");if(s(e))return{owner:a.fromText(r)};let[n,...i]=c.split("-").reverse(),t=i.reverse().join("-"),o={owner:a.fromText(t),subaccount:l(e.padStart(g,"0"))};if(u(o)!==n)throw new Error("Invalid account. Invalid checksum.");return o};import{isNullish as A,nonNullish as y}from"@dfinity/utils";var U=r=>{let c=/^([a-zA-Z]+):([A-Za-z0-9:\-.]+).*?(?:[?&](?:amount|value)=(\d+(?:\.\d+)?))?$/,e=r.match(c);if(A(e))return;let[n,i,t,o]=e;return{token:i,identifier:t,...y(o)&&!isNaN(parseFloat(o))&&{amount:parseFloat(o)}}};export{m as IcrcIndexCanister,p as IcrcLedgerCanister,d as IcrcMetadataResponseEntries,b as IcrcTransferError,S as IndexError,E as decodeIcrcAccount,U as decodePayment,C as encodeIcrcAccount};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as a}from"./chunk-
|
|
1
|
+
import{b as a}from"./chunk-SEWDUW4T.js";export{a as IcrcLedgerCanister};
|
|
2
2
|
//# sourceMappingURL=ledger.canister.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dfinity/ledger-icrc",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1-next-2024-01-30",
|
|
4
4
|
"description": "A library for interfacing with ICRC ledgers on the Internet Computer.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/cjs/index.cjs.js",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
],
|
|
38
38
|
"homepage": "https://github.com/dfinity/ic-js#readme",
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@dfinity/agent": "
|
|
41
|
-
"@dfinity/candid": "
|
|
42
|
-
"@dfinity/principal": "
|
|
43
|
-
"@dfinity/utils": "
|
|
40
|
+
"@dfinity/agent": "*",
|
|
41
|
+
"@dfinity/candid": "*",
|
|
42
|
+
"@dfinity/principal": "*",
|
|
43
|
+
"@dfinity/utils": "*"
|
|
44
44
|
}
|
|
45
|
-
}
|
|
45
|
+
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Canister as $,createServices as I,toNullable as L}from"@dfinity/utils";var H=({IDL:e})=>{let s=e.Rec(),r=e.Variant({Int:e.Int,Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text}),a=e.Vec(e.Nat8),t=e.Record({owner:e.Principal,subaccount:e.Opt(a)}),l=e.Variant({SetTo:t,Unset:e.Null}),p=e.Record({icrc2:e.Bool}),O=e.Record({token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat),metadata:e.Opt(e.Vec(e.Tuple(e.Text,r))),maximum_number_of_accounts:e.Opt(e.Nat64),accounts_overflow_trim_quantity:e.Opt(e.Nat64),change_fee_collector:e.Opt(l),max_memo_length:e.Opt(e.Nat16),token_name:e.Opt(e.Text),feature_flags:e.Opt(p)}),g=e.Record({decimals:e.Opt(e.Nat8),token_symbol:e.Text,transfer_fee:e.Nat,metadata:e.Vec(e.Tuple(e.Text,r)),minting_account:t,initial_balances:e.Vec(e.Tuple(t,e.Nat)),maximum_number_of_accounts:e.Opt(e.Nat64),accounts_overflow_trim_quantity:e.Opt(e.Nat64),fee_collector_account:e.Opt(t),archive_options:e.Record({num_blocks_to_archive:e.Nat64,max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Nat64,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),token_name:e.Text,feature_flags:e.Opt(p)}),Z=e.Variant({Upgrade:e.Opt(O),Init:g}),n=e.Nat,u=e.Record({start:n,length:e.Nat}),T=e.Vec(e.Tuple(e.Text,s));s.fill(e.Variant({Int:e.Int,Map:T,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(s)}));let d=s,x=e.Record({blocks:e.Vec(d)}),R=e.Func([u],[x],[]),V=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),first_index:n,blocks:e.Vec(d),chain_length:e.Nat64,archived_blocks:e.Vec(e.Record({callback:R,start:n,length:e.Nat}))}),b=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),hash_tree:e.Vec(e.Nat8)}),_=e.Nat,f=e.Record({start:_,length:e.Nat}),c=e.Nat64,y=e.Record({from:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:e.Nat,spender:e.Opt(t)}),F=e.Record({to:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:e.Nat}),h=e.Record({fee:e.Opt(e.Nat),from:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(c),spender:t}),A=e.Record({to:t,fee:e.Opt(e.Nat),from:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:e.Nat,spender:e.Opt(t)}),N=e.Record({burn:e.Opt(y),kind:e.Text,mint:e.Opt(F),approve:e.Opt(h),timestamp:c,transfer:e.Opt(A)}),k=e.Record({transactions:e.Vec(N)}),v=e.Func([f],[k],[]),w=e.Record({first_index:_,log_length:e.Nat,transactions:e.Vec(N),archived_transactions:e.Vec(e.Record({callback:v,start:_,length:e.Nat}))}),o=e.Nat,B=e.Record({url:e.Text,name:e.Text}),P=e.Record({to:t,fee:e.Opt(o),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(a),created_at_time:e.Opt(c),amount:o}),E=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:n}),BadFee:e.Record({expected_fee:o}),CreatedInFuture:e.Record({ledger_time:c}),TooOld:e.Null,InsufficientFunds:e.Record({balance:o})}),q=e.Variant({Ok:n,Err:E}),C=e.Record({account:t,spender:t}),S=e.Record({allowance:e.Nat,expires_at:e.Opt(c)}),U=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(c),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(c),spender:t}),G=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,Duplicate:e.Record({duplicate_of:n}),BadFee:e.Record({expected_fee:e.Nat}),AllowanceChanged:e.Record({current_allowance:e.Nat}),CreatedInFuture:e.Record({ledger_time:c}),TooOld:e.Null,Expired:e.Record({ledger_time:c}),InsufficientFunds:e.Record({balance:e.Nat})}),M=e.Variant({Ok:n,Err:G}),z=e.Record({to:t,fee:e.Opt(o),spender_subaccount:e.Opt(a),from:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:o}),Q=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:n}),BadFee:e.Record({expected_fee:o}),CreatedInFuture:e.Record({ledger_time:c}),TooOld:e.Null,InsufficientFunds:e.Record({balance:o})}),j=e.Variant({Ok:n,Err:Q});return e.Service({get_blocks:e.Func([u],[V],[]),get_data_certificate:e.Func([],[b],[]),get_transactions:e.Func([f],[w],[]),icrc1_balance_of:e.Func([t],[o],[]),icrc1_decimals:e.Func([],[e.Nat8],[]),icrc1_fee:e.Func([],[o],[]),icrc1_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,r))],[]),icrc1_minting_account:e.Func([],[e.Opt(t)],[]),icrc1_name:e.Func([],[e.Text],[]),icrc1_supported_standards:e.Func([],[e.Vec(B)],[]),icrc1_symbol:e.Func([],[e.Text],[]),icrc1_total_supply:e.Func([],[o],[]),icrc1_transfer:e.Func([P],[q],[]),icrc2_allowance:e.Func([C],[S],[]),icrc2_approve:e.Func([U],[M],[]),icrc2_transfer_from:e.Func([z],[j],[])})};var J=({IDL:e})=>{let s=e.Rec(),r=e.Variant({Int:e.Int,Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text}),a=e.Vec(e.Nat8),t=e.Record({owner:e.Principal,subaccount:e.Opt(a)}),l=e.Variant({SetTo:t,Unset:e.Null}),p=e.Record({icrc2:e.Bool}),O=e.Record({token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat),metadata:e.Opt(e.Vec(e.Tuple(e.Text,r))),maximum_number_of_accounts:e.Opt(e.Nat64),accounts_overflow_trim_quantity:e.Opt(e.Nat64),change_fee_collector:e.Opt(l),max_memo_length:e.Opt(e.Nat16),token_name:e.Opt(e.Text),feature_flags:e.Opt(p)}),g=e.Record({decimals:e.Opt(e.Nat8),token_symbol:e.Text,transfer_fee:e.Nat,metadata:e.Vec(e.Tuple(e.Text,r)),minting_account:t,initial_balances:e.Vec(e.Tuple(t,e.Nat)),maximum_number_of_accounts:e.Opt(e.Nat64),accounts_overflow_trim_quantity:e.Opt(e.Nat64),fee_collector_account:e.Opt(t),archive_options:e.Record({num_blocks_to_archive:e.Nat64,max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Nat64,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),token_name:e.Text,feature_flags:e.Opt(p)}),Z=e.Variant({Upgrade:e.Opt(O),Init:g}),n=e.Nat,u=e.Record({start:n,length:e.Nat}),T=e.Vec(e.Tuple(e.Text,s));s.fill(e.Variant({Int:e.Int,Map:T,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(s)}));let d=s,x=e.Record({blocks:e.Vec(d)}),R=e.Func([u],[x],["query"]),V=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),first_index:n,blocks:e.Vec(d),chain_length:e.Nat64,archived_blocks:e.Vec(e.Record({callback:R,start:n,length:e.Nat}))}),b=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),hash_tree:e.Vec(e.Nat8)}),_=e.Nat,f=e.Record({start:_,length:e.Nat}),c=e.Nat64,y=e.Record({from:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:e.Nat,spender:e.Opt(t)}),F=e.Record({to:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:e.Nat}),h=e.Record({fee:e.Opt(e.Nat),from:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(c),spender:t}),A=e.Record({to:t,fee:e.Opt(e.Nat),from:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:e.Nat,spender:e.Opt(t)}),N=e.Record({burn:e.Opt(y),kind:e.Text,mint:e.Opt(F),approve:e.Opt(h),timestamp:c,transfer:e.Opt(A)}),k=e.Record({transactions:e.Vec(N)}),v=e.Func([f],[k],["query"]),w=e.Record({first_index:_,log_length:e.Nat,transactions:e.Vec(N),archived_transactions:e.Vec(e.Record({callback:v,start:_,length:e.Nat}))}),o=e.Nat,B=e.Record({url:e.Text,name:e.Text}),P=e.Record({to:t,fee:e.Opt(o),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(a),created_at_time:e.Opt(c),amount:o}),E=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:n}),BadFee:e.Record({expected_fee:o}),CreatedInFuture:e.Record({ledger_time:c}),TooOld:e.Null,InsufficientFunds:e.Record({balance:o})}),q=e.Variant({Ok:n,Err:E}),C=e.Record({account:t,spender:t}),S=e.Record({allowance:e.Nat,expires_at:e.Opt(c)}),U=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(c),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(c),spender:t}),G=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,Duplicate:e.Record({duplicate_of:n}),BadFee:e.Record({expected_fee:e.Nat}),AllowanceChanged:e.Record({current_allowance:e.Nat}),CreatedInFuture:e.Record({ledger_time:c}),TooOld:e.Null,Expired:e.Record({ledger_time:c}),InsufficientFunds:e.Record({balance:e.Nat})}),M=e.Variant({Ok:n,Err:G}),z=e.Record({to:t,fee:e.Opt(o),spender_subaccount:e.Opt(a),from:t,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(c),amount:o}),Q=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:n}),BadFee:e.Record({expected_fee:o}),CreatedInFuture:e.Record({ledger_time:c}),TooOld:e.Null,InsufficientFunds:e.Record({balance:o})}),j=e.Variant({Ok:n,Err:Q});return e.Service({get_blocks:e.Func([u],[V],["query"]),get_data_certificate:e.Func([],[b],["query"]),get_transactions:e.Func([f],[w],["query"]),icrc1_balance_of:e.Func([t],[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,r))],["query"]),icrc1_minting_account:e.Func([],[e.Opt(t)],["query"]),icrc1_name:e.Func([],[e.Text],["query"]),icrc1_supported_standards:e.Func([],[e.Vec(B)],["query"]),icrc1_symbol:e.Func([],[e.Text],["query"]),icrc1_total_supply:e.Func([],[o],["query"]),icrc1_transfer:e.Func([P],[q],[]),icrc2_allowance:e.Func([C],[S],["query"]),icrc2_approve:e.Func([U],[M],[]),icrc2_transfer_from:e.Func([z],[j],[])})};import{toNullable as i}from"@dfinity/utils";var K=({from_subaccount:e,fee:s,created_at_time:r,memo:a,...t})=>({...t,fee:i(s),memo:i(a),from_subaccount:i(e),created_at_time:i(r)}),W=({spender_subaccount:e,fee:s,created_at_time:r,memo:a,...t})=>({...t,fee:i(s),memo:i(a),spender_subaccount:i(e),created_at_time:i(r)}),X=({fee:e,created_at_time:s,memo:r,from_subaccount:a,expected_allowance:t,expires_at:l,...p})=>({...p,fee:i(e),memo:i(r),from_subaccount:i(a),created_at_time:i(s),expected_allowance:i(t),expires_at:i(l)});var m=class extends Error{constructor({msg:r,errorType:a}){super(r);this.errorType=a}};var Y=class e extends ${constructor(){super(...arguments);this.metadata=r=>this.caller(r).icrc1_metadata();this.transactionFee=r=>this.caller(r).icrc1_fee();this.balance=r=>this.caller({certified:r.certified}).icrc1_balance_of({owner:r.owner,subaccount:L(r.subaccount)});this.transfer=async r=>{let a=await this.caller({certified:!0}).icrc1_transfer(K(r));if("Err"in a)throw new m({errorType:a.Err,msg:"Failed to transfer"});return a.Ok};this.totalTokensSupply=r=>this.caller(r).icrc1_total_supply();this.transferFrom=async r=>{let a=await this.caller({certified:!0}).icrc2_transfer_from(W(r));if("Err"in a)throw new m({errorType:a.Err,msg:"Failed to transfer from"});return a.Ok};this.approve=async r=>{let a=await this.caller({certified:!0}).icrc2_approve(X(r));if("Err"in a)throw new m({errorType:a.Err,msg:"Failed to entitle the spender to transfer the amount"});return a.Ok};this.allowance=async r=>{let{certified:a,...t}=r;return this.caller({certified:a}).icrc2_allowance({...t})}}static create(r){let{service:a,certifiedService:t,canisterId:l}=I({options:r,idlFactory:J,certifiedIdlFactory:H});return new e(l,a,t)}};export{m as a,Y as b};
|
|
2
|
-
//# sourceMappingURL=chunk-DXWXHYEN.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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 { QueryParams } from \"@dfinity/utils\";\nimport { Canister, createServices, toNullable } from \"@dfinity/utils\";\nimport type {\n Allowance,\n BlockIndex,\n _SERVICE as IcrcLedgerService,\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 toTransferArg,\n toTransferFromArgs,\n} from \"./converters/ledger.converters\";\nimport { IcrcTransferError } from \"./errors/ledger.errors\";\nimport type { IcrcLedgerCanisterOptions } from \"./types/canister.options\";\nimport type {\n AllowanceParams,\n ApproveParams,\n BalanceParams,\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 return this.caller(params).icrc1_total_supply();\n };\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 = async (params: AllowanceParams): Promise<Allowance> => {\n const { certified, ...rest } = params;\n return this.caller({ certified }).icrc2_allowance({ ...rest });\n };\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 Value = IDL.Rec();\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 '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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\n 'change_fee_collector' : IDL.Opt(ChangeFeeCollector),\n 'max_memo_length' : IDL.Opt(IDL.Nat16),\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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\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 '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 '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 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 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 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 return IDL.Service({\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 '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 '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 });\n};\nexport const init = ({ IDL }) => {\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 '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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\n 'change_fee_collector' : IDL.Opt(ChangeFeeCollector),\n 'max_memo_length' : IDL.Opt(IDL.Nat16),\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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\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 '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 '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 Value = IDL.Rec();\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 '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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\n 'change_fee_collector' : IDL.Opt(ChangeFeeCollector),\n 'max_memo_length' : IDL.Opt(IDL.Nat16),\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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\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 '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 '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 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 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 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 return IDL.Service({\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 '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 '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 });\n};\nexport const init = ({ IDL }) => {\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 '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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\n 'change_fee_collector' : IDL.Opt(ChangeFeeCollector),\n 'max_memo_length' : IDL.Opt(IDL.Nat16),\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 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),\n 'accounts_overflow_trim_quantity' : IDL.Opt(IDL.Nat64),\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 '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 '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 { toNullable } from \"@dfinity/utils\";\nimport type {\n ApproveArgs,\n TransferArg,\n TransferFromArgs,\n} from \"../../candid/icrc_ledger\";\nimport type {\n ApproveParams,\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", "export 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"],
|
|
5
|
-
"mappings": "AACA,OAAS,YAAAA,EAAU,kBAAAC,EAAgB,cAAAC,MAAkB,iBCA9C,IAAMC,EAAa,CAAC,CAAE,IAAAC,CAAI,IAAM,CACrC,IAAMC,EAAQD,EAAI,IAAI,EAChBE,EAAgBF,EAAI,QAAQ,CAChC,IAAQA,EAAI,IACZ,IAAQA,EAAI,IACZ,KAASA,EAAI,IAAIA,EAAI,IAAI,EACzB,KAASA,EAAI,IACf,CAAC,EACKG,EAAaH,EAAI,IAAIA,EAAI,IAAI,EAC7BI,EAAUJ,EAAI,OAAO,CACzB,MAAUA,EAAI,UAC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,CAAC,EAAE,gBAAgB,CAAE,GAAGC,CAAK,CAAC,CAC/D,EAxHA,OAAO,OAAOC,EAAuD,CACnE,GAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,WAAAC,CAAW,EAC5CC,EAAkC,CAChC,QAAAJ,EACA,WAAAK,EACA,oBAAAA,CACF,CAAC,EAEH,OAAO,IAAIhB,EAAmBc,EAAYF,EAASC,CAAgB,CACrE,CAgHF",
|
|
6
|
-
"names": ["Canister", "createServices", "toNullable", "idlFactory", "IDL", "Value", "MetadataValue", "Subaccount", "Account", "ChangeFeeCollector", "FeatureFlags", "UpgradeArgs", "InitArgs", "LedgerArg", "BlockIndex", "GetBlocksArgs", "Map", "Block", "BlockRange", "QueryBlockArchiveFn", "GetBlocksResponse", "DataCertificate", "TxIndex", "GetTransactionsRequest", "Timestamp", "Burn", "Mint", "Approve", "Transfer", "Transaction", "TransactionRange", "QueryArchiveFn", "GetTransactionsResponse", "Tokens", "StandardRecord", "TransferArg", "TransferError", "TransferResult", "AllowanceArgs", "Allowance", "ApproveArgs", "ApproveError", "ApproveResult", "TransferFromArgs", "TransferFromError", "TransferFromResult", "idlFactory", "IDL", "Value", "MetadataValue", "Subaccount", "Account", "ChangeFeeCollector", "FeatureFlags", "UpgradeArgs", "InitArgs", "LedgerArg", "BlockIndex", "GetBlocksArgs", "Map", "Block", "BlockRange", "QueryBlockArchiveFn", "GetBlocksResponse", "DataCertificate", "TxIndex", "GetTransactionsRequest", "Timestamp", "Burn", "Mint", "Approve", "Transfer", "Transaction", "TransactionRange", "QueryArchiveFn", "GetTransactionsResponse", "Tokens", "StandardRecord", "TransferArg", "TransferError", "TransferResult", "AllowanceArgs", "Allowance", "ApproveArgs", "ApproveError", "ApproveResult", "TransferFromArgs", "TransferFromError", "TransferFromResult", "toNullable", "toTransferArg", "from_subaccount", "fee", "created_at_time", "memo", "rest", "toTransferFromArgs", "spender_subaccount", "toApproveArgs", "expected_allowance", "expires_at", "IcrcTransferError", "msg", "errorType", "IcrcLedgerCanister", "_IcrcLedgerCanister", "Canister", "params", "toNullable", "response", "toTransferArg", "IcrcTransferError", "toTransferFromArgs", "toApproveArgs", "certified", "rest", "options", "service", "certifiedService", "canisterId", "createServices", "idlFactory"]
|
|
7
|
-
}
|