@webb-tools/tangle-substrate-types 0.5.9 → 0.5.13

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 (84) hide show
  1. package/README.md +20 -13
  2. package/build/index.cjs +2 -0
  3. package/build/index.d.ts +19013 -3
  4. package/build/index.mjs +1 -0
  5. package/package.json +37 -52
  6. package/.envrc +0 -5
  7. package/babel-config-cjs.cjs +0 -10
  8. package/build/examples/job_and_result_submission.d.ts +0 -1
  9. package/build/examples/job_and_result_submission.js +0 -230
  10. package/build/index.js +0 -5
  11. package/build/interfaces/augment-api-consts.d.ts +0 -950
  12. package/build/interfaces/augment-api-consts.js +0 -3
  13. package/build/interfaces/augment-api-errors.d.ts +0 -2144
  14. package/build/interfaces/augment-api-errors.js +0 -3
  15. package/build/interfaces/augment-api-events.d.ts +0 -2281
  16. package/build/interfaces/augment-api-events.js +0 -3
  17. package/build/interfaces/augment-api-query.d.ts +0 -1660
  18. package/build/interfaces/augment-api-query.js +0 -3
  19. package/build/interfaces/augment-api-rpc.d.ts +0 -679
  20. package/build/interfaces/augment-api-rpc.js +0 -3
  21. package/build/interfaces/augment-api-runtime.d.ts +0 -363
  22. package/build/interfaces/augment-api-runtime.js +0 -3
  23. package/build/interfaces/augment-api-tx.d.ts +0 -2876
  24. package/build/interfaces/augment-api-tx.js +0 -3
  25. package/build/interfaces/augment-api.d.ts +0 -7
  26. package/build/interfaces/augment-api.js +0 -9
  27. package/build/interfaces/augment-types.d.ts +0 -1249
  28. package/build/interfaces/augment-types.js +0 -3
  29. package/build/interfaces/lookup.d.ts +0 -5920
  30. package/build/interfaces/lookup.js +0 -5928
  31. package/build/interfaces/registry.d.ts +0 -428
  32. package/build/interfaces/registry.js +0 -3
  33. package/build/interfaces/types-lookup.d.ts +0 -6062
  34. package/build/interfaces/types-lookup.js +0 -3
  35. package/build/metadata/static-latest.d.ts +0 -2
  36. package/build/metadata/static-latest.js +0 -7
  37. package/build/metadata/static-type.d.ts +0 -2
  38. package/build/metadata/static-type.js +0 -1
  39. package/build/package.json +0 -1
  40. package/playground.ts +0 -86
  41. package/polkadot-dev-configs/babel-config-cjs.cjs +0 -12
  42. package/polkadot-dev-configs/babel-general.cjs +0 -15
  43. package/polkadot-dev-configs/babel-plugins.cjs +0 -21
  44. package/polkadot-dev-configs/babel-presets.cjs +0 -33
  45. package/polkadot-dev-configs/babel-resolver.cjs +0 -14
  46. package/scripts/build.js +0 -134
  47. package/scripts/publish-types.js +0 -95
  48. package/scripts/updateMetadata.ts +0 -44
  49. package/src/examples/job_and_result_submission.ts +0 -203
  50. package/src/index.ts +0 -7
  51. package/src/interfaces/augment-api-consts.ts +0 -958
  52. package/src/interfaces/augment-api-errors.ts +0 -2152
  53. package/src/interfaces/augment-api-events.ts +0 -1465
  54. package/src/interfaces/augment-api-query.ts +0 -1629
  55. package/src/interfaces/augment-api-rpc.ts +0 -617
  56. package/src/interfaces/augment-api-runtime.ts +0 -308
  57. package/src/interfaces/augment-api-tx.ts +0 -1550
  58. package/src/interfaces/augment-api.ts +0 -10
  59. package/src/interfaces/augment-types.ts +0 -1256
  60. package/src/interfaces/lookup.ts +0 -5924
  61. package/src/interfaces/registry.ts +0 -435
  62. package/src/interfaces/types-lookup.ts +0 -6467
  63. package/src/metadata/metadata.json +0 -5
  64. package/src/metadata/static-latest.ts +0 -1
  65. package/src/metadata/static-type.ts +0 -3
  66. package/ts-types/playground.d.ts +0 -1
  67. package/ts-types/src/examples/job_and_result_submission.d.ts +0 -1
  68. package/ts-types/src/index.d.ts +0 -3
  69. package/ts-types/src/interfaces/augment-api-consts.d.ts +0 -950
  70. package/ts-types/src/interfaces/augment-api-errors.d.ts +0 -2144
  71. package/ts-types/src/interfaces/augment-api-events.d.ts +0 -2281
  72. package/ts-types/src/interfaces/augment-api-query.d.ts +0 -1660
  73. package/ts-types/src/interfaces/augment-api-rpc.d.ts +0 -679
  74. package/ts-types/src/interfaces/augment-api-runtime.d.ts +0 -363
  75. package/ts-types/src/interfaces/augment-api-tx.d.ts +0 -2876
  76. package/ts-types/src/interfaces/augment-api.d.ts +0 -7
  77. package/ts-types/src/interfaces/augment-types.d.ts +0 -1249
  78. package/ts-types/src/interfaces/lookup.d.ts +0 -5920
  79. package/ts-types/src/interfaces/registry.d.ts +0 -428
  80. package/ts-types/src/interfaces/types-lookup.d.ts +0 -6062
  81. package/ts-types/src/metadata/static-latest.d.ts +0 -2
  82. package/ts-types/src/metadata/static-type.d.ts +0 -2
  83. package/ts-types/tsconfig.tsbuildinfo +0 -1
  84. package/tsconfig.json +0 -36
@@ -0,0 +1 @@
1
+ import '@polkadot/types/types/registry';
package/package.json CHANGED
@@ -1,72 +1,57 @@
1
1
  {
2
2
  "name": "@webb-tools/tangle-substrate-types",
3
- "version": "0.5.9",
3
+ "version": "0.5.13",
4
4
  "description": "Polkadot.js type definitions required for interacting with Webb's tangle network",
5
- "main": "./build/index.js",
6
- "types": "./build/index.d.ts",
7
- "typings": "./build/index.d.ts",
8
5
  "author": "Webb Developers <drew@webb.tools>",
9
6
  "license": "Apache-2.0",
10
- "type": "commonjs",
7
+ "repository": "https://github.com/webb-tools/tangle.git",
8
+ "homepage": "https://github.com/webb-tools/tangle",
9
+ "files": [
10
+ "build"
11
+ ],
12
+ "main": "./build/index.cjs",
13
+ "module": "./build/index.mjs",
14
+ "types": "./build/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./build/index.d.ts",
18
+ "require": "./build/index.cjs",
19
+ "import": "./build/index.mjs",
20
+ "module": "./build/index.mjs"
21
+ }
22
+ },
11
23
  "publishConfig": {
12
24
  "access": "public",
13
25
  "registry": "https://registry.npmjs.org"
14
26
  },
15
- "repository": "https://github.com/webb-tools/tangle.git",
16
27
  "bugs": {
17
28
  "url": "https://github.com/webb-tools/tangle/issues"
18
29
  },
19
- "homepage": "https://github.com/webb-tools/tangle",
30
+ "scripts": {
31
+ "build": "bunchee",
32
+ "build:interfaces": "yarn build:interfaces:defs && yarn build:interfaces:chain",
33
+ "build:interfaces:defs": "tsx node_modules/.bin/polkadot-types-from-defs --input ./src/interfaces --package @webb-tools/tangle-substrate-types --endpoint ws://127.0.0.1:9944",
34
+ "build:interfaces:chain": "tsx node_modules/.bin/polkadot-types-from-chain --output ./src/interfaces --package @webb-tools/tangle-substrate-types --endpoint ws://127.0.0.1:9944",
35
+ "clean": "rm -rf build",
36
+ "publish-types": "release-it patch",
37
+ "update:metadata": "tsx ./scripts/updateMetadata.ts"
38
+ },
20
39
  "dependencies": {
21
- "@babel/cli": "^7.23.9",
22
- "@babel/core": "^7.24.0",
23
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
24
- "@babel/plugin-proposal-numeric-separator": "^7.18.6",
25
- "@babel/plugin-proposal-optional-chaining": "^7.20.7",
26
- "@babel/plugin-syntax-bigint": "^7.8.3",
27
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
28
- "@babel/plugin-syntax-import-assertions": "^7.23.3",
29
- "@babel/plugin-syntax-import-meta": "^7.10.4",
30
- "@babel/plugin-syntax-top-level-await": "^7.14.5",
31
- "@babel/plugin-transform-regenerator": "^7.23.3",
32
- "@babel/plugin-transform-runtime": "^7.24.0",
33
- "@babel/preset-env": "^7.24.0",
34
- "@babel/preset-react": "^7.23.3",
35
- "@babel/preset-typescript": "^7.23.3",
36
- "@babel/register": "^7.23.7",
37
- "@babel/runtime": "^7.24.0",
38
- "@open-web3/orml-types": "^2.0.1",
39
- "@polkadot/api": "^11.0.2",
40
- "@polkadot/dev": "^0.78.11",
41
- "@polkadot/typegen": "^11.0.2",
42
- "@polkadot/types": "^11.0.2",
43
- "babel-jest": "^29.7.0",
44
- "babel-plugin-module-extension-resolver": "^1.0.0",
45
- "babel-plugin-module-resolver": "^5.0.0",
46
- "babel-plugin-styled-components": "^2.1.4",
40
+ "@polkadot/api": "^13.2.1",
41
+ "@polkadot/typegen": "^13.2.1",
42
+ "@polkadot/types": "^13.2.1",
47
43
  "ecpair": "^2.1.0",
48
- "elliptic": "^6.5.5",
49
- "fs-extra": "^11.2.0",
50
- "glob2base": "^0.0.12",
51
- "minimatch": "^9.0.3",
52
- "mkdirp": "^3.0.1",
53
44
  "tiny-secp256k1": "^2.2.3"
54
45
  },
55
46
  "devDependencies": {
56
- "@types/websocket": "^1.0.10",
57
- "rimraf": "5.0.5",
58
- "ts-node": "10.9.2",
59
- "tsconfig-paths": "^4.2.0",
47
+ "@types/node": "^22.6.1",
48
+ "@types/ws": "^8.5.12",
49
+ "bunchee": "^5.4.0",
50
+ "prettier": "3.2.5",
51
+ "release-it": "^17.6.0",
52
+ "tsx": "^4.19.1",
60
53
  "typescript": "5.4.2",
61
- "websocket": "^1.0.34"
54
+ "ws": "^8.18.0"
62
55
  },
63
- "scripts": {
64
- "build": "node ./scripts/build.js",
65
- "build:interfaces": "yarn build:interfaces:defs && yarn build:interfaces:chain && rm ./src/interfaces/index.ts && rm ./src/interfaces/types.ts",
66
- "build:interfaces:defs": "npx ts-node node_modules/.bin/polkadot-types-from-defs --input ./src/interfaces --package @webb-tools/tangle-substrate-types --endpoint ./src/metadata/metadata.json",
67
- "build:interfaces:chain": "npx ts-node node_modules/.bin/polkadot-types-from-chain --endpoint ./src/metadata/metadata.json --output ./src/interfaces",
68
- "clean": "rm -rf build && rm -rf ts-types",
69
- "publish-types": "node ./scripts/publish-types.js",
70
- "update:metadata": "npx ts-node ./scripts/updateMetadata.ts"
71
- }
56
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
72
57
  }
package/.envrc DELETED
@@ -1,5 +0,0 @@
1
- source_env_if_exists ../.envrc
2
- dotenv_if_exists
3
- layout node
4
-
5
- # vi: ft=sh
@@ -1,10 +0,0 @@
1
- const polkadotBabelConfig = require('./polkadot-dev-configs/babel-config-cjs.cjs');
2
-
3
- module.exports = {
4
- plugins: [
5
- ...polkadotBabelConfig.plugins,
6
- ],
7
- presets: [
8
- ...polkadotBabelConfig.presets
9
- ]
10
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,230 +0,0 @@
1
- "use strict";
2
-
3
- var _api = require("@polkadot/api");
4
- var _keyring = require("@polkadot/keyring");
5
- var _util = require("@polkadot/util");
6
- var _utilCrypto = require("@polkadot/util-crypto");
7
- var _ecpair = require("ecpair");
8
- /**
9
- * @fileoverview
10
- * Example script to submit jobs/job results to Tangle chain, to test this script
11
- *
12
- * 1. Build the tangle node and start the local network using `./scripts/run-standalone-local.sh --clean`
13
- *
14
- * 2. Make sure you have the necessary dependencies installed. You can install them using npm:
15
- * ```
16
- * npm i
17
- * ```
18
- *
19
- * 3. Run the script using `cd types && npx ts-node src/playground.ts`
20
- *
21
- * 4. The script will connect to the tangle chain, create roles for alice & bob, then submit a job and job result.
22
- *
23
- */
24
-
25
- const tinysecp = require('tiny-secp256k1');
26
- const ECPair = (0, _ecpair.ECPairFactory)(tinysecp);
27
- (async () => {
28
- // Establish connection to the Polkadot node
29
- const provider = new _api.WsProvider('ws://127.0.0.1:9944');
30
- const api = await _api.ApiPromise.create({
31
- provider
32
- });
33
-
34
- // Wait for the API to be ready
35
- await api.isReady;
36
-
37
- // Initialize keyring for sr25519 type
38
- const sr25519Keyring = new _keyring.Keyring({
39
- type: 'sr25519'
40
- });
41
-
42
- // Define Alice and Bob's identities and role seeds
43
- const ALICE = sr25519Keyring.addFromUri('//Alice');
44
- const BOB = sr25519Keyring.addFromUri('//Bob');
45
-
46
- // Generated by subkey inspect //Alice --scheme Ecdsa
47
- const ALICE_ROLE_SEED = new Uint8Array(Buffer.from("cb6df9de1efca7a3998a8ead4e02159d5fa99c3e0d4fd6432667390bb4726854", "hex"));
48
- // Generated by subkey inspect //Bob --scheme Ecdsa
49
- const BOB_ROLE_SEED = new Uint8Array(Buffer.from("79c3b7fc0b7697b9414cb87adcb37317d1cab32818ae18c0e97ad76395d1fdcf", "hex"));
50
-
51
- // Print role seeds for reference
52
- console.log('ALICE_ROLE_SEED:', (0, _util.u8aToHex)(ALICE_ROLE_SEED));
53
- console.log('BOB_ROLE_SEED:', (0, _util.u8aToHex)(BOB_ROLE_SEED));
54
-
55
- // Generate role key pairs for Alice and Bob
56
- const ALICE_ROLE = ECPair.fromPrivateKey(Buffer.from(ALICE_ROLE_SEED));
57
- const BOB_ROLE = ECPair.fromPrivateKey(Buffer.from(BOB_ROLE_SEED));
58
- console.log('ALICE_ROLE:', (0, _util.u8aToHex)(ALICE_ROLE.publicKey));
59
- console.log('BOB_ROLE:', (0, _util.u8aToHex)(BOB_ROLE.publicKey));
60
-
61
- // Obtain the next available job ID from the chain
62
- const nextJobId = await api.query.jobs.nextJobId();
63
- const jobId = nextJobId;
64
-
65
- // Transaction to create a profile for Alice
66
- const creatingProfileTx = api.tx.roles.createProfile({
67
- Shared: {
68
- records: [{
69
- role: {
70
- Tss: {
71
- DfnsCGGMP21Secp256k1: {}
72
- }
73
- }
74
- }],
75
- amount: "10000000000000000000"
76
- }
77
- }, 10);
78
-
79
- // Sign and send the transaction for creating Alice's profile
80
- await new Promise(async resolve => {
81
- const unsub = await creatingProfileTx.signAndSend(ALICE, async ({
82
- events = [],
83
- status
84
- }) => {
85
- if (status.isInBlock) {
86
- console.log('[creatingProfileTx] Included at block hash', status.asInBlock.toHex());
87
- console.log('[creatingProfileTx] Events:');
88
- events.forEach(({
89
- event: {
90
- data,
91
- method,
92
- section
93
- }
94
- }) => {
95
- console.log(`\t${section}.${method}:: ${data}`);
96
- });
97
- unsub();
98
- resolve(void 0);
99
- }
100
- });
101
- });
102
-
103
- // Sign and send the transaction for creating Bob's profile
104
- await new Promise(async resolve => {
105
- const unsub = await creatingProfileTx.signAndSend(BOB, async ({
106
- events = [],
107
- status
108
- }) => {
109
- if (status.isInBlock) {
110
- console.log('[creatingProfileTx] Included at block hash', status.asInBlock.toHex());
111
- console.log('[creatingProfileTx] Events:');
112
- events.forEach(({
113
- event: {
114
- data,
115
- method,
116
- section
117
- }
118
- }) => {
119
- console.log(`\t${section}.${method}:: ${data}`);
120
- });
121
- unsub();
122
- resolve(void 0);
123
- }
124
- });
125
- });
126
-
127
- // Transaction to submit a job
128
- const submittingJobTx = api.tx.jobs.submitJob({
129
- expiry: 100,
130
- ttl: 100,
131
- jobType: {
132
- DkgtssPhaseOne: {
133
- participants: [ALICE.address, BOB.address],
134
- threshold: 1,
135
- permittedCaller: null,
136
- roleType: {
137
- DfnsCGGMP21Secp256k1: {}
138
- }
139
- }
140
- }
141
- });
142
-
143
- // Sign and send the transaction for submitting the job
144
- await new Promise(async resolve => {
145
- const unsub = await submittingJobTx.signAndSend(ALICE, async ({
146
- events = [],
147
- status
148
- }) => {
149
- if (status.isInBlock) {
150
- console.log('[submittingJobTx] Included at block hash', status.asInBlock.toHex());
151
- console.log('[submittingJobTx] Events:');
152
- events.forEach(({
153
- event: {
154
- data,
155
- method,
156
- section
157
- }
158
- }) => {
159
- console.log(`\t${section}.${method}:: ${data}`);
160
- });
161
- unsub();
162
- resolve(void 0);
163
- }
164
- });
165
- });
166
-
167
- // Generate a new ECDSA KeyPair for DKG
168
- const dkgKeyPair = ECPair.fromPrivateKey(Buffer.from("eec7245d6b7d2ccb30380bfbe2a3648cd7a942653f5aa340edcea1f283686619", "hex"), {
169
- compressed: false
170
- });
171
-
172
- // Sign the compressed public key of the ECDSA KeyPair with the role keys of Alice and Bob
173
- const dkgPublicKey = dkgKeyPair.publicKey;
174
- const dkgPublicKeyHash = (0, _utilCrypto.keccak256AsU8a)(dkgPublicKey);
175
- const lowR = false;
176
- const signature1 = ALICE_ROLE.sign(Buffer.from(dkgPublicKeyHash), lowR);
177
- const signature2 = BOB_ROLE.sign(Buffer.from(dkgPublicKeyHash), lowR);
178
- const v = lowR ? 27 : 28;
179
-
180
- // Extend the signatures with recovery id
181
- const signature1Array = Array.from(signature1);
182
- const signature2Array = Array.from(signature2);
183
- signature1Array[64] = v;
184
- signature2Array[64] = v;
185
- console.assert(signature1Array.length == 65, 'Signature 1 length is invalid');
186
- console.assert(signature2Array.length == 65, 'Signature 2 length is invalid');
187
-
188
- // Transaction to submit job result
189
- const submittingJobResultTx = api.tx.jobs.submitJobResult({
190
- Tss: {
191
- DfnsCGGMP21Secp256k1: {}
192
- }
193
- }, jobId, {
194
- DKGPhaseOne: {
195
- key: (0, _util.u8aToHex)(dkgPublicKey),
196
- signatures: [(0, _util.u8aToHex)(Uint8Array.from(signature1Array)), (0, _util.u8aToHex)(Uint8Array.from(signature2Array))],
197
- threshold: 1,
198
- signatureScheme: {
199
- Ecdsa: {}
200
- }
201
- }
202
- });
203
-
204
- // Sign and send the transaction for submitting the job result
205
- await new Promise(async resolve => {
206
- const unsub = await submittingJobResultTx.signAndSend(ALICE, async ({
207
- events = [],
208
- status
209
- }) => {
210
- if (status.isInBlock) {
211
- console.log('[submittingJobResultTx] Included at block hash', status.asInBlock.toHex());
212
- console.log('[submittingJobResultTx] Events:');
213
- events.forEach(({
214
- event: {
215
- data,
216
- method,
217
- section
218
- }
219
- }) => {
220
- console.log(`\t${section}.${method}:: ${data}`);
221
- });
222
- unsub();
223
- resolve(void 0);
224
- }
225
- });
226
- });
227
-
228
- // Exit process after completing all transactions
229
- process.exit(0);
230
- })();
package/build/index.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- require("./interfaces/augment-api.js");
4
- require("./interfaces/augment-types.js");
5
- require("./interfaces/types-lookup.js");