@dfinity/ledger-icrc 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/candid/icrc_index.d.ts +6 -6
- package/dist/candid/icrc_ledger.d.ts +16 -16
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/index.cjs.js.map +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,7 +88,7 @@ Parameters:
|
|
|
88
88
|
|
|
89
89
|
- `accountString`: string
|
|
90
90
|
|
|
91
|
-
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger-icrc/src/utils/ledger.utils.ts#
|
|
91
|
+
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/ledger-icrc/src/utils/ledger.utils.ts#L61)
|
|
92
92
|
|
|
93
93
|
#### :gear: decodePayment
|
|
94
94
|
|
|
@@ -3,12 +3,12 @@ import type { Principal } from "@dfinity/principal";
|
|
|
3
3
|
|
|
4
4
|
export interface Account {
|
|
5
5
|
owner: Principal;
|
|
6
|
-
subaccount: [] | [Uint8Array];
|
|
6
|
+
subaccount: [] | [Uint8Array | number[]];
|
|
7
7
|
}
|
|
8
8
|
export interface Approve {
|
|
9
9
|
fee: [] | [bigint];
|
|
10
10
|
from: Account;
|
|
11
|
-
memo: [] | [Uint8Array];
|
|
11
|
+
memo: [] | [Uint8Array | number[]];
|
|
12
12
|
created_at_time: [] | [bigint];
|
|
13
13
|
amount: bigint;
|
|
14
14
|
expected_allowance: [] | [bigint];
|
|
@@ -17,7 +17,7 @@ export interface Approve {
|
|
|
17
17
|
}
|
|
18
18
|
export interface Burn {
|
|
19
19
|
from: Account;
|
|
20
|
-
memo: [] | [Uint8Array];
|
|
20
|
+
memo: [] | [Uint8Array | number[]];
|
|
21
21
|
created_at_time: [] | [bigint];
|
|
22
22
|
amount: bigint;
|
|
23
23
|
spender: [] | [Account];
|
|
@@ -46,11 +46,11 @@ export interface ListSubaccountsArgs {
|
|
|
46
46
|
}
|
|
47
47
|
export interface Mint {
|
|
48
48
|
to: Account;
|
|
49
|
-
memo: [] | [Uint8Array];
|
|
49
|
+
memo: [] | [Uint8Array | number[]];
|
|
50
50
|
created_at_time: [] | [bigint];
|
|
51
51
|
amount: bigint;
|
|
52
52
|
}
|
|
53
|
-
export type SubAccount = Uint8Array;
|
|
53
|
+
export type SubAccount = Uint8Array | number[];
|
|
54
54
|
export interface Transaction {
|
|
55
55
|
burn: [] | [Burn];
|
|
56
56
|
kind: string;
|
|
@@ -67,7 +67,7 @@ export interface Transfer {
|
|
|
67
67
|
to: Account;
|
|
68
68
|
fee: [] | [bigint];
|
|
69
69
|
from: Account;
|
|
70
|
-
memo: [] | [Uint8Array];
|
|
70
|
+
memo: [] | [Uint8Array | number[]];
|
|
71
71
|
created_at_time: [] | [bigint];
|
|
72
72
|
amount: bigint;
|
|
73
73
|
spender: [] | [Account];
|
|
@@ -16,7 +16,7 @@ export interface AllowanceArgs {
|
|
|
16
16
|
export interface Approve {
|
|
17
17
|
fee: [] | [bigint];
|
|
18
18
|
from: Account;
|
|
19
|
-
memo: [] | [Uint8Array];
|
|
19
|
+
memo: [] | [Uint8Array | number[]];
|
|
20
20
|
created_at_time: [] | [Timestamp];
|
|
21
21
|
amount: bigint;
|
|
22
22
|
expected_allowance: [] | [bigint];
|
|
@@ -25,8 +25,8 @@ export interface Approve {
|
|
|
25
25
|
}
|
|
26
26
|
export interface ApproveArgs {
|
|
27
27
|
fee: [] | [bigint];
|
|
28
|
-
memo: [] | [Uint8Array];
|
|
29
|
-
from_subaccount: [] | [Uint8Array];
|
|
28
|
+
memo: [] | [Uint8Array | number[]];
|
|
29
|
+
from_subaccount: [] | [Uint8Array | number[]];
|
|
30
30
|
created_at_time: [] | [Timestamp];
|
|
31
31
|
amount: bigint;
|
|
32
32
|
expected_allowance: [] | [bigint];
|
|
@@ -53,15 +53,15 @@ export interface BlockRange {
|
|
|
53
53
|
}
|
|
54
54
|
export interface Burn {
|
|
55
55
|
from: Account;
|
|
56
|
-
memo: [] | [Uint8Array];
|
|
56
|
+
memo: [] | [Uint8Array | number[]];
|
|
57
57
|
created_at_time: [] | [Timestamp];
|
|
58
58
|
amount: bigint;
|
|
59
59
|
spender: [] | [Account];
|
|
60
60
|
}
|
|
61
61
|
export type ChangeFeeCollector = { SetTo: Account } | { Unset: null };
|
|
62
62
|
export interface DataCertificate {
|
|
63
|
-
certificate: [] | [Uint8Array];
|
|
64
|
-
hash_tree: Uint8Array;
|
|
63
|
+
certificate: [] | [Uint8Array | number[]];
|
|
64
|
+
hash_tree: Uint8Array | number[];
|
|
65
65
|
}
|
|
66
66
|
export type Duration = bigint;
|
|
67
67
|
export interface FeatureFlags {
|
|
@@ -72,7 +72,7 @@ export interface GetBlocksArgs {
|
|
|
72
72
|
length: bigint;
|
|
73
73
|
}
|
|
74
74
|
export interface GetBlocksResponse {
|
|
75
|
-
certificate: [] | [Uint8Array];
|
|
75
|
+
certificate: [] | [Uint8Array | number[]];
|
|
76
76
|
first_index: BlockIndex;
|
|
77
77
|
blocks: Array<Block>;
|
|
78
78
|
chain_length: bigint;
|
|
@@ -99,11 +99,11 @@ export interface GetTransactionsResponse {
|
|
|
99
99
|
export interface HttpRequest {
|
|
100
100
|
url: string;
|
|
101
101
|
method: string;
|
|
102
|
-
body: Uint8Array;
|
|
102
|
+
body: Uint8Array | number[];
|
|
103
103
|
headers: Array<[string, string]>;
|
|
104
104
|
}
|
|
105
105
|
export interface HttpResponse {
|
|
106
|
-
body: Uint8Array;
|
|
106
|
+
body: Uint8Array | number[];
|
|
107
107
|
headers: Array<[string, string]>;
|
|
108
108
|
status_code: number;
|
|
109
109
|
}
|
|
@@ -135,11 +135,11 @@ export type Map = Array<[string, Value]>;
|
|
|
135
135
|
export type MetadataValue =
|
|
136
136
|
| { Int: bigint }
|
|
137
137
|
| { Nat: bigint }
|
|
138
|
-
| { Blob: Uint8Array }
|
|
138
|
+
| { Blob: Uint8Array | number[] }
|
|
139
139
|
| { Text: string };
|
|
140
140
|
export interface Mint {
|
|
141
141
|
to: Account;
|
|
142
|
-
memo: [] | [Uint8Array];
|
|
142
|
+
memo: [] | [Uint8Array | number[]];
|
|
143
143
|
created_at_time: [] | [Timestamp];
|
|
144
144
|
amount: bigint;
|
|
145
145
|
}
|
|
@@ -152,7 +152,7 @@ export interface StandardRecord {
|
|
|
152
152
|
url: string;
|
|
153
153
|
name: string;
|
|
154
154
|
}
|
|
155
|
-
export type Subaccount = Uint8Array;
|
|
155
|
+
export type Subaccount = Uint8Array | number[];
|
|
156
156
|
export type Timestamp = bigint;
|
|
157
157
|
export type Tokens = bigint;
|
|
158
158
|
export interface Transaction {
|
|
@@ -170,7 +170,7 @@ export interface Transfer {
|
|
|
170
170
|
to: Account;
|
|
171
171
|
fee: [] | [bigint];
|
|
172
172
|
from: Account;
|
|
173
|
-
memo: [] | [Uint8Array];
|
|
173
|
+
memo: [] | [Uint8Array | number[]];
|
|
174
174
|
created_at_time: [] | [Timestamp];
|
|
175
175
|
amount: bigint;
|
|
176
176
|
spender: [] | [Account];
|
|
@@ -178,7 +178,7 @@ export interface Transfer {
|
|
|
178
178
|
export interface TransferArg {
|
|
179
179
|
to: Account;
|
|
180
180
|
fee: [] | [Tokens];
|
|
181
|
-
memo: [] | [Uint8Array];
|
|
181
|
+
memo: [] | [Uint8Array | number[]];
|
|
182
182
|
from_subaccount: [] | [Subaccount];
|
|
183
183
|
created_at_time: [] | [Timestamp];
|
|
184
184
|
amount: Tokens;
|
|
@@ -199,7 +199,7 @@ export interface TransferFromArgs {
|
|
|
199
199
|
fee: [] | [Tokens];
|
|
200
200
|
spender_subaccount: [] | [Subaccount];
|
|
201
201
|
from: Account;
|
|
202
|
-
memo: [] | [Uint8Array];
|
|
202
|
+
memo: [] | [Uint8Array | number[]];
|
|
203
203
|
created_at_time: [] | [Timestamp];
|
|
204
204
|
amount: Tokens;
|
|
205
205
|
}
|
|
@@ -236,7 +236,7 @@ export type Value =
|
|
|
236
236
|
| { Map: Map }
|
|
237
237
|
| { Nat: bigint }
|
|
238
238
|
| { Nat64: bigint }
|
|
239
|
-
| { Blob: Uint8Array }
|
|
239
|
+
| { Blob: Uint8Array | number[] }
|
|
240
240
|
| { Text: string }
|
|
241
241
|
| { Array: Array<Value> };
|
|
242
242
|
export interface _SERVICE {
|
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)(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 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});
|
|
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(uint8ArrayToHexString(subaccount));\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,GAA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ction 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,EACrDE,EAAOF,EAAI,IACXG,EAAUH,EAAI,OAAO,CACzB,MAAUA,EAAI,UACd,WAAeA,EAAI,IAAIA,EAAI,IAAIA,EAAI,IAAI,CAAC,CAC1C,CAAC,EACKI,EAA6BJ,EAAI,OAAO,CAC5C,YAAgBA,EAAI,IACpB,MAAUA,EAAI,IAAIE,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AU,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
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"]
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as S,b as
|
|
1
|
+
import{a as S,b as m}from"./chunk-MJQNXPUY.js";import{a as b,b as p}from"./chunk-DXWXHYEN.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
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/types/ledger.responses.ts", "../../src/utils/ledger.utils.ts", "../../src/utils/payment.utils.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Principal } from \"@dfinity/principal\";\nimport type { Subaccount, Value } from \"../../candid/icrc_ledger\";\n\n// Source: https://github.com/dfinity/icrc-1#standard-metadata-entries\nexport enum IcrcMetadataResponseEntries {\n SYMBOL = \"icrc1:symbol\",\n NAME = \"icrc1:name\",\n DECIMALS = \"icrc1:decimals\",\n FEE = \"icrc1:fee\",\n LOGO = \"icrc1:logo\",\n}\n\nexport type IcrcTokenMetadataResponse = [\n string | IcrcMetadataResponseEntries,\n Value,\n][];\n\nexport interface IcrcAccount {\n owner: Principal;\n subaccount?: Subaccount;\n}\n", "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(uint8ArrayToHexString(subaccount));\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": "8FAIO,IAAKA,OACVA,EAAA,OAAS,eACTA,EAAA,KAAO,aACPA,EAAA,SAAW,iBACXA,EAAA,IAAM,YACNA,EAAA,KAAO,aALGA,OAAA,ICJZ,OAAS,aAAAC,MAAiB,qBAC1B,OACE,kBAAAC,EACA,gBAAAC,EACA,yBAAAC,EACA,aAAAC,EACA,kBAAAC,EACA,yBAAAC,MACK,iBAGP,IAAMC,EAA4B,GASrBC,EAAoB,CAAC,CAChC,MAAAC,EACA,WAAAC,CACF,IAA2B,CACzB,GAAIN,EAAUM,CAAU,EACtB,OAAOD,EAAM,OAAO,EAKtB,IAAME,GAFsBC,GAAyBA,EAAK,QAAQ,MAAO,EAAE,
|
|
4
|
+
"sourcesContent": ["import type { Principal } from \"@dfinity/principal\";\nimport type { Subaccount, Value } from \"../../candid/icrc_ledger\";\n\n// Source: https://github.com/dfinity/icrc-1#standard-metadata-entries\nexport enum IcrcMetadataResponseEntries {\n SYMBOL = \"icrc1:symbol\",\n NAME = \"icrc1:name\",\n DECIMALS = \"icrc1:decimals\",\n FEE = \"icrc1:fee\",\n LOGO = \"icrc1:logo\",\n}\n\nexport type IcrcTokenMetadataResponse = [\n string | IcrcMetadataResponseEntries,\n Value,\n][];\n\nexport interface IcrcAccount {\n owner: Principal;\n subaccount?: Subaccount;\n}\n", "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": "8FAIO,IAAKA,OACVA,EAAA,OAAS,eACTA,EAAA,KAAO,aACPA,EAAA,SAAW,iBACXA,EAAA,IAAM,Y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,oCAAoC,EAGtD,OAAOG,CACT,EC1FA,OAAS,aAAAC,EAAW,cAAAC,MAAkB,iBAyB/B,IAAMC,EACXC,GACuE,CACvE,IAAMC,EACJ,+EAEIC,EAAQF,EAAK,MAAMC,CAAK,EAC9B,GAAIJ,EAAUK,CAAK,EACjB,OAIF,GAAM,CAACC,EAAGC,EAAOC,EAAYC,CAAM,EAAIJ,EAEvC,MAAO,CACL,MAAAE,EACA,WAAAC,EACA,GAAIP,EAAWQ,CAAM,GACnB,CAAC,MAAM,WAAWA,CAAM,CAAC,GAAK,CAAE,OAAQ,WAAWA,CAAM,CAAE,CAC/D,CACF",
|
|
6
6
|
"names": ["IcrcMetadataResponseEntries", "Principal", "bigEndianCrc32", "encodeBase32", "hexStringToUint8Array", "isNullish", "notEmptyString", "uint8ArrayToHexString", "MAX_SUBACCOUNT_HEX_LENGTH", "encodeIcrcAccount", "owner", "subaccount", "subaccountText", "text", "encodeCrc", "crc", "decodeIcrcAccount", "accountString", "principalAndMaybeCheckSum", "subaccountHex", "checksum", "rest", "principalText", "account", "isNullish", "nonNullish", "decodePayment", "code", "regex", "match", "_", "token", "identifier", "amount"]
|
|
7
7
|
}
|