-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnear-api-js.min.js
1249 lines (1172 loc) · 251 KB
/
near-api-js.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function (Buffer){(function (){
window.nearApi=require("./lib/browser-index"),window.Buffer=Buffer;
}).call(this)}).call(this,require("buffer").Buffer)
},{"./lib/browser-index":6,"buffer":40}],2:[function(require,module,exports){
(function (Buffer){(function (){
"use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Account=void 0;const bn_js_1=__importDefault(require("bn.js")),depd_1=__importDefault(require("depd")),transaction_1=require("./transaction"),providers_1=require("./providers"),borsh_1=require("borsh"),key_pair_1=require("./utils/key_pair"),errors_1=require("./utils/errors"),rpc_errors_1=require("./utils/rpc_errors"),exponential_backoff_1=__importDefault(require("./utils/exponential-backoff")),DEFAULT_FUNC_CALL_GAS=new bn_js_1.default("30000000000000"),TX_NONCE_RETRY_NUMBER=12,TX_NONCE_RETRY_WAIT=500,TX_NONCE_RETRY_WAIT_BACKOFF=1.5;function parseJsonFromRawResponse(t){return JSON.parse(Buffer.from(t).toString())}class Account{constructor(t,e){this.accessKeyByPublicKeyCache={},this.connection=t,this.accountId=e}get ready(){return depd_1.default("Account.ready()")("not needed anymore, always ready"),Promise.resolve()}async fetchState(){depd_1.default("Account.fetchState()")("use `Account.state()` instead")}async state(){return this.connection.provider.query({request_type:"view_account",account_id:this.accountId,finality:"optimistic"})}printLogsAndFailures(t,e){for(const n of e)console.log(`Receipt${n.receiptIds.length>1?"s":""}: ${n.receiptIds.join(", ")}`),this.printLogs(t,n.logs,"\t"),n.failure&&console.warn(`\tFailure [${t}]: ${n.failure}`)}printLogs(t,e,n=""){for(const r of e)console.log(`${n}Log [${t}]: ${r}`)}async signTransaction(t,e){const n=await this.findAccessKey(t,e);if(!n)throw new providers_1.TypedError(`Can not sign transactions for account ${this.accountId} on network ${this.connection.networkId}, no matching key pair found in ${this.connection.signer}.`,"KeyNotFound");const{accessKey:r}=n,s=(await this.connection.provider.block({finality:"final"})).header.hash,a=++r.nonce;return await transaction_1.signTransaction(t,a,e,borsh_1.baseDecode(s),this.connection.signer,this.accountId,this.connection.networkId)}signAndSendTransaction(...t){return"string"==typeof t[0]?this.signAndSendTransactionV1(t[0],t[1]):this.signAndSendTransactionV2(t[0])}signAndSendTransactionV1(t,e){return depd_1.default("Account.signAndSendTransaction(receiverId, actions")("use `Account.signAndSendTransaction(SignAndSendTransactionOptions)` instead"),this.signAndSendTransactionV2({receiverId:t,actions:e})}async signAndSendTransactionV2({receiverId:t,actions:e}){let n,r;const s=await exponential_backoff_1.default(TX_NONCE_RETRY_WAIT,TX_NONCE_RETRY_NUMBER,TX_NONCE_RETRY_WAIT_BACKOFF,async()=>{[n,r]=await this.signTransaction(t,e);const s=r.transaction.publicKey;try{return await this.connection.provider.sendTransaction(r)}catch(e){if("InvalidNonce"===e.type)return console.warn(`Retrying transaction ${t}:${borsh_1.baseEncode(n)} with new nonce.`),delete this.accessKeyByPublicKeyCache[s.toString()],null;throw e.context=new providers_1.ErrorContext(borsh_1.baseEncode(n)),e}});if(!s)throw new providers_1.TypedError("nonce retries exceeded for transaction. This usually means there are too many parallel requests with the same access key.","RetriesExceeded");const a=[s.transaction_outcome,...s.receipts_outcome].reduce((t,e)=>e.outcome.logs.length||"object"==typeof e.outcome.status&&"object"==typeof e.outcome.status.Failure?t.concat({receiptIds:e.outcome.receipt_ids,logs:e.outcome.logs,failure:void 0!==e.outcome.status.Failure?rpc_errors_1.parseRpcError(e.outcome.status.Failure):null}):t,[]);if(this.printLogsAndFailures(r.transaction.receiverId,a),"object"==typeof s.status&&"object"==typeof s.status.Failure)throw s.status.Failure.error_message&&s.status.Failure.error_type?new providers_1.TypedError(`Transaction ${s.transaction_outcome.id} failed. ${s.status.Failure.error_message}`,s.status.Failure.error_type):rpc_errors_1.parseResultError(s);return s}async findAccessKey(t,e){const n=await this.connection.signer.getPublicKey(this.accountId,this.connection.networkId);if(!n)return null;const r=this.accessKeyByPublicKeyCache[n.toString()];if(void 0!==r)return{publicKey:n,accessKey:r};try{const t=await this.connection.provider.query({request_type:"view_access_key",account_id:this.accountId,public_key:n.toString(),finality:"optimistic"});return this.accessKeyByPublicKeyCache[n.toString()]?{publicKey:n,accessKey:this.accessKeyByPublicKeyCache[n.toString()]}:(this.accessKeyByPublicKeyCache[n.toString()]=t,{publicKey:n,accessKey:t})}catch(t){if("AccessKeyDoesNotExist"==t.type)return null;throw t}}async createAndDeployContract(t,e,n,r){const s=transaction_1.fullAccessKey();return await this.signAndSendTransaction({receiverId:t,actions:[transaction_1.createAccount(),transaction_1.transfer(r),transaction_1.addKey(key_pair_1.PublicKey.from(e),s),transaction_1.deployContract(n)]}),new Account(this.connection,t)}async sendMoney(t,e){return this.signAndSendTransaction({receiverId:t,actions:[transaction_1.transfer(e)]})}async createAccount(t,e,n){const r=transaction_1.fullAccessKey();return this.signAndSendTransaction({receiverId:t,actions:[transaction_1.createAccount(),transaction_1.transfer(n),transaction_1.addKey(key_pair_1.PublicKey.from(e),r)]})}async deleteAccount(t){return this.signAndSendTransaction({receiverId:this.accountId,actions:[transaction_1.deleteAccount(t)]})}async deployContract(t){return this.signAndSendTransaction({receiverId:this.accountId,actions:[transaction_1.deployContract(t)]})}async functionCall(...t){return"string"==typeof t[0]?this.functionCallV1(t[0],t[1],t[2],t[3],t[4]):this.functionCallV2(t[0])}functionCallV1(t,e,n,r,s){return depd_1.default("Account.functionCall(contractId, methodName, args, gas, amount)")("use `Account.functionCall(FunctionCallOptions)` instead"),n=n||{},this.validateArgs(n),this.signAndSendTransaction({receiverId:t,actions:[transaction_1.functionCall(e,n,r||DEFAULT_FUNC_CALL_GAS,s)]})}functionCallV2({contractId:t,methodName:e,args:n={},gas:r=DEFAULT_FUNC_CALL_GAS,attachedDeposit:s,walletMeta:a,walletCallbackUrl:i}){return this.validateArgs(n),this.signAndSendTransaction({receiverId:t,actions:[transaction_1.functionCall(e,n,r,s)],walletMeta:a,walletCallbackUrl:i})}async addKey(t,e,n,r){let s;return n||(n=[]),Array.isArray(n)||(n=[n]),s=e?transaction_1.functionCallAccessKey(e,n,r):transaction_1.fullAccessKey(),this.signAndSendTransaction({receiverId:this.accountId,actions:[transaction_1.addKey(key_pair_1.PublicKey.from(t),s)]})}async deleteKey(t){return this.signAndSendTransaction({receiverId:this.accountId,actions:[transaction_1.deleteKey(key_pair_1.PublicKey.from(t))]})}async stake(t,e){return this.signAndSendTransaction({receiverId:this.accountId,actions:[transaction_1.stake(e,key_pair_1.PublicKey.from(t))]})}validateArgs(t){if(!(void 0!==t.byteLength&&t.byteLength===t.length)&&(Array.isArray(t)||"object"!=typeof t))throw new errors_1.PositionalArgsError}async viewFunction(t,e,n={},{parse:r=parseJsonFromRawResponse}={}){this.validateArgs(n);const s=await this.connection.provider.query({request_type:"call_function",account_id:t,method_name:e,args_base64:Buffer.from(JSON.stringify(n)).toString("base64"),finality:"optimistic"});return s.logs&&this.printLogs(t,s.logs),s.result&&s.result.length>0&&r(Buffer.from(s.result))}async viewState(t,e={finality:"optimistic"}){const{values:n}=await this.connection.provider.query({request_type:"view_state",...e,account_id:this.accountId,prefix_base64:Buffer.from(t).toString("base64")});return n.map(({key:t,value:e})=>({key:Buffer.from(t,"base64"),value:Buffer.from(e,"base64")}))}async getAccessKeys(){const t=await this.connection.provider.query({request_type:"view_access_key_list",account_id:this.accountId,finality:"optimistic"});return Array.isArray(t)?t:t.keys}async getAccountDetails(){return{authorizedApps:(await this.getAccessKeys()).filter(t=>"FullAccess"!==t.access_key.permission).map(t=>{const e=t.access_key.permission;return{contractId:e.FunctionCall.receiver_id,amount:e.FunctionCall.allowance,publicKey:t.public_key}})}}async getAccountBalance(){const t=await this.connection.provider.experimental_protocolConfig({finality:"final"}),e=await this.state(),n=new bn_js_1.default(t.runtime_config.storage_amount_per_byte),r=new bn_js_1.default(e.storage_usage).mul(n),s=new bn_js_1.default(e.locked),a=new bn_js_1.default(e.amount).add(s),i=a.sub(bn_js_1.default.max(s,r));return{total:a.toString(),stateStaked:r.toString(),staked:s.toString(),available:i.toString()}}}exports.Account=Account;
}).call(this)}).call(this,require("buffer").Buffer)
},{"./providers":17,"./transaction":22,"./utils/errors":24,"./utils/exponential-backoff":25,"./utils/key_pair":28,"./utils/rpc_errors":29,"bn.js":36,"borsh":37,"buffer":40,"depd":46}],3:[function(require,module,exports){
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.UrlAccountCreator=exports.LocalAccountCreator=exports.AccountCreator=void 0;const web_1=require("./utils/web");class AccountCreator{}exports.AccountCreator=AccountCreator;class LocalAccountCreator extends AccountCreator{constructor(t,c){super(),this.masterAccount=t,this.initialBalance=c}async createAccount(t,c){await this.masterAccount.createAccount(t,c,this.initialBalance)}}exports.LocalAccountCreator=LocalAccountCreator;class UrlAccountCreator extends AccountCreator{constructor(t,c){super(),this.connection=t,this.helperUrl=c}async createAccount(t,c){await web_1.fetchJson(`${this.helperUrl}/account`,JSON.stringify({newAccountId:t,newAccountPublicKey:c.toString()}))}}exports.UrlAccountCreator=UrlAccountCreator;
},{"./utils/web":31}],4:[function(require,module,exports){
(function (Buffer){(function (){
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Account2FA=exports.AccountMultisig=exports.MULTISIG_CONFIRM_METHODS=exports.MULTISIG_CHANGE_METHODS=exports.MULTISIG_DEPOSIT=exports.MULTISIG_GAS=exports.MULTISIG_ALLOWANCE=exports.MULTISIG_STORAGE_KEY=void 0;const bn_js_1=__importDefault(require("bn.js")),account_1=require("./account"),format_1=require("./utils/format"),key_pair_1=require("./utils/key_pair"),transaction_1=require("./transaction"),web_1=require("./utils/web");exports.MULTISIG_STORAGE_KEY="__multisigRequest",exports.MULTISIG_ALLOWANCE=new bn_js_1.default(format_1.parseNearAmount("1")),exports.MULTISIG_GAS=new bn_js_1.default("100000000000000"),exports.MULTISIG_DEPOSIT=new bn_js_1.default("0"),exports.MULTISIG_CHANGE_METHODS=["add_request","add_request_and_confirm","delete_request","confirm"],exports.MULTISIG_CONFIRM_METHODS=["confirm"];const storageFallback={[exports.MULTISIG_STORAGE_KEY]:null};class AccountMultisig extends account_1.Account{constructor(e,t,s){super(e,t),this.storage=s.storage,this.onAddRequestResult=s.onAddRequestResult}async signAndSendTransactionWithAccount(e,t){return super.signAndSendTransaction(e,t)}signAndSendTransaction(...e){return"string"==typeof e[0]?this._signAndSendTransaction({receiverId:e[0],actions:e[1]}):this._signAndSendTransaction(e[0])}async _signAndSendTransaction({receiverId:e,actions:t}){const{accountId:s}=this,n=Buffer.from(JSON.stringify({request:{receiver_id:e,actions:convertActions(t,s,e)}}));let i;try{i=await super.signAndSendTransaction(s,[transaction_1.functionCall("add_request_and_confirm",n,exports.MULTISIG_GAS,exports.MULTISIG_DEPOSIT)])}catch(s){if(s.toString().includes("Account has too many active requests. Confirm or delete some"))return await this.deleteUnconfirmedRequests(),await this.signAndSendTransaction(e,t);throw s}if(!i.status)throw new Error("Request failed");const o={...i.status};if(!o.SuccessValue||"string"!=typeof o.SuccessValue)throw new Error("Request failed");return this.setRequest({accountId:s,actions:t,requestId:parseInt(Buffer.from(o.SuccessValue,"base64").toString("ascii"),10)}),this.onAddRequestResult&&await this.onAddRequestResult(i),this.deleteUnconfirmedRequests(),i}async deleteUnconfirmedRequests(){const e=await this.getRequestIds(),{requestId:t}=this.getRequest();for(const s of e)if(s!=t)try{await super.signAndSendTransaction(this.accountId,[transaction_1.functionCall("delete_request",{request_id:s},exports.MULTISIG_GAS,exports.MULTISIG_DEPOSIT)])}catch(e){console.warn("Attempt to delete an earlier request before 15 minutes failed. Will try again.")}}async getRequestIds(){return this.viewFunction(this.accountId,"list_request_ids")}getRequest(){return this.storage?JSON.parse(this.storage.getItem(exports.MULTISIG_STORAGE_KEY)||"{}"):storageFallback[exports.MULTISIG_STORAGE_KEY]}setRequest(e){if(this.storage)return this.storage.setItem(exports.MULTISIG_STORAGE_KEY,JSON.stringify(e));storageFallback[exports.MULTISIG_STORAGE_KEY]=e}}exports.AccountMultisig=AccountMultisig;class Account2FA extends AccountMultisig{constructor(e,t,s){super(e,t,s),this.helperUrl="https://helper.testnet.near.org",this.helperUrl=s.helperUrl||this.helperUrl,this.storage=s.storage,this.sendCode=s.sendCode||this.sendCodeDefault,this.getCode=s.getCode||this.getCodeDefault,this.verifyCode=s.verifyCode||this.verifyCodeDefault,this.onConfirmResult=s.onConfirmResult}async signAndSendTransaction(e,t){await super.signAndSendTransaction(e,t),await this.sendCode();const s=await this.promptAndVerify();return this.onConfirmResult&&await this.onConfirmResult(s),s}async deployMultisig(e){const{accountId:t}=this,s=(await this.getRecoveryMethods()).data.filter(({kind:e,publicKey:t})=>("phrase"===e||"ledger"===e)&&null!==t).map(e=>e.publicKey),n=(await this.getAccessKeys()).filter(({public_key:e,access_key:{permission:t}})=>"FullAccess"===t&&!s.includes(e)).map(e=>e.public_key).map(toPK),i=toPK((await this.postSignedJson("/2fa/getAccessKey",{accountId:t})).publicKey),o=Buffer.from(JSON.stringify({num_confirmations:2})),r=[...n.map(e=>transaction_1.deleteKey(e)),...n.map(e=>transaction_1.addKey(e,transaction_1.functionCallAccessKey(t,exports.MULTISIG_CHANGE_METHODS,null))),transaction_1.addKey(i,transaction_1.functionCallAccessKey(t,exports.MULTISIG_CONFIRM_METHODS,null)),transaction_1.deployContract(e)];return"11111111111111111111111111111111"===(await this.state()).code_hash&&r.push(transaction_1.functionCall("new",o,exports.MULTISIG_GAS,exports.MULTISIG_DEPOSIT)),console.log("deploying multisig contract for",t),await super.signAndSendTransactionWithAccount(t,r)}async disable(e){const{accountId:t}=this,s=(await this.getAccessKeys()).filter(({access_key:e})=>"FullAccess"!==e.permission).filter(({access_key:e})=>{const s=e.permission.FunctionCall;return s.receiver_id===t&&4===s.method_names.length&&s.method_names.includes("add_request_and_confirm")}),n=key_pair_1.PublicKey.from((await this.postSignedJson("/2fa/getAccessKey",{accountId:t})).publicKey),i=[transaction_1.deleteKey(n),...s.map(({public_key:e})=>transaction_1.deleteKey(e)),...s.map(({public_key:e})=>transaction_1.addKey(e,null)),transaction_1.deployContract(e)];return console.log("disabling 2fa for",t),await this.signAndSendTransaction(t,i)}async sendCodeDefault(){const{accountId:e}=this,{requestId:t}=this.getRequest(),s=await this.get2faMethod();return await this.postSignedJson("/2fa/send",{accountId:e,method:s,requestId:t}),t}async getCodeDefault(e){throw new Error('There is no getCode callback provided. Please provide your own in AccountMultisig constructor options. It has a parameter method where method.kind is "email" or "phone".')}async promptAndVerify(){const e=await this.get2faMethod(),t=await this.getCode(e);try{return await this.verifyCode(t)}catch(e){if(console.warn("Error validating security code:",e),e.toString().includes("invalid 2fa code provided")||e.toString().includes("2fa code not valid"))return await this.promptAndVerify();throw e}}async verifyCodeDefault(e){const{accountId:t}=this,s=this.getRequest();if(!s)throw new Error("no request pending");const{requestId:n}=s;return await this.postSignedJson("/2fa/verify",{accountId:t,securityCode:e,requestId:n})}async getRecoveryMethods(){const{accountId:e}=this;return{accountId:e,data:await this.postSignedJson("/account/recoveryMethods",{accountId:e})}}async get2faMethod(){let{data:e}=await this.getRecoveryMethods();if(e&&e.length&&(e=e.find(e=>0===e.kind.indexOf("2fa-"))),!e)return null;const{kind:t,detail:s}=e;return{kind:t,detail:s}}async signatureFor(){const{accountId:e}=this,t=(await this.connection.provider.block({finality:"final"})).header.height.toString(),s=await this.connection.signer.signMessage(Buffer.from(t),e,this.connection.networkId);return{blockNumber:t,blockNumberSignature:Buffer.from(s.signature).toString("base64")}}async postSignedJson(e,t){return await web_1.fetchJson(this.helperUrl+e,JSON.stringify({...t,...await this.signatureFor()}))}}exports.Account2FA=Account2FA;const toPK=e=>key_pair_1.PublicKey.from(e),convertPKForContract=e=>e.toString().replace("ed25519:",""),convertActions=(e,t,s)=>e.map(e=>{const n=e.enum,{gas:i,publicKey:o,methodName:r,args:a,deposit:c,accessKey:u,code:d}=e[n],l={type:n[0].toUpperCase()+n.substr(1),gas:i&&i.toString()||void 0,public_key:o&&convertPKForContract(o)||void 0,method_name:r,args:a&&Buffer.from(a).toString("base64")||void 0,code:d&&Buffer.from(d).toString("base64")||void 0,amount:c&&c.toString()||void 0,deposit:c&&c.toString()||"0",permission:void 0};if(u&&(s===t&&"fullAccess"!==u.permission.enum&&(l.permission={receiver_id:t,allowance:exports.MULTISIG_ALLOWANCE.toString(),method_names:exports.MULTISIG_CHANGE_METHODS}),"functionCall"===u.permission.enum)){const{receiverId:e,methodNames:t,allowance:s}=u.permission.functionCall;l.permission={receiver_id:e,allowance:s&&s.toString()||void 0,method_names:t}}return l});
}).call(this)}).call(this,require("buffer").Buffer)
},{"./account":2,"./transaction":22,"./utils/format":26,"./utils/key_pair":28,"./utils/web":31,"bn.js":36,"buffer":40}],5:[function(require,module,exports){
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.connect=void 0;const near_1=require("./near");async function connect(e){return new near_1.Near(e)}exports.connect=connect;
},{"./near":16}],6:[function(require,module,exports){
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&__createBinding(t,e,r);return __setModuleDefault(t,e),t},__exportStar=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||__createBinding(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.keyStores=__importStar(require("./key_stores/browser-index")),__exportStar(require("./common-index"),exports),__exportStar(require("./browser-connect"),exports),require("error-polyfill");
},{"./browser-connect":5,"./common-index":7,"./key_stores/browser-index":11,"error-polyfill":47}],7:[function(require,module,exports){
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&__createBinding(t,e,r);return __setModuleDefault(t,e),t};Object.defineProperty(exports,"__esModule",{value:!0}),exports.WalletConnection=exports.WalletAccount=exports.ConnectedWalletAccount=exports.Near=exports.KeyPair=exports.Signer=exports.InMemorySigner=exports.Contract=exports.Connection=exports.Account=exports.multisig=exports.validators=exports.transactions=exports.utils=exports.providers=exports.accountCreator=void 0;const providers=__importStar(require("./providers"));exports.providers=providers;const utils=__importStar(require("./utils"));exports.utils=utils;const transactions=__importStar(require("./transaction"));exports.transactions=transactions;const validators=__importStar(require("./validators"));exports.validators=validators;const account_1=require("./account");Object.defineProperty(exports,"Account",{enumerable:!0,get:function(){return account_1.Account}});const multisig=__importStar(require("./account_multisig"));exports.multisig=multisig;const accountCreator=__importStar(require("./account_creator"));exports.accountCreator=accountCreator;const connection_1=require("./connection");Object.defineProperty(exports,"Connection",{enumerable:!0,get:function(){return connection_1.Connection}});const signer_1=require("./signer");Object.defineProperty(exports,"Signer",{enumerable:!0,get:function(){return signer_1.Signer}}),Object.defineProperty(exports,"InMemorySigner",{enumerable:!0,get:function(){return signer_1.InMemorySigner}});const contract_1=require("./contract");Object.defineProperty(exports,"Contract",{enumerable:!0,get:function(){return contract_1.Contract}});const key_pair_1=require("./utils/key_pair");Object.defineProperty(exports,"KeyPair",{enumerable:!0,get:function(){return key_pair_1.KeyPair}});const near_1=require("./near");Object.defineProperty(exports,"Near",{enumerable:!0,get:function(){return near_1.Near}});const wallet_account_1=require("./wallet-account");Object.defineProperty(exports,"ConnectedWalletAccount",{enumerable:!0,get:function(){return wallet_account_1.ConnectedWalletAccount}}),Object.defineProperty(exports,"WalletAccount",{enumerable:!0,get:function(){return wallet_account_1.WalletAccount}}),Object.defineProperty(exports,"WalletConnection",{enumerable:!0,get:function(){return wallet_account_1.WalletConnection}});
},{"./account":2,"./account_creator":3,"./account_multisig":4,"./connection":8,"./contract":9,"./near":16,"./providers":17,"./signer":21,"./transaction":22,"./utils":27,"./utils/key_pair":28,"./validators":32,"./wallet-account":33}],8:[function(require,module,exports){
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Connection=void 0;const providers_1=require("./providers"),signer_1=require("./signer");function getProvider(e){switch(e.type){case void 0:return e;case"JsonRpcProvider":return new providers_1.JsonRpcProvider(e.args.url);default:throw new Error(`Unknown provider type ${e.type}`)}}function getSigner(e){switch(e.type){case void 0:return e;case"InMemorySigner":return new signer_1.InMemorySigner(e.keyStore);default:throw new Error(`Unknown signer type ${e.type}`)}}class Connection{constructor(e,r,n){this.networkId=e,this.provider=r,this.signer=n}static fromConfig(e){const r=getProvider(e.provider),n=getSigner(e.signer);return new Connection(e.networkId,r,n)}}exports.Connection=Connection;
},{"./providers":17,"./signer":21}],9:[function(require,module,exports){
"use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Contract=void 0;const bn_js_1=__importDefault(require("bn.js")),depd_1=__importDefault(require("depd")),providers_1=require("./providers"),errors_1=require("./utils/errors");function nameFunction(t,e){return{[t]:(...t)=>e(...t)}[t]}const isUint8Array=t=>t&&void 0!==t.byteLength&&t.byteLength===t.length,isObject=t=>"[object Object]"===Object.prototype.toString.call(t);class Contract{constructor(t,e,r){this.account=t,this.contractId=e;const{viewMethods:a=[],changeMethods:o=[]}=r;a.forEach(t=>{Object.defineProperty(this,t,{writable:!1,enumerable:!0,value:nameFunction(t,async(e={},r={},...a)=>{if(a.length||!isObject(e)&&!isUint8Array(e)||!isObject(r))throw new errors_1.PositionalArgsError;return this.account.viewFunction(this.contractId,t,e,r)})})}),o.forEach(t=>{Object.defineProperty(this,t,{writable:!1,enumerable:!0,value:nameFunction(t,async(...e)=>{if(e.length&&(e.length>3||!isObject(e[0])&&!isUint8Array(e[0])))throw new errors_1.PositionalArgsError;if(e.length>1||!e[0]||!e[0].args){return depd_1.default("contract.methodName(args, gas, amount)")("use `contract.methodName({ args, gas?, amount?, callbackUrl?, meta? })` instead"),this._changeMethod({methodName:t,args:e[0],gas:e[1],amount:e[2]})}return this._changeMethod({methodName:t,...e[0]})})})})}async _changeMethod({args:t,methodName:e,gas:r,amount:a,meta:o,callbackUrl:n}){validateBNLike({gas:r,amount:a});const s=await this.account.functionCall({contractId:this.contractId,methodName:e,args:t,gas:r,attachedDeposit:a,walletMeta:o,walletCallbackUrl:n});return providers_1.getTransactionLastResult(s)}}function validateBNLike(t){for(const e of Object.keys(t)){const r=t[e];if(r&&!bn_js_1.default.isBN(r)&&isNaN(r))throw new errors_1.ArgumentTypeError(e,"number, decimal string or BN",r)}}exports.Contract=Contract;
},{"./providers":17,"./utils/errors":24,"bn.js":36,"depd":46}],10:[function(require,module,exports){
module.exports={
"schema": {
"BadUTF16": {
"name": "BadUTF16",
"subtypes": [],
"props": {}
},
"BadUTF8": {
"name": "BadUTF8",
"subtypes": [],
"props": {}
},
"BalanceExceeded": {
"name": "BalanceExceeded",
"subtypes": [],
"props": {}
},
"BreakpointTrap": {
"name": "BreakpointTrap",
"subtypes": [],
"props": {}
},
"CacheError": {
"name": "CacheError",
"subtypes": [
"ReadError",
"WriteError",
"DeserializationError",
"SerializationError"
],
"props": {}
},
"CallIndirectOOB": {
"name": "CallIndirectOOB",
"subtypes": [],
"props": {}
},
"CannotAppendActionToJointPromise": {
"name": "CannotAppendActionToJointPromise",
"subtypes": [],
"props": {}
},
"CannotReturnJointPromise": {
"name": "CannotReturnJointPromise",
"subtypes": [],
"props": {}
},
"CodeDoesNotExist": {
"name": "CodeDoesNotExist",
"subtypes": [],
"props": {
"account_id": ""
}
},
"CompilationError": {
"name": "CompilationError",
"subtypes": [
"CodeDoesNotExist",
"PrepareError",
"WasmerCompileError"
],
"props": {}
},
"ContractSizeExceeded": {
"name": "ContractSizeExceeded",
"subtypes": [],
"props": {
"limit": "",
"size": ""
}
},
"Deprecated": {
"name": "Deprecated",
"subtypes": [],
"props": {
"method_name": ""
}
},
"Deserialization": {
"name": "Deserialization",
"subtypes": [],
"props": {}
},
"DeserializationError": {
"name": "DeserializationError",
"subtypes": [],
"props": {}
},
"EmptyMethodName": {
"name": "EmptyMethodName",
"subtypes": [],
"props": {}
},
"FunctionCallError": {
"name": "FunctionCallError",
"subtypes": [
"CompilationError",
"LinkError",
"MethodResolveError",
"WasmTrap",
"WasmUnknownError",
"HostError",
"EvmError"
],
"props": {}
},
"GasExceeded": {
"name": "GasExceeded",
"subtypes": [],
"props": {}
},
"GasInstrumentation": {
"name": "GasInstrumentation",
"subtypes": [],
"props": {}
},
"GasLimitExceeded": {
"name": "GasLimitExceeded",
"subtypes": [],
"props": {}
},
"GenericTrap": {
"name": "GenericTrap",
"subtypes": [],
"props": {}
},
"GuestPanic": {
"name": "GuestPanic",
"subtypes": [],
"props": {
"panic_msg": ""
}
},
"HostError": {
"name": "HostError",
"subtypes": [
"BadUTF16",
"BadUTF8",
"GasExceeded",
"GasLimitExceeded",
"BalanceExceeded",
"EmptyMethodName",
"GuestPanic",
"IntegerOverflow",
"InvalidPromiseIndex",
"CannotAppendActionToJointPromise",
"CannotReturnJointPromise",
"InvalidPromiseResultIndex",
"InvalidRegisterId",
"IteratorWasInvalidated",
"MemoryAccessViolation",
"InvalidReceiptIndex",
"InvalidIteratorIndex",
"InvalidAccountId",
"InvalidMethodName",
"InvalidPublicKey",
"ProhibitedInView",
"NumberOfLogsExceeded",
"KeyLengthExceeded",
"ValueLengthExceeded",
"TotalLogLengthExceeded",
"NumberPromisesExceeded",
"NumberInputDataDependenciesExceeded",
"ReturnedValueLengthExceeded",
"ContractSizeExceeded",
"Deprecated"
],
"props": {}
},
"IllegalArithmetic": {
"name": "IllegalArithmetic",
"subtypes": [],
"props": {}
},
"IncorrectCallIndirectSignature": {
"name": "IncorrectCallIndirectSignature",
"subtypes": [],
"props": {}
},
"Instantiate": {
"name": "Instantiate",
"subtypes": [],
"props": {}
},
"IntegerOverflow": {
"name": "IntegerOverflow",
"subtypes": [],
"props": {}
},
"InternalMemoryDeclared": {
"name": "InternalMemoryDeclared",
"subtypes": [],
"props": {}
},
"InvalidAccountId": {
"name": "InvalidAccountId",
"subtypes": [],
"props": {
"account_id": ""
}
},
"InvalidIteratorIndex": {
"name": "InvalidIteratorIndex",
"subtypes": [],
"props": {
"iterator_index": ""
}
},
"InvalidMethodName": {
"name": "InvalidMethodName",
"subtypes": [],
"props": {}
},
"InvalidPromiseIndex": {
"name": "InvalidPromiseIndex",
"subtypes": [],
"props": {
"promise_idx": ""
}
},
"InvalidPromiseResultIndex": {
"name": "InvalidPromiseResultIndex",
"subtypes": [],
"props": {
"result_idx": ""
}
},
"InvalidPublicKey": {
"name": "InvalidPublicKey",
"subtypes": [],
"props": {}
},
"InvalidReceiptIndex": {
"name": "InvalidReceiptIndex",
"subtypes": [],
"props": {
"receipt_index": ""
}
},
"InvalidRegisterId": {
"name": "InvalidRegisterId",
"subtypes": [],
"props": {
"register_id": ""
}
},
"IteratorWasInvalidated": {
"name": "IteratorWasInvalidated",
"subtypes": [],
"props": {
"iterator_index": ""
}
},
"KeyLengthExceeded": {
"name": "KeyLengthExceeded",
"subtypes": [],
"props": {
"length": "",
"limit": ""
}
},
"LinkError": {
"name": "LinkError",
"subtypes": [],
"props": {
"msg": ""
}
},
"Memory": {
"name": "Memory",
"subtypes": [],
"props": {}
},
"MemoryAccessViolation": {
"name": "MemoryAccessViolation",
"subtypes": [],
"props": {}
},
"MemoryOutOfBounds": {
"name": "MemoryOutOfBounds",
"subtypes": [],
"props": {}
},
"MethodEmptyName": {
"name": "MethodEmptyName",
"subtypes": [],
"props": {}
},
"MethodInvalidSignature": {
"name": "MethodInvalidSignature",
"subtypes": [],
"props": {}
},
"MethodNotFound": {
"name": "MethodNotFound",
"subtypes": [],
"props": {}
},
"MethodResolveError": {
"name": "MethodResolveError",
"subtypes": [
"MethodEmptyName",
"MethodUTF8Error",
"MethodNotFound",
"MethodInvalidSignature"
],
"props": {}
},
"MethodUTF8Error": {
"name": "MethodUTF8Error",
"subtypes": [],
"props": {}
},
"MisalignedAtomicAccess": {
"name": "MisalignedAtomicAccess",
"subtypes": [],
"props": {}
},
"NumberInputDataDependenciesExceeded": {
"name": "NumberInputDataDependenciesExceeded",
"subtypes": [],
"props": {
"limit": "",
"number_of_input_data_dependencies": ""
}
},
"NumberOfLogsExceeded": {
"name": "NumberOfLogsExceeded",
"subtypes": [],
"props": {
"limit": ""
}
},
"NumberPromisesExceeded": {
"name": "NumberPromisesExceeded",
"subtypes": [],
"props": {
"limit": "",
"number_of_promises": ""
}
},
"PrepareError": {
"name": "PrepareError",
"subtypes": [
"Serialization",
"Deserialization",
"InternalMemoryDeclared",
"GasInstrumentation",
"StackHeightInstrumentation",
"Instantiate",
"Memory"
],
"props": {}
},
"ProhibitedInView": {
"name": "ProhibitedInView",
"subtypes": [],
"props": {
"method_name": ""
}
},
"ReadError": {
"name": "ReadError",
"subtypes": [],
"props": {}
},
"ReturnedValueLengthExceeded": {
"name": "ReturnedValueLengthExceeded",
"subtypes": [],
"props": {
"length": "",
"limit": ""
}
},
"Serialization": {
"name": "Serialization",
"subtypes": [],
"props": {}
},
"SerializationError": {
"name": "SerializationError",
"subtypes": [],
"props": {
"hash": ""
}
},
"StackHeightInstrumentation": {
"name": "StackHeightInstrumentation",
"subtypes": [],
"props": {}
},
"StackOverflow": {
"name": "StackOverflow",
"subtypes": [],
"props": {}
},
"TotalLogLengthExceeded": {
"name": "TotalLogLengthExceeded",
"subtypes": [],
"props": {
"length": "",
"limit": ""
}
},
"Unreachable": {
"name": "Unreachable",
"subtypes": [],
"props": {}
},
"ValueLengthExceeded": {
"name": "ValueLengthExceeded",
"subtypes": [],
"props": {
"length": "",
"limit": ""
}
},
"WasmTrap": {
"name": "WasmTrap",
"subtypes": [
"Unreachable",
"IncorrectCallIndirectSignature",
"MemoryOutOfBounds",
"CallIndirectOOB",
"IllegalArithmetic",
"MisalignedAtomicAccess",
"BreakpointTrap",
"StackOverflow",
"GenericTrap"
],
"props": {}
},
"WasmUnknownError": {
"name": "WasmUnknownError",
"subtypes": [],
"props": {}
},
"WasmerCompileError": {
"name": "WasmerCompileError",
"subtypes": [],
"props": {
"msg": ""
}
},
"WriteError": {
"name": "WriteError",
"subtypes": [],
"props": {}
},
"AccessKeyNotFound": {
"name": "AccessKeyNotFound",
"subtypes": [],
"props": {
"account_id": "",
"public_key": ""
}
},
"AccountAlreadyExists": {
"name": "AccountAlreadyExists",
"subtypes": [],
"props": {
"account_id": ""
}
},
"AccountDoesNotExist": {
"name": "AccountDoesNotExist",
"subtypes": [],
"props": {
"account_id": ""
}
},
"ActionError": {
"name": "ActionError",
"subtypes": [
"AccountAlreadyExists",
"AccountDoesNotExist",
"CreateAccountOnlyByRegistrar",
"CreateAccountNotAllowed",
"ActorNoPermission",
"DeleteKeyDoesNotExist",
"AddKeyAlreadyExists",
"DeleteAccountStaking",
"LackBalanceForState",
"TriesToUnstake",
"TriesToStake",
"InsufficientStake",
"FunctionCallError",
"NewReceiptValidationError",
"OnlyImplicitAccountCreationAllowed"
],
"props": {
"index": ""
}
},
"ActionsValidationError": {
"name": "ActionsValidationError",
"subtypes": [
"DeleteActionMustBeFinal",
"TotalPrepaidGasExceeded",
"TotalNumberOfActionsExceeded",
"AddKeyMethodNamesNumberOfBytesExceeded",
"AddKeyMethodNameLengthExceeded",
"IntegerOverflow",
"InvalidAccountId",
"ContractSizeExceeded",
"FunctionCallMethodNameLengthExceeded",
"FunctionCallArgumentsLengthExceeded",
"UnsuitableStakingKey",
"FunctionCallZeroAttachedGas"
],
"props": {}
},
"ActorNoPermission": {
"name": "ActorNoPermission",
"subtypes": [],
"props": {
"account_id": "",
"actor_id": ""
}
},
"AddKeyAlreadyExists": {
"name": "AddKeyAlreadyExists",
"subtypes": [],
"props": {
"account_id": "",
"public_key": ""
}
},
"AddKeyMethodNameLengthExceeded": {
"name": "AddKeyMethodNameLengthExceeded",
"subtypes": [],
"props": {
"length": "",
"limit": ""
}
},
"AddKeyMethodNamesNumberOfBytesExceeded": {
"name": "AddKeyMethodNamesNumberOfBytesExceeded",
"subtypes": [],
"props": {
"limit": "",
"total_number_of_bytes": ""
}
},
"BalanceMismatchError": {
"name": "BalanceMismatchError",
"subtypes": [],
"props": {
"final_accounts_balance": "",
"final_postponed_receipts_balance": "",
"incoming_receipts_balance": "",
"incoming_validator_rewards": "",
"initial_accounts_balance": "",
"initial_postponed_receipts_balance": "",
"new_delayed_receipts_balance": "",
"other_burnt_amount": "",
"outgoing_receipts_balance": "",
"processed_delayed_receipts_balance": "",
"slashed_burnt_amount": "",
"tx_burnt_amount": ""
}
},
"CostOverflow": {
"name": "CostOverflow",
"subtypes": [],
"props": {}
},
"CreateAccountNotAllowed": {
"name": "CreateAccountNotAllowed",
"subtypes": [],
"props": {
"account_id": "",
"predecessor_id": ""
}
},
"CreateAccountOnlyByRegistrar": {
"name": "CreateAccountOnlyByRegistrar",
"subtypes": [],
"props": {
"account_id": "",
"predecessor_id": "",
"registrar_account_id": ""
}
},
"DeleteAccountStaking": {
"name": "DeleteAccountStaking",
"subtypes": [],
"props": {
"account_id": ""
}
},
"DeleteActionMustBeFinal": {
"name": "DeleteActionMustBeFinal",
"subtypes": [],
"props": {}
},
"DeleteKeyDoesNotExist": {
"name": "DeleteKeyDoesNotExist",
"subtypes": [],
"props": {
"account_id": "",
"public_key": ""
}
},
"DepositWithFunctionCall": {
"name": "DepositWithFunctionCall",
"subtypes": [],
"props": {}
},
"Expired": {
"name": "Expired",
"subtypes": [],
"props": {}
},
"FunctionCallArgumentsLengthExceeded": {
"name": "FunctionCallArgumentsLengthExceeded",
"subtypes": [],
"props": {
"length": "",
"limit": ""
}
},
"FunctionCallMethodNameLengthExceeded": {
"name": "FunctionCallMethodNameLengthExceeded",
"subtypes": [],
"props": {
"length": "",
"limit": ""
}
},
"FunctionCallZeroAttachedGas": {
"name": "FunctionCallZeroAttachedGas",
"subtypes": [],
"props": {}
},
"InsufficientStake": {
"name": "InsufficientStake",
"subtypes": [],
"props": {
"account_id": "",
"minimum_stake": "",
"stake": ""
}
},
"InvalidAccessKeyError": {
"name": "InvalidAccessKeyError",
"subtypes": [
"AccessKeyNotFound",
"ReceiverMismatch",
"MethodNameMismatch",
"RequiresFullAccess",
"NotEnoughAllowance",
"DepositWithFunctionCall"
],
"props": {}
},
"InvalidChain": {
"name": "InvalidChain",
"subtypes": [],
"props": {}
},
"InvalidDataReceiverId": {
"name": "InvalidDataReceiverId",
"subtypes": [],
"props": {
"account_id": ""
}
},
"InvalidNonce": {
"name": "InvalidNonce",
"subtypes": [],
"props": {
"ak_nonce": "",
"tx_nonce": ""
}
},
"InvalidPredecessorId": {
"name": "InvalidPredecessorId",
"subtypes": [],
"props": {
"account_id": ""
}
},
"InvalidReceiverId": {
"name": "InvalidReceiverId",
"subtypes": [],
"props": {
"account_id": ""
}
},
"InvalidSignature": {
"name": "InvalidSignature",
"subtypes": [],
"props": {}
},
"InvalidSignerId": {
"name": "InvalidSignerId",
"subtypes": [],
"props": {
"account_id": ""
}
},
"InvalidTxError": {
"name": "InvalidTxError",
"subtypes": [
"InvalidAccessKeyError",
"InvalidSignerId",
"SignerDoesNotExist",
"InvalidNonce",
"InvalidReceiverId",
"InvalidSignature",
"NotEnoughBalance",
"LackBalanceForState",
"CostOverflow",
"InvalidChain",
"Expired",
"ActionsValidation"
],
"props": {}
},
"LackBalanceForState": {
"name": "LackBalanceForState",
"subtypes": [],
"props": {
"account_id": "",
"amount": ""
}
},
"MethodNameMismatch": {
"name": "MethodNameMismatch",
"subtypes": [],
"props": {
"method_name": ""
}
},
"NotEnoughAllowance": {
"name": "NotEnoughAllowance",
"subtypes": [],
"props": {
"account_id": "",
"allowance": "",
"cost": "",
"public_key": ""
}
},
"NotEnoughBalance": {
"name": "NotEnoughBalance",
"subtypes": [],
"props": {
"balance": "",
"cost": "",
"signer_id": ""
}
},
"OnlyImplicitAccountCreationAllowed": {
"name": "OnlyImplicitAccountCreationAllowed",
"subtypes": [],
"props": {
"account_id": ""
}
},
"ReceiptValidationError": {
"name": "ReceiptValidationError",
"subtypes": [
"InvalidPredecessorId",
"InvalidReceiverId",
"InvalidSignerId",
"InvalidDataReceiverId",
"ReturnedValueLengthExceeded",
"NumberInputDataDependenciesExceeded",
"ActionsValidation"
],
"props": {}
},
"ReceiverMismatch": {
"name": "ReceiverMismatch",
"subtypes": [],
"props": {
"ak_receiver": "",
"tx_receiver": ""
}
},
"RequiresFullAccess": {
"name": "RequiresFullAccess",
"subtypes": [],
"props": {}
},
"SignerDoesNotExist": {
"name": "SignerDoesNotExist",
"subtypes": [],
"props": {
"signer_id": ""
}
},
"TotalNumberOfActionsExceeded": {
"name": "TotalNumberOfActionsExceeded",
"subtypes": [],
"props": {
"limit": "",
"total_number_of_actions": ""
}
},
"TotalPrepaidGasExceeded": {
"name": "TotalPrepaidGasExceeded",
"subtypes": [],
"props": {
"limit": "",
"total_prepaid_gas": ""
}
},
"TriesToStake": {
"name": "TriesToStake",
"subtypes": [],
"props": {
"account_id": "",
"balance": "",
"locked": "",
"stake": ""
}
},
"TriesToUnstake": {
"name": "TriesToUnstake",
"subtypes": [],
"props": {
"account_id": ""
}
},
"TxExecutionError": {
"name": "TxExecutionError",
"subtypes": [
"ActionError",
"InvalidTxError"
],
"props": {}
},
"UnsuitableStakingKey": {
"name": "UnsuitableStakingKey",
"subtypes": [],
"props": {
"public_key": ""
}
},
"Closed": {
"name": "Closed",
"subtypes": [],
"props": {}
},
"InternalError": {
"name": "InternalError",
"subtypes": [],
"props": {}
},
"ServerError": {
"name": "ServerError",
"subtypes": [
"TxExecutionError",
"Timeout",
"Closed",
"InternalError"
],
"props": {}
},
"Timeout": {
"name": "Timeout",
"subtypes": [],
"props": {}
}
}
}
},{}],11:[function(require,module,exports){
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MergeKeyStore=exports.BrowserLocalStorageKeyStore=exports.InMemoryKeyStore=exports.KeyStore=void 0;const keystore_1=require("./keystore");Object.defineProperty(exports,"KeyStore",{enumerable:!0,get:function(){return keystore_1.KeyStore}});const in_memory_key_store_1=require("./in_memory_key_store");Object.defineProperty(exports,"InMemoryKeyStore",{enumerable:!0,get:function(){return in_memory_key_store_1.InMemoryKeyStore}});const browser_local_storage_key_store_1=require("./browser_local_storage_key_store");Object.defineProperty(exports,"BrowserLocalStorageKeyStore",{enumerable:!0,get:function(){return browser_local_storage_key_store_1.BrowserLocalStorageKeyStore}});const merge_key_store_1=require("./merge_key_store");Object.defineProperty(exports,"MergeKeyStore",{enumerable:!0,get:function(){return merge_key_store_1.MergeKeyStore}});
},{"./browser_local_storage_key_store":12,"./in_memory_key_store":13,"./keystore":14,"./merge_key_store":15}],12:[function(require,module,exports){
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BrowserLocalStorageKeyStore=void 0;const keystore_1=require("./keystore"),key_pair_1=require("../utils/key_pair"),LOCAL_STORAGE_KEY_PREFIX="near-api-js:keystore:";class BrowserLocalStorageKeyStore extends keystore_1.KeyStore{constructor(e=window.localStorage,t=LOCAL_STORAGE_KEY_PREFIX){super(),this.localStorage=e,this.prefix=t}async setKey(e,t,r){this.localStorage.setItem(this.storageKeyForSecretKey(e,t),r.toString())}async getKey(e,t){const r=this.localStorage.getItem(this.storageKeyForSecretKey(e,t));return r?key_pair_1.KeyPair.fromString(r):null}async removeKey(e,t){this.localStorage.removeItem(this.storageKeyForSecretKey(e,t))}async clear(){for(const e of this.storageKeys())e.startsWith(this.prefix)&&this.localStorage.removeItem(e)}async getNetworks(){const e=new Set;for(const t of this.storageKeys())if(t.startsWith(this.prefix)){const r=t.substring(this.prefix.length).split(":");e.add(r[1])}return Array.from(e.values())}async getAccounts(e){const t=new Array;for(const r of this.storageKeys())if(r.startsWith(this.prefix)){const s=r.substring(this.prefix.length).split(":");s[1]===e&&t.push(s[0])}return t}storageKeyForSecretKey(e,t){return`${this.prefix}${t}:${e}`}*storageKeys(){for(let e=0;e<this.localStorage.length;e++)yield this.localStorage.key(e)}}exports.BrowserLocalStorageKeyStore=BrowserLocalStorageKeyStore;
},{"../utils/key_pair":28,"./keystore":14}],13:[function(require,module,exports){
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.InMemoryKeyStore=void 0;const keystore_1=require("./keystore"),key_pair_1=require("../utils/key_pair");class InMemoryKeyStore extends keystore_1.KeyStore{constructor(){super(),this.keys={}}async setKey(e,t,r){this.keys[`${t}:${e}`]=r.toString()}async getKey(e,t){const r=this.keys[`${t}:${e}`];return r?key_pair_1.KeyPair.fromString(r):null}async removeKey(e,t){delete this.keys[`${t}:${e}`]}async clear(){this.keys={}}async getNetworks(){const e=new Set;return Object.keys(this.keys).forEach(t=>{const r=t.split(":");e.add(r[1])}),Array.from(e.values())}async getAccounts(e){const t=new Array;return Object.keys(this.keys).forEach(r=>{const s=r.split(":");s[s.length-1]===e&&t.push(s.slice(0,s.length-1).join(":"))}),t}toString(){return"InMemoryKeyStore"}}exports.InMemoryKeyStore=InMemoryKeyStore;
},{"../utils/key_pair":28,"./keystore":14}],14:[function(require,module,exports){
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KeyStore=void 0;class KeyStore{}exports.KeyStore=KeyStore;
},{}],15:[function(require,module,exports){
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MergeKeyStore=void 0;const keystore_1=require("./keystore");class MergeKeyStore extends keystore_1.KeyStore{constructor(e,t={writeKeyStoreIndex:0}){super(),this.options=t,this.keyStores=e}async setKey(e,t,r){await this.keyStores[this.options.writeKeyStoreIndex].setKey(e,t,r)}async getKey(e,t){for(const r of this.keyStores){const o=await r.getKey(e,t);if(o)return o}return null}async removeKey(e,t){for(const r of this.keyStores)await r.removeKey(e,t)}async clear(){for(const e of this.keyStores)await e.clear()}async getNetworks(){const e=new Set;for(const t of this.keyStores)for(const r of await t.getNetworks())e.add(r);return Array.from(e)}async getAccounts(e){const t=new Set;for(const r of this.keyStores)for(const o of await r.getAccounts(e))t.add(o);return Array.from(t)}toString(){return`MergeKeyStore(${this.keyStores.join(", ")})`}}exports.MergeKeyStore=MergeKeyStore;
},{"./keystore":14}],16:[function(require,module,exports){
"use strict";var __importDefault=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Near=void 0;const bn_js_1=__importDefault(require("bn.js")),account_1=require("./account"),connection_1=require("./connection"),contract_1=require("./contract"),account_creator_1=require("./account_creator");class Near{constructor(n){if(this.config=n,this.connection=connection_1.Connection.fromConfig({networkId:n.networkId,provider:{type:"JsonRpcProvider",args:{url:n.nodeUrl}},signer:n.signer||{type:"InMemorySigner",keyStore:n.keyStore||n.deps.keyStore}}),n.masterAccount){const t=n.initialBalance?new bn_js_1.default(n.initialBalance):new bn_js_1.default("500000000000000000000000000");this.accountCreator=new account_creator_1.LocalAccountCreator(new account_1.Account(this.connection,n.masterAccount),t)}else n.helperUrl?this.accountCreator=new account_creator_1.UrlAccountCreator(this.connection,n.helperUrl):this.accountCreator=null}async account(n){return new account_1.Account(this.connection,n)}async createAccount(n,t){if(!this.accountCreator)throw new Error("Must specify account creator, either via masterAccount or helperUrl configuration settings.");return await this.accountCreator.createAccount(n,t),new account_1.Account(this.connection,n)}async loadContract(n,t){const e=new account_1.Account(this.connection,t.sender);return new contract_1.Contract(e,n,t)}async sendTokens(n,t,e){console.warn("near.sendTokens is deprecated. Use `yourAccount.sendMoney` instead.");const c=new account_1.Account(this.connection,t);return(await c.sendMoney(e,n)).transaction_outcome.id}}exports.Near=Near;
},{"./account":2,"./account_creator":3,"./connection":8,"./contract":9,"bn.js":36}],17:[function(require,module,exports){
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ErrorContext=exports.TypedError=exports.getTransactionLastResult=exports.FinalExecutionStatusBasic=exports.JsonRpcProvider=exports.Provider=void 0;const provider_1=require("./provider");Object.defineProperty(exports,"Provider",{enumerable:!0,get:function(){return provider_1.Provider}}),Object.defineProperty(exports,"getTransactionLastResult",{enumerable:!0,get:function(){return provider_1.getTransactionLastResult}}),Object.defineProperty(exports,"FinalExecutionStatusBasic",{enumerable:!0,get:function(){return provider_1.FinalExecutionStatusBasic}});const json_rpc_provider_1=require("./json-rpc-provider");Object.defineProperty(exports,"JsonRpcProvider",{enumerable:!0,get:function(){return json_rpc_provider_1.JsonRpcProvider}}),Object.defineProperty(exports,"TypedError",{enumerable:!0,get:function(){return json_rpc_provider_1.TypedError}}),Object.defineProperty(exports,"ErrorContext",{enumerable:!0,get:function(){return json_rpc_provider_1.ErrorContext}});
},{"./json-rpc-provider":18,"./provider":19}],18:[function(require,module,exports){
(function (Buffer){(function (){
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.JsonRpcProvider=exports.ErrorContext=exports.TypedError=void 0;const depd_1=__importDefault(require("depd")),provider_1=require("./provider"),web_1=require("../utils/web"),errors_1=require("../utils/errors");Object.defineProperty(exports,"TypedError",{enumerable:!0,get:function(){return errors_1.TypedError}}),Object.defineProperty(exports,"ErrorContext",{enumerable:!0,get:function(){return errors_1.ErrorContext}});const borsh_1=require("borsh"),exponential_backoff_1=__importDefault(require("../utils/exponential-backoff")),rpc_errors_1=require("../utils/rpc_errors"),REQUEST_RETRY_NUMBER=12,REQUEST_RETRY_WAIT=500,REQUEST_RETRY_WAIT_BACKOFF=1.5;let _nextId=123;class JsonRpcProvider extends provider_1.Provider{constructor(e){super(),this.connection={url:e}}async status(){return this.sendJsonRpc("status",[])}async sendTransaction(e){const r=e.encode();return this.sendJsonRpc("broadcast_tx_commit",[Buffer.from(r).toString("base64")])}async sendTransactionAsync(e){const r=e.encode();return this.sendJsonRpc("broadcast_tx_async",[Buffer.from(r).toString("base64")])}async txStatus(e,r){return"string"==typeof e?this.txStatusString(e,r):this.txStatusUint8Array(e,r)}async txStatusUint8Array(e,r){return this.sendJsonRpc("tx",[borsh_1.baseEncode(e),r])}async txStatusString(e,r){return this.sendJsonRpc("tx",[e,r])}async txStatusReceipts(e,r){return this.sendJsonRpc("EXPERIMENTAL_tx_status",[borsh_1.baseEncode(e),r])}async query(...e){let r;if(1===e.length)r=await this.sendJsonRpc("query",e[0]);else{const[t,s]=e;r=await this.sendJsonRpc("query",[t,s])}if(r&&r.error)throw new errors_1.TypedError(`Querying ${e} failed: ${r.error}.\n${JSON.stringify(r,null,2)}`,rpc_errors_1.getErrorTypeFromErrorMessage(r.error));return r}async block(e){const{finality:r}=e;let{blockId:t}=e;if("object"!=typeof e){depd_1.default("JsonRpcProvider.block(blockId)")("use `block({ blockId })` or `block({ finality })` instead"),t=e}return this.sendJsonRpc("block",{block_id:t,finality:r})}async blockChanges(e){const{finality:r}=e,{blockId:t}=e;return this.sendJsonRpc("EXPERIMENTAL_changes_in_block",{block_id:t,finality:r})}async chunk(e){return this.sendJsonRpc("chunk",[e])}async validators(e){return this.sendJsonRpc("validators",[e])}async experimental_genesisConfig(){return depd_1.default("JsonRpcProvider.experimental_protocolConfig({ sync_checkpoint: 'genesis' })")("use `experimental_protocolConfig` to fetch the up-to-date or genesis protocol config explicitly"),await this.sendJsonRpc("EXPERIMENTAL_protocol_config",{sync_checkpoint:"genesis"})}async experimental_protocolConfig(e){return await this.sendJsonRpc("EXPERIMENTAL_protocol_config",e)}async experimental_lightClientProof(e){return depd_1.default("JsonRpcProvider.experimental_lightClientProof(request)")("use `lightClientProof` instead"),await this.lightClientProof(e)}async lightClientProof(e){return await this.sendJsonRpc("EXPERIMENTAL_light_client_proof",e)}async accessKeyChanges(e,r){const{finality:t}=r,{blockId:s}=r;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"all_access_key_changes",account_ids:e,block_id:s,finality:t})}async singleAccessKeyChanges(e,r){const{finality:t}=r,{blockId:s}=r;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"single_access_key_changes",keys:e,block_id:s,finality:t})}async accountChanges(e,r){const{finality:t}=r,{blockId:s}=r;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"account_changes",account_ids:e,block_id:s,finality:t})}async contractStateChanges(e,r,t=""){const{finality:s}=r,{blockId:o}=r;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"data_changes",account_ids:e,key_prefix_base64:t,block_id:o,finality:s})}async contractCodeChanges(e,r){const{finality:t}=r,{blockId:s}=r;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"contract_code_changes",account_ids:e,block_id:s,finality:t})}async gasPrice(e){return await this.sendJsonRpc("gas_price",[e])}async sendJsonRpc(e,r){const t=await exponential_backoff_1.default(REQUEST_RETRY_WAIT,REQUEST_RETRY_NUMBER,REQUEST_RETRY_WAIT_BACKOFF,async()=>{try{const t={method:e,params:r,id:_nextId++,jsonrpc:"2.0"},s=await web_1.fetchJson(this.connection,JSON.stringify(t));if(s.error){if("object"==typeof s.error.data){if("string"==typeof s.error.data.error_message&&"string"==typeof s.error.data.error_type)throw new errors_1.TypedError(s.error.data.error_message,s.error.data.error_type);throw rpc_errors_1.parseRpcError(s.error.data)}{const e=`[${s.error.code}] ${s.error.message}: ${s.error.data}`;if("Timeout"===s.error.data||e.includes("Timeout error")||e.includes("query has timed out"))throw new errors_1.TypedError(e,"TimeoutError");throw new errors_1.TypedError(e,rpc_errors_1.getErrorTypeFromErrorMessage(s.error.data))}}return s.result}catch(t){if("TimeoutError"===t.type)return console.warn(`Retrying request to ${e} as it has timed out`,r),null;throw t}});if(!t)throw new errors_1.TypedError(`Exceeded ${REQUEST_RETRY_NUMBER} attempts for request to ${e}.`,"RetriesExceeded");return t}}exports.JsonRpcProvider=JsonRpcProvider;
}).call(this)}).call(this,require("buffer").Buffer)
},{"../utils/errors":24,"../utils/exponential-backoff":25,"../utils/rpc_errors":29,"../utils/web":31,"./provider":19,"borsh":37,"buffer":40,"depd":46}],19:[function(require,module,exports){
(function (Buffer){(function (){
"use strict";var ExecutionStatusBasic,FinalExecutionStatusBasic,IdType;Object.defineProperty(exports,"__esModule",{value:!0}),exports.getTransactionLastResult=exports.Provider=exports.IdType=exports.FinalExecutionStatusBasic=exports.ExecutionStatusBasic=void 0,function(t){t.Unknown="Unknown",t.Pending="Pending",t.Failure="Failure"}(ExecutionStatusBasic=exports.ExecutionStatusBasic||(exports.ExecutionStatusBasic={})),function(t){t.NotStarted="NotStarted",t.Started="Started",t.Failure="Failure"}(FinalExecutionStatusBasic=exports.FinalExecutionStatusBasic||(exports.FinalExecutionStatusBasic={})),function(t){t.Transaction="transaction",t.Receipt="receipt"}(IdType=exports.IdType||(exports.IdType={}));class Provider{}function getTransactionLastResult(t){if("object"==typeof t.status&&"string"==typeof t.status.SuccessValue){const e=Buffer.from(t.status.SuccessValue,"base64").toString();try{return JSON.parse(e)}catch(t){return e}}return null}exports.Provider=Provider,exports.getTransactionLastResult=getTransactionLastResult;
}).call(this)}).call(this,require("buffer").Buffer)
},{"buffer":40}],20:[function(require,module,exports){
module.exports={
"GasLimitExceeded": "Exceeded the maximum amount of gas allowed to burn per contract",
"MethodEmptyName": "Method name is empty",
"WasmerCompileError": "Wasmer compilation error: {{msg}}",
"GuestPanic": "Smart contract panicked: {{panic_msg}}",
"Memory": "Error creating Wasm memory",
"GasExceeded": "Exceeded the prepaid gas",
"MethodUTF8Error": "Method name is not valid UTF8 string",
"BadUTF16": "String encoding is bad UTF-16 sequence",
"WasmTrap": "WebAssembly trap: {{msg}}",
"GasInstrumentation": "Gas instrumentation failed or contract has denied instructions.",
"InvalidPromiseIndex": "{{promise_idx}} does not correspond to existing promises",
"InvalidPromiseResultIndex": "Accessed invalid promise result index: {{result_idx}}",
"Deserialization": "Error happened while deserializing the module",
"MethodNotFound": "Contract method is not found",
"InvalidRegisterId": "Accessed invalid register id: {{register_id}}",
"InvalidReceiptIndex": "VM Logic returned an invalid receipt index: {{receipt_index}}",
"EmptyMethodName": "Method name is empty in contract call",
"CannotReturnJointPromise": "Returning joint promise is currently prohibited",
"StackHeightInstrumentation": "Stack instrumentation failed",
"CodeDoesNotExist": "Cannot find contract code for account {{account_id}}",
"MethodInvalidSignature": "Invalid method signature",
"IntegerOverflow": "Integer overflow happened during contract execution",
"MemoryAccessViolation": "MemoryAccessViolation",
"InvalidIteratorIndex": "Iterator index {{iterator_index}} does not exist",
"IteratorWasInvalidated": "Iterator {{iterator_index}} was invalidated after its creation by performing a mutable operation on trie",
"InvalidAccountId": "VM Logic returned an invalid account id",
"Serialization": "Error happened while serializing the module",
"CannotAppendActionToJointPromise": "Actions can only be appended to non-joint promise.",
"InternalMemoryDeclared": "Internal memory declaration has been found in the module",
"Instantiate": "Error happened during instantiation",
"ProhibitedInView": "{{method_name}} is not allowed in view calls",
"InvalidMethodName": "VM Logic returned an invalid method name",
"BadUTF8": "String encoding is bad UTF-8 sequence",
"BalanceExceeded": "Exceeded the account balance",
"LinkError": "Wasm contract link error: {{msg}}",
"InvalidPublicKey": "VM Logic provided an invalid public key",
"ActorNoPermission": "Actor {{actor_id}} doesn't have permission to account {{account_id}} to complete the action",
"LackBalanceForState": "The account {{account_id}} wouldn't have enough balance to cover storage, required to have {{amount}} yoctoNEAR more",
"ReceiverMismatch": "Wrong AccessKey used for transaction: transaction is sent to receiver_id={{tx_receiver}}, but is signed with function call access key that restricted to only use with receiver_id={{ak_receiver}}. Either change receiver_id in your transaction or switch to use a FullAccessKey.",
"CostOverflow": "Transaction gas or balance cost is too high",
"InvalidSignature": "Transaction is not signed with the given public key",
"AccessKeyNotFound": "Signer \"{{account_id}}\" doesn't have access key with the given public_key {{public_key}}",
"NotEnoughBalance": "Sender {{signer_id}} does not have enough balance {{#formatNear}}{{balance}}{{/formatNear}} for operation costing {{#formatNear}}{{cost}}{{/formatNear}}",
"NotEnoughAllowance": "Access Key {account_id}:{public_key} does not have enough balance {{#formatNear}}{{allowance}}{{/formatNear}} for transaction costing {{#formatNear}}{{cost}}{{/formatNear}}",
"Expired": "Transaction has expired",
"DeleteAccountStaking": "Account {{account_id}} is staking and can not be deleted",
"SignerDoesNotExist": "Signer {{signer_id}} does not exist",
"TriesToStake": "Account {{account_id}} tried to stake {{#formatNear}}{{stake}}{{/formatNear}}, but has staked {{#formatNear}}{{locked}}{{/formatNear}} and only has {{#formatNear}}{{balance}}{{/formatNear}}",
"AddKeyAlreadyExists": "The public key {{public_key}} is already used for an existing access key",
"InvalidSigner": "Invalid signer account ID {{signer_id}} according to requirements",
"CreateAccountNotAllowed": "The new account_id {{account_id}} can't be created by {{predecessor_id}}",
"RequiresFullAccess": "The transaction contains more then one action, but it was signed with an access key which allows transaction to apply only one specific action. To apply more then one actions TX must be signed with a full access key",
"TriesToUnstake": "Account {{account_id}} is not yet staked, but tried to unstake",
"InvalidNonce": "Transaction nonce {{tx_nonce}} must be larger than nonce of the used access key {{ak_nonce}}",
"AccountAlreadyExists": "Can't create a new account {{account_id}}, because it already exists",
"InvalidChain": "Transaction parent block hash doesn't belong to the current chain",
"AccountDoesNotExist": "Can't complete the action because account {{account_id}} doesn't exist",
"MethodNameMismatch": "Transaction method name {{method_name}} isn't allowed by the access key",
"DeleteAccountHasRent": "Account {{account_id}} can't be deleted. It has {{#formatNear}}{{balance}}{{/formatNear}}, which is enough to cover the rent",
"DeleteAccountHasEnoughBalance": "Account {{account_id}} can't be deleted. It has {{#formatNear}}{{balance}}{{/formatNear}}, which is enough to cover it's storage",
"InvalidReceiver": "Invalid receiver account ID {{receiver_id}} according to requirements",
"DeleteKeyDoesNotExist": "Account {{account_id}} tries to remove an access key that doesn't exist",
"Timeout": "Timeout exceeded",