@aeternity/aepp-sdk 10.0.0-beta.1 → 11.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -14
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.LICENSE.txt +7 -27
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +1 -1
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +1 -1
- package/dist/aepp-sdk.js.map +1 -1
- package/es/account/{base.js → base.mjs} +23 -11
- package/es/account/base.mjs.map +1 -0
- package/es/account/{memory.js → memory.mjs} +29 -14
- package/es/account/memory.mjs.map +1 -0
- package/es/account/{multiple.js → multiple.mjs} +14 -11
- package/es/account/multiple.mjs.map +1 -0
- package/es/ae/{aens.js → aens.mjs} +69 -59
- package/es/ae/aens.mjs.map +1 -0
- package/es/ae/{aepp.js → aepp.mjs} +9 -9
- package/es/ae/aepp.mjs.map +1 -0
- package/es/ae/contract.mjs +159 -0
- package/es/ae/contract.mjs.map +1 -0
- package/es/ae/{index.js → index.mjs} +12 -10
- package/es/ae/index.mjs.map +1 -0
- package/es/ae/{oracle.js → oracle.mjs} +37 -20
- package/es/ae/oracle.mjs.map +1 -0
- package/es/ae/{universal.js → universal.mjs} +10 -10
- package/es/ae/universal.mjs.map +1 -0
- package/es/ae/{wallet.js → wallet.mjs} +10 -10
- package/es/ae/wallet.mjs.map +1 -0
- package/es/aepp-wallet-communication/schema.d.ts +74 -0
- package/es/bignumber.d.ts +1 -7
- package/es/chain/{index.js → index.mjs} +28 -8
- package/es/chain/index.mjs.map +1 -0
- package/es/chain/{node.js → node.mjs} +133 -90
- package/es/chain/node.mjs.map +1 -0
- package/es/channel/{handlers.js → handlers.mjs} +18 -20
- package/es/channel/handlers.mjs.map +1 -0
- package/es/channel/{index.js → index.mjs} +43 -22
- package/es/channel/index.mjs.map +1 -0
- package/es/channel/{internal.js → internal.mjs} +51 -35
- package/es/channel/internal.mjs.map +1 -0
- package/es/contract/aci.mjs +477 -0
- package/es/contract/aci.mjs.map +1 -0
- package/es/contract/compiler.mjs +115 -0
- package/es/contract/compiler.mjs.map +1 -0
- package/es/contract/ga/helpers.mjs +30 -0
- package/es/contract/ga/helpers.mjs.map +1 -0
- package/es/contract/ga/{index.js → index.mjs} +40 -28
- package/es/contract/ga/index.mjs.map +1 -0
- package/es/encoder.d.ts +26 -0
- package/es/errors.d.ts +284 -0
- package/es/index.mjs +57 -0
- package/es/index.mjs.map +1 -0
- package/es/node-pool/{index.js → index.mjs} +15 -12
- package/es/node-pool/index.mjs.map +1 -0
- package/es/{node.js → node.mjs} +17 -11
- package/es/node.mjs.map +1 -0
- package/es/tx/builder/constants.mjs +108 -0
- package/es/tx/builder/constants.mjs.map +1 -0
- package/es/tx/builder/field-types.mjs +74 -0
- package/es/tx/builder/field-types.mjs.map +1 -0
- package/es/tx/builder/helpers.mjs +321 -0
- package/es/tx/builder/helpers.mjs.map +1 -0
- package/es/tx/builder/{index.js → index.mjs} +92 -74
- package/es/tx/builder/index.mjs.map +1 -0
- package/es/tx/builder/{schema.js → schema.mjs} +16 -172
- package/es/tx/builder/schema.mjs.map +1 -0
- package/es/tx/{index.js → index.mjs} +106 -14
- package/es/tx/index.mjs.map +1 -0
- package/es/tx/{tx-object.js → tx-object.mjs} +31 -18
- package/es/tx/tx-object.mjs.map +1 -0
- package/es/tx/{tx.js → tx.mjs} +15 -14
- package/es/tx/tx.mjs.map +1 -0
- package/es/tx/{validator.js → validator.mjs} +72 -33
- package/es/tx/validator.mjs.map +1 -0
- package/es/typings/blakejs/index.d.mjs +2 -0
- package/es/typings/blakejs/{index.d.js.map → index.d.mjs.map} +1 -1
- package/es/utils/aepp-wallet-communication/connection/{browser-runtime.js → browser-runtime.mjs} +10 -8
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/connection/{browser-window-message.js → browser-window-message.mjs} +25 -17
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/connection/{index.js → index.mjs} +7 -3
- package/es/utils/aepp-wallet-communication/connection/index.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/{content-script-bridge.js → content-script-bridge.mjs} +15 -8
- package/es/utils/aepp-wallet-communication/content-script-bridge.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/{helpers.js → helpers.mjs} +3 -14
- package/es/utils/aepp-wallet-communication/helpers.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/rpc/{aepp-rpc.js → aepp-rpc.mjs} +126 -72
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/rpc/{rpc-client.js → rpc-client.mjs} +23 -14
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/rpc/{wallet-rpc.js → wallet-rpc.mjs} +116 -91
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/schema.mjs +102 -0
- package/es/utils/aepp-wallet-communication/schema.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/{wallet-detector.js → wallet-detector.mjs} +6 -5
- package/es/utils/aepp-wallet-communication/wallet-detector.mjs.map +1 -0
- package/es/utils/{amount-formatter.js → amount-formatter.mjs} +14 -7
- package/es/utils/amount-formatter.mjs.map +1 -0
- package/es/utils/{async-init.js → async-init.mjs} +8 -11
- package/es/utils/async-init.mjs.map +1 -0
- package/es/utils/{bignumber.js → bignumber.mjs} +2 -9
- package/es/utils/bignumber.mjs.map +1 -0
- package/es/utils/{bytes.js → bytes.mjs} +16 -8
- package/es/utils/bytes.mjs.map +1 -0
- package/es/utils/{crypto-ts.js → crypto-ts.mjs} +11 -3
- package/es/utils/crypto-ts.mjs.map +1 -0
- package/es/utils/{crypto.js → crypto.mjs} +42 -156
- package/es/utils/crypto.mjs.map +1 -0
- package/es/utils/encoder.mjs +106 -0
- package/es/utils/encoder.mjs.map +1 -0
- package/es/utils/errors.mjs +689 -0
- package/es/utils/errors.mjs.map +1 -0
- package/es/utils/{hd-wallet.js → hd-wallet.mjs} +33 -34
- package/es/utils/hd-wallet.mjs.map +1 -0
- package/es/utils/{json-big.js → json-big.mjs} +1 -1
- package/es/utils/{json-big.js.map → json-big.mjs.map} +1 -1
- package/es/utils/{keystore.js → keystore.mjs} +63 -51
- package/es/utils/keystore.mjs.map +1 -0
- package/es/utils/{mptree.js → mptree.mjs} +21 -12
- package/es/utils/mptree.mjs.map +1 -0
- package/es/utils/{other.js → other.mjs} +2 -2
- package/es/utils/other.mjs.map +1 -0
- package/es/utils/{semver-satisfies.js → semver-satisfies.mjs} +1 -1
- package/es/utils/{semver-satisfies.js.map → semver-satisfies.mjs.map} +1 -1
- package/es/utils/{string.js → string.mjs} +1 -1
- package/es/utils/{string.js.map → string.mjs.map} +1 -1
- package/es/utils/{swagger.js → swagger.mjs} +49 -15
- package/es/utils/swagger.mjs.map +1 -0
- package/package.json +49 -58
- package/src/account/base.js +3 -1
- package/src/account/memory.js +13 -8
- package/src/account/multiple.js +16 -6
- package/src/ae/aens.js +52 -58
- package/src/ae/aepp.js +2 -2
- package/src/ae/contract.js +21 -154
- package/src/ae/index.js +6 -4
- package/src/ae/oracle.js +33 -14
- package/src/ae/universal.js +4 -2
- package/src/ae/wallet.js +2 -2
- package/src/chain/index.js +29 -6
- package/src/chain/node.js +95 -65
- package/src/channel/handlers.js +30 -20
- package/src/channel/index.js +46 -16
- package/src/channel/internal.js +35 -30
- package/src/contract/aci.js +376 -0
- package/src/contract/compiler.js +22 -113
- package/src/contract/ga/helpers.js +10 -6
- package/src/contract/ga/index.js +31 -24
- package/src/index.js +9 -8
- package/src/node-pool/index.js +13 -10
- package/src/node.js +11 -10
- package/src/tx/builder/constants.js +100 -0
- package/src/tx/builder/field-types.js +61 -0
- package/src/tx/builder/helpers.js +99 -103
- package/src/tx/builder/index.js +81 -40
- package/src/tx/builder/schema.js +44 -132
- package/src/tx/index.js +101 -12
- package/src/tx/tx-object.js +35 -15
- package/src/tx/tx.js +110 -35
- package/src/tx/validator.js +25 -5
- package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +11 -5
- package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +35 -13
- package/src/utils/aepp-wallet-communication/connection/index.js +2 -1
- package/src/utils/aepp-wallet-communication/content-script-bridge.js +14 -7
- package/src/utils/aepp-wallet-communication/helpers.js +6 -14
- package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +106 -57
- package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +24 -11
- package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +95 -53
- package/src/utils/aepp-wallet-communication/schema.ts +80 -0
- package/src/utils/aepp-wallet-communication/wallet-detector.js +6 -2
- package/src/utils/amount-formatter.ts +4 -3
- package/src/utils/async-init.js +10 -6
- package/src/utils/bignumber.ts +1 -9
- package/src/utils/bytes.ts +3 -2
- package/src/utils/crypto-ts.ts +2 -2
- package/src/utils/crypto.js +11 -155
- package/src/utils/encoder.ts +101 -0
- package/src/utils/errors.ts +683 -0
- package/src/utils/hd-wallet.js +11 -26
- package/src/utils/keystore.js +57 -53
- package/src/utils/mptree.ts +12 -6
- package/src/utils/swagger.js +68 -45
- package/es/account/base.js.map +0 -1
- package/es/account/memory.js.map +0 -1
- package/es/account/multiple.js.map +0 -1
- package/es/ae/aens.js.map +0 -1
- package/es/ae/aepp.js.map +0 -1
- package/es/ae/contract.js +0 -308
- package/es/ae/contract.js.map +0 -1
- package/es/ae/index.js.map +0 -1
- package/es/ae/oracle.js.map +0 -1
- package/es/ae/universal.js.map +0 -1
- package/es/ae/wallet.js.map +0 -1
- package/es/chain/index.js.map +0 -1
- package/es/chain/node.js.map +0 -1
- package/es/channel/handlers.js.map +0 -1
- package/es/channel/index.js.map +0 -1
- package/es/channel/internal.js.map +0 -1
- package/es/contract/aci/helpers.js +0 -298
- package/es/contract/aci/helpers.js.map +0 -1
- package/es/contract/aci/index.js +0 -356
- package/es/contract/aci/index.js.map +0 -1
- package/es/contract/aci/transformation.js +0 -66
- package/es/contract/aci/transformation.js.map +0 -1
- package/es/contract/compiler.js +0 -242
- package/es/contract/compiler.js.map +0 -1
- package/es/contract/ga/helpers.js +0 -22
- package/es/contract/ga/helpers.js.map +0 -1
- package/es/contract/ga/index.js.map +0 -1
- package/es/contract/index.js +0 -158
- package/es/contract/index.js.map +0 -1
- package/es/index.js +0 -56
- package/es/index.js.map +0 -1
- package/es/node-pool/index.js.map +0 -1
- package/es/node.js.map +0 -1
- package/es/tx/builder/helpers.js +0 -318
- package/es/tx/builder/helpers.js.map +0 -1
- package/es/tx/builder/index.js.map +0 -1
- package/es/tx/builder/schema.js.map +0 -1
- package/es/tx/index.js.map +0 -1
- package/es/tx/tx-object.js.map +0 -1
- package/es/tx/tx.js.map +0 -1
- package/es/tx/validator.js.map +0 -1
- package/es/typings/blakejs/index.d.js +0 -2
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.js.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.js.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/index.js.map +0 -1
- package/es/utils/aepp-wallet-communication/content-script-bridge.js.map +0 -1
- package/es/utils/aepp-wallet-communication/helpers.js.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.js.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js.map +0 -1
- package/es/utils/aepp-wallet-communication/schema.js +0 -107
- package/es/utils/aepp-wallet-communication/schema.js.map +0 -1
- package/es/utils/aepp-wallet-communication/wallet-detector.js.map +0 -1
- package/es/utils/amount-formatter.js.map +0 -1
- package/es/utils/async-init.js.map +0 -1
- package/es/utils/bignumber.js.map +0 -1
- package/es/utils/bytes.js.map +0 -1
- package/es/utils/crypto-ts.js.map +0 -1
- package/es/utils/crypto.js.map +0 -1
- package/es/utils/hd-wallet.js.map +0 -1
- package/es/utils/keystore.js.map +0 -1
- package/es/utils/mptree.js.map +0 -1
- package/es/utils/other.js.map +0 -1
- package/es/utils/swagger.js.map +0 -1
- package/src/contract/aci/index.js +0 -310
- package/src/contract/aci/transformation.js +0 -72
- package/src/contract/index.js +0 -159
- package/src/utils/aepp-wallet-communication/schema.js +0 -108
|
@@ -0,0 +1,683 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error module
|
|
3
|
+
* @module @aeternity/aepp-sdk/es/utils/errors
|
|
4
|
+
* @example import { BytecodeMismatchError } from '@aeternity/aepp-sdk'
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* aepp-sdk originated error
|
|
9
|
+
*/
|
|
10
|
+
export abstract class BaseError extends Error {
|
|
11
|
+
constructor (message: string) {
|
|
12
|
+
super(message)
|
|
13
|
+
this.name = 'BaseError'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class AccountError extends BaseError {
|
|
18
|
+
constructor (message: string) {
|
|
19
|
+
super(message)
|
|
20
|
+
this.name = 'AccountError'
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class AensError extends BaseError {
|
|
25
|
+
constructor (message: string) {
|
|
26
|
+
super(message)
|
|
27
|
+
this.name = 'AensError'
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class AeppError extends BaseError {
|
|
32
|
+
constructor (message: string) {
|
|
33
|
+
super(message)
|
|
34
|
+
this.name = 'AeppError'
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class ChannelError extends BaseError {
|
|
39
|
+
constructor (message: string) {
|
|
40
|
+
super(message)
|
|
41
|
+
this.name = 'ChannelError'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export class CompilerError extends BaseError {
|
|
46
|
+
constructor (message: string) {
|
|
47
|
+
super(message)
|
|
48
|
+
this.name = 'CompilerError'
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export class ContractError extends BaseError {
|
|
53
|
+
constructor (message: string) {
|
|
54
|
+
super(message)
|
|
55
|
+
this.name = 'ContractError'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export class CryptographyError extends BaseError {
|
|
60
|
+
constructor (message: string) {
|
|
61
|
+
super(message)
|
|
62
|
+
this.name = 'CryptographyError'
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export class NodeError extends BaseError {
|
|
67
|
+
constructor (message: string) {
|
|
68
|
+
super(message)
|
|
69
|
+
this.name = 'NodeError'
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export class TransactionError extends BaseError {
|
|
74
|
+
constructor (message: string) {
|
|
75
|
+
super(message)
|
|
76
|
+
this.name = 'TransactionError'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export class WalletError extends BaseError {
|
|
81
|
+
constructor (message: string) {
|
|
82
|
+
super(message)
|
|
83
|
+
this.name = 'WalletError'
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Common error patterns */
|
|
88
|
+
export class ArgumentError extends BaseError {
|
|
89
|
+
constructor (argumentName: string, requirement: string, argumentValue: any) {
|
|
90
|
+
super(`${argumentName} should be ${requirement}, got ${argumentValue} instead`)
|
|
91
|
+
this.name = 'ArgumentError'
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export class IllegalArgumentError extends CryptographyError {
|
|
96
|
+
constructor (message: string) {
|
|
97
|
+
super(message)
|
|
98
|
+
this.name = 'IllegalArgumentError'
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export class ArgumentCountMismatchError extends BaseError {
|
|
103
|
+
constructor (functionName: string, requiredCount: number, providedCount: number) {
|
|
104
|
+
super(`${functionName} expects ${requiredCount} arguments, got ${providedCount} instead`)
|
|
105
|
+
this.name = 'ArgumentCountMismatchError'
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export class InsufficientBalanceError extends BaseError {
|
|
110
|
+
constructor (message: string) {
|
|
111
|
+
super(message)
|
|
112
|
+
this.name = 'InsufficientBalanceError'
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export class InvalidDenominationError extends BaseError {
|
|
117
|
+
constructor (message: string) {
|
|
118
|
+
super(message)
|
|
119
|
+
this.name = 'InvalidDenominationError'
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export class InvalidNameError extends BaseError {
|
|
124
|
+
constructor (message: string) {
|
|
125
|
+
super(message)
|
|
126
|
+
this.name = 'InvalidNameError'
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export class MissingParamError extends BaseError {
|
|
131
|
+
constructor (message: string) {
|
|
132
|
+
super(message)
|
|
133
|
+
this.name = 'MissingParamError'
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export class NoBrowserFoundError extends BaseError {
|
|
138
|
+
constructor () {
|
|
139
|
+
super('Browser is not detected')
|
|
140
|
+
this.name = 'NoBrowserFoundError'
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export class NoSerializerFoundError extends BaseError {
|
|
145
|
+
constructor () {
|
|
146
|
+
super('Byte serialization not supported')
|
|
147
|
+
this.name = 'NoSerializerFoundError'
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export class RequestTimedOutError extends BaseError {
|
|
152
|
+
constructor (requestTime: number);
|
|
153
|
+
constructor (requestTime: number, currentHeight?: number, height?: number) {
|
|
154
|
+
if (currentHeight !== undefined && height !== undefined) {
|
|
155
|
+
super(`Giving up after ${requestTime}ms, current height: ${currentHeight}, desired height: ${height}`)
|
|
156
|
+
} else {
|
|
157
|
+
super(`Giving up after ${requestTime} ms`)
|
|
158
|
+
}
|
|
159
|
+
this.name = 'RequestTimedOutError'
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export class TxTimedOutError extends BaseError {
|
|
164
|
+
constructor (blocks: number, th: string, status?: string) {
|
|
165
|
+
super([
|
|
166
|
+
`Giving up after ${blocks} blocks mined`,
|
|
167
|
+
`transaction hash: ${th}`,
|
|
168
|
+
...status ? [`status: ${status}`] : []
|
|
169
|
+
].join(', '))
|
|
170
|
+
this.name = 'TxTimedOutError'
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export class TypeError extends BaseError {
|
|
175
|
+
constructor (message: string) {
|
|
176
|
+
super(message)
|
|
177
|
+
this.name = 'TypeError'
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export class UnsupportedPlatformError extends BaseError {
|
|
182
|
+
constructor (message: string) {
|
|
183
|
+
super(message)
|
|
184
|
+
this.name = 'UnsupportedPlatformError'
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export class UnsupportedProtocolError extends BaseError {
|
|
189
|
+
constructor (message: string) {
|
|
190
|
+
super(message)
|
|
191
|
+
this.name = 'UnsupportedProtocolError'
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export class NotImplementedError extends BaseError {
|
|
196
|
+
constructor (message: string) {
|
|
197
|
+
super(message)
|
|
198
|
+
this.name = 'NotImplementedError'
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export class UnsupportedVersionError extends BaseError {
|
|
203
|
+
constructor (dependency: string, version: string, geVersion: string, ltVersion: string) {
|
|
204
|
+
super(`Unsupported ${dependency} version ${version}. Supported: >= ${geVersion} < ${ltVersion}`)
|
|
205
|
+
this.name = 'UnsupportedVersionError'
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export class InternalError extends BaseError {
|
|
210
|
+
constructor (message: string) {
|
|
211
|
+
super(message)
|
|
212
|
+
this.name = 'InternalError'
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* keypair an account related errors */
|
|
217
|
+
export class InvalidKeypairError extends AccountError {
|
|
218
|
+
constructor (message: string) {
|
|
219
|
+
super(message)
|
|
220
|
+
this.name = 'InvalidKeypairError'
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export class UnavailableAccountError extends AccountError {
|
|
225
|
+
constructor (address: string) {
|
|
226
|
+
super(`Account for ${address} not available`)
|
|
227
|
+
this.name = 'UnavailableAccountError'
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* errors originating from AENS operation */
|
|
232
|
+
export class AensPointerContextError extends AensError {
|
|
233
|
+
constructor (nameOrId: string, prefix: string) {
|
|
234
|
+
super(`Name ${nameOrId} don't have pointers for ${prefix}`)
|
|
235
|
+
this.name = 'AensPointerContextError'
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export class InsufficientNameFeeError extends AensError {
|
|
240
|
+
constructor (nameFee: number, minNameFee: number) {
|
|
241
|
+
super(`the provided fee ${nameFee} is not enough to execute the claim, required: ${minNameFee}`)
|
|
242
|
+
this.name = 'InsufficientNameFeeError'
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export class InvalidAensNameError extends AensError {
|
|
247
|
+
constructor (message: string) {
|
|
248
|
+
super(message)
|
|
249
|
+
this.name = 'InvalidAensNameError'
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/* Aepp Errors */
|
|
254
|
+
export class DuplicateCallbackError extends AeppError {
|
|
255
|
+
constructor () {
|
|
256
|
+
super('Callback Already exist')
|
|
257
|
+
this.name = 'DuplicateCallbackError'
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export class InvalidRpcMessageError extends AeppError {
|
|
262
|
+
constructor (message: string) {
|
|
263
|
+
super(`Received invalid message: ${message}`)
|
|
264
|
+
this.name = 'InvalidRpcMessageError'
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export class MissingCallbackError extends AeppError {
|
|
269
|
+
constructor (id: string) {
|
|
270
|
+
super(`Can't find callback for this messageId ${id}`)
|
|
271
|
+
this.name = 'MissingCallbackError'
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export class UnAuthorizedAccountError extends AeppError {
|
|
276
|
+
constructor (onAccount: string) {
|
|
277
|
+
super(`You do not have access to account ${onAccount}`)
|
|
278
|
+
this.name = 'UnAuthorizedAccountError'
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export class UnknownRpcClientError extends AeppError {
|
|
283
|
+
constructor (id: string) {
|
|
284
|
+
super(`RpcClient with id ${id} do not exist`)
|
|
285
|
+
this.name = 'UnknownRpcClientError'
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export class UnsubscribedAccountError extends AeppError {
|
|
290
|
+
constructor () {
|
|
291
|
+
super('You are not subscribed for an account.')
|
|
292
|
+
this.name = 'UnsubscribedAccountError'
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/* Channel originated errors */
|
|
297
|
+
export class ChannelCallError extends ChannelError {
|
|
298
|
+
constructor (message: string) {
|
|
299
|
+
super(message)
|
|
300
|
+
this.name = 'ChannelCallError'
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export class ChannelConnectionError extends ChannelError {
|
|
305
|
+
constructor (message: string) {
|
|
306
|
+
super(message)
|
|
307
|
+
this.name = 'ChannelConnectionError'
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export class ChannelPingTimedOutError extends ChannelError {
|
|
312
|
+
constructor () {
|
|
313
|
+
super('Server pong timed out')
|
|
314
|
+
this.name = 'ChannelPingTimedOutError'
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export class UnexpectedChannelMessageError extends ChannelError {
|
|
319
|
+
constructor (message: string) {
|
|
320
|
+
super(message)
|
|
321
|
+
this.name = 'UnexpectedChannelMessageError'
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export class UnknownChannelStateError extends ChannelError {
|
|
326
|
+
constructor () {
|
|
327
|
+
super('State Channels FSM entered unknown state')
|
|
328
|
+
this.name = 'UnknownChannelStateError'
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/* compiler issued errors */
|
|
333
|
+
/* errors from option validations */
|
|
334
|
+
export class InvalidAuthDataError extends CompilerError {
|
|
335
|
+
constructor (message: string) {
|
|
336
|
+
super(message)
|
|
337
|
+
this.name = 'InvalidAuthDataError'
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/* contract invocation errors */
|
|
342
|
+
export class BytecodeMismatchError extends ContractError {
|
|
343
|
+
constructor (source: string) {
|
|
344
|
+
super(`Contract ${source} do not correspond to the bytecode deployed on the chain`)
|
|
345
|
+
this.name = 'BytecodeMismatchError'
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export class DuplicateContractError extends ContractError {
|
|
350
|
+
constructor () {
|
|
351
|
+
super('Contract already deployed')
|
|
352
|
+
this.name = 'DuplicateContractError'
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export class InactiveContractError extends ContractError {
|
|
357
|
+
constructor (contractAddress: string) {
|
|
358
|
+
super(`Contract with address ${contractAddress} not active`)
|
|
359
|
+
this.name = 'InactiveContractError'
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export class InvalidMethodInvocationError extends ContractError {
|
|
364
|
+
constructor (message: string) {
|
|
365
|
+
super(message)
|
|
366
|
+
this.name = 'InvalidMethodInvocationError'
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export class MissingContractAddressError extends ContractError {
|
|
371
|
+
constructor (message: string) {
|
|
372
|
+
super(message)
|
|
373
|
+
this.name = 'MissingContractAddressError'
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export class MissingContractDefError extends ContractError {
|
|
378
|
+
constructor () {
|
|
379
|
+
super('Either ACI or source code is required')
|
|
380
|
+
this.name = 'MissingContractDefError'
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export class MissingFunctionNameError extends ContractError {
|
|
385
|
+
constructor () {
|
|
386
|
+
super('Function name is required')
|
|
387
|
+
this.name = 'MissingFunctionNameError'
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export class NodeInvocationError extends ContractError {
|
|
392
|
+
constructor (message?: string) {
|
|
393
|
+
message = message ?? ''
|
|
394
|
+
super(`Invocation failed${message === '' ? '' : `: "${message}"`}`)
|
|
395
|
+
this.name = 'NodeInvocationError'
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export class NoSuchContractFunctionError extends ContractError {
|
|
400
|
+
constructor (name: string) {
|
|
401
|
+
super(`Function ${name} doesn't exist in contract`)
|
|
402
|
+
this.name = 'NoSuchContractFunctionError'
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
export class NotPayableFunctionError extends ContractError {
|
|
407
|
+
constructor (amount: string, fn: string) {
|
|
408
|
+
super(
|
|
409
|
+
`You try to pay "${amount}" to function "${fn}" which is not payable. ` +
|
|
410
|
+
'Only payable function can accept tokens')
|
|
411
|
+
this.name = 'NotPayableFunctionError'
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export class MissingEventDefinitionError extends ContractError {
|
|
416
|
+
constructor (eventNameHash: string, eventAddress: string) {
|
|
417
|
+
super(
|
|
418
|
+
`Can't find definition of ${eventNameHash} event emitted by ${eventAddress}` +
|
|
419
|
+
' (use omitUnknown option to ignore events like this)'
|
|
420
|
+
)
|
|
421
|
+
this.name = 'MissingEventDefinitionError'
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export class AmbiguousEventDefinitionError extends ContractError {
|
|
426
|
+
constructor (eventAddress: string, matchedEvents: [string, string][]) {
|
|
427
|
+
super(
|
|
428
|
+
`Found multiple definitions of "${matchedEvents[0][1]}" event emitted by ${eventAddress}` +
|
|
429
|
+
` in ${matchedEvents.map(([name]) => `"${name}"`).join(', ')} contracts` +
|
|
430
|
+
' (use contractAddressToName option to specify contract name corresponding to address)'
|
|
431
|
+
)
|
|
432
|
+
this.name = 'AmbiguousEventDefinitionError'
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/* cryptography errors */
|
|
437
|
+
export class InvalidChecksumError extends CryptographyError {
|
|
438
|
+
constructor () {
|
|
439
|
+
super('Invalid checksum')
|
|
440
|
+
this.name = 'InvalidChecksumError'
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
export class InvalidDerivationPathError extends CryptographyError {
|
|
445
|
+
constructor () {
|
|
446
|
+
super('Invalid path')
|
|
447
|
+
this.name = 'InvalidDerivationPathError'
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
export class InvalidKeyError extends CryptographyError {
|
|
452
|
+
constructor (message: string) {
|
|
453
|
+
super(message)
|
|
454
|
+
this.name = 'InvalidKeyError'
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
export class InvalidPasswordError extends CryptographyError {
|
|
459
|
+
constructor (message: string) {
|
|
460
|
+
super(message)
|
|
461
|
+
this.name = 'InvalidPasswordError'
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
export class MerkleTreeHashMismatchError extends CryptographyError {
|
|
466
|
+
constructor () {
|
|
467
|
+
super('Node hash is not equal to provided one')
|
|
468
|
+
this.name = 'MerkleTreeHashMismatchError'
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
export class MissingNodeInTreeError extends CryptographyError {
|
|
473
|
+
constructor (message: string) {
|
|
474
|
+
super(message)
|
|
475
|
+
this.name = 'MissingNodeInTreeError'
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
export class UnsupportedAlgorithmError extends CryptographyError {
|
|
480
|
+
constructor (algo: string) {
|
|
481
|
+
super(algo + ' is not available')
|
|
482
|
+
this.name = 'UnsupportedAlgorithmError'
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export class NotHardenedSegmentError extends CryptographyError {
|
|
487
|
+
constructor (message: string) {
|
|
488
|
+
super(message)
|
|
489
|
+
this.name = 'NotHardenedSegmentError'
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
export class UnknownNodeLengthError extends CryptographyError {
|
|
494
|
+
constructor (nodeLength: number) {
|
|
495
|
+
super(`Unknown node length: ${nodeLength}`)
|
|
496
|
+
this.name = 'UnknownNodeLengthError'
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
export class UnknownPathNibbleError extends CryptographyError {
|
|
501
|
+
constructor (nibble: number) {
|
|
502
|
+
super(`Unknown path nibble: ${nibble}`)
|
|
503
|
+
this.name = 'UnknownPathNibbleError'
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
export class UnsupportedChildIndexError extends CryptographyError {
|
|
508
|
+
constructor (index: string) {
|
|
509
|
+
super(`Child index #${index} is not supported`)
|
|
510
|
+
this.name = 'UnsupportedChildIndexError'
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/* Node errors */
|
|
515
|
+
export class DisconnectedError extends NodeError {
|
|
516
|
+
constructor () {
|
|
517
|
+
super('Can not get node info. Node is not connected')
|
|
518
|
+
this.name = 'DisconnectedError'
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
export class DuplicateNodeError extends NodeError {
|
|
523
|
+
constructor (name: string) {
|
|
524
|
+
super(`Node with name ${name} already exist`)
|
|
525
|
+
this.name = 'DuplicateNodeError'
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export class NodeNotFoundError extends NodeError {
|
|
530
|
+
constructor (message: string) {
|
|
531
|
+
super(message)
|
|
532
|
+
this.name = 'NodeNotFoundError'
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/* transaction related errors */
|
|
537
|
+
export class DecodeError extends TransactionError {
|
|
538
|
+
constructor (message: string) {
|
|
539
|
+
super(message)
|
|
540
|
+
this.name = 'DecodeError'
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
export class EncodeError extends TransactionError {
|
|
545
|
+
constructor (message: string) {
|
|
546
|
+
super(message)
|
|
547
|
+
this.name = 'EncodeError'
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
export class PayloadLengthError extends TransactionError {
|
|
552
|
+
constructor (message: string) {
|
|
553
|
+
super(message)
|
|
554
|
+
this.name = 'PayloadLengthError'
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export class DryRunError extends TransactionError {
|
|
559
|
+
constructor (message: string) {
|
|
560
|
+
super(message)
|
|
561
|
+
this.name = 'DryRunError'
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
export class IllegalBidFeeError extends TransactionError {
|
|
566
|
+
constructor (message: string) {
|
|
567
|
+
super(message)
|
|
568
|
+
this.name = 'IllegalBidFeeError'
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
export class InvalidSignatureError extends TransactionError {
|
|
573
|
+
constructor (message: string) {
|
|
574
|
+
super(message)
|
|
575
|
+
this.name = 'InvalidSignatureError'
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
export class InvalidTxError extends TransactionError {
|
|
580
|
+
constructor (message: string) {
|
|
581
|
+
super(message)
|
|
582
|
+
this.name = 'InvalidTxError'
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
export class InvalidTxParamsError extends TransactionError {
|
|
587
|
+
constructor (message: string) {
|
|
588
|
+
super(message)
|
|
589
|
+
this.name = 'InvalidTxParamsError'
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
export class NoDefaultAensPointerError extends TransactionError {
|
|
594
|
+
constructor (prefix: string) {
|
|
595
|
+
super(`Default AENS pointer key is not defined for ${prefix} prefix`)
|
|
596
|
+
this.name = 'NoDefaultAensPointerError'
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
export class PrefixMismatchError extends TransactionError {
|
|
601
|
+
constructor (prefix: string, requiredPrefix: string) {
|
|
602
|
+
super(`Encoded string have a wrong type: ${prefix} (expected: ${requiredPrefix})`)
|
|
603
|
+
this.name = 'PrefixMismatchError'
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
export class PrefixNotFoundError extends TransactionError {
|
|
608
|
+
constructor (tag: string) {
|
|
609
|
+
super(`Prefix for id-tag ${tag} not found.`)
|
|
610
|
+
this.name = 'PrefixNotFoundError'
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
export class SchemaNotFoundError extends TransactionError {
|
|
615
|
+
constructor (message: string) {
|
|
616
|
+
super(message)
|
|
617
|
+
this.name = 'SchemaNotFoundError'
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
export class TagNotFoundError extends TransactionError {
|
|
622
|
+
constructor (prefix: string) {
|
|
623
|
+
super(`Id tag for prefix ${prefix} not found.`)
|
|
624
|
+
this.name = 'DecodeError'
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
export class TxNotInChainError extends TransactionError {
|
|
629
|
+
constructor (txHash: string) {
|
|
630
|
+
super(`Transaction ${txHash} is removed from chain`)
|
|
631
|
+
this.name = 'TxNotInChainError'
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
export class UnknownTxError extends TransactionError {
|
|
636
|
+
constructor (message: string) {
|
|
637
|
+
super(message)
|
|
638
|
+
this.name = 'UnknownTxError'
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
export class UnsupportedABIversionError extends TransactionError {
|
|
643
|
+
constructor (message: string) {
|
|
644
|
+
super(message)
|
|
645
|
+
this.name = 'UnsupportedABIversionError'
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
export class UnsupportedVMversionError extends TransactionError {
|
|
650
|
+
constructor (message: string) {
|
|
651
|
+
super(message)
|
|
652
|
+
this.name = 'UnsupportedVMversionError'
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/* Wallet Errors */
|
|
657
|
+
export class AlreadyConnectedError extends WalletError {
|
|
658
|
+
constructor (message: string) {
|
|
659
|
+
super(message)
|
|
660
|
+
this.name = 'AlreadyConnectedError'
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
export class MessageDirectionError extends WalletError {
|
|
665
|
+
constructor (message: string) {
|
|
666
|
+
super(message)
|
|
667
|
+
this.name = 'MessageDirectionError'
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
export class NoWalletConnectedError extends WalletError {
|
|
672
|
+
constructor (message: string) {
|
|
673
|
+
super(message)
|
|
674
|
+
this.name = 'NoWalletConnectedError'
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
export class RpcConnectionError extends WalletError {
|
|
679
|
+
constructor (message: string) {
|
|
680
|
+
super(message)
|
|
681
|
+
this.name = 'RpcConnectionError'
|
|
682
|
+
}
|
|
683
|
+
}
|