@fedimint/react-native-bindings 0.0.0-om-rn1-d72fdc108a01df2d7d64c2b85c8b1f9fd43927cb
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/LICENSE +21 -0
- package/README.md +7 -0
- package/ReactNative.podspec +45 -0
- package/ReactNativeBindings.podspec +44 -0
- package/android/CMakeLists.txt +76 -0
- package/android/build.gradle +144 -0
- package/android/cpp-adapter.cpp +44 -0
- package/android/generated/java/com/fedimint/reactnative/NativeReactNativeBindingsSpec.java +41 -0
- package/android/generated/jni/CMakeLists.txt +28 -0
- package/android/generated/jni/ReactNativeBindingsSpec-generated.cpp +38 -0
- package/android/generated/jni/ReactNativeBindingsSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/ComponentDescriptors.cpp +22 -0
- package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/ComponentDescriptors.h +24 -0
- package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/EventEmitters.cpp +16 -0
- package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/EventEmitters.h +17 -0
- package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/Props.cpp +19 -0
- package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/Props.h +18 -0
- package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/ReactNativeBindingsSpecJSI.h +45 -0
- package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/ShadowNodes.cpp +17 -0
- package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/ShadowNodes.h +23 -0
- package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/States.cpp +16 -0
- package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/States.h +20 -0
- package/android/src/main/AndroidManifest.xml +5 -0
- package/android/src/main/java/com/fedimint/reactnative/ReactNativeBindingsModule.kt +43 -0
- package/android/src/main/java/com/fedimint/reactnative/ReactNativeBindingsPackage.kt +34 -0
- package/app.plugin.js +1 -0
- package/cpp/fedimint-react-native-bindings.cpp +16 -0
- package/cpp/fedimint-react-native-bindings.h +15 -0
- package/cpp/generated/fedimint_client_uniffi.cpp +2281 -0
- package/cpp/generated/fedimint_client_uniffi.hpp +95 -0
- package/ios/ReactNativeBindings.h +16 -0
- package/ios/ReactNativeBindings.mm +66 -0
- package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/ComponentDescriptors.cpp +22 -0
- package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/ComponentDescriptors.h +24 -0
- package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/EventEmitters.cpp +16 -0
- package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/EventEmitters.h +17 -0
- package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/Props.cpp +19 -0
- package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/Props.h +18 -0
- package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/RCTComponentViewHelpers.h +18 -0
- package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/ReactNativeBindingsSpec-generated.mm +46 -0
- package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/ReactNativeBindingsSpec.h +63 -0
- package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/ShadowNodes.cpp +17 -0
- package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/ShadowNodes.h +23 -0
- package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/States.cpp +16 -0
- package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/States.h +20 -0
- package/ios/generated/ReactCodegen/ReactNativeBindingsSpecJSI.h +45 -0
- package/lib/commonjs/NativeReactNativeBindings.js +10 -0
- package/lib/commonjs/NativeReactNativeBindings.js.map +1 -0
- package/lib/commonjs/generated/fedimint_client_uniffi-ffi.js +44 -0
- package/lib/commonjs/generated/fedimint_client_uniffi-ffi.js.map +1 -0
- package/lib/commonjs/generated/fedimint_client_uniffi.js +426 -0
- package/lib/commonjs/generated/fedimint_client_uniffi.js.map +1 -0
- package/lib/commonjs/index.js +63 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/NativeReactNativeBindings.js +7 -0
- package/lib/module/NativeReactNativeBindings.js.map +1 -0
- package/lib/module/generated/fedimint_client_uniffi-ffi.js +43 -0
- package/lib/module/generated/fedimint_client_uniffi-ffi.js.map +1 -0
- package/lib/module/generated/fedimint_client_uniffi.js +420 -0
- package/lib/module/generated/fedimint_client_uniffi.js.map +1 -0
- package/lib/module/index.js +43 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/plugin/src/index.d.ts +11 -0
- package/lib/typescript/commonjs/plugin/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/plugin/src/utils.d.ts +9 -0
- package/lib/typescript/commonjs/plugin/src/utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts +6 -0
- package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts.map +1 -0
- package/lib/typescript/commonjs/plugin/src/withBinaryArtifacts.d.ts +7 -0
- package/lib/typescript/commonjs/plugin/src/withBinaryArtifacts.d.ts.map +1 -0
- package/lib/typescript/commonjs/plugin/src/withIOS.d.ts +7 -0
- package/lib/typescript/commonjs/plugin/src/withIOS.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/NativeReactNativeBindings.d.ts +8 -0
- package/lib/typescript/commonjs/src/NativeReactNativeBindings.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/generated/fedimint_client_uniffi-ffi.d.ts +95 -0
- package/lib/typescript/commonjs/src/generated/fedimint_client_uniffi-ffi.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/generated/fedimint_client_uniffi.d.ts +501 -0
- package/lib/typescript/commonjs/src/generated/fedimint_client_uniffi.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +8 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/plugin/src/index.d.ts +11 -0
- package/lib/typescript/module/plugin/src/index.d.ts.map +1 -0
- package/lib/typescript/module/plugin/src/utils.d.ts +9 -0
- package/lib/typescript/module/plugin/src/utils.d.ts.map +1 -0
- package/lib/typescript/module/plugin/src/withAndroid.d.ts +6 -0
- package/lib/typescript/module/plugin/src/withAndroid.d.ts.map +1 -0
- package/lib/typescript/module/plugin/src/withBinaryArtifacts.d.ts +7 -0
- package/lib/typescript/module/plugin/src/withBinaryArtifacts.d.ts.map +1 -0
- package/lib/typescript/module/plugin/src/withIOS.d.ts +7 -0
- package/lib/typescript/module/plugin/src/withIOS.d.ts.map +1 -0
- package/lib/typescript/module/src/NativeReactNativeBindings.d.ts +8 -0
- package/lib/typescript/module/src/NativeReactNativeBindings.d.ts.map +1 -0
- package/lib/typescript/module/src/generated/fedimint_client_uniffi-ffi.d.ts +95 -0
- package/lib/typescript/module/src/generated/fedimint_client_uniffi-ffi.d.ts.map +1 -0
- package/lib/typescript/module/src/generated/fedimint_client_uniffi.d.ts +501 -0
- package/lib/typescript/module/src/generated/fedimint_client_uniffi.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +8 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +146 -0
- package/patches/rn083_callinvoker.patch +50 -0
- package/plugin/tsconfig.json +18 -0
- package/react-native.config.js +15 -0
- package/scripts/download-binaries.js +111 -0
- package/src/NativeReactNativeBindings.ts +10 -0
- package/src/generated/fedimint_client_uniffi-ffi.ts +221 -0
- package/src/generated/fedimint_client_uniffi.ts +651 -0
- package/src/index.tsx +41 -0
|
@@ -0,0 +1,651 @@
|
|
|
1
|
+
// This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
|
|
2
|
+
// Trust me, you don't want to mess with it!
|
|
3
|
+
import nativeModule, {
|
|
4
|
+
type UniffiRustFutureContinuationCallback,
|
|
5
|
+
type UniffiForeignFuture,
|
|
6
|
+
type UniffiForeignFutureStructU8,
|
|
7
|
+
type UniffiForeignFutureCompleteU8,
|
|
8
|
+
type UniffiForeignFutureStructI8,
|
|
9
|
+
type UniffiForeignFutureCompleteI8,
|
|
10
|
+
type UniffiForeignFutureStructU16,
|
|
11
|
+
type UniffiForeignFutureCompleteU16,
|
|
12
|
+
type UniffiForeignFutureStructI16,
|
|
13
|
+
type UniffiForeignFutureCompleteI16,
|
|
14
|
+
type UniffiForeignFutureStructU32,
|
|
15
|
+
type UniffiForeignFutureCompleteU32,
|
|
16
|
+
type UniffiForeignFutureStructI32,
|
|
17
|
+
type UniffiForeignFutureCompleteI32,
|
|
18
|
+
type UniffiForeignFutureStructU64,
|
|
19
|
+
type UniffiForeignFutureCompleteU64,
|
|
20
|
+
type UniffiForeignFutureStructI64,
|
|
21
|
+
type UniffiForeignFutureCompleteI64,
|
|
22
|
+
type UniffiForeignFutureStructF32,
|
|
23
|
+
type UniffiForeignFutureCompleteF32,
|
|
24
|
+
type UniffiForeignFutureStructF64,
|
|
25
|
+
type UniffiForeignFutureCompleteF64,
|
|
26
|
+
type UniffiForeignFutureStructPointer,
|
|
27
|
+
type UniffiForeignFutureCompletePointer,
|
|
28
|
+
type UniffiForeignFutureStructRustBuffer,
|
|
29
|
+
type UniffiForeignFutureCompleteRustBuffer,
|
|
30
|
+
type UniffiForeignFutureStructVoid,
|
|
31
|
+
type UniffiForeignFutureCompleteVoid,
|
|
32
|
+
type UniffiVTableCallbackInterfaceRpcCallback,
|
|
33
|
+
} from './fedimint_client_uniffi-ffi'
|
|
34
|
+
import {
|
|
35
|
+
type FfiConverter,
|
|
36
|
+
type UniffiByteArray,
|
|
37
|
+
type UniffiHandle,
|
|
38
|
+
type UniffiObjectFactory,
|
|
39
|
+
type UniffiReferenceHolder,
|
|
40
|
+
type UniffiRustArcPtr,
|
|
41
|
+
type UniffiRustCallStatus,
|
|
42
|
+
type UnsafeMutableRawPointer,
|
|
43
|
+
AbstractFfiConverterByteArray,
|
|
44
|
+
FfiConverterCallback,
|
|
45
|
+
FfiConverterInt32,
|
|
46
|
+
FfiConverterObject,
|
|
47
|
+
FfiConverterUInt64,
|
|
48
|
+
RustBuffer,
|
|
49
|
+
UniffiAbstractObject,
|
|
50
|
+
UniffiError,
|
|
51
|
+
UniffiInternalError,
|
|
52
|
+
UniffiResult,
|
|
53
|
+
UniffiRustCaller,
|
|
54
|
+
destructorGuardSymbol,
|
|
55
|
+
pointerLiteralSymbol,
|
|
56
|
+
uniffiCreateFfiConverterString,
|
|
57
|
+
uniffiTraitInterfaceCall,
|
|
58
|
+
uniffiTypeNameSymbol,
|
|
59
|
+
variantOrdinalSymbol,
|
|
60
|
+
} from 'uniffi-bindgen-react-native'
|
|
61
|
+
|
|
62
|
+
// Get converters from the other files, if any.
|
|
63
|
+
const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }))
|
|
64
|
+
|
|
65
|
+
const uniffiIsDebug =
|
|
66
|
+
// @ts-ignore -- The process global might not be defined
|
|
67
|
+
typeof process !== 'object' ||
|
|
68
|
+
// @ts-ignore -- The process global might not be defined
|
|
69
|
+
process?.env?.NODE_ENV !== 'production' ||
|
|
70
|
+
false
|
|
71
|
+
// Public interface members begin here.
|
|
72
|
+
|
|
73
|
+
export interface RpcCallback {
|
|
74
|
+
onResponse(responseJson: string): void
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
78
|
+
const uniffiCallbackInterfaceRpcCallback: {
|
|
79
|
+
vtable: UniffiVTableCallbackInterfaceRpcCallback
|
|
80
|
+
register: () => void
|
|
81
|
+
} = {
|
|
82
|
+
// Create the VTable using a series of closures.
|
|
83
|
+
// ts automatically converts these into C callback functions.
|
|
84
|
+
vtable: {
|
|
85
|
+
onResponse: (uniffiHandle: bigint, responseJson: Uint8Array) => {
|
|
86
|
+
const uniffiMakeCall = (): void => {
|
|
87
|
+
const jsCallback = FfiConverterTypeRpcCallback.lift(uniffiHandle)
|
|
88
|
+
return jsCallback.onResponse(FfiConverterString.lift(responseJson))
|
|
89
|
+
}
|
|
90
|
+
const uniffiResult = UniffiResult.ready<void>()
|
|
91
|
+
const uniffiHandleSuccess = (obj: any) => {}
|
|
92
|
+
const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => {
|
|
93
|
+
UniffiResult.writeError(uniffiResult, code, errBuf)
|
|
94
|
+
}
|
|
95
|
+
uniffiTraitInterfaceCall(
|
|
96
|
+
/*makeCall:*/ uniffiMakeCall,
|
|
97
|
+
/*handleSuccess:*/ uniffiHandleSuccess,
|
|
98
|
+
/*handleError:*/ uniffiHandleError,
|
|
99
|
+
/*lowerString:*/ FfiConverterString.lower,
|
|
100
|
+
)
|
|
101
|
+
return uniffiResult
|
|
102
|
+
},
|
|
103
|
+
uniffiFree: (uniffiHandle: UniffiHandle): void => {
|
|
104
|
+
// RpcCallback: this will throw a stale handle error if the handle isn't found.
|
|
105
|
+
FfiConverterTypeRpcCallback.drop(uniffiHandle)
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
register: () => {
|
|
109
|
+
nativeModule().ubrn_uniffi_fedimint_client_uniffi_fn_init_callback_vtable_rpccallback(
|
|
110
|
+
uniffiCallbackInterfaceRpcCallback.vtable,
|
|
111
|
+
)
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// FfiConverter protocol for callback interfaces
|
|
116
|
+
const FfiConverterTypeRpcCallback = new FfiConverterCallback<RpcCallback>()
|
|
117
|
+
|
|
118
|
+
const stringConverter = {
|
|
119
|
+
stringToBytes: (s: string) =>
|
|
120
|
+
uniffiCaller.rustCall((status) =>
|
|
121
|
+
nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer(
|
|
122
|
+
s,
|
|
123
|
+
status,
|
|
124
|
+
),
|
|
125
|
+
),
|
|
126
|
+
bytesToString: (ab: UniffiByteArray) =>
|
|
127
|
+
uniffiCaller.rustCall((status) =>
|
|
128
|
+
nativeModule().ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string(
|
|
129
|
+
ab,
|
|
130
|
+
status,
|
|
131
|
+
),
|
|
132
|
+
),
|
|
133
|
+
stringByteLength: (s: string) =>
|
|
134
|
+
uniffiCaller.rustCall((status) =>
|
|
135
|
+
nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length(
|
|
136
|
+
s,
|
|
137
|
+
status,
|
|
138
|
+
),
|
|
139
|
+
),
|
|
140
|
+
}
|
|
141
|
+
const FfiConverterString = uniffiCreateFfiConverterString(stringConverter)
|
|
142
|
+
|
|
143
|
+
// Error type: FedimintError
|
|
144
|
+
|
|
145
|
+
// Enum: FedimintError
|
|
146
|
+
export enum FedimintError_Tags {
|
|
147
|
+
DatabaseError = 'DatabaseError',
|
|
148
|
+
NetworkingError = 'NetworkingError',
|
|
149
|
+
RuntimeError = 'RuntimeError',
|
|
150
|
+
InvalidRequest = 'InvalidRequest',
|
|
151
|
+
General = 'General',
|
|
152
|
+
}
|
|
153
|
+
export const FedimintError = (() => {
|
|
154
|
+
type DatabaseError__interface = {
|
|
155
|
+
tag: FedimintError_Tags.DatabaseError
|
|
156
|
+
inner: Readonly<{ msg: string }>
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
class DatabaseError_ extends UniffiError implements DatabaseError__interface {
|
|
160
|
+
/**
|
|
161
|
+
* @private
|
|
162
|
+
* This field is private and should not be used, use `tag` instead.
|
|
163
|
+
*/
|
|
164
|
+
readonly [uniffiTypeNameSymbol] = 'FedimintError'
|
|
165
|
+
readonly tag = FedimintError_Tags.DatabaseError
|
|
166
|
+
readonly inner: Readonly<{ msg: string }>
|
|
167
|
+
constructor(inner: { msg: string }) {
|
|
168
|
+
super('FedimintError', 'DatabaseError')
|
|
169
|
+
this.inner = Object.freeze(inner)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
static new(inner: { msg: string }): DatabaseError_ {
|
|
173
|
+
return new DatabaseError_(inner)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
static instanceOf(obj: any): obj is DatabaseError_ {
|
|
177
|
+
return obj.tag === FedimintError_Tags.DatabaseError
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
static hasInner(obj: any): obj is DatabaseError_ {
|
|
181
|
+
return DatabaseError_.instanceOf(obj)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
static getInner(obj: DatabaseError_): Readonly<{ msg: string }> {
|
|
185
|
+
return obj.inner
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
type NetworkingError__interface = {
|
|
190
|
+
tag: FedimintError_Tags.NetworkingError
|
|
191
|
+
inner: Readonly<{ msg: string }>
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
class NetworkingError_
|
|
195
|
+
extends UniffiError
|
|
196
|
+
implements NetworkingError__interface
|
|
197
|
+
{
|
|
198
|
+
/**
|
|
199
|
+
* @private
|
|
200
|
+
* This field is private and should not be used, use `tag` instead.
|
|
201
|
+
*/
|
|
202
|
+
readonly [uniffiTypeNameSymbol] = 'FedimintError'
|
|
203
|
+
readonly tag = FedimintError_Tags.NetworkingError
|
|
204
|
+
readonly inner: Readonly<{ msg: string }>
|
|
205
|
+
constructor(inner: { msg: string }) {
|
|
206
|
+
super('FedimintError', 'NetworkingError')
|
|
207
|
+
this.inner = Object.freeze(inner)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
static new(inner: { msg: string }): NetworkingError_ {
|
|
211
|
+
return new NetworkingError_(inner)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
static instanceOf(obj: any): obj is NetworkingError_ {
|
|
215
|
+
return obj.tag === FedimintError_Tags.NetworkingError
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
static hasInner(obj: any): obj is NetworkingError_ {
|
|
219
|
+
return NetworkingError_.instanceOf(obj)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
static getInner(obj: NetworkingError_): Readonly<{ msg: string }> {
|
|
223
|
+
return obj.inner
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
type RuntimeError__interface = {
|
|
228
|
+
tag: FedimintError_Tags.RuntimeError
|
|
229
|
+
inner: Readonly<{ msg: string }>
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
class RuntimeError_ extends UniffiError implements RuntimeError__interface {
|
|
233
|
+
/**
|
|
234
|
+
* @private
|
|
235
|
+
* This field is private and should not be used, use `tag` instead.
|
|
236
|
+
*/
|
|
237
|
+
readonly [uniffiTypeNameSymbol] = 'FedimintError'
|
|
238
|
+
readonly tag = FedimintError_Tags.RuntimeError
|
|
239
|
+
readonly inner: Readonly<{ msg: string }>
|
|
240
|
+
constructor(inner: { msg: string }) {
|
|
241
|
+
super('FedimintError', 'RuntimeError')
|
|
242
|
+
this.inner = Object.freeze(inner)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
static new(inner: { msg: string }): RuntimeError_ {
|
|
246
|
+
return new RuntimeError_(inner)
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
static instanceOf(obj: any): obj is RuntimeError_ {
|
|
250
|
+
return obj.tag === FedimintError_Tags.RuntimeError
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
static hasInner(obj: any): obj is RuntimeError_ {
|
|
254
|
+
return RuntimeError_.instanceOf(obj)
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
static getInner(obj: RuntimeError_): Readonly<{ msg: string }> {
|
|
258
|
+
return obj.inner
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
type InvalidRequest__interface = {
|
|
263
|
+
tag: FedimintError_Tags.InvalidRequest
|
|
264
|
+
inner: Readonly<{ msg: string }>
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
class InvalidRequest_
|
|
268
|
+
extends UniffiError
|
|
269
|
+
implements InvalidRequest__interface
|
|
270
|
+
{
|
|
271
|
+
/**
|
|
272
|
+
* @private
|
|
273
|
+
* This field is private and should not be used, use `tag` instead.
|
|
274
|
+
*/
|
|
275
|
+
readonly [uniffiTypeNameSymbol] = 'FedimintError'
|
|
276
|
+
readonly tag = FedimintError_Tags.InvalidRequest
|
|
277
|
+
readonly inner: Readonly<{ msg: string }>
|
|
278
|
+
constructor(inner: { msg: string }) {
|
|
279
|
+
super('FedimintError', 'InvalidRequest')
|
|
280
|
+
this.inner = Object.freeze(inner)
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
static new(inner: { msg: string }): InvalidRequest_ {
|
|
284
|
+
return new InvalidRequest_(inner)
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
static instanceOf(obj: any): obj is InvalidRequest_ {
|
|
288
|
+
return obj.tag === FedimintError_Tags.InvalidRequest
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
static hasInner(obj: any): obj is InvalidRequest_ {
|
|
292
|
+
return InvalidRequest_.instanceOf(obj)
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
static getInner(obj: InvalidRequest_): Readonly<{ msg: string }> {
|
|
296
|
+
return obj.inner
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
type General__interface = {
|
|
301
|
+
tag: FedimintError_Tags.General
|
|
302
|
+
inner: Readonly<{ msg: string }>
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
class General_ extends UniffiError implements General__interface {
|
|
306
|
+
/**
|
|
307
|
+
* @private
|
|
308
|
+
* This field is private and should not be used, use `tag` instead.
|
|
309
|
+
*/
|
|
310
|
+
readonly [uniffiTypeNameSymbol] = 'FedimintError'
|
|
311
|
+
readonly tag = FedimintError_Tags.General
|
|
312
|
+
readonly inner: Readonly<{ msg: string }>
|
|
313
|
+
constructor(inner: { msg: string }) {
|
|
314
|
+
super('FedimintError', 'General')
|
|
315
|
+
this.inner = Object.freeze(inner)
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
static new(inner: { msg: string }): General_ {
|
|
319
|
+
return new General_(inner)
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
static instanceOf(obj: any): obj is General_ {
|
|
323
|
+
return obj.tag === FedimintError_Tags.General
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
static hasInner(obj: any): obj is General_ {
|
|
327
|
+
return General_.instanceOf(obj)
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
static getInner(obj: General_): Readonly<{ msg: string }> {
|
|
331
|
+
return obj.inner
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function instanceOf(obj: any): obj is FedimintError {
|
|
336
|
+
return obj[uniffiTypeNameSymbol] === 'FedimintError'
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return Object.freeze({
|
|
340
|
+
instanceOf,
|
|
341
|
+
DatabaseError: DatabaseError_,
|
|
342
|
+
NetworkingError: NetworkingError_,
|
|
343
|
+
RuntimeError: RuntimeError_,
|
|
344
|
+
InvalidRequest: InvalidRequest_,
|
|
345
|
+
General: General_,
|
|
346
|
+
})
|
|
347
|
+
})()
|
|
348
|
+
|
|
349
|
+
export type FedimintError = InstanceType<
|
|
350
|
+
(typeof FedimintError)[keyof Omit<typeof FedimintError, 'instanceOf'>]
|
|
351
|
+
>
|
|
352
|
+
|
|
353
|
+
// FfiConverter for enum FedimintError
|
|
354
|
+
const FfiConverterTypeFedimintError = (() => {
|
|
355
|
+
const ordinalConverter = FfiConverterInt32
|
|
356
|
+
type TypeName = FedimintError
|
|
357
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
358
|
+
read(from: RustBuffer): TypeName {
|
|
359
|
+
switch (ordinalConverter.read(from)) {
|
|
360
|
+
case 1:
|
|
361
|
+
return new FedimintError.DatabaseError({
|
|
362
|
+
msg: FfiConverterString.read(from),
|
|
363
|
+
})
|
|
364
|
+
case 2:
|
|
365
|
+
return new FedimintError.NetworkingError({
|
|
366
|
+
msg: FfiConverterString.read(from),
|
|
367
|
+
})
|
|
368
|
+
case 3:
|
|
369
|
+
return new FedimintError.RuntimeError({
|
|
370
|
+
msg: FfiConverterString.read(from),
|
|
371
|
+
})
|
|
372
|
+
case 4:
|
|
373
|
+
return new FedimintError.InvalidRequest({
|
|
374
|
+
msg: FfiConverterString.read(from),
|
|
375
|
+
})
|
|
376
|
+
case 5:
|
|
377
|
+
return new FedimintError.General({
|
|
378
|
+
msg: FfiConverterString.read(from),
|
|
379
|
+
})
|
|
380
|
+
default:
|
|
381
|
+
throw new UniffiInternalError.UnexpectedEnumCase()
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
385
|
+
switch (value.tag) {
|
|
386
|
+
case FedimintError_Tags.DatabaseError: {
|
|
387
|
+
ordinalConverter.write(1, into)
|
|
388
|
+
const inner = value.inner
|
|
389
|
+
FfiConverterString.write(inner.msg, into)
|
|
390
|
+
return
|
|
391
|
+
}
|
|
392
|
+
case FedimintError_Tags.NetworkingError: {
|
|
393
|
+
ordinalConverter.write(2, into)
|
|
394
|
+
const inner = value.inner
|
|
395
|
+
FfiConverterString.write(inner.msg, into)
|
|
396
|
+
return
|
|
397
|
+
}
|
|
398
|
+
case FedimintError_Tags.RuntimeError: {
|
|
399
|
+
ordinalConverter.write(3, into)
|
|
400
|
+
const inner = value.inner
|
|
401
|
+
FfiConverterString.write(inner.msg, into)
|
|
402
|
+
return
|
|
403
|
+
}
|
|
404
|
+
case FedimintError_Tags.InvalidRequest: {
|
|
405
|
+
ordinalConverter.write(4, into)
|
|
406
|
+
const inner = value.inner
|
|
407
|
+
FfiConverterString.write(inner.msg, into)
|
|
408
|
+
return
|
|
409
|
+
}
|
|
410
|
+
case FedimintError_Tags.General: {
|
|
411
|
+
ordinalConverter.write(5, into)
|
|
412
|
+
const inner = value.inner
|
|
413
|
+
FfiConverterString.write(inner.msg, into)
|
|
414
|
+
return
|
|
415
|
+
}
|
|
416
|
+
default:
|
|
417
|
+
// Throwing from here means that FedimintError_Tags hasn't matched an ordinal.
|
|
418
|
+
throw new UniffiInternalError.UnexpectedEnumCase()
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
allocationSize(value: TypeName): number {
|
|
422
|
+
switch (value.tag) {
|
|
423
|
+
case FedimintError_Tags.DatabaseError: {
|
|
424
|
+
const inner = value.inner
|
|
425
|
+
let size = ordinalConverter.allocationSize(1)
|
|
426
|
+
size += FfiConverterString.allocationSize(inner.msg)
|
|
427
|
+
return size
|
|
428
|
+
}
|
|
429
|
+
case FedimintError_Tags.NetworkingError: {
|
|
430
|
+
const inner = value.inner
|
|
431
|
+
let size = ordinalConverter.allocationSize(2)
|
|
432
|
+
size += FfiConverterString.allocationSize(inner.msg)
|
|
433
|
+
return size
|
|
434
|
+
}
|
|
435
|
+
case FedimintError_Tags.RuntimeError: {
|
|
436
|
+
const inner = value.inner
|
|
437
|
+
let size = ordinalConverter.allocationSize(3)
|
|
438
|
+
size += FfiConverterString.allocationSize(inner.msg)
|
|
439
|
+
return size
|
|
440
|
+
}
|
|
441
|
+
case FedimintError_Tags.InvalidRequest: {
|
|
442
|
+
const inner = value.inner
|
|
443
|
+
let size = ordinalConverter.allocationSize(4)
|
|
444
|
+
size += FfiConverterString.allocationSize(inner.msg)
|
|
445
|
+
return size
|
|
446
|
+
}
|
|
447
|
+
case FedimintError_Tags.General: {
|
|
448
|
+
const inner = value.inner
|
|
449
|
+
let size = ordinalConverter.allocationSize(5)
|
|
450
|
+
size += FfiConverterString.allocationSize(inner.msg)
|
|
451
|
+
return size
|
|
452
|
+
}
|
|
453
|
+
default:
|
|
454
|
+
throw new UniffiInternalError.UnexpectedEnumCase()
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return new FFIConverter()
|
|
459
|
+
})()
|
|
460
|
+
|
|
461
|
+
export interface RpcHandlerInterface {
|
|
462
|
+
rpc(requestJson: string, callback: RpcCallback) /*throws*/ : void
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
export class RpcHandler
|
|
466
|
+
extends UniffiAbstractObject
|
|
467
|
+
implements RpcHandlerInterface
|
|
468
|
+
{
|
|
469
|
+
readonly [uniffiTypeNameSymbol] = 'RpcHandler'
|
|
470
|
+
readonly [destructorGuardSymbol]: UniffiRustArcPtr
|
|
471
|
+
readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer
|
|
472
|
+
constructor(dbPath: string) /*throws*/ {
|
|
473
|
+
super()
|
|
474
|
+
const pointer = uniffiCaller.rustCallWithError(
|
|
475
|
+
/*liftError:*/ FfiConverterTypeFedimintError.lift.bind(
|
|
476
|
+
FfiConverterTypeFedimintError,
|
|
477
|
+
),
|
|
478
|
+
/*caller:*/ (callStatus) => {
|
|
479
|
+
return nativeModule().ubrn_uniffi_fedimint_client_uniffi_fn_constructor_rpchandler_new(
|
|
480
|
+
FfiConverterString.lower(dbPath),
|
|
481
|
+
callStatus,
|
|
482
|
+
)
|
|
483
|
+
},
|
|
484
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
485
|
+
)
|
|
486
|
+
this[pointerLiteralSymbol] = pointer
|
|
487
|
+
this[destructorGuardSymbol] =
|
|
488
|
+
uniffiTypeRpcHandlerObjectFactory.bless(pointer)
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
public rpc(requestJson: string, callback: RpcCallback): void /*throws*/ {
|
|
492
|
+
uniffiCaller.rustCallWithError(
|
|
493
|
+
/*liftError:*/ FfiConverterTypeFedimintError.lift.bind(
|
|
494
|
+
FfiConverterTypeFedimintError,
|
|
495
|
+
),
|
|
496
|
+
/*caller:*/ (callStatus) => {
|
|
497
|
+
nativeModule().ubrn_uniffi_fedimint_client_uniffi_fn_method_rpchandler_rpc(
|
|
498
|
+
uniffiTypeRpcHandlerObjectFactory.clonePointer(this),
|
|
499
|
+
FfiConverterString.lower(requestJson),
|
|
500
|
+
FfiConverterTypeRpcCallback.lower(callback),
|
|
501
|
+
callStatus,
|
|
502
|
+
)
|
|
503
|
+
},
|
|
504
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
505
|
+
)
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
|
|
510
|
+
*/
|
|
511
|
+
uniffiDestroy(): void {
|
|
512
|
+
const ptr = (this as any)[destructorGuardSymbol]
|
|
513
|
+
if (ptr !== undefined) {
|
|
514
|
+
const pointer = uniffiTypeRpcHandlerObjectFactory.pointer(this)
|
|
515
|
+
uniffiTypeRpcHandlerObjectFactory.freePointer(pointer)
|
|
516
|
+
uniffiTypeRpcHandlerObjectFactory.unbless(ptr)
|
|
517
|
+
delete (this as any)[destructorGuardSymbol]
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
static instanceOf(obj: any): obj is RpcHandler {
|
|
522
|
+
return uniffiTypeRpcHandlerObjectFactory.isConcreteType(obj)
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
const uniffiTypeRpcHandlerObjectFactory: UniffiObjectFactory<RpcHandlerInterface> =
|
|
527
|
+
(() => {
|
|
528
|
+
return {
|
|
529
|
+
create(pointer: UnsafeMutableRawPointer): RpcHandlerInterface {
|
|
530
|
+
const instance = Object.create(RpcHandler.prototype)
|
|
531
|
+
instance[pointerLiteralSymbol] = pointer
|
|
532
|
+
instance[destructorGuardSymbol] = this.bless(pointer)
|
|
533
|
+
instance[uniffiTypeNameSymbol] = 'RpcHandler'
|
|
534
|
+
return instance
|
|
535
|
+
},
|
|
536
|
+
|
|
537
|
+
bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr {
|
|
538
|
+
return uniffiCaller.rustCall(
|
|
539
|
+
/*caller:*/ (status) =>
|
|
540
|
+
nativeModule().ubrn_uniffi_internal_fn_method_rpchandler_ffi__bless_pointer(
|
|
541
|
+
p,
|
|
542
|
+
status,
|
|
543
|
+
),
|
|
544
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
545
|
+
)
|
|
546
|
+
},
|
|
547
|
+
|
|
548
|
+
unbless(ptr: UniffiRustArcPtr) {
|
|
549
|
+
ptr.markDestroyed()
|
|
550
|
+
},
|
|
551
|
+
|
|
552
|
+
pointer(obj: RpcHandlerInterface): UnsafeMutableRawPointer {
|
|
553
|
+
if ((obj as any)[destructorGuardSymbol] === undefined) {
|
|
554
|
+
throw new UniffiInternalError.UnexpectedNullPointer()
|
|
555
|
+
}
|
|
556
|
+
return (obj as any)[pointerLiteralSymbol]
|
|
557
|
+
},
|
|
558
|
+
|
|
559
|
+
clonePointer(obj: RpcHandlerInterface): UnsafeMutableRawPointer {
|
|
560
|
+
const pointer = this.pointer(obj)
|
|
561
|
+
return uniffiCaller.rustCall(
|
|
562
|
+
/*caller:*/ (callStatus) =>
|
|
563
|
+
nativeModule().ubrn_uniffi_fedimint_client_uniffi_fn_clone_rpchandler(
|
|
564
|
+
pointer,
|
|
565
|
+
callStatus,
|
|
566
|
+
),
|
|
567
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
568
|
+
)
|
|
569
|
+
},
|
|
570
|
+
|
|
571
|
+
freePointer(pointer: UnsafeMutableRawPointer): void {
|
|
572
|
+
uniffiCaller.rustCall(
|
|
573
|
+
/*caller:*/ (callStatus) =>
|
|
574
|
+
nativeModule().ubrn_uniffi_fedimint_client_uniffi_fn_free_rpchandler(
|
|
575
|
+
pointer,
|
|
576
|
+
callStatus,
|
|
577
|
+
),
|
|
578
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
579
|
+
)
|
|
580
|
+
},
|
|
581
|
+
|
|
582
|
+
isConcreteType(obj: any): obj is RpcHandlerInterface {
|
|
583
|
+
return (
|
|
584
|
+
obj[destructorGuardSymbol] &&
|
|
585
|
+
obj[uniffiTypeNameSymbol] === 'RpcHandler'
|
|
586
|
+
)
|
|
587
|
+
},
|
|
588
|
+
}
|
|
589
|
+
})()
|
|
590
|
+
// FfiConverter for RpcHandlerInterface
|
|
591
|
+
const FfiConverterTypeRpcHandler = new FfiConverterObject(
|
|
592
|
+
uniffiTypeRpcHandlerObjectFactory,
|
|
593
|
+
)
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* This should be called before anything else.
|
|
597
|
+
*
|
|
598
|
+
* It is likely that this is being done for you by the library's `index.ts`.
|
|
599
|
+
*
|
|
600
|
+
* It checks versions of uniffi between when the Rust scaffolding was generated
|
|
601
|
+
* and when the bindings were generated.
|
|
602
|
+
*
|
|
603
|
+
* It also initializes the machinery to enable Rust to talk back to Javascript.
|
|
604
|
+
*/
|
|
605
|
+
function uniffiEnsureInitialized() {
|
|
606
|
+
// Get the bindings contract version from our ComponentInterface
|
|
607
|
+
const bindingsContractVersion = 29
|
|
608
|
+
// Get the scaffolding contract version by calling the into the dylib
|
|
609
|
+
const scaffoldingContractVersion =
|
|
610
|
+
nativeModule().ubrn_ffi_fedimint_client_uniffi_uniffi_contract_version()
|
|
611
|
+
if (bindingsContractVersion !== scaffoldingContractVersion) {
|
|
612
|
+
throw new UniffiInternalError.ContractVersionMismatch(
|
|
613
|
+
scaffoldingContractVersion,
|
|
614
|
+
bindingsContractVersion,
|
|
615
|
+
)
|
|
616
|
+
}
|
|
617
|
+
if (
|
|
618
|
+
nativeModule().ubrn_uniffi_fedimint_client_uniffi_checksum_method_rpchandler_rpc() !==
|
|
619
|
+
11869
|
|
620
|
+
) {
|
|
621
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
622
|
+
'uniffi_fedimint_client_uniffi_checksum_method_rpchandler_rpc',
|
|
623
|
+
)
|
|
624
|
+
}
|
|
625
|
+
if (
|
|
626
|
+
nativeModule().ubrn_uniffi_fedimint_client_uniffi_checksum_constructor_rpchandler_new() !==
|
|
627
|
+
44077
|
|
628
|
+
) {
|
|
629
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
630
|
+
'uniffi_fedimint_client_uniffi_checksum_constructor_rpchandler_new',
|
|
631
|
+
)
|
|
632
|
+
}
|
|
633
|
+
if (
|
|
634
|
+
nativeModule().ubrn_uniffi_fedimint_client_uniffi_checksum_method_rpccallback_on_response() !==
|
|
635
|
+
7989
|
|
636
|
+
) {
|
|
637
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
638
|
+
'uniffi_fedimint_client_uniffi_checksum_method_rpccallback_on_response',
|
|
639
|
+
)
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
uniffiCallbackInterfaceRpcCallback.register()
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
export default Object.freeze({
|
|
646
|
+
initialize: uniffiEnsureInitialized,
|
|
647
|
+
converters: {
|
|
648
|
+
FfiConverterTypeFedimintError,
|
|
649
|
+
FfiConverterTypeRpcHandler,
|
|
650
|
+
},
|
|
651
|
+
})
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Generated by uniffi-bindgen-react-native
|
|
2
|
+
import installer from './NativeReactNativeBindings';
|
|
3
|
+
|
|
4
|
+
// Register the rust crate with Hermes
|
|
5
|
+
// - the boolean flag ensures this loads exactly once, even if the JS
|
|
6
|
+
// code is reloaded (e.g. during development with metro).
|
|
7
|
+
let rustInstalled = false;
|
|
8
|
+
if (!rustInstalled) {
|
|
9
|
+
installer.installRustCrate();
|
|
10
|
+
rustInstalled = true;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Export the generated bindings to the app.
|
|
14
|
+
export * from './generated/fedimint_client_uniffi';
|
|
15
|
+
|
|
16
|
+
// Now import the bindings so we can:
|
|
17
|
+
// - intialize them
|
|
18
|
+
// - export them as namespaced objects as the default export.
|
|
19
|
+
import * as fedimint_client_uniffi from './generated/fedimint_client_uniffi';
|
|
20
|
+
|
|
21
|
+
// Initialize the generated bindings: mostly checksums, but also callbacks.
|
|
22
|
+
// - the boolean flag ensures this loads exactly once, even if the JS code
|
|
23
|
+
// is reloaded (e.g. during development with metro).
|
|
24
|
+
let initialized = false;
|
|
25
|
+
if (!initialized) {
|
|
26
|
+
fedimint_client_uniffi.default.initialize();
|
|
27
|
+
initialized = true;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// This provides parity with the index.web.ts version of this file.
|
|
31
|
+
// The web version relies on an asynchronous fetch, which this doesn't
|
|
32
|
+
// need, so we just no-op.
|
|
33
|
+
export async function uniffiInitAsync() {
|
|
34
|
+
// NOOP.
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Export the crates as individually namespaced objects.
|
|
38
|
+
export default {
|
|
39
|
+
fedimint_client_uniffi,
|
|
40
|
+
};
|
|
41
|
+
|