@tari-project/ootle-wasm-bor 0.0.0-bootstrap.0 → 0.48.0-rc.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 +15 -3
- package/ootle_wasm_bor.d.ts +20 -0
- package/ootle_wasm_bor.js +1 -1
- package/ootle_wasm_bor_bg.js +104 -0
- package/ootle_wasm_bor_bg.wasm +0 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@ WASM decoders for Tari Ootle values in their CBOR encoding. It carries only the
|
|
|
4
4
|
size of [`@tari-project/ootle-wasm`](https://www.npmjs.com/package/@tari-project/ootle-wasm), which builds and signs
|
|
5
5
|
transactions.
|
|
6
6
|
|
|
7
|
-
The indexer serves
|
|
8
|
-
|
|
7
|
+
The indexer serves engine values in their CBOR encoding, as base64 strings. These decode one into its JSON, in the
|
|
8
|
+
shape of the type of the same name in `@tari-project/ootle-ts-bindings`.
|
|
9
9
|
|
|
10
10
|
### `decodeSubstateValue(encoded)`
|
|
11
11
|
|
|
@@ -23,7 +23,19 @@ import { decodeExecuteResult } from "@tari-project/ootle-wasm-bor";
|
|
|
23
23
|
const result = JSON.parse(decodeExecuteResult(finalized.execution_result));
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
### `decodeTransactionReceipt`, `decodeEvent`, `decodeResource`, `decodeUtxo`
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { decodeEvent, decodeTransactionReceipt } from "@tari-project/ootle-wasm-bor";
|
|
30
|
+
|
|
31
|
+
const receipt = JSON.parse(decodeTransactionReceipt(response.receipt));
|
|
32
|
+
const events = response.events.map(([transactionId, event]) => [transactionId, JSON.parse(decodeEvent(event))]);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`decodeTransactionReceipt` reads `/transaction-receipts`, `decodeEvent` the `/transactions/events` query and stream,
|
|
36
|
+
`decodeResource` `/resources/{address}` and `decodeUtxo` `/utxos`.
|
|
37
|
+
|
|
38
|
+
All throw if `encoded` is not base64 or its bytes are not a complete encoding of the value.
|
|
27
39
|
|
|
28
40
|
## License
|
|
29
41
|
|
package/ootle_wasm_bor.d.ts
CHANGED
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Decode an `Event` as the indexer serves it (its CBOR encoding, base64) → JSON string.
|
|
6
|
+
*/
|
|
7
|
+
export function decodeEvent(encoded: string): string;
|
|
8
|
+
|
|
4
9
|
/**
|
|
5
10
|
* Decode an `ExecuteResult` as the indexer serves it (its CBOR encoding, base64) → JSON string.
|
|
6
11
|
*/
|
|
7
12
|
export function decodeExecuteResult(encoded: string): string;
|
|
8
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Decode a `Resource` as the indexer serves it (its CBOR encoding, base64) → JSON string.
|
|
16
|
+
*/
|
|
17
|
+
export function decodeResource(encoded: string): string;
|
|
18
|
+
|
|
9
19
|
/**
|
|
10
20
|
* Decode a `SubstateValue` as the indexer serves it (its CBOR encoding, base64) → JSON string.
|
|
11
21
|
*/
|
|
12
22
|
export function decodeSubstateValue(encoded: string): string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Decode a `TransactionReceipt` as the indexer serves it (its CBOR encoding, base64) → JSON string.
|
|
26
|
+
*/
|
|
27
|
+
export function decodeTransactionReceipt(encoded: string): string;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Decode a `Utxo` as the indexer serves it (its CBOR encoding, base64) → JSON string.
|
|
31
|
+
*/
|
|
32
|
+
export function decodeUtxo(encoded: string): string;
|
package/ootle_wasm_bor.js
CHANGED
|
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./ootle_wasm_bor_bg.js";
|
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
wasm.__wbindgen_start();
|
|
7
7
|
export {
|
|
8
|
-
decodeExecuteResult, decodeSubstateValue
|
|
8
|
+
decodeEvent, decodeExecuteResult, decodeResource, decodeSubstateValue, decodeTransactionReceipt, decodeUtxo
|
|
9
9
|
} from "./ootle_wasm_bor_bg.js";
|
package/ootle_wasm_bor_bg.js
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decode an `Event` as the indexer serves it (its CBOR encoding, base64) → JSON string.
|
|
3
|
+
* @param {string} encoded
|
|
4
|
+
* @returns {string}
|
|
5
|
+
*/
|
|
6
|
+
export function decodeEvent(encoded) {
|
|
7
|
+
let deferred3_0;
|
|
8
|
+
let deferred3_1;
|
|
9
|
+
try {
|
|
10
|
+
const ptr0 = passStringToWasm0(encoded, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
11
|
+
const len0 = WASM_VECTOR_LEN;
|
|
12
|
+
const ret = wasm.decodeEvent(ptr0, len0);
|
|
13
|
+
var ptr2 = ret[0];
|
|
14
|
+
var len2 = ret[1];
|
|
15
|
+
if (ret[3]) {
|
|
16
|
+
ptr2 = 0; len2 = 0;
|
|
17
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
18
|
+
}
|
|
19
|
+
deferred3_0 = ptr2;
|
|
20
|
+
deferred3_1 = len2;
|
|
21
|
+
return getStringFromWasm0(ptr2, len2);
|
|
22
|
+
} finally {
|
|
23
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
1
27
|
/**
|
|
2
28
|
* Decode an `ExecuteResult` as the indexer serves it (its CBOR encoding, base64) → JSON string.
|
|
3
29
|
* @param {string} encoded
|
|
@@ -24,6 +50,32 @@ export function decodeExecuteResult(encoded) {
|
|
|
24
50
|
}
|
|
25
51
|
}
|
|
26
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Decode a `Resource` as the indexer serves it (its CBOR encoding, base64) → JSON string.
|
|
55
|
+
* @param {string} encoded
|
|
56
|
+
* @returns {string}
|
|
57
|
+
*/
|
|
58
|
+
export function decodeResource(encoded) {
|
|
59
|
+
let deferred3_0;
|
|
60
|
+
let deferred3_1;
|
|
61
|
+
try {
|
|
62
|
+
const ptr0 = passStringToWasm0(encoded, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
63
|
+
const len0 = WASM_VECTOR_LEN;
|
|
64
|
+
const ret = wasm.decodeResource(ptr0, len0);
|
|
65
|
+
var ptr2 = ret[0];
|
|
66
|
+
var len2 = ret[1];
|
|
67
|
+
if (ret[3]) {
|
|
68
|
+
ptr2 = 0; len2 = 0;
|
|
69
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
70
|
+
}
|
|
71
|
+
deferred3_0 = ptr2;
|
|
72
|
+
deferred3_1 = len2;
|
|
73
|
+
return getStringFromWasm0(ptr2, len2);
|
|
74
|
+
} finally {
|
|
75
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
27
79
|
/**
|
|
28
80
|
* Decode a `SubstateValue` as the indexer serves it (its CBOR encoding, base64) → JSON string.
|
|
29
81
|
* @param {string} encoded
|
|
@@ -49,6 +101,58 @@ export function decodeSubstateValue(encoded) {
|
|
|
49
101
|
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
50
102
|
}
|
|
51
103
|
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Decode a `TransactionReceipt` as the indexer serves it (its CBOR encoding, base64) → JSON string.
|
|
107
|
+
* @param {string} encoded
|
|
108
|
+
* @returns {string}
|
|
109
|
+
*/
|
|
110
|
+
export function decodeTransactionReceipt(encoded) {
|
|
111
|
+
let deferred3_0;
|
|
112
|
+
let deferred3_1;
|
|
113
|
+
try {
|
|
114
|
+
const ptr0 = passStringToWasm0(encoded, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
115
|
+
const len0 = WASM_VECTOR_LEN;
|
|
116
|
+
const ret = wasm.decodeTransactionReceipt(ptr0, len0);
|
|
117
|
+
var ptr2 = ret[0];
|
|
118
|
+
var len2 = ret[1];
|
|
119
|
+
if (ret[3]) {
|
|
120
|
+
ptr2 = 0; len2 = 0;
|
|
121
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
122
|
+
}
|
|
123
|
+
deferred3_0 = ptr2;
|
|
124
|
+
deferred3_1 = len2;
|
|
125
|
+
return getStringFromWasm0(ptr2, len2);
|
|
126
|
+
} finally {
|
|
127
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Decode a `Utxo` as the indexer serves it (its CBOR encoding, base64) → JSON string.
|
|
133
|
+
* @param {string} encoded
|
|
134
|
+
* @returns {string}
|
|
135
|
+
*/
|
|
136
|
+
export function decodeUtxo(encoded) {
|
|
137
|
+
let deferred3_0;
|
|
138
|
+
let deferred3_1;
|
|
139
|
+
try {
|
|
140
|
+
const ptr0 = passStringToWasm0(encoded, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
141
|
+
const len0 = WASM_VECTOR_LEN;
|
|
142
|
+
const ret = wasm.decodeUtxo(ptr0, len0);
|
|
143
|
+
var ptr2 = ret[0];
|
|
144
|
+
var len2 = ret[1];
|
|
145
|
+
if (ret[3]) {
|
|
146
|
+
ptr2 = 0; len2 = 0;
|
|
147
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
148
|
+
}
|
|
149
|
+
deferred3_0 = ptr2;
|
|
150
|
+
deferred3_1 = len2;
|
|
151
|
+
return getStringFromWasm0(ptr2, len2);
|
|
152
|
+
} finally {
|
|
153
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
52
156
|
export function __wbg_Error_67e7344beaa85059(arg0, arg1) {
|
|
53
157
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
54
158
|
return ret;
|
package/ootle_wasm_bor_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
"The Tari Development Community"
|
|
6
6
|
],
|
|
7
7
|
"description": "WASM decoders for the Tari Ootle values the indexer serves in their CBOR encoding",
|
|
8
|
-
"version": "0.
|
|
8
|
+
"version": "0.48.0-rc.0",
|
|
9
9
|
"license": "BSD-3-Clause",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "https://github.com/tari-project/tari-ootle"
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
|
-
"
|
|
16
|
-
"ootle_wasm_bor.d.ts",
|
|
15
|
+
"ootle_wasm_bor_bg.wasm",
|
|
17
16
|
"ootle_wasm_bor.js",
|
|
18
17
|
"ootle_wasm_bor_bg.js",
|
|
19
|
-
"
|
|
18
|
+
"ootle_wasm_bor.d.ts",
|
|
19
|
+
"README.md"
|
|
20
20
|
],
|
|
21
21
|
"main": "ootle_wasm_bor.js",
|
|
22
22
|
"types": "ootle_wasm_bor.d.ts",
|