@cartridge/controller-wasm 0.1.0 → 0.1.2

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.
Binary file
package/.gitignore DELETED
@@ -1 +0,0 @@
1
- *
package/account_wasm.js DELETED
@@ -1,259 +0,0 @@
1
-
2
- let imports = {};
3
- imports['__wbindgen_placeholder__'] = module.exports;
4
- let wasm;
5
- const { TextDecoder, TextEncoder } = require(`util`);
6
-
7
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
8
-
9
- cachedTextDecoder.decode();
10
-
11
- let cachedUint8ArrayMemory0 = null;
12
-
13
- function getUint8ArrayMemory0() {
14
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
15
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
16
- }
17
- return cachedUint8ArrayMemory0;
18
- }
19
-
20
- function getStringFromWasm0(ptr, len) {
21
- ptr = ptr >>> 0;
22
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
23
- }
24
-
25
- let cachedDataViewMemory0 = null;
26
-
27
- function getDataViewMemory0() {
28
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
29
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
30
- }
31
- return cachedDataViewMemory0;
32
- }
33
-
34
- let WASM_VECTOR_LEN = 0;
35
-
36
- let cachedTextEncoder = new TextEncoder('utf-8');
37
-
38
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
39
- ? function (arg, view) {
40
- return cachedTextEncoder.encodeInto(arg, view);
41
- }
42
- : function (arg, view) {
43
- const buf = cachedTextEncoder.encode(arg);
44
- view.set(buf);
45
- return {
46
- read: arg.length,
47
- written: buf.length
48
- };
49
- });
50
-
51
- function passStringToWasm0(arg, malloc, realloc) {
52
-
53
- if (realloc === undefined) {
54
- const buf = cachedTextEncoder.encode(arg);
55
- const ptr = malloc(buf.length, 1) >>> 0;
56
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
57
- WASM_VECTOR_LEN = buf.length;
58
- return ptr;
59
- }
60
-
61
- let len = arg.length;
62
- let ptr = malloc(len, 1) >>> 0;
63
-
64
- const mem = getUint8ArrayMemory0();
65
-
66
- let offset = 0;
67
-
68
- for (; offset < len; offset++) {
69
- const code = arg.charCodeAt(offset);
70
- if (code > 0x7F) break;
71
- mem[ptr + offset] = code;
72
- }
73
-
74
- if (offset !== len) {
75
- if (offset !== 0) {
76
- arg = arg.slice(offset);
77
- }
78
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
79
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
80
- const ret = encodeString(arg, view);
81
-
82
- offset += ret.written;
83
- ptr = realloc(ptr, len, offset, 1) >>> 0;
84
- }
85
-
86
- WASM_VECTOR_LEN = offset;
87
- return ptr;
88
- }
89
-
90
- function isLikeNone(x) {
91
- return x === undefined || x === null;
92
- }
93
- /**
94
- * @enum {1 | 20 | 24 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 40 | 41 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 10 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136}
95
- */
96
- module.exports.ErrorCode = Object.freeze({
97
- StarknetFailedToReceiveTransaction: 1, "1": "StarknetFailedToReceiveTransaction",
98
- StarknetContractNotFound: 20, "20": "StarknetContractNotFound",
99
- StarknetBlockNotFound: 24, "24": "StarknetBlockNotFound",
100
- StarknetInvalidTransactionIndex: 27, "27": "StarknetInvalidTransactionIndex",
101
- StarknetClassHashNotFound: 28, "28": "StarknetClassHashNotFound",
102
- StarknetTransactionHashNotFound: 29, "29": "StarknetTransactionHashNotFound",
103
- StarknetPageSizeTooBig: 31, "31": "StarknetPageSizeTooBig",
104
- StarknetNoBlocks: 32, "32": "StarknetNoBlocks",
105
- StarknetInvalidContinuationToken: 33, "33": "StarknetInvalidContinuationToken",
106
- StarknetTooManyKeysInFilter: 34, "34": "StarknetTooManyKeysInFilter",
107
- StarknetContractError: 40, "40": "StarknetContractError",
108
- StarknetTransactionExecutionError: 41, "41": "StarknetTransactionExecutionError",
109
- StarknetClassAlreadyDeclared: 51, "51": "StarknetClassAlreadyDeclared",
110
- StarknetInvalidTransactionNonce: 52, "52": "StarknetInvalidTransactionNonce",
111
- StarknetInsufficientMaxFee: 53, "53": "StarknetInsufficientMaxFee",
112
- StarknetInsufficientAccountBalance: 54, "54": "StarknetInsufficientAccountBalance",
113
- StarknetValidationFailure: 55, "55": "StarknetValidationFailure",
114
- StarknetCompilationFailed: 56, "56": "StarknetCompilationFailed",
115
- StarknetContractClassSizeIsTooLarge: 57, "57": "StarknetContractClassSizeIsTooLarge",
116
- StarknetNonAccount: 58, "58": "StarknetNonAccount",
117
- StarknetDuplicateTx: 59, "59": "StarknetDuplicateTx",
118
- StarknetCompiledClassHashMismatch: 60, "60": "StarknetCompiledClassHashMismatch",
119
- StarknetUnsupportedTxVersion: 61, "61": "StarknetUnsupportedTxVersion",
120
- StarknetUnsupportedContractClassVersion: 62, "62": "StarknetUnsupportedContractClassVersion",
121
- StarknetUnexpectedError: 63, "63": "StarknetUnexpectedError",
122
- StarknetNoTraceAvailable: 10, "10": "StarknetNoTraceAvailable",
123
- SignError: 101, "101": "SignError",
124
- StorageError: 102, "102": "StorageError",
125
- AccountFactoryError: 103, "103": "AccountFactoryError",
126
- PaymasterExecutionTimeNotReached: 104, "104": "PaymasterExecutionTimeNotReached",
127
- PaymasterExecutionTimePassed: 105, "105": "PaymasterExecutionTimePassed",
128
- PaymasterInvalidCaller: 106, "106": "PaymasterInvalidCaller",
129
- PaymasterRateLimitExceeded: 107, "107": "PaymasterRateLimitExceeded",
130
- PaymasterNotSupported: 108, "108": "PaymasterNotSupported",
131
- PaymasterHttp: 109, "109": "PaymasterHttp",
132
- PaymasterExcecution: 110, "110": "PaymasterExcecution",
133
- PaymasterSerialization: 111, "111": "PaymasterSerialization",
134
- CartridgeControllerNotDeployed: 112, "112": "CartridgeControllerNotDeployed",
135
- InsufficientBalance: 113, "113": "InsufficientBalance",
136
- OriginError: 114, "114": "OriginError",
137
- EncodingError: 115, "115": "EncodingError",
138
- SerdeWasmBindgenError: 116, "116": "SerdeWasmBindgenError",
139
- CairoSerdeError: 117, "117": "CairoSerdeError",
140
- CairoShortStringToFeltError: 118, "118": "CairoShortStringToFeltError",
141
- DeviceCreateCredential: 119, "119": "DeviceCreateCredential",
142
- DeviceGetAssertion: 120, "120": "DeviceGetAssertion",
143
- DeviceBadAssertion: 121, "121": "DeviceBadAssertion",
144
- DeviceChannel: 122, "122": "DeviceChannel",
145
- DeviceOrigin: 123, "123": "DeviceOrigin",
146
- AccountSigning: 124, "124": "AccountSigning",
147
- AccountProvider: 125, "125": "AccountProvider",
148
- AccountClassHashCalculation: 126, "126": "AccountClassHashCalculation",
149
- AccountClassCompression: 127, "127": "AccountClassCompression",
150
- AccountFeeOutOfRange: 128, "128": "AccountFeeOutOfRange",
151
- ProviderRateLimited: 129, "129": "ProviderRateLimited",
152
- ProviderArrayLengthMismatch: 130, "130": "ProviderArrayLengthMismatch",
153
- ProviderOther: 131, "131": "ProviderOther",
154
- SessionAlreadyRegistered: 132, "132": "SessionAlreadyRegistered",
155
- UrlParseError: 133, "133": "UrlParseError",
156
- Base64DecodeError: 134, "134": "Base64DecodeError",
157
- CoseError: 135, "135": "CoseError",
158
- PolicyChainIdMismatch: 136, "136": "PolicyChainIdMismatch",
159
- });
160
-
161
- const JsControllerErrorFinalization = (typeof FinalizationRegistry === 'undefined')
162
- ? { register: () => {}, unregister: () => {} }
163
- : new FinalizationRegistry(ptr => wasm.__wbg_jscontrollererror_free(ptr >>> 0, 1));
164
-
165
- class JsControllerError {
166
-
167
- __destroy_into_raw() {
168
- const ptr = this.__wbg_ptr;
169
- this.__wbg_ptr = 0;
170
- JsControllerErrorFinalization.unregister(this);
171
- return ptr;
172
- }
173
-
174
- free() {
175
- const ptr = this.__destroy_into_raw();
176
- wasm.__wbg_jscontrollererror_free(ptr, 0);
177
- }
178
- /**
179
- * @returns {ErrorCode}
180
- */
181
- get code() {
182
- const ret = wasm.__wbg_get_jscontrollererror_code(this.__wbg_ptr);
183
- return ret;
184
- }
185
- /**
186
- * @param {ErrorCode} arg0
187
- */
188
- set code(arg0) {
189
- wasm.__wbg_set_jscontrollererror_code(this.__wbg_ptr, arg0);
190
- }
191
- /**
192
- * @returns {string}
193
- */
194
- get message() {
195
- let deferred1_0;
196
- let deferred1_1;
197
- try {
198
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
199
- wasm.__wbg_get_jscontrollererror_message(retptr, this.__wbg_ptr);
200
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
201
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
202
- deferred1_0 = r0;
203
- deferred1_1 = r1;
204
- return getStringFromWasm0(r0, r1);
205
- } finally {
206
- wasm.__wbindgen_add_to_stack_pointer(16);
207
- wasm.__wbindgen_export_0(deferred1_0, deferred1_1, 1);
208
- }
209
- }
210
- /**
211
- * @param {string} arg0
212
- */
213
- set message(arg0) {
214
- const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
215
- const len0 = WASM_VECTOR_LEN;
216
- wasm.__wbg_set_jscontrollererror_message(this.__wbg_ptr, ptr0, len0);
217
- }
218
- /**
219
- * @returns {string | undefined}
220
- */
221
- get data() {
222
- try {
223
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
224
- wasm.__wbg_get_jscontrollererror_data(retptr, this.__wbg_ptr);
225
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
226
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
227
- let v1;
228
- if (r0 !== 0) {
229
- v1 = getStringFromWasm0(r0, r1).slice();
230
- wasm.__wbindgen_export_0(r0, r1 * 1, 1);
231
- }
232
- return v1;
233
- } finally {
234
- wasm.__wbindgen_add_to_stack_pointer(16);
235
- }
236
- }
237
- /**
238
- * @param {string | null} [arg0]
239
- */
240
- set data(arg0) {
241
- var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
242
- var len0 = WASM_VECTOR_LEN;
243
- wasm.__wbg_set_jscontrollererror_data(this.__wbg_ptr, ptr0, len0);
244
- }
245
- }
246
- module.exports.JsControllerError = JsControllerError;
247
-
248
- module.exports.__wbindgen_throw = function(arg0, arg1) {
249
- throw new Error(getStringFromWasm0(arg0, arg1));
250
- };
251
-
252
- const path = require('path').join(__dirname, 'account_wasm_bg.wasm');
253
- const bytes = require('fs').readFileSync(path);
254
-
255
- const wasmModule = new WebAssembly.Module(bytes);
256
- const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
257
- wasm = wasmInstance.exports;
258
- module.exports.__wasm = wasm;
259
-
Binary file
@@ -1,14 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- export const memory: WebAssembly.Memory;
4
- export const __wbg_jscontrollererror_free: (a: number, b: number) => void;
5
- export const __wbg_get_jscontrollererror_code: (a: number) => number;
6
- export const __wbg_set_jscontrollererror_code: (a: number, b: number) => void;
7
- export const __wbg_get_jscontrollererror_message: (a: number, b: number) => void;
8
- export const __wbg_set_jscontrollererror_message: (a: number, b: number, c: number) => void;
9
- export const __wbg_get_jscontrollererror_data: (a: number, b: number) => void;
10
- export const __wbg_set_jscontrollererror_data: (a: number, b: number, c: number) => void;
11
- export const __wbindgen_add_to_stack_pointer: (a: number) => number;
12
- export const __wbindgen_export_0: (a: number, b: number, c: number) => void;
13
- export const __wbindgen_export_1: (a: number, b: number) => number;
14
- export const __wbindgen_export_2: (a: number, b: number, c: number, d: number) => number;
@@ -1,13 +0,0 @@
1
- function releaseStub() {}
2
-
3
- export class Mutex {
4
- lastPromise = Promise.resolve();
5
-
6
- async obtain() {
7
- let release = releaseStub;
8
- const lastPromise = this.lastPromise;
9
- this.lastPromise = new Promise((resolve) => (release = resolve));
10
- await lastPromise;
11
- return release;
12
- }
13
- }