@stellar-expert/contract-wasm-interface-parser 1.0.6 → 1.1.0

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 ADDED
@@ -0,0 +1,24 @@
1
+ # @stellar-expert/contract-wasm-interface-parser
2
+
3
+ > Lightweight contract interface metadata parser for Soroban binary WASM
4
+
5
+ ## Installation
6
+
7
+ ```shell
8
+ npm i @stellar-expert/contract-wasm-interface-parser
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```js
14
+ parseContractMetadata(Buffer.from(/*binary wasm code*/))
15
+ /*{
16
+ rustVersion: '1.76.0',
17
+ sdkVersion: '20.0.0',
18
+ functions: [],
19
+ enums: [],
20
+ structs: [],
21
+ unions: [],
22
+ errors: []
23
+ }*/
24
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar-expert/contract-wasm-interface-parser",
3
- "version": "1.0.6",
3
+ "version": "1.1.0",
4
4
  "description": "Contract interface metadata parser for binary WASM",
5
5
  "main": "index.js",
6
6
  "module": "./index.js",
@@ -11,6 +11,6 @@
11
11
  "author": "orbitlens <orbit@stellar.expert>",
12
12
  "license": "MIT",
13
13
  "peerDependencies": {
14
- "@stellar/stellar-base": "^10.0.1"
14
+ "@stellar/stellar-base": ">=11"
15
15
  }
16
16
  }
package/src/xdr-reader.js CHANGED
@@ -72,7 +72,6 @@ export class XdrReader {
72
72
 
73
73
  /**
74
74
  * Reset reader position
75
- * @return {void}
76
75
  */
77
76
  rewind() {
78
77
  this._index = 0
@@ -138,8 +137,6 @@ export class XdrReader {
138
137
 
139
138
  /**
140
139
  * Ensure that input buffer has been consumed in full, otherwise it's a type mismatch
141
- * @return {void}
142
- * @throws {Error}
143
140
  */
144
141
  ensureInputConsumed() {
145
142
  if (this._index !== this._length)
@@ -47,7 +47,7 @@ export function parseSpec(entries) {
47
47
  name: parseStructName(value),
48
48
  cases: value.cases().reduce((agg, c) => {
49
49
  const value = c.value()
50
- agg[value.name().toString()] = value.type ? value.type().map(parseParameterType) : 'void'
50
+ agg[value.name().toString()] = value.type ? value.type().map(parseParameterType) : []
51
51
  return agg
52
52
  }, {})
53
53
  })