@dfinity/nns 0.7.0 → 0.8.0-next-2022-09-22

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.
@@ -1,2 +1,2 @@
1
- import{t as a}from"./chunk-EBY4MEUW.js";import"./chunk-SXX75EEC.js";import"./chunk-JKX2HJUB.js";import"./chunk-H6Y4RZE2.js";import"./chunk-IL4SIX75.js";import"./chunk-XMMTS4WT.js";import"./chunk-Q3ETFEQV.js";export{a as GovernanceCanister};
1
+ import{t as a}from"./chunk-OQ6FZDUA.js";import"./chunk-I4ASNREM.js";import"./chunk-JKX2HJUB.js";import"./chunk-H6Y4RZE2.js";import"./chunk-IL4SIX75.js";import"./chunk-XMMTS4WT.js";import"./chunk-Q3ETFEQV.js";export{a as GovernanceCanister};
2
2
  //# sourceMappingURL=governance.canister.js.map
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-INZ5ERFK.js";import{a as v,b as P,c as b,d as y,e as B,f as S,g as C,h as g,i as T,j as _,k as w,l as A,m as G,n as V,o as W,p as h,q as k,r as D,s as F,t as m}from"./chunk-EBY4MEUW.js";import{k as d,l as u}from"./chunk-SXX75EEC.js";import{a as I}from"./chunk-MM4DMXZG.js";import{a as z,b as E,c as H,d as J,e as K,f as M,g as Q,h as R,i as U,j as c}from"./chunk-LWTBV6PO.js";import"./chunk-JKX2HJUB.js";import{a as x}from"./chunk-LBNBEXHT.js";import"./chunk-H6Y4RZE2.js";import{a as L,b as O,c as j,d as q}from"./chunk-WMBK2I6I.js";import"./chunk-IL4SIX75.js";import"./chunk-XMMTS4WT.js";import"./chunk-Q3ETFEQV.js";var f=({recentBallots:e,proposalId:o})=>o?e.find(({proposalId:r})=>r===o)?.vote:void 0,N=({neurons:e,proposal:o})=>{let{ballots:n,proposalTimestampSeconds:r}=o;return e.filter(({createdTimestampSeconds:t,neuronId:s})=>{let p=t>r,l=n.find(({neuronId:a})=>a===s)===void 0;return p||l})},X=({neurons:e,proposal:o})=>{let{id:n}=o;return e.filter(({recentBallots:r,neuronId:t})=>f({recentBallots:r,proposalId:n})===void 0&&N({neurons:e,proposal:o}).find(({neuronId:s})=>s===t)===void 0)},Y=({neurons:e,proposal:o})=>{let{id:n}=o;return e.filter(({recentBallots:r})=>f({recentBallots:r,proposalId:n})!==void 0)};export{d as AccountIdentifier,Q as BadFeeError,P as CouldNotClaimNeuronError,T as FeatureNotSupportedError,L as FromStringToTokenError,i as GenesisTokenCanister,m as GovernanceCanister,B as GovernanceError,I as ICP,j as ICPToken,b as InsufficientAmountError,H as InsufficientFundsError,C as InvalidAccountIDError,S as InvalidPercentageError,E as InvalidSenderError,c as LedgerCanister,G as NeuronState,D as NnsFunction,W as ProposalRewardStatus,h as ProposalStatus,x as SnsWasmCanister,v as StakeNeuronError,u as SubAccount,q as TokenAmount,V as Topic,z as TransferError,K as TxCreatedInFutureError,M as TxDuplicateError,J as TxTooOldError,y as UnrecognizedTypeError,g as UnsupportedValueError,k as Vote,w as accountIdentifierFromBytes,_ as accountIdentifierToBytes,F as checkAccountId,O as convertStringToE8s,N as ineligibleNeurons,R as mapTransferError,U as mapTransferProtoError,A as principalToAccountIdentifier,X as votableNeurons,Y as votedNeurons};
1
+ import{a as i}from"./chunk-INZ5ERFK.js";import{a as v,b as P,c as b,d as y,e as B,f as S,g as C,h as g,i as T,j as _,k as w,l as A,m as G,n as V,o as W,p as h,q as k,r as D,s as F,t as m}from"./chunk-OQ6FZDUA.js";import{g as d,h as u}from"./chunk-I4ASNREM.js";import{a as I}from"./chunk-MM4DMXZG.js";import{a as z,b as E,c as H,d as J,e as K,f as M,g as Q,h as R,i as U,j as c}from"./chunk-NA2JZFZA.js";import"./chunk-JKX2HJUB.js";import{a as x}from"./chunk-LBNBEXHT.js";import"./chunk-H6Y4RZE2.js";import{a as L,b as O,c as j,d as q}from"./chunk-WMBK2I6I.js";import"./chunk-IL4SIX75.js";import"./chunk-XMMTS4WT.js";import"./chunk-Q3ETFEQV.js";var f=({recentBallots:e,proposalId:o})=>o?e.find(({proposalId:r})=>r===o)?.vote:void 0,N=({neurons:e,proposal:o})=>{let{ballots:n,proposalTimestampSeconds:r}=o;return e.filter(({createdTimestampSeconds:t,neuronId:s})=>{let p=t>r,l=n.find(({neuronId:a})=>a===s)===void 0;return p||l})},X=({neurons:e,proposal:o})=>{let{id:n}=o;return e.filter(({recentBallots:r,neuronId:t})=>f({recentBallots:r,proposalId:n})===void 0&&N({neurons:e,proposal:o}).find(({neuronId:s})=>s===t)===void 0)},Y=({neurons:e,proposal:o})=>{let{id:n}=o;return e.filter(({recentBallots:r})=>f({recentBallots:r,proposalId:n})!==void 0)};export{d as AccountIdentifier,Q as BadFeeError,P as CouldNotClaimNeuronError,T as FeatureNotSupportedError,L as FromStringToTokenError,i as GenesisTokenCanister,m as GovernanceCanister,B as GovernanceError,I as ICP,j as ICPToken,b as InsufficientAmountError,H as InsufficientFundsError,C as InvalidAccountIDError,S as InvalidPercentageError,E as InvalidSenderError,c as LedgerCanister,G as NeuronState,D as NnsFunction,W as ProposalRewardStatus,h as ProposalStatus,x as SnsWasmCanister,v as StakeNeuronError,u as SubAccount,q as TokenAmount,V as Topic,z as TransferError,K as TxCreatedInFutureError,M as TxDuplicateError,J as TxTooOldError,y as UnrecognizedTypeError,g as UnsupportedValueError,k as Vote,w as accountIdentifierFromBytes,_ as accountIdentifierToBytes,F as checkAccountId,O as convertStringToE8s,N as ineligibleNeurons,R as mapTransferError,U as mapTransferProtoError,A as principalToAccountIdentifier,X as votableNeurons,Y as votedNeurons};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- import{j as a}from"./chunk-LWTBV6PO.js";import"./chunk-JKX2HJUB.js";import"./chunk-H6Y4RZE2.js";import"./chunk-WMBK2I6I.js";import"./chunk-IL4SIX75.js";import"./chunk-XMMTS4WT.js";import"./chunk-Q3ETFEQV.js";export{a as LedgerCanister};
1
+ import{j as a}from"./chunk-NA2JZFZA.js";import"./chunk-JKX2HJUB.js";import"./chunk-H6Y4RZE2.js";import"./chunk-WMBK2I6I.js";import"./chunk-IL4SIX75.js";import"./chunk-XMMTS4WT.js";import"./chunk-Q3ETFEQV.js";export{a as LedgerCanister};
2
2
  //# sourceMappingURL=ledger.canister.js.map
@@ -3,10 +3,9 @@ import type { Command as RawCommand, ListNeurons as RawListNeurons, ListProposal
3
3
  import type { AccountIdentifier as AccountIdentifierClass } from "../../account_identifier";
4
4
  import type { Vote } from "../../enums/governance.enums";
5
5
  import type { E8s, NeuronId } from "../../types/common";
6
- import type { ClaimNeuronRequest, ClaimOrRefreshNeuronRequest, DisburseToNeuronRequest, FollowRequest, ListProposalsRequest, MakeProposalRequest, ManageNeuron, ProposalId } from "../../types/governance_converters";
6
+ import type { ClaimOrRefreshNeuronRequest, DisburseToNeuronRequest, FollowRequest, ListProposalsRequest, MakeProposalRequest, ManageNeuron, ProposalId } from "../../types/governance_converters";
7
7
  export declare const fromListNeurons: (neuronIds?: bigint[] | undefined) => RawListNeurons;
8
8
  export declare const fromManageNeuron: ({ id, command, neuronIdOrSubaccount, }: ManageNeuron) => RawManageNeuron;
9
- export declare const fromClaimNeuronRequest: ({ publicKey, nonce, dissolveDelayInSecs, }: ClaimNeuronRequest) => [Array<number>, bigint, bigint];
10
9
  export declare const fromListProposalsRequest: ({ includeRewardStatus, beforeProposal, excludeTopic, includeStatus, limit, }: ListProposalsRequest) => ListProposalInfo;
11
10
  export declare const fromClaimOrRefreshNeuronRequest: (request: ClaimOrRefreshNeuronRequest) => RawManageNeuron;
12
11
  export declare const toClaimOrRefreshRequest: ({ memo, controller, }: {
@@ -24,6 +24,8 @@ export declare type Action = {
24
24
  Motion: Motion;
25
25
  } | {
26
26
  SetSnsTokenSwapOpenTimeWindow: SetSnsTokenSwapOpenTimeWindow;
27
+ } | {
28
+ OpenSnsTokenSwap: OpenSnsTokenSwap;
27
29
  };
28
30
  export interface AddHotKey {
29
31
  newHotKey: Option<PrincipalString>;
@@ -94,6 +96,8 @@ export declare type Command = {
94
96
  DisburseToNeuron: DisburseToNeuron;
95
97
  } | {
96
98
  MergeMaturity: MergeMaturity;
99
+ } | {
100
+ StakeMaturity: StakeMaturity;
97
101
  } | {
98
102
  MakeProposal: Proposal;
99
103
  } | {
@@ -144,6 +148,9 @@ export interface KnownNeuron {
144
148
  export interface SetDissolveTimestamp {
145
149
  dissolveTimestampSeconds: bigint;
146
150
  }
151
+ export interface ChangeAutoStakeMaturity {
152
+ requestedSettingForAutoStakeMaturity: boolean;
153
+ }
147
154
  export interface ListProposalsRequest {
148
155
  limit: number;
149
156
  beforeProposal: Option<ProposalId>;
@@ -169,6 +176,9 @@ export interface MergeRequest {
169
176
  sourceNeuronId: NeuronId;
170
177
  targetNeuronId: NeuronId;
171
178
  }
179
+ export interface StakeMaturity {
180
+ percentageToStake?: number;
181
+ }
172
182
  export interface MergeMaturity {
173
183
  percentageToMerge: number;
174
184
  }
@@ -193,6 +203,19 @@ export interface MethodAuthzInfo {
193
203
  export interface Motion {
194
204
  motionText: string;
195
205
  }
206
+ export interface OpenSnsTokenSwap {
207
+ communityFundInvestmentE8s?: bigint;
208
+ targetSwapCanisterId?: Principal;
209
+ params?: {
210
+ minParticipantIcpE8s: bigint;
211
+ maxIcpE8s: bigint;
212
+ swapDueTimestampSeconds: bigint;
213
+ minParticipants: number;
214
+ snsTokenE8s: bigint;
215
+ maxParticipantIcpE8s: bigint;
216
+ minIcpE8s: bigint;
217
+ };
218
+ }
196
219
  export interface SetSnsTokenSwapOpenTimeWindow {
197
220
  request?: {
198
221
  openTimeWindow?: {
@@ -214,12 +237,14 @@ export interface NetworkEconomics {
214
237
  }
215
238
  export interface Neuron {
216
239
  id: Option<NeuronId>;
240
+ stakedMaturityE8sEquivalent: Option<bigint>;
217
241
  controller: Option<PrincipalString>;
218
242
  recentBallots: Array<BallotInfo>;
219
243
  kycVerified: boolean;
220
244
  notForProfit: boolean;
221
245
  cachedNeuronStake: E8s;
222
246
  createdTimestampSeconds: bigint;
247
+ autoStakeMaturity: Option<boolean>;
223
248
  maturityE8sEquivalent: bigint;
224
249
  agingSinceTimestampSeconds: bigint;
225
250
  spawnAtTimesSeconds: Option<bigint>;
@@ -267,6 +292,8 @@ export declare type Operation = {
267
292
  LeaveCommunityFund: Record<string, never>;
268
293
  } | {
269
294
  SetDissolveTimestamp: SetDissolveTimestamp;
295
+ } | {
296
+ ChangeAutoStakeMaturity: ChangeAutoStakeMaturity;
270
297
  };
271
298
  export interface Proposal {
272
299
  title: Option<string>;
@@ -1,7 +1,2 @@
1
- export declare const uint8ArrayToBigInt: (array: Uint8Array) => bigint;
2
- export declare const arrayBufferToArrayOfNumber: (buffer: ArrayBuffer) => Array<number>;
3
- export declare const arrayOfNumberToUint8Array: (numbers: Array<number>) => Uint8Array;
4
- export declare const arrayOfNumberToArrayBuffer: (numbers: Array<number>) => ArrayBuffer;
5
- export declare const asciiStringToByteArray: (text: string) => Array<number>;
6
1
  export declare const toHexString: (bytes: Uint8Array) => string;
7
2
  export declare const calculateCrc32: (bytes: Uint8Array) => Uint8Array;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dfinity/nns",
3
- "version": "0.7.0",
3
+ "version": "0.8.0-next-2022-09-22",
4
4
  "description": "A library for interfacing with the Internet Computer's Network Nervous System.",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/cjs/index.cjs.js",
@@ -55,6 +55,6 @@
55
55
  "network-nervous-system"
56
56
  ],
57
57
  "peerDependencies": {
58
- "@dfinity/utils": "^0.0.2"
58
+ "@dfinity/utils": "^0.0.3-next"
59
59
  }
60
- }
60
+ }
@@ -1,2 +0,0 @@
1
- import{a as W,b as Q}from"./chunk-JKX2HJUB.js";import{b as M}from"./chunk-H6Y4RZE2.js";import{b as z}from"./chunk-WMBK2I6I.js";import{a as p}from"./chunk-IL4SIX75.js";import{c as H}from"./chunk-XMMTS4WT.js";import{b as E}from"./chunk-Q3ETFEQV.js";import{createServices as Y}from"@dfinity/utils";var G=({IDL:e})=>{let t=e.Nat64,r=e.Record({start:t,length:e.Nat64}),n=e.Nat64,c=e.Vec(e.Nat8),o=e.Record({e8s:e.Nat64}),a=e.Variant({Burn:e.Record({from:c,amount:o}),Mint:e.Record({to:c,amount:o}),Transfer:e.Record({to:c,fee:o,from:c,amount:o})}),i=e.Record({timestamp_nanos:e.Nat64}),l=e.Record({memo:n,operation:e.Opt(a),created_at_time:i}),d=e.Record({transaction:l,timestamp:i,parent_hash:e.Opt(e.Vec(e.Nat8))}),m=e.Record({blocks:e.Vec(d)}),T=e.Variant({BadFirstBlockIndex:e.Record({requested_index:t,first_valid_index:t}),Other:e.Record({error_message:e.Text,error_code:e.Nat64})}),f=e.Variant({Ok:m,Err:T}),x=e.Func([r],[f],[]),w=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),blocks:e.Vec(d),chain_length:e.Nat64,first_block_index:t,archived_blocks:e.Vec(e.Record({callback:x,start:t,length:e.Nat64}))}),F=e.Record({account:c}),v=e.Record({canister_id:e.Principal}),N=e.Record({archives:e.Vec(v)}),k=e.Vec(e.Nat8),A=e.Record({to:c,fee:o,memo:n,from_subaccount:e.Opt(k),created_at_time:e.Opt(i),amount:o}),B=e.Variant({TxTooOld:e.Record({allowed_window_nanos:e.Nat64}),BadFee:e.Record({expected_fee:o}),TxDuplicate:e.Record({duplicate_of:t}),TxCreatedInFuture:e.Null,InsufficientFunds:e.Record({balance:o})}),S=e.Variant({Ok:t,Err:B}),O=e.Record({}),q=e.Record({transfer_fee:o});return e.Service({_blocks:e.Func([r],[w],[]),account_balance:e.Func([F],[o],[]),archives:e.Func([],[N],[]),decimals:e.Func([],[e.Record({decimals:e.Nat32})],[]),name:e.Func([],[e.Record({name:e.Text})],[]),symbol:e.Func([],[e.Record({symbol:e.Text})],[]),transfer:e.Func([A],[S],[]),transfer_fee:e.Func([O],[q],[])})};var U=({IDL:e})=>{let t=e.Vec(e.Nat8),r=e.Record({account:t}),n=e.Record({e8s:e.Nat64}),c=e.Record({canister_id:e.Principal}),o=e.Record({archives:e.Vec(c)}),a=e.Nat64,i=e.Record({start:a,length:e.Nat64}),l=e.Nat64,d=e.Variant({Burn:e.Record({from:t,amount:n}),Mint:e.Record({to:t,amount:n}),Transfer:e.Record({to:t,fee:n,from:t,amount:n})}),m=e.Record({timestamp_nanos:e.Nat64}),T=e.Record({memo:l,operation:e.Opt(d),created_at_time:m}),f=e.Record({transaction:T,timestamp:m,parent_hash:e.Opt(e.Vec(e.Nat8))}),x=e.Record({blocks:e.Vec(f)}),w=e.Variant({BadFirstBlockIndex:e.Record({requested_index:a,first_valid_index:a}),Other:e.Record({error_message:e.Text,error_code:e.Nat64})}),F=e.Variant({Ok:x,Err:w}),v=e.Func([i],[F],["query"]),N=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),blocks:e.Vec(f),chain_length:e.Nat64,first_block_index:a,archived_blocks:e.Vec(e.Record({callback:v,start:a,length:e.Nat64}))}),k=e.Vec(e.Nat8),A=e.Record({to:t,fee:n,memo:l,from_subaccount:e.Opt(k),created_at_time:e.Opt(m),amount:n}),B=e.Variant({TxTooOld:e.Record({allowed_window_nanos:e.Nat64}),BadFee:e.Record({expected_fee:n}),TxDuplicate:e.Record({duplicate_of:a}),TxCreatedInFuture:e.Null,InsufficientFunds:e.Record({balance:n})}),S=e.Variant({Ok:a,Err:B}),O=e.Record({}),q=e.Record({transfer_fee:n});return e.Service({account_balance:e.Func([r],[n],["query"]),archives:e.Func([],[o],["query"]),decimals:e.Func([],[e.Record({decimals:e.Nat32})],["query"]),name:e.Func([],[e.Record({name:e.Text})],["query"]),query_blocks:e.Func([i],[N],["query"]),symbol:e.Func([],[e.Record({symbol:e.Text})],["query"]),transfer:e.Func([A],[S],[]),transfer_fee:e.Func([O],[q],["query"])})};var s=E(H());var R=E(H());var J=e=>{let t=new Uint8Array(e).buffer,r=new R.Subaccount;return r.setSubAccount(new Uint8Array(t)),r},V=e=>{let t=new R.ICPTs;return t.setE8s(e.toString(10)),t},j=e=>({e8s:e}),$=({to:e,amount:t,memo:r,fee:n,fromSubAccount:c})=>({to:e.toNumbers(),fee:j(n??p),amount:j(t),memo:r??BigInt(0),created_at_time:[],from_subaccount:c===void 0?[]:[c]});var u=class extends Error{},C=class extends u{},h=class extends u{constructor(r){super();this.balance=r}},y=class extends u{constructor(r){super();this.allowed_window_secs=r}},b=class extends u{},g=class extends u{constructor(r){super();this.duplicateOf=r}},P=class extends u{constructor(r){super();this.expectedFee=r}},K=e=>"TxDuplicate"in e?new g(e.TxDuplicate.duplicate_of):"InsufficientFunds"in e?new h(e.InsufficientFunds.balance.e8s):"TxCreatedInFuture"in e?new b:"TxTooOld"in e?new y(Number(e.TxTooOld.allowed_window_nanos)):"BadFee"in e?new P(e.BadFee.expected_fee.e8s):new u(`Unknown error type ${JSON.stringify(e)}`),X=e=>{let{message:t}=e;if(t.includes("Reject code: 5")){if(t.match(/Sending from (.*) is not allowed/))return new C;{let r=t.match(/transaction.*duplicate.* in block (\d+)/);if(r&&r.length>1)return new g(BigInt(r[1]))}{let r=t.match(/debit account.*, current balance: (\d*(\.\d*)?)/);if(r&&r.length>1){let n=z(r[1]);if(typeof n=="bigint")return new h(n)}}if(t.includes("is in future"))return new b;{let r=t.match(/older than (\d+)/);if(r&&r.length>1)return new y(Number.parseInt(r[1]))}}throw e};var _=class{constructor(t,r,n,c,o,a,i=!1){this.agent=t;this.canisterId=r;this.service=n;this.certifiedService=c;this.updateFetcher=o;this.queryFetcher=a;this.hardwareWallet=i}static create(t={}){let r=t.canisterId??M,{service:n,certifiedService:c,agent:o}=Y({options:{...t,canisterId:r},idlFactory:U,certifiedIdlFactory:G});return new _(o,r,n,c,t.updateCallOverride??W,t.queryCallOverride??Q,t.hardwareWallet)}accountBalance=async({accountIdentifier:t,certified:r=!0})=>this.hardwareWallet?this.accountBalanceHardwareWallet({accountIdentifier:t,certified:r}):(await(r?this.certifiedService:this.service).account_balance({account:t.toNumbers()})).e8s;transactionFee=async()=>{let{transfer_fee:{e8s:t}}=await this.service.transfer_fee({});return t};transfer=async t=>{if(this.hardwareWallet)return this.transferHardwareWallet(t);t.fee===void 0&&(t.fee=this.hardwareWallet?p:await this.transactionFee());let r=$(t),n=await this.certifiedService.transfer(r);if("Err"in n)throw K(n.Err);return n.Ok};accountBalanceHardwareWallet=async({accountIdentifier:t,certified:r=!0})=>{let n=r?this.updateFetcher:this.queryFetcher,c=new s.AccountBalanceRequest;c.setAccount(t.toProto());let o=await n({agent:this.agent,canisterId:this.canisterId,methodName:"account_balance_pb",arg:c.serializeBinary()});return BigInt(s.ICPTs.deserializeBinary(new Uint8Array(o)).getE8s())};transferHardwareWallet=async({to:t,amount:r,memo:n,fee:c,fromSubAccount:o})=>{let a=new s.SendRequest;a.setTo(t.toProto());let i=new s.Payment;i.setReceiverGets(V(r)),a.setPayment(i),a.setMaxFee(V(c??p));let l=new s.Memo;l.setMemo((n??BigInt(0)).toString()),a.setMemo(l),o!==void 0&&a.setFromSubaccount(J(o));try{let d=await this.updateFetcher({agent:this.agent,canisterId:this.canisterId,methodName:"send_pb",arg:a.serializeBinary()});return BigInt(s.BlockHeight.deserializeBinary(d).getHeight())}catch(d){throw d instanceof Error?X(d):d}}};export{u as a,C as b,h as c,y as d,b as e,g as f,P as g,K as h,X as i,_ as j};
2
- //# sourceMappingURL=chunk-LWTBV6PO.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/ledger.canister.ts", "../../candid/ledger.certified.idl.js", "../../candid/ledger.idl.js", "../../src/canisters/ledger/ledger.request.converts.ts", "../../src/errors/ledger.errors.ts"],
4
- "sourcesContent": ["import type { ActorSubclass, Agent } from \"@dfinity/agent\";\nimport type { Principal } from \"@dfinity/principal\";\nimport { createServices } from \"@dfinity/utils\";\nimport type { _SERVICE as LedgerService } from \"../candid/ledger\";\nimport { idlFactory as certifiedIdlFactory } from \"../candid/ledger.certified.idl\";\nimport { idlFactory } from \"../candid/ledger.idl\";\nimport {\n AccountBalanceRequest,\n BlockHeight as PbBlockHeight,\n ICPTs,\n Memo,\n Payment,\n SendRequest,\n} from \"../proto/ledger_pb\";\nimport type { AccountIdentifier } from \"./account_identifier\";\nimport {\n subAccountNumbersToSubaccount,\n toICPTs,\n toTransferRawRequest,\n} from \"./canisters/ledger/ledger.request.converts\";\nimport { MAINNET_LEDGER_CANISTER_ID } from \"./constants/canister_ids\";\nimport { TRANSACTION_FEE } from \"./constants/constants\";\nimport {\n mapTransferError,\n mapTransferProtoError,\n} from \"./errors/ledger.errors\";\nimport type { BlockHeight } from \"./types/common\";\nimport type {\n LedgerCanisterCall,\n LedgerCanisterOptions,\n} from \"./types/ledger.options\";\nimport type { TransferRequest } from \"./types/ledger_converters\";\nimport { queryCall, updateCall } from \"./utils/proto.utils\";\n\nexport class LedgerCanister {\n private constructor(\n private readonly agent: Agent,\n private readonly canisterId: Principal,\n private readonly service: ActorSubclass<LedgerService>,\n private readonly certifiedService: ActorSubclass<LedgerService>,\n private readonly updateFetcher: LedgerCanisterCall,\n private readonly queryFetcher: LedgerCanisterCall,\n private readonly hardwareWallet: boolean = false\n ) {}\n\n public static create(options: LedgerCanisterOptions = {}) {\n const canisterId: Principal =\n options.canisterId ?? MAINNET_LEDGER_CANISTER_ID;\n\n const { service, certifiedService, agent } = createServices<LedgerService>({\n options: {\n ...options,\n canisterId,\n },\n idlFactory,\n certifiedIdlFactory,\n });\n\n return new LedgerCanister(\n agent,\n canisterId,\n service,\n certifiedService,\n options.updateCallOverride ?? updateCall,\n options.queryCallOverride ?? queryCall,\n options.hardwareWallet\n );\n }\n\n /**\n * Returns the balance of the specified account identifier.\n *\n * If `certified` is true, the request is fetched as an update call, otherwise\n * it is fetched using a query call.\n *\n * @throws {@link Error}\n */\n public accountBalance = async ({\n accountIdentifier,\n certified = true,\n }: {\n accountIdentifier: AccountIdentifier;\n certified?: boolean;\n }): Promise<bigint> => {\n if (this.hardwareWallet) {\n return this.accountBalanceHardwareWallet({\n accountIdentifier,\n certified,\n });\n }\n const service = certified ? this.certifiedService : this.service;\n const tokens = await service.account_balance({\n account: accountIdentifier.toNumbers(),\n });\n return tokens.e8s;\n };\n\n /**\n * Returns the transaction fee of the ledger canister\n * @returns {BigInt}\n */\n public transactionFee = async () => {\n const {\n transfer_fee: { e8s },\n } = await this.service.transfer_fee({});\n return e8s;\n };\n\n /**\n * Transfer ICP from the caller to the destination `accountIdentifier`.\n * Returns the index of the block containing the tx if it was successful.\n *\n * @throws {@link TransferError}\n */\n public transfer = async (request: TransferRequest): Promise<BlockHeight> => {\n if (this.hardwareWallet) {\n return this.transferHardwareWallet(request);\n }\n // When candid is implemented, the previous lines will go away.\n // But the transaction fee method is not supported by Ledger App yet.\n if (request.fee === undefined) {\n request.fee = this.hardwareWallet\n ? TRANSACTION_FEE\n : await this.transactionFee();\n }\n const rawRequest = toTransferRawRequest(request);\n const response = await this.certifiedService.transfer(rawRequest);\n if (\"Err\" in response) {\n throw mapTransferError(response.Err);\n }\n return response.Ok;\n };\n\n private accountBalanceHardwareWallet = async ({\n accountIdentifier,\n certified = true,\n }: {\n accountIdentifier: AccountIdentifier;\n certified?: boolean;\n }): Promise<bigint> => {\n const callMethod = certified ? this.updateFetcher : this.queryFetcher;\n\n const request = new AccountBalanceRequest();\n request.setAccount(accountIdentifier.toProto());\n\n const responseBytes = await callMethod({\n agent: this.agent,\n canisterId: this.canisterId,\n methodName: \"account_balance_pb\",\n arg: request.serializeBinary(),\n });\n\n return BigInt(\n ICPTs.deserializeBinary(new Uint8Array(responseBytes)).getE8s()\n );\n };\n\n private transferHardwareWallet = async ({\n to,\n amount,\n memo,\n fee,\n fromSubAccount,\n }: TransferRequest): Promise<BlockHeight> => {\n const request = new SendRequest();\n request.setTo(to.toProto());\n\n const payment = new Payment();\n payment.setReceiverGets(toICPTs(amount));\n request.setPayment(payment);\n\n request.setMaxFee(toICPTs(fee ?? TRANSACTION_FEE));\n\n // Always explicitly set the memo for compatibility with ledger wallet - hardware wallet\n const requestMemo: Memo = new Memo();\n requestMemo.setMemo((memo ?? BigInt(0)).toString());\n request.setMemo(requestMemo);\n\n if (fromSubAccount !== undefined) {\n request.setFromSubaccount(subAccountNumbersToSubaccount(fromSubAccount));\n }\n\n try {\n const responseBytes = await this.updateFetcher({\n agent: this.agent,\n canisterId: this.canisterId,\n methodName: \"send_pb\",\n arg: request.serializeBinary(),\n });\n\n // Successful tx. Return the block height.\n return BigInt(PbBlockHeight.deserializeBinary(responseBytes).getHeight());\n } catch (err) {\n if (err instanceof Error) {\n throw mapTransferProtoError(err);\n }\n\n throw err;\n }\n };\n}\n", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/nns/candid/ledger.did */\nexport const idlFactory = ({ IDL }) => {\n const BlockIndex = IDL.Nat64;\n const GetBlocksArgs = IDL.Record({\n 'start' : BlockIndex,\n 'length' : IDL.Nat64,\n });\n const Memo = IDL.Nat64;\n const AccountIdentifier = IDL.Vec(IDL.Nat8);\n const Tokens = IDL.Record({ 'e8s' : IDL.Nat64 });\n const Operation = IDL.Variant({\n 'Burn' : IDL.Record({ 'from' : AccountIdentifier, 'amount' : Tokens }),\n 'Mint' : IDL.Record({ 'to' : AccountIdentifier, 'amount' : Tokens }),\n 'Transfer' : IDL.Record({\n 'to' : AccountIdentifier,\n 'fee' : Tokens,\n 'from' : AccountIdentifier,\n 'amount' : Tokens,\n }),\n });\n const TimeStamp = IDL.Record({ 'timestamp_nanos' : IDL.Nat64 });\n const Transaction = IDL.Record({\n 'memo' : Memo,\n 'operation' : IDL.Opt(Operation),\n 'created_at_time' : TimeStamp,\n });\n const Block = IDL.Record({\n 'transaction' : Transaction,\n 'timestamp' : TimeStamp,\n 'parent_hash' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n });\n const BlockRange = IDL.Record({ 'blocks' : IDL.Vec(Block) });\n const QueryArchiveError = IDL.Variant({\n 'BadFirstBlockIndex' : IDL.Record({\n 'requested_index' : BlockIndex,\n 'first_valid_index' : BlockIndex,\n }),\n 'Other' : IDL.Record({\n 'error_message' : IDL.Text,\n 'error_code' : IDL.Nat64,\n }),\n });\n const QueryArchiveResult = IDL.Variant({\n 'Ok' : BlockRange,\n 'Err' : QueryArchiveError,\n });\n const QueryArchiveFn = IDL.Func([GetBlocksArgs], [QueryArchiveResult], []);\n const QueryBlocksResponse = IDL.Record({\n 'certificate' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'blocks' : IDL.Vec(Block),\n 'chain_length' : IDL.Nat64,\n 'first_block_index' : BlockIndex,\n 'archived_blocks' : IDL.Vec(\n IDL.Record({\n 'callback' : QueryArchiveFn,\n 'start' : BlockIndex,\n 'length' : IDL.Nat64,\n })\n ),\n });\n const AccountBalanceArgs = IDL.Record({ 'account' : AccountIdentifier });\n const Archive = IDL.Record({ 'canister_id' : IDL.Principal });\n const Archives = IDL.Record({ 'archives' : IDL.Vec(Archive) });\n const SubAccount = IDL.Vec(IDL.Nat8);\n const TransferArgs = IDL.Record({\n 'to' : AccountIdentifier,\n 'fee' : Tokens,\n 'memo' : Memo,\n 'from_subaccount' : IDL.Opt(SubAccount),\n 'created_at_time' : IDL.Opt(TimeStamp),\n 'amount' : Tokens,\n });\n const TransferError = IDL.Variant({\n 'TxTooOld' : IDL.Record({ 'allowed_window_nanos' : IDL.Nat64 }),\n 'BadFee' : IDL.Record({ 'expected_fee' : Tokens }),\n 'TxDuplicate' : IDL.Record({ 'duplicate_of' : BlockIndex }),\n 'TxCreatedInFuture' : IDL.Null,\n 'InsufficientFunds' : IDL.Record({ 'balance' : Tokens }),\n });\n const TransferResult = IDL.Variant({\n 'Ok' : BlockIndex,\n 'Err' : TransferError,\n });\n const TransferFeeArg = IDL.Record({});\n const TransferFee = IDL.Record({ 'transfer_fee' : Tokens });\n return IDL.Service({\n '_blocks' : IDL.Func([GetBlocksArgs], [QueryBlocksResponse], []),\n 'account_balance' : IDL.Func([AccountBalanceArgs], [Tokens], []),\n 'archives' : IDL.Func([], [Archives], []),\n 'decimals' : IDL.Func([], [IDL.Record({ 'decimals' : IDL.Nat32 })], []),\n 'name' : IDL.Func([], [IDL.Record({ 'name' : IDL.Text })], []),\n 'symbol' : IDL.Func([], [IDL.Record({ 'symbol' : IDL.Text })], []),\n 'transfer' : IDL.Func([TransferArgs], [TransferResult], []),\n 'transfer_fee' : IDL.Func([TransferFeeArg], [TransferFee], []),\n });\n};\nexport const init = ({ IDL }) => { return []; };\n", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/nns/candid/ledger.did */\nexport const idlFactory = ({ IDL }) => {\n const AccountIdentifier = IDL.Vec(IDL.Nat8);\n const AccountBalanceArgs = IDL.Record({ 'account' : AccountIdentifier });\n const Tokens = IDL.Record({ 'e8s' : IDL.Nat64 });\n const Archive = IDL.Record({ 'canister_id' : IDL.Principal });\n const Archives = IDL.Record({ 'archives' : IDL.Vec(Archive) });\n const BlockIndex = IDL.Nat64;\n const GetBlocksArgs = IDL.Record({\n 'start' : BlockIndex,\n 'length' : IDL.Nat64,\n });\n const Memo = IDL.Nat64;\n const Operation = IDL.Variant({\n 'Burn' : IDL.Record({ 'from' : AccountIdentifier, 'amount' : Tokens }),\n 'Mint' : IDL.Record({ 'to' : AccountIdentifier, 'amount' : Tokens }),\n 'Transfer' : IDL.Record({\n 'to' : AccountIdentifier,\n 'fee' : Tokens,\n 'from' : AccountIdentifier,\n 'amount' : Tokens,\n }),\n });\n const TimeStamp = IDL.Record({ 'timestamp_nanos' : IDL.Nat64 });\n const Transaction = IDL.Record({\n 'memo' : Memo,\n 'operation' : IDL.Opt(Operation),\n 'created_at_time' : TimeStamp,\n });\n const Block = IDL.Record({\n 'transaction' : Transaction,\n 'timestamp' : TimeStamp,\n 'parent_hash' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n });\n const BlockRange = IDL.Record({ 'blocks' : IDL.Vec(Block) });\n const QueryArchiveError = IDL.Variant({\n 'BadFirstBlockIndex' : IDL.Record({\n 'requested_index' : BlockIndex,\n 'first_valid_index' : BlockIndex,\n }),\n 'Other' : IDL.Record({\n 'error_message' : IDL.Text,\n 'error_code' : IDL.Nat64,\n }),\n });\n const QueryArchiveResult = IDL.Variant({\n 'Ok' : BlockRange,\n 'Err' : QueryArchiveError,\n });\n const QueryArchiveFn = IDL.Func(\n [GetBlocksArgs],\n [QueryArchiveResult],\n ['query'],\n );\n const QueryBlocksResponse = IDL.Record({\n 'certificate' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'blocks' : IDL.Vec(Block),\n 'chain_length' : IDL.Nat64,\n 'first_block_index' : BlockIndex,\n 'archived_blocks' : IDL.Vec(\n IDL.Record({\n 'callback' : QueryArchiveFn,\n 'start' : BlockIndex,\n 'length' : IDL.Nat64,\n })\n ),\n });\n const SubAccount = IDL.Vec(IDL.Nat8);\n const TransferArgs = IDL.Record({\n 'to' : AccountIdentifier,\n 'fee' : Tokens,\n 'memo' : Memo,\n 'from_subaccount' : IDL.Opt(SubAccount),\n 'created_at_time' : IDL.Opt(TimeStamp),\n 'amount' : Tokens,\n });\n const TransferError = IDL.Variant({\n 'TxTooOld' : IDL.Record({ 'allowed_window_nanos' : IDL.Nat64 }),\n 'BadFee' : IDL.Record({ 'expected_fee' : Tokens }),\n 'TxDuplicate' : IDL.Record({ 'duplicate_of' : BlockIndex }),\n 'TxCreatedInFuture' : IDL.Null,\n 'InsufficientFunds' : IDL.Record({ 'balance' : Tokens }),\n });\n const TransferResult = IDL.Variant({\n 'Ok' : BlockIndex,\n 'Err' : TransferError,\n });\n const TransferFeeArg = IDL.Record({});\n const TransferFee = IDL.Record({ 'transfer_fee' : Tokens });\n return IDL.Service({\n 'account_balance' : IDL.Func([AccountBalanceArgs], [Tokens], ['query']),\n 'archives' : IDL.Func([], [Archives], ['query']),\n 'decimals' : IDL.Func(\n [],\n [IDL.Record({ 'decimals' : IDL.Nat32 })],\n ['query'],\n ),\n 'name' : IDL.Func([], [IDL.Record({ 'name' : IDL.Text })], ['query']),\n 'query_blocks' : IDL.Func(\n [GetBlocksArgs],\n [QueryBlocksResponse],\n ['query'],\n ),\n 'symbol' : IDL.Func([], [IDL.Record({ 'symbol' : IDL.Text })], ['query']),\n 'transfer' : IDL.Func([TransferArgs], [TransferResult], []),\n 'transfer_fee' : IDL.Func([TransferFeeArg], [TransferFee], ['query']),\n });\n};\nexport const init = ({ IDL }) => { return []; };\n", "import type {\n Tokens,\n TransferArgs as TransferRawRequest,\n} from \"../../../candid/ledger\";\nimport { ICPTs, Subaccount } from \"../../../proto/ledger_pb\";\nimport { TRANSACTION_FEE } from \"../../constants/constants\";\nimport type { TransferRequest } from \"../../types/ledger_converters\";\n\nexport const subAccountNumbersToSubaccount = (\n subAccountNumbers: number[]\n): Subaccount => {\n const bytes = new Uint8Array(subAccountNumbers).buffer;\n const subaccount: Subaccount = new Subaccount();\n subaccount.setSubAccount(new Uint8Array(bytes));\n return subaccount;\n};\n\nexport const toICPTs = (amount: bigint): ICPTs => {\n const result = new ICPTs();\n result.setE8s(amount.toString(10));\n return result;\n};\n\nconst e8sToTokens = (e8s: bigint): Tokens => ({ e8s });\n\nexport const toTransferRawRequest = ({\n to,\n amount,\n memo,\n fee,\n fromSubAccount,\n}: TransferRequest): TransferRawRequest => ({\n to: to.toNumbers(),\n fee: e8sToTokens(fee ?? TRANSACTION_FEE),\n amount: e8sToTokens(amount),\n // Always explicitly set the memo for compatibility with ledger wallet - hardware wallet\n memo: memo ?? BigInt(0),\n created_at_time: [],\n from_subaccount: fromSubAccount === undefined ? [] : [fromSubAccount],\n});\n", "import type { TransferError as RawTransferError } from \"../../candid/ledger\";\nimport { convertStringToE8s } from \"../token\";\nimport type { BlockHeight } from \"../types/common\";\n\nexport class TransferError extends Error {}\n\nexport class InvalidSenderError extends TransferError {}\n\nexport class InsufficientFundsError extends TransferError {\n constructor(public readonly balance: bigint) {\n super();\n }\n}\n\nexport class TxTooOldError extends TransferError {\n constructor(public readonly allowed_window_secs: number) {\n super();\n }\n}\n\nexport class TxCreatedInFutureError extends TransferError {}\n\nexport class TxDuplicateError extends TransferError {\n constructor(public readonly duplicateOf: BlockHeight) {\n super();\n }\n}\n\nexport class BadFeeError extends TransferError {\n constructor(public readonly expectedFee: bigint) {\n super();\n }\n}\n\nexport const mapTransferError = (\n rawTransferError: RawTransferError\n): TransferError => {\n if (\"TxDuplicate\" in rawTransferError) {\n return new TxDuplicateError(rawTransferError.TxDuplicate.duplicate_of);\n }\n if (\"InsufficientFunds\" in rawTransferError) {\n return new InsufficientFundsError(\n rawTransferError.InsufficientFunds.balance.e8s\n );\n }\n if (\"TxCreatedInFuture\" in rawTransferError) {\n return new TxCreatedInFutureError();\n }\n if (\"TxTooOld\" in rawTransferError) {\n return new TxTooOldError(\n Number(rawTransferError.TxTooOld.allowed_window_nanos)\n );\n }\n if (\"BadFee\" in rawTransferError) {\n return new BadFeeError(rawTransferError.BadFee.expected_fee.e8s);\n }\n // Edge case\n return new TransferError(\n `Unknown error type ${JSON.stringify(rawTransferError)}`\n );\n};\n\nexport const mapTransferProtoError = (responseBytes: Error): TransferError => {\n const { message } = responseBytes;\n\n if (message.includes(\"Reject code: 5\")) {\n // Match against the different error types.\n // This string matching is fragile. It's a stop-gap solution until\n // we migrate to the candid interface.\n\n if (message.match(/Sending from (.*) is not allowed/)) {\n return new InvalidSenderError();\n }\n\n {\n const m = message.match(/transaction.*duplicate.* in block (\\d+)/);\n if (m && m.length > 1) {\n return new TxDuplicateError(BigInt(m[1]));\n }\n }\n\n {\n const m = message.match(\n /debit account.*, current balance: (\\d*(\\.\\d*)?)/\n );\n if (m && m.length > 1) {\n const balance = convertStringToE8s(m[1]);\n if (typeof balance === \"bigint\") {\n return new InsufficientFundsError(balance);\n }\n }\n }\n\n if (message.includes(\"is in future\")) {\n return new TxCreatedInFutureError();\n }\n\n {\n const m = message.match(/older than (\\d+)/);\n if (m && m.length > 1) {\n return new TxTooOldError(Number.parseInt(m[1]));\n }\n }\n }\n\n // Unknown error. Throw as-is.\n throw responseBytes;\n};\n"],
5
- "mappings": "uPAEA,gDCDO,GAAM,GAAa,CAAC,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