@docknetwork/wallet-sdk-wasm 1.5.9 → 1.5.10

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.
Files changed (262) hide show
  1. package/lib/core/format-utils.js +0 -28
  2. package/lib/core/format-utils.mjs +1 -24
  3. package/lib/core/validation.js +1 -24
  4. package/lib/core/validation.mjs +2 -21
  5. package/lib/index.js +13 -23
  6. package/lib/index.mjs +13 -23
  7. package/lib/rpc-server.js +13 -23
  8. package/lib/rpc-server.mjs +13 -23
  9. package/lib/rpc-util.js +14 -0
  10. package/lib/rpc-util.mjs +14 -0
  11. package/lib/services/blockchain/index.js +3 -6
  12. package/lib/services/blockchain/index.mjs +3 -6
  13. package/lib/services/blockchain/service.js +4 -6
  14. package/lib/services/blockchain/service.mjs +4 -6
  15. package/lib/services/credential/bbs-revocation.js +4 -7
  16. package/lib/services/credential/bbs-revocation.mjs +3 -6
  17. package/lib/services/credential/bound-check.js +9 -4
  18. package/lib/services/credential/bound-check.mjs +9 -4
  19. package/lib/services/credential/index.js +11 -13
  20. package/lib/services/credential/index.mjs +11 -13
  21. package/lib/services/credential/service.js +18 -18
  22. package/lib/services/credential/service.mjs +15 -15
  23. package/lib/services/credential/utils.js +65 -28
  24. package/lib/services/credential/utils.mjs +62 -32
  25. package/lib/services/dids/index.js +11 -14
  26. package/lib/services/dids/index.mjs +11 -14
  27. package/lib/services/dids/keypair-utils.js +142 -0
  28. package/lib/services/dids/keypair-utils.mjs +113 -0
  29. package/lib/services/dids/service.js +15 -34
  30. package/lib/services/dids/service.mjs +15 -34
  31. package/lib/services/edv/index.js +8 -14
  32. package/lib/services/edv/index.mjs +8 -14
  33. package/lib/services/edv/service.js +10 -22
  34. package/lib/services/edv/service.mjs +10 -22
  35. package/lib/services/index.js +13 -25
  36. package/lib/services/index.mjs +13 -25
  37. package/lib/services/relay-service/configs.js +0 -1
  38. package/lib/services/relay-service/configs.mjs +0 -1
  39. package/lib/services/relay-service/index.android.js +0 -1
  40. package/lib/services/relay-service/index.android.mjs +0 -1
  41. package/lib/services/relay-service/index.ios.js +0 -1
  42. package/lib/services/relay-service/index.ios.mjs +0 -1
  43. package/lib/services/relay-service/index.js +0 -1
  44. package/lib/services/relay-service/index.mjs +0 -1
  45. package/lib/services/relay-service/service-rpc.js +0 -1
  46. package/lib/services/relay-service/service-rpc.mjs +0 -1
  47. package/lib/services/relay-service/service.js +0 -1
  48. package/lib/services/relay-service/service.mjs +0 -1
  49. package/lib/services/test-utils.js +0 -44
  50. package/lib/services/test-utils.mjs +1 -44
  51. package/lib/services/util-crypto/configs.js +0 -12
  52. package/lib/services/util-crypto/configs.mjs +0 -12
  53. package/lib/services/util-crypto/index.android.js +0 -3
  54. package/lib/services/util-crypto/index.android.mjs +0 -3
  55. package/lib/services/util-crypto/index.ios.js +0 -3
  56. package/lib/services/util-crypto/index.ios.mjs +0 -3
  57. package/lib/services/util-crypto/index.js +4 -7
  58. package/lib/services/util-crypto/index.mjs +4 -7
  59. package/lib/services/util-crypto/service-rpc.js +0 -23
  60. package/lib/services/util-crypto/service-rpc.mjs +0 -23
  61. package/lib/services/util-crypto/service.js +68 -61
  62. package/lib/services/util-crypto/service.mjs +50 -59
  63. package/lib/services/wallet/configs.js +0 -63
  64. package/lib/services/wallet/configs.mjs +1 -64
  65. package/lib/services/wallet/index.android.js +0 -1
  66. package/lib/services/wallet/index.android.mjs +0 -1
  67. package/lib/services/wallet/index.ios.js +0 -1
  68. package/lib/services/wallet/index.ios.mjs +0 -1
  69. package/lib/services/wallet/index.js +2 -12
  70. package/lib/services/wallet/index.mjs +2 -12
  71. package/lib/services/wallet/service-rpc.js +0 -77
  72. package/lib/services/wallet/service-rpc.mjs +0 -77
  73. package/lib/services/wallet/service.js +1 -215
  74. package/lib/services/wallet/service.mjs +1 -211
  75. package/lib/setup-nodejs.js +13 -23
  76. package/lib/setup-nodejs.mjs +13 -23
  77. package/lib/setup-tests.js +13 -23
  78. package/lib/setup-tests.mjs +13 -23
  79. package/lib/src/core/format-utils.d.ts +0 -5
  80. package/lib/src/core/format-utils.d.ts.map +1 -1
  81. package/lib/src/core/validation.d.ts +0 -3
  82. package/lib/src/core/validation.d.ts.map +1 -1
  83. package/lib/src/rpc-util.d.ts.map +1 -1
  84. package/lib/src/services/blockchain/service.d.ts.map +1 -1
  85. package/lib/src/services/credential/bbs-revocation.d.ts.map +1 -1
  86. package/lib/src/services/credential/bound-check.d.ts +1 -1
  87. package/lib/src/services/credential/bound-check.d.ts.map +1 -1
  88. package/lib/src/services/credential/service.d.ts.map +1 -1
  89. package/lib/src/services/credential/utils.d.ts +2 -1
  90. package/lib/src/services/credential/utils.d.ts.map +1 -1
  91. package/lib/src/services/dids/keypair-utils.d.ts +15 -0
  92. package/lib/src/services/dids/keypair-utils.d.ts.map +1 -0
  93. package/lib/src/services/dids/service.d.ts +6 -6
  94. package/lib/src/services/dids/service.d.ts.map +1 -1
  95. package/lib/src/services/edv/service.d.ts.map +1 -1
  96. package/lib/src/services/util-crypto/configs.d.ts +0 -3
  97. package/lib/src/services/util-crypto/configs.d.ts.map +1 -1
  98. package/lib/src/services/util-crypto/service.d.ts +3 -8
  99. package/lib/src/services/util-crypto/service.d.ts.map +1 -1
  100. package/lib/src/services/wallet/configs.d.ts +13 -0
  101. package/lib/src/services/wallet/configs.d.ts.map +1 -0
  102. package/lib/src/services/wallet/service.d.ts +1 -44
  103. package/lib/src/services/wallet/service.d.ts.map +1 -1
  104. package/lib/test-utils.js +0 -4
  105. package/lib/test-utils.mjs +1 -4
  106. package/lib/tsconfig.tsbuildinfo +1 -1
  107. package/package.json +5 -25
  108. package/readme.md +0 -61
  109. package/src/core/format-utils.test.js +1 -28
  110. package/src/core/format-utils.ts +0 -33
  111. package/src/core/validation.test.js +1 -33
  112. package/src/core/validation.ts +1 -25
  113. package/src/rpc-server.test.js +2 -9
  114. package/src/rpc-util.js +14 -0
  115. package/src/services/blockchain/service.ts +1 -0
  116. package/src/services/credential/bbs-revocation.ts +2 -1
  117. package/src/services/credential/bound-check.test.ts +6 -6
  118. package/src/services/credential/bound-check.ts +4 -4
  119. package/src/services/credential/index.test.js +0 -2
  120. package/src/services/credential/service.ts +5 -2
  121. package/src/services/credential/utils.js +65 -23
  122. package/src/services/dids/index.test.js +8 -19
  123. package/src/services/dids/keypair-utils.js +111 -0
  124. package/src/services/dids/service.ts +6 -25
  125. package/src/services/edv/service.ts +2 -9
  126. package/src/services/index.js +0 -4
  127. package/src/services/test-utils.js +0 -29
  128. package/src/services/util-crypto/configs.ts +0 -12
  129. package/src/services/util-crypto/index.test.js +6 -83
  130. package/src/services/util-crypto/service-rpc.js +0 -20
  131. package/src/services/util-crypto/service.ts +62 -75
  132. package/src/services/wallet/configs.ts +1 -113
  133. package/src/services/wallet/index.test.js +0 -159
  134. package/src/services/wallet/service-rpc.js +1 -88
  135. package/src/services/wallet/service.ts +0 -258
  136. package/src/test-utils.js +0 -13
  137. package/lib/account-357ab05d.js +0 -742
  138. package/lib/account-399e6053.js +0 -752
  139. package/lib/core/polkadot-utils.js +0 -119
  140. package/lib/core/polkadot-utils.mjs +0 -94
  141. package/lib/core/realm-schemas.js +0 -50
  142. package/lib/core/realm-schemas.mjs +0 -44
  143. package/lib/core/subscan.js +0 -75
  144. package/lib/core/subscan.mjs +0 -64
  145. package/lib/fixtures.js +0 -56
  146. package/lib/fixtures.mjs +0 -52
  147. package/lib/modules/account.js +0 -48
  148. package/lib/modules/account.mjs +0 -40
  149. package/lib/modules/accounts.js +0 -49
  150. package/lib/modules/accounts.mjs +0 -40
  151. package/lib/modules/data-migration.js +0 -72
  152. package/lib/modules/data-migration.mjs +0 -68
  153. package/lib/modules/wallet-backup.js +0 -82
  154. package/lib/modules/wallet-backup.mjs +0 -71
  155. package/lib/modules/wallet.js +0 -49
  156. package/lib/modules/wallet.mjs +0 -40
  157. package/lib/services/example/configs.js +0 -21
  158. package/lib/services/example/configs.mjs +0 -13
  159. package/lib/services/example/index.js +0 -18
  160. package/lib/services/example/index.mjs +0 -14
  161. package/lib/services/example/service-rpc.js +0 -25
  162. package/lib/services/example/service-rpc.mjs +0 -21
  163. package/lib/services/example/service.js +0 -25
  164. package/lib/services/example/service.mjs +0 -20
  165. package/lib/services/keyring/configs.js +0 -70
  166. package/lib/services/keyring/configs.mjs +0 -61
  167. package/lib/services/keyring/index.android.js +0 -22
  168. package/lib/services/keyring/index.android.mjs +0 -18
  169. package/lib/services/keyring/index.ios.js +0 -22
  170. package/lib/services/keyring/index.ios.mjs +0 -18
  171. package/lib/services/keyring/index.js +0 -16
  172. package/lib/services/keyring/index.mjs +0 -8
  173. package/lib/services/keyring/service-rpc.js +0 -65
  174. package/lib/services/keyring/service-rpc.mjs +0 -61
  175. package/lib/services/keyring/service.js +0 -84
  176. package/lib/services/keyring/service.mjs +0 -74
  177. package/lib/services/polkadot/configs.js +0 -17
  178. package/lib/services/polkadot/configs.mjs +0 -13
  179. package/lib/services/polkadot/index.android.js +0 -22
  180. package/lib/services/polkadot/index.android.mjs +0 -18
  181. package/lib/services/polkadot/index.ios.js +0 -22
  182. package/lib/services/polkadot/index.ios.mjs +0 -18
  183. package/lib/services/polkadot/index.js +0 -15
  184. package/lib/services/polkadot/index.mjs +0 -7
  185. package/lib/services/polkadot/service-rpc.js +0 -30
  186. package/lib/services/polkadot/service-rpc.mjs +0 -26
  187. package/lib/services/polkadot/service.js +0 -28
  188. package/lib/services/polkadot/service.mjs +0 -23
  189. package/lib/src/core/polkadot-utils.d.ts +0 -11
  190. package/lib/src/core/polkadot-utils.d.ts.map +0 -1
  191. package/lib/src/modules/account.d.ts +0 -60
  192. package/lib/src/modules/account.d.ts.map +0 -1
  193. package/lib/src/modules/accounts.d.ts +0 -48
  194. package/lib/src/modules/accounts.d.ts.map +0 -1
  195. package/lib/src/modules/data-migration.d.ts +0 -7
  196. package/lib/src/modules/data-migration.d.ts.map +0 -1
  197. package/lib/src/modules/wallet-backup.d.ts +0 -12
  198. package/lib/src/modules/wallet-backup.d.ts.map +0 -1
  199. package/lib/src/modules/wallet.d.ts +0 -134
  200. package/lib/src/modules/wallet.d.ts.map +0 -1
  201. package/lib/src/services/blockchain/index.d.ts +0 -2
  202. package/lib/src/services/blockchain/index.d.ts.map +0 -1
  203. package/lib/src/services/example/configs.d.ts +0 -9
  204. package/lib/src/services/example/configs.d.ts.map +0 -1
  205. package/lib/src/services/example/service.d.ts +0 -8
  206. package/lib/src/services/example/service.d.ts.map +0 -1
  207. package/lib/src/services/keyring/configs.d.ts +0 -39
  208. package/lib/src/services/keyring/configs.d.ts.map +0 -1
  209. package/lib/src/services/keyring/index.d.ts +0 -2
  210. package/lib/src/services/keyring/index.d.ts.map +0 -1
  211. package/lib/src/services/polkadot/configs.d.ts +0 -8
  212. package/lib/src/services/polkadot/configs.d.ts.map +0 -1
  213. package/lib/src/services/polkadot/index.d.ts +0 -2
  214. package/lib/src/services/polkadot/index.d.ts.map +0 -1
  215. package/lib/src/services/polkadot/service.d.ts +0 -8
  216. package/lib/src/services/polkadot/service.d.ts.map +0 -1
  217. package/lib/src/services/wallet/index.d.ts +0 -2
  218. package/lib/src/services/wallet/index.d.ts.map +0 -1
  219. package/lib/test/axiosMocks.js +0 -431
  220. package/lib/test/axiosMocks.mjs +0 -420
  221. package/lib/test/setup-test-state.js +0 -81
  222. package/lib/test/setup-test-state.mjs +0 -73
  223. package/src/core/polkadot-utils.js +0 -99
  224. package/src/core/realm-schemas.js +0 -42
  225. package/src/core/subscan.js +0 -62
  226. package/src/core/subscan.test.js +0 -56
  227. package/src/fixtures.js +0 -43
  228. package/src/modules/account.test.js +0 -56
  229. package/src/modules/account.ts +0 -128
  230. package/src/modules/accounts.test.js +0 -63
  231. package/src/modules/accounts.ts +0 -231
  232. package/src/modules/data-migration.test.js +0 -61
  233. package/src/modules/data-migration.ts +0 -86
  234. package/src/modules/wallet-backup.test.js +0 -24
  235. package/src/modules/wallet-backup.ts +0 -68
  236. package/src/modules/wallet.test.js +0 -216
  237. package/src/modules/wallet.ts +0 -424
  238. package/src/services/example/configs.js +0 -14
  239. package/src/services/example/index.js +0 -3
  240. package/src/services/example/index.test.js +0 -28
  241. package/src/services/example/service-rpc.js +0 -11
  242. package/src/services/example/service.ts +0 -18
  243. package/src/services/keyring/configs.ts +0 -110
  244. package/src/services/keyring/index.android.js +0 -3
  245. package/src/services/keyring/index.ios.js +0 -3
  246. package/src/services/keyring/index.js +0 -1
  247. package/src/services/keyring/index.test.js +0 -48
  248. package/src/services/keyring/service-rpc.js +0 -56
  249. package/src/services/keyring/service.ts +0 -111
  250. package/src/services/polkadot/configs.ts +0 -13
  251. package/src/services/polkadot/index.android.js +0 -3
  252. package/src/services/polkadot/index.ios.js +0 -3
  253. package/src/services/polkadot/index.js +0 -1
  254. package/src/services/polkadot/index.test.js +0 -52
  255. package/src/services/polkadot/service-rpc.js +0 -13
  256. package/src/services/polkadot/service.ts +0 -21
  257. package/src/test/axiosMocks.js +0 -20
  258. package/src/test/fixtures/subscan-failure.json +0 -5
  259. package/src/test/fixtures/subscan-success.json +0 -370
  260. package/src/test/fixtures/subscan-too-many-requests.json +0 -9
  261. package/src/test/setup-test-state.js +0 -35
  262. package/src/test/test-wallet.test.js +0 -15
@@ -1,56 +0,0 @@
1
- import {RpcService} from '../rpc-service-client';
2
- import {
3
- AddFromJsonParams,
4
- AddFromMnemonicParams,
5
- AddressFromUriParams,
6
- GetKeyringParams,
7
- serviceName,
8
- validation,
9
- SignDataParams,
10
- } from './configs';
11
-
12
- export class KeyringServiceRpc extends RpcService {
13
- constructor() {
14
- super(serviceName);
15
- }
16
-
17
- initialize(params: InitializeParams) {
18
- validation.initialize(params);
19
- return this.call('initialize', params);
20
- }
21
-
22
- addFromMnemonic(params: AddFromMnemonicParams) {
23
- validation.addFromMnemonic(params);
24
- return this.call('addFromMnemonic', params);
25
- }
26
-
27
- addFromJson(params: AddFromJsonParams) {
28
- validation.addFromJson(params);
29
- return this.call('addFromJson', params);
30
- }
31
-
32
- decryptKeyPair(params: AddFromJsonParams) {
33
- validation.addFromJson(params);
34
- return this.call('decryptKeyPair', params);
35
- }
36
-
37
- getKeyringPair(params: GetKeyringParams) {
38
- validation.getKeyringPair(params);
39
- return this.call('getKeyringPair', params);
40
- }
41
-
42
- getKeyringPairJSON(params: GetKeyringParams) {
43
- validation.getKeyringPair(params);
44
- return this.call('getKeyringPairJSON', params);
45
- }
46
-
47
- addressFromUri(params: AddressFromUriParams) {
48
- validation.addressFromUri(params);
49
- return this.call('addressFromUri', params);
50
- }
51
-
52
- signData(params: SignDataParams) {
53
- validation.signData(params);
54
- return this.call('signData', params);
55
- }
56
- }
@@ -1,111 +0,0 @@
1
- // @ts-nocheck
2
- import Keyring from '@polkadot/keyring';
3
- import {cryptoWaitReady} from '@polkadot/util-crypto';
4
- import {
5
- AddFromJsonParams,
6
- AddFromMnemonicParams,
7
- CreateFromUriParams,
8
- CreateFromPairParams,
9
- InitializeParams,
10
- serviceName,
11
- validation,
12
- SignDataParams,
13
- } from './configs';
14
-
15
- export function getKeyring() {
16
- return keyringService.keyring;
17
- }
18
-
19
- export class KeyringService {
20
- keyring: Keyring;
21
-
22
- rpcMethods = [
23
- KeyringService.prototype.addFromJson,
24
- KeyringService.prototype.addFromMnemonic,
25
- KeyringService.prototype.addressFromUri,
26
- KeyringService.prototype.getKeyringPair,
27
- KeyringService.prototype.getKeyringPairJSON,
28
- KeyringService.prototype.initialize,
29
- KeyringService.prototype.signData,
30
- KeyringService.prototype.decryptKeyPair,
31
- ];
32
-
33
- constructor() {
34
- this.name = serviceName;
35
- }
36
-
37
- async initialize(params: InitializeParams) {
38
- await cryptoWaitReady();
39
-
40
- validation.initialize(params);
41
-
42
- this.keyring = new Keyring(params);
43
-
44
- return true;
45
- }
46
-
47
- addFromMnemonic({mnemonic, meta, type}: AddFromMnemonicParams) {
48
- validation.addFromMnemonic({mnemonic, meta, type});
49
- return this.keyring.addFromMnemonic(mnemonic, meta, type);
50
- }
51
-
52
- decryptKeyPair({jsonData, password}: {keyPair: any, password: string}) {
53
- validation.addFromJson({jsonData, password});
54
-
55
- const pair = this.keyring.addFromJson(jsonData);
56
-
57
- pair.unlock(password);
58
-
59
- return pair;
60
- }
61
-
62
- addFromJson({jsonData, password}: AddFromJsonParams) {
63
- validation.addFromJson({jsonData, password});
64
-
65
- const pair = this.keyring.addFromJson(jsonData);
66
-
67
- pair.unlock(password);
68
-
69
- return pair.toJson();
70
- }
71
-
72
- signData(params: SignDataParams): any {
73
- validation.signData(params);
74
- const account = this.keyring.addFromPair(params.keyPair);
75
- return account.sign(params.data);
76
- }
77
-
78
- getKeyringPair(params: CreateFromUriParams): KeyringPair {
79
- validation.getKeyringPair(params);
80
-
81
- const {mnemonic, meta, type, derivePath = ''} = params;
82
-
83
- return this.keyring.createFromUri(
84
- `${mnemonic.trim()}${derivePath}`,
85
- meta,
86
- type,
87
- );
88
- }
89
-
90
- createFromPair(params: CreateFromPairParams): KeyringPair {
91
- validation.createFromPair(params);
92
-
93
- const {pair, meta, type} = params;
94
-
95
- return this.keyring.createFromPair(
96
- pair,
97
- meta,
98
- type,
99
- );
100
- }
101
-
102
- getKeyringPairJSON(params: CreateFromUriParams): KeyringPair {
103
- return this.getKeyringPair(params).toJson();
104
- }
105
-
106
- addressFromUri(params: CreateFromUriParams) {
107
- return this.getKeyringPair(params).address;
108
- }
109
- }
110
-
111
- export const keyringService: KeyringService = new KeyringService();
@@ -1,13 +0,0 @@
1
- // @ts-nocheck
2
- import {assertAddress} from '../../core/validation';
3
-
4
- export const validation = {
5
- getAddressSvg({address, isAlternative}: GetAddressSvgParams) {
6
- assertAddress(address);
7
- },
8
- };
9
-
10
- export type GetAddressSvgParams = {
11
- address: string,
12
- isAlternative?: boolean,
13
- };
@@ -1,3 +0,0 @@
1
- import {PolkadotServiceRpc} from './service-rpc';
2
-
3
- export const polkadotService = new PolkadotServiceRpc();
@@ -1,3 +0,0 @@
1
- import {PolkadotServiceRpc} from './service-rpc';
2
-
3
- export const polkadotService = new PolkadotServiceRpc();
@@ -1 +0,0 @@
1
- export {polkadotService} from './service';
@@ -1,52 +0,0 @@
1
- import {TestFixtures} from '../../fixtures';
2
- import {assertRpcService, getPromiseError} from '../test-utils';
3
- import {validation} from './configs';
4
- import {polkadotService as service} from './service';
5
- import {PolkadotServiceRpc} from './service-rpc';
6
-
7
- describe('PolkadotService', () => {
8
- it('ServiceRpc', () => {
9
- assertRpcService(PolkadotServiceRpc, service, validation);
10
- });
11
-
12
- describe('service', () => {
13
- beforeAll(async () => {});
14
-
15
- describe('getAddressSvg', () => {
16
- it('expect to getAddressSvg', async () => {
17
- const result = await service.getAddressSvg({
18
- address: TestFixtures.account1.address,
19
- });
20
- expect(result).toEqual([
21
- {cx: 32, cy: 32, fill: '#eee', r: 32},
22
- {cx: 32, cy: 8, fill: 'hsl(118, 63%, 53%)', r: 5},
23
- {cx: 32, cy: 20, fill: 'hsl(348, 63%, 35%)', r: 5},
24
- {cx: 21.607695154586736, cy: 14, fill: 'hsl(225, 63%, 35%)', r: 5},
25
- {cx: 11.215390309173472, cy: 20, fill: 'hsl(11, 63%, 75%)', r: 5},
26
- {cx: 21.607695154586736, cy: 26, fill: 'hsl(264, 63%, 15%)', r: 5},
27
- {cx: 11.215390309173472, cy: 32, fill: 'hsl(56, 63%, 15%)', r: 5},
28
- {cx: 11.215390309173472, cy: 44, fill: 'hsl(95, 63%, 75%)', r: 5},
29
- {cx: 21.607695154586736, cy: 38, fill: 'hsl(163, 63%, 75%)', r: 5},
30
- {cx: 21.607695154586736, cy: 50, fill: 'hsl(33, 63%, 53%)', r: 5},
31
- {cx: 32, cy: 56, fill: 'hsl(213, 63%, 75%)', r: 5},
32
- {cx: 32, cy: 44, fill: 'hsl(281, 63%, 15%)', r: 5},
33
- {cx: 42.392304845413264, cy: 50, fill: 'hsl(33, 63%, 53%)', r: 5},
34
- {cx: 52.78460969082653, cy: 44, fill: 'hsl(95, 63%, 75%)', r: 5},
35
- {cx: 42.392304845413264, cy: 38, fill: 'hsl(163, 63%, 75%)', r: 5},
36
- {cx: 52.78460969082653, cy: 32, fill: 'hsl(56, 63%, 15%)', r: 5},
37
- {cx: 52.78460969082653, cy: 20, fill: 'hsl(11, 63%, 75%)', r: 5},
38
- {cx: 42.392304845413264, cy: 26, fill: 'hsl(264, 63%, 15%)', r: 5},
39
- {cx: 42.392304845413264, cy: 14, fill: 'hsl(225, 63%, 35%)', r: 5},
40
- {cx: 32, cy: 32, fill: 'hsl(39, 63%, 15%)', r: 5},
41
- ]);
42
- });
43
-
44
- it('expect to validate params', async () => {
45
- const error = await getPromiseError(() =>
46
- service.getAddressSvg({address: undefined}),
47
- );
48
- expect(error.message).toBe('invalid address: undefined');
49
- });
50
- });
51
- });
52
- });
@@ -1,13 +0,0 @@
1
- import {RpcService} from '../rpc-service-client';
2
- import {GetAddressSvgParams, validation} from './configs';
3
-
4
- export class PolkadotServiceRpc extends RpcService {
5
- constructor() {
6
- super('polkadot');
7
- }
8
-
9
- getAddressSvg(params: GetAddressSvgParams): Promise<any> {
10
- validation.getAddressSvg(params);
11
- return this.call('getAddressSvg', params);
12
- }
13
- }
@@ -1,21 +0,0 @@
1
- // @ts-nocheck
2
- import {polkadotIcon} from '@polkadot/ui-shared/cjs/icons/index';
3
- import {GetAddressSvgParams, validation} from './configs';
4
-
5
- export class PolkadotService {
6
- rpcMethods = [PolkadotService.prototype.getAddressSvg];
7
-
8
- constructor() {
9
- this.name = 'polkadot';
10
- }
11
-
12
- async getAddressSvg(params: GetAddressSvgParams) {
13
- validation.getAddressSvg(params);
14
-
15
- return polkadotIcon(params.address, {
16
- isAlternative: params.isAlternative,
17
- });
18
- }
19
- }
20
-
21
- export const polkadotService: PolkadotService = new PolkadotService();
@@ -1,20 +0,0 @@
1
- import axios from 'axios';
2
- import MockAdapter from 'axios-mock-adapter';
3
- import successData from './fixtures/subscan-success.json';
4
- import paramsFailure from './fixtures/subscan-failure.json';
5
- import requestFailure from './fixtures/subscan-too-many-requests.json';
6
- import {SUBSCAN_TRANSFER_URL} from '../core/subscan';
7
-
8
- const mockAdapter = new MockAdapter(axios);
9
-
10
- export function mockSubscanSuccess() {
11
- mockAdapter.onPost(SUBSCAN_TRANSFER_URL).replyOnce(200, successData);
12
- }
13
-
14
- export function mockSubscanParamsFailure() {
15
- mockAdapter.onPost(SUBSCAN_TRANSFER_URL).replyOnce(200, paramsFailure);
16
- }
17
-
18
- export function mockSubscanRequestFailure() {
19
- mockAdapter.onPost(SUBSCAN_TRANSFER_URL).replyOnce(429, requestFailure);
20
- }
@@ -1,5 +0,0 @@
1
- {
2
- "code": 10001,
3
- "message": "Params Error",
4
- "generated_at": 1643066008
5
- }
@@ -1,370 +0,0 @@
1
- {
2
- "code": 0,
3
- "message": "Success",
4
- "generated_at": 1643065993,
5
- "data": {
6
- "count": 55,
7
- "transfers": [
8
- {
9
- "from": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
10
- "to": "3EZ85Y5FLEsqzD5xKTyqB9gtvSHFhEVG83d2i6P54SFJNvSF",
11
- "extrinsic_index": "4176898-1",
12
- "success": true,
13
- "hash": "0x8df2969b4e70230efd8c0070c0f126c6cf2bbd6c5386362c91502aed0b18cc46",
14
- "block_num": 4176898,
15
- "block_timestamp": 1638387639,
16
- "module": "balances",
17
- "amount": "8920.915",
18
- "fee": "2085000",
19
- "nonce": 0,
20
- "asset_symbol": "",
21
- "from_account_display": {
22
- "address": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
23
- "display": "",
24
- "judgements": null,
25
- "account_index": "",
26
- "identity": false,
27
- "parent": null
28
- },
29
- "to_account_display": {
30
- "address": "3EZ85Y5FLEsqzD5xKTyqB9gtvSHFhEVG83d2i6P54SFJNvSF",
31
- "display": "",
32
- "judgements": null,
33
- "account_index": "",
34
- "identity": false,
35
- "parent": null
36
- }
37
- },
38
- {
39
- "from": "3FYAYVDzXT7ceb9vtLSn5JXT4B878q2ho1wBaeRU2qk42WRy",
40
- "to": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
41
- "extrinsic_index": "4176087-1",
42
- "success": true,
43
- "hash": "0x8b9a5c1c4c7d9bf180eb5aa1ebe49f2c7e6a4a3d10c1cf78fe9b23caadcad4a5",
44
- "block_num": 4176087,
45
- "block_timestamp": 1638385200,
46
- "module": "balances",
47
- "amount": "8923",
48
- "fee": "2125000",
49
- "nonce": 2759,
50
- "asset_symbol": "",
51
- "from_account_display": {
52
- "address": "3FYAYVDzXT7ceb9vtLSn5JXT4B878q2ho1wBaeRU2qk42WRy",
53
- "display": "",
54
- "judgements": null,
55
- "account_index": "",
56
- "identity": false,
57
- "parent": null
58
- },
59
- "to_account_display": {
60
- "address": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
61
- "display": "",
62
- "judgements": null,
63
- "account_index": "",
64
- "identity": false,
65
- "parent": null
66
- }
67
- },
68
- {
69
- "from": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
70
- "to": "3EZ85Y5FLEsqzD5xKTyqB9gtvSHFhEVG83d2i6P54SFJNvSF",
71
- "extrinsic_index": "4167511-1",
72
- "success": true,
73
- "hash": "0x52f975cc5983e8e11c4a54c8d26ceabd4d7ce42021b5d10912f6051f7f285be4",
74
- "block_num": 4167511,
75
- "block_timestamp": 1638359442,
76
- "module": "balances",
77
- "amount": "7911.915",
78
- "fee": "2085000",
79
- "nonce": 0,
80
- "asset_symbol": "",
81
- "from_account_display": {
82
- "address": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
83
- "display": "",
84
- "judgements": null,
85
- "account_index": "",
86
- "identity": false,
87
- "parent": null
88
- },
89
- "to_account_display": {
90
- "address": "3EZ85Y5FLEsqzD5xKTyqB9gtvSHFhEVG83d2i6P54SFJNvSF",
91
- "display": "",
92
- "judgements": null,
93
- "account_index": "",
94
- "identity": false,
95
- "parent": null
96
- }
97
- },
98
- {
99
- "from": "3FYAYVDzXT7ceb9vtLSn5JXT4B878q2ho1wBaeRU2qk42WRy",
100
- "to": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
101
- "extrinsic_index": "4166794-1",
102
- "success": true,
103
- "hash": "0x40809d9a8d5b0da7f4f49a62f2fab5977b20c8bdef3133df87161013624ef8ca",
104
- "block_num": 4166794,
105
- "block_timestamp": 1638357288,
106
- "module": "balances",
107
- "amount": "7914",
108
- "fee": "2125000",
109
- "nonce": 2754,
110
- "asset_symbol": "",
111
- "from_account_display": {
112
- "address": "3FYAYVDzXT7ceb9vtLSn5JXT4B878q2ho1wBaeRU2qk42WRy",
113
- "display": "",
114
- "judgements": null,
115
- "account_index": "",
116
- "identity": false,
117
- "parent": null
118
- },
119
- "to_account_display": {
120
- "address": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
121
- "display": "",
122
- "judgements": null,
123
- "account_index": "",
124
- "identity": false,
125
- "parent": null
126
- }
127
- },
128
- {
129
- "from": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
130
- "to": "3EZ85Y5FLEsqzD5xKTyqB9gtvSHFhEVG83d2i6P54SFJNvSF",
131
- "extrinsic_index": "4147624-1",
132
- "success": true,
133
- "hash": "0x2aa32f1c54960268c4ca6c86f1a9e13a4d3cb5b6dd557de5669c7e0edbd099cf",
134
- "block_num": 4147624,
135
- "block_timestamp": 1638299757,
136
- "module": "balances",
137
- "amount": "8810.3386",
138
- "fee": "2085000",
139
- "nonce": 0,
140
- "asset_symbol": "",
141
- "from_account_display": {
142
- "address": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
143
- "display": "",
144
- "judgements": null,
145
- "account_index": "",
146
- "identity": false,
147
- "parent": null
148
- },
149
- "to_account_display": {
150
- "address": "3EZ85Y5FLEsqzD5xKTyqB9gtvSHFhEVG83d2i6P54SFJNvSF",
151
- "display": "",
152
- "judgements": null,
153
- "account_index": "",
154
- "identity": false,
155
- "parent": null
156
- }
157
- },
158
- {
159
- "from": "3FYAYVDzXT7ceb9vtLSn5JXT4B878q2ho1wBaeRU2qk42WRy",
160
- "to": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
161
- "extrinsic_index": "4146793-1",
162
- "success": true,
163
- "hash": "0x0cc3a04a654fbb7c6fe169845e98a0f5e801e5dd1a5c348b3734c06a2984d28c",
164
- "block_num": 4146793,
165
- "block_timestamp": 1638297261,
166
- "module": "balances",
167
- "amount": "8812.4236",
168
- "fee": "2125000",
169
- "nonce": 2743,
170
- "asset_symbol": "",
171
- "from_account_display": {
172
- "address": "3FYAYVDzXT7ceb9vtLSn5JXT4B878q2ho1wBaeRU2qk42WRy",
173
- "display": "",
174
- "judgements": null,
175
- "account_index": "",
176
- "identity": false,
177
- "parent": null
178
- },
179
- "to_account_display": {
180
- "address": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
181
- "display": "",
182
- "judgements": null,
183
- "account_index": "",
184
- "identity": false,
185
- "parent": null
186
- }
187
- },
188
- {
189
- "from": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
190
- "to": "3EZ85Y5FLEsqzD5xKTyqB9gtvSHFhEVG83d2i6P54SFJNvSF",
191
- "extrinsic_index": "4145825-1",
192
- "success": true,
193
- "hash": "0x71ec251ac396a9181b1d96d1e6b4371dafd25964be12e4500047164fc4da52ba",
194
- "block_num": 4145825,
195
- "block_timestamp": 1638294357,
196
- "module": "balances",
197
- "amount": "8756.8092",
198
- "fee": "2085000",
199
- "nonce": 0,
200
- "asset_symbol": "",
201
- "from_account_display": {
202
- "address": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
203
- "display": "",
204
- "judgements": null,
205
- "account_index": "",
206
- "identity": false,
207
- "parent": null
208
- },
209
- "to_account_display": {
210
- "address": "3EZ85Y5FLEsqzD5xKTyqB9gtvSHFhEVG83d2i6P54SFJNvSF",
211
- "display": "",
212
- "judgements": null,
213
- "account_index": "",
214
- "identity": false,
215
- "parent": null
216
- }
217
- },
218
- {
219
- "from": "3FYAYVDzXT7ceb9vtLSn5JXT4B878q2ho1wBaeRU2qk42WRy",
220
- "to": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
221
- "extrinsic_index": "4145093-1",
222
- "success": true,
223
- "hash": "0x561f7962d5469980f19e62f6e4382df28429dac09332edc0c1580a67bc665a9d",
224
- "block_num": 4145093,
225
- "block_timestamp": 1638292158,
226
- "module": "balances",
227
- "amount": "8758.8942",
228
- "fee": "2125000",
229
- "nonce": 2742,
230
- "asset_symbol": "",
231
- "from_account_display": {
232
- "address": "3FYAYVDzXT7ceb9vtLSn5JXT4B878q2ho1wBaeRU2qk42WRy",
233
- "display": "",
234
- "judgements": null,
235
- "account_index": "",
236
- "identity": false,
237
- "parent": null
238
- },
239
- "to_account_display": {
240
- "address": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
241
- "display": "",
242
- "judgements": null,
243
- "account_index": "",
244
- "identity": false,
245
- "parent": null
246
- }
247
- },
248
- {
249
- "from": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
250
- "to": "3EZ85Y5FLEsqzD5xKTyqB9gtvSHFhEVG83d2i6P54SFJNvSF",
251
- "extrinsic_index": "4144826-1",
252
- "success": true,
253
- "hash": "0x504a703981d2477e6c521476f71a263f1e104a22ba76c34b701e2507424a3cd5",
254
- "block_num": 4144826,
255
- "block_timestamp": 1638291357,
256
- "module": "balances",
257
- "amount": "8611.394",
258
- "fee": "2085000",
259
- "nonce": 0,
260
- "asset_symbol": "",
261
- "from_account_display": {
262
- "address": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
263
- "display": "",
264
- "judgements": null,
265
- "account_index": "",
266
- "identity": false,
267
- "parent": null
268
- },
269
- "to_account_display": {
270
- "address": "3EZ85Y5FLEsqzD5xKTyqB9gtvSHFhEVG83d2i6P54SFJNvSF",
271
- "display": "",
272
- "judgements": null,
273
- "account_index": "",
274
- "identity": false,
275
- "parent": null
276
- }
277
- },
278
- {
279
- "from": "3FYAYVDzXT7ceb9vtLSn5JXT4B878q2ho1wBaeRU2qk42WRy",
280
- "to": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
281
- "extrinsic_index": "4144192-1",
282
- "success": true,
283
- "hash": "0x0a92325dba27d323c7b128d041d41d92a78c924f39b7c570c4aa14b365db08d9",
284
- "block_num": 4144192,
285
- "block_timestamp": 1638289455,
286
- "module": "balances",
287
- "amount": "8613.479",
288
- "fee": "2125000",
289
- "nonce": 2741,
290
- "asset_symbol": "",
291
- "from_account_display": {
292
- "address": "3FYAYVDzXT7ceb9vtLSn5JXT4B878q2ho1wBaeRU2qk42WRy",
293
- "display": "",
294
- "judgements": null,
295
- "account_index": "",
296
- "identity": false,
297
- "parent": null
298
- },
299
- "to_account_display": {
300
- "address": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
301
- "display": "",
302
- "judgements": null,
303
- "account_index": "",
304
- "identity": false,
305
- "parent": null
306
- }
307
- },
308
- {
309
- "from": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
310
- "to": "3EZ85Y5FLEsqzD5xKTyqB9gtvSHFhEVG83d2i6P54SFJNvSF",
311
- "extrinsic_index": "4143626-1",
312
- "success": true,
313
- "hash": "0x2af4f055b3e4cdc02014acdb0e8767a9a1b43a1ba28e9f5b2d95bedc023bbe6f",
314
- "block_num": 4143626,
315
- "block_timestamp": 1638287757,
316
- "module": "balances",
317
- "amount": "8413.915",
318
- "fee": "2085000",
319
- "nonce": 0,
320
- "asset_symbol": "",
321
- "from_account_display": {
322
- "address": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
323
- "display": "",
324
- "judgements": null,
325
- "account_index": "",
326
- "identity": false,
327
- "parent": null
328
- },
329
- "to_account_display": {
330
- "address": "3EZ85Y5FLEsqzD5xKTyqB9gtvSHFhEVG83d2i6P54SFJNvSF",
331
- "display": "",
332
- "judgements": null,
333
- "account_index": "",
334
- "identity": false,
335
- "parent": null
336
- }
337
- },
338
- {
339
- "from": "3FYAYVDzXT7ceb9vtLSn5JXT4B878q2ho1wBaeRU2qk42WRy",
340
- "to": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
341
- "extrinsic_index": "4142892-1",
342
- "success": true,
343
- "hash": "0xabf03b38ea4fa6eaddbb3c46438c8fa38c86d248c653c28bb1b15d0fb3e0a19a",
344
- "block_num": 4142892,
345
- "block_timestamp": 1638285555,
346
- "module": "balances",
347
- "amount": "8416",
348
- "fee": "2125000",
349
- "nonce": 2740,
350
- "asset_symbol": "",
351
- "from_account_display": {
352
- "address": "3FYAYVDzXT7ceb9vtLSn5JXT4B878q2ho1wBaeRU2qk42WRy",
353
- "display": "",
354
- "judgements": null,
355
- "account_index": "",
356
- "identity": false,
357
- "parent": null
358
- },
359
- "to_account_display": {
360
- "address": "3Dj6YssQkpo1HVJ6Mkxjd25EwZNAeVgKCGtBp5u3RtdWX9y9",
361
- "display": "",
362
- "judgements": null,
363
- "account_index": "",
364
- "identity": false,
365
- "parent": null
366
- }
367
- }
368
- ]
369
- }
370
- }