@yodlpay/react-native 0.1.1 → 0.1.3
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.md +88 -0
- package/README.md +171 -160
- package/THIRD_PARTY_NOTICES.txt +32 -0
- package/dist/index.cjs +2 -6
- package/dist/index.d.cts +31 -21
- package/dist/index.d.mts +31 -21
- package/dist/index.mjs +2 -6
- package/package.json +19 -6
- package/metro-config.cjs +0 -95
package/dist/index.d.cts
CHANGED
|
@@ -2,6 +2,10 @@ import { ViewStyle } from "react-native";
|
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/types.d.ts
|
|
5
|
+
/** Any JSON-RPC payload value — used wherever provider params/results cross the wire. */
|
|
6
|
+
type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
7
|
+
[key: string]: JsonValue;
|
|
8
|
+
};
|
|
5
9
|
/**
|
|
6
10
|
* Minimal EIP-1193 provider interface.
|
|
7
11
|
* Works with any wallet SDK: Privy, MetaMask, Coinbase, Rainbow, WalletConnect, etc.
|
|
@@ -9,8 +13,8 @@ import { ReactNode } from "react";
|
|
|
9
13
|
interface EIP1193Provider {
|
|
10
14
|
request: (args: {
|
|
11
15
|
method: string;
|
|
12
|
-
params?:
|
|
13
|
-
}) => Promise<
|
|
16
|
+
params?: JsonValue[] | object;
|
|
17
|
+
}) => Promise<JsonValue>;
|
|
14
18
|
}
|
|
15
19
|
type SupportedChainIds = number[];
|
|
16
20
|
type YodlPaymentLifecycleStatus = 'submitted' | 'processing' | 'success' | 'failure';
|
|
@@ -55,7 +59,7 @@ interface YodlPaymentDetails {
|
|
|
55
59
|
streakMultiplier?: string;
|
|
56
60
|
berserMultiplier?: number;
|
|
57
61
|
};
|
|
58
|
-
raw?:
|
|
62
|
+
raw?: JsonValue;
|
|
59
63
|
}
|
|
60
64
|
/** Runtime wallet connection shared across the provider, context, and Yodl UI host. */
|
|
61
65
|
interface YodlWallet {
|
|
@@ -98,13 +102,14 @@ declare function YodlDashboard({
|
|
|
98
102
|
//#endregion
|
|
99
103
|
//#region src/components/YodlPayment.d.ts
|
|
100
104
|
interface YodlPaymentProps extends YodlComponentProps {
|
|
101
|
-
/** Raw QR data
|
|
105
|
+
/** Raw scanned QR data. The component resolves it to the Yodl UI URL. */
|
|
102
106
|
qrData: string;
|
|
103
107
|
}
|
|
104
108
|
/**
|
|
105
109
|
* Renders the Yodl payment flow for a scanned QR code. Reads the SDK instance
|
|
106
|
-
* and wallet state from <YodlProvider
|
|
107
|
-
* configured Yodl
|
|
110
|
+
* and wallet state from <YodlProvider> and resolves the QR to the Yodl UI URL
|
|
111
|
+
* (e.g. the `/resolve` screen on the configured host). The Yodl UI is
|
|
112
|
+
* origin-locked to that host. Renders nothing for empty/unsupported QR data.
|
|
108
113
|
*/
|
|
109
114
|
declare function YodlPayment({
|
|
110
115
|
qrData,
|
|
@@ -118,6 +123,10 @@ declare function YodlPayment({
|
|
|
118
123
|
/**
|
|
119
124
|
* App-host configuration for the Yodl React Native SDK.
|
|
120
125
|
* Injected once via {@link createSdk}.
|
|
126
|
+
*
|
|
127
|
+
* No RPC endpoint is needed: the embedded Yodl UI reads chain state through its
|
|
128
|
+
* own provider, and the injected wallet bridge only forwards signing/wallet
|
|
129
|
+
* methods to the host wallet.
|
|
121
130
|
*/
|
|
122
131
|
interface YodlConfig {
|
|
123
132
|
/** Identifies the SDK integrator/wallet app in Yodl-owned request headers. */
|
|
@@ -132,24 +141,13 @@ type ResolvedYodlConfig = Omit<YodlConfig, 'yodlUiBaseUrl'> & {
|
|
|
132
141
|
yodlUiBaseUrl: string;
|
|
133
142
|
};
|
|
134
143
|
/**
|
|
135
|
-
* The Yodl SDK instance.
|
|
136
|
-
*
|
|
144
|
+
* The Yodl SDK instance. Holds the resolved app config that `<YodlProvider>`
|
|
145
|
+
* and the components read at runtime. Stateless QR helpers are exported as
|
|
146
|
+
* standalone functions (e.g. {@link isPaymentQr}) rather than instance methods.
|
|
137
147
|
*/
|
|
138
148
|
declare class Yodl {
|
|
139
149
|
readonly config: ResolvedYodlConfig;
|
|
140
150
|
constructor(config: YodlConfig);
|
|
141
|
-
get qr(): {
|
|
142
|
-
/**
|
|
143
|
-
* Returns true if the QR data is a Yodl-supported payment QR code.
|
|
144
|
-
* Accepts a single string or an array — true if any entry is supported.
|
|
145
|
-
*/
|
|
146
|
-
isPaymentQr(qrData: string | string[]): boolean;
|
|
147
|
-
};
|
|
148
|
-
/**
|
|
149
|
-
* Warm up SDK caches ahead of a payment. No-op today — reserved for future
|
|
150
|
-
* prefetching of rates, token lists, and processor metadata.
|
|
151
|
-
*/
|
|
152
|
-
prefetch(): Promise<void>;
|
|
153
151
|
}
|
|
154
152
|
/**
|
|
155
153
|
* Create a Yodl SDK instance. Factory pattern, consistent with
|
|
@@ -181,4 +179,16 @@ declare function YodlProvider({
|
|
|
181
179
|
children
|
|
182
180
|
}: YodlProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
183
181
|
//#endregion
|
|
184
|
-
|
|
182
|
+
//#region src/sdk/qr.d.ts
|
|
183
|
+
/**
|
|
184
|
+
* Returns true if the QR data is a Yodl-supported payment QR code — one the SDK
|
|
185
|
+
* can route to the resolve flow that `<YodlPayment>` renders. Accepts a single
|
|
186
|
+
* string or an array (true if any entry is supported). Provider-hosted
|
|
187
|
+
* `webview`-action QRs are not handled and return false.
|
|
188
|
+
*
|
|
189
|
+
* Pure helper: no SDK instance or config needed, so it can guard a render
|
|
190
|
+
* before `<YodlProvider>` is mounted.
|
|
191
|
+
*/
|
|
192
|
+
declare function isPaymentQr(qrData: string | string[]): boolean;
|
|
193
|
+
//#endregion
|
|
194
|
+
export { type EIP1193Provider, type SupportedChainIds, Yodl, type YodlConfig, YodlDashboard, type YodlDashboardProps, YodlPayment, type YodlPaymentDetails, type YodlPaymentLifecycleStatus, type YodlPaymentProps, YodlProvider, type YodlProviderProps, createSdk, isPaymentQr };
|
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,10 @@ import { ReactNode } from "react";
|
|
|
2
2
|
import { ViewStyle } from "react-native";
|
|
3
3
|
|
|
4
4
|
//#region src/types.d.ts
|
|
5
|
+
/** Any JSON-RPC payload value — used wherever provider params/results cross the wire. */
|
|
6
|
+
type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
7
|
+
[key: string]: JsonValue;
|
|
8
|
+
};
|
|
5
9
|
/**
|
|
6
10
|
* Minimal EIP-1193 provider interface.
|
|
7
11
|
* Works with any wallet SDK: Privy, MetaMask, Coinbase, Rainbow, WalletConnect, etc.
|
|
@@ -9,8 +13,8 @@ import { ViewStyle } from "react-native";
|
|
|
9
13
|
interface EIP1193Provider {
|
|
10
14
|
request: (args: {
|
|
11
15
|
method: string;
|
|
12
|
-
params?:
|
|
13
|
-
}) => Promise<
|
|
16
|
+
params?: JsonValue[] | object;
|
|
17
|
+
}) => Promise<JsonValue>;
|
|
14
18
|
}
|
|
15
19
|
type SupportedChainIds = number[];
|
|
16
20
|
type YodlPaymentLifecycleStatus = 'submitted' | 'processing' | 'success' | 'failure';
|
|
@@ -55,7 +59,7 @@ interface YodlPaymentDetails {
|
|
|
55
59
|
streakMultiplier?: string;
|
|
56
60
|
berserMultiplier?: number;
|
|
57
61
|
};
|
|
58
|
-
raw?:
|
|
62
|
+
raw?: JsonValue;
|
|
59
63
|
}
|
|
60
64
|
/** Runtime wallet connection shared across the provider, context, and Yodl UI host. */
|
|
61
65
|
interface YodlWallet {
|
|
@@ -98,13 +102,14 @@ declare function YodlDashboard({
|
|
|
98
102
|
//#endregion
|
|
99
103
|
//#region src/components/YodlPayment.d.ts
|
|
100
104
|
interface YodlPaymentProps extends YodlComponentProps {
|
|
101
|
-
/** Raw QR data
|
|
105
|
+
/** Raw scanned QR data. The component resolves it to the Yodl UI URL. */
|
|
102
106
|
qrData: string;
|
|
103
107
|
}
|
|
104
108
|
/**
|
|
105
109
|
* Renders the Yodl payment flow for a scanned QR code. Reads the SDK instance
|
|
106
|
-
* and wallet state from <YodlProvider
|
|
107
|
-
* configured Yodl
|
|
110
|
+
* and wallet state from <YodlProvider> and resolves the QR to the Yodl UI URL
|
|
111
|
+
* (e.g. the `/resolve` screen on the configured host). The Yodl UI is
|
|
112
|
+
* origin-locked to that host. Renders nothing for empty/unsupported QR data.
|
|
108
113
|
*/
|
|
109
114
|
declare function YodlPayment({
|
|
110
115
|
qrData,
|
|
@@ -118,6 +123,10 @@ declare function YodlPayment({
|
|
|
118
123
|
/**
|
|
119
124
|
* App-host configuration for the Yodl React Native SDK.
|
|
120
125
|
* Injected once via {@link createSdk}.
|
|
126
|
+
*
|
|
127
|
+
* No RPC endpoint is needed: the embedded Yodl UI reads chain state through its
|
|
128
|
+
* own provider, and the injected wallet bridge only forwards signing/wallet
|
|
129
|
+
* methods to the host wallet.
|
|
121
130
|
*/
|
|
122
131
|
interface YodlConfig {
|
|
123
132
|
/** Identifies the SDK integrator/wallet app in Yodl-owned request headers. */
|
|
@@ -132,24 +141,13 @@ type ResolvedYodlConfig = Omit<YodlConfig, 'yodlUiBaseUrl'> & {
|
|
|
132
141
|
yodlUiBaseUrl: string;
|
|
133
142
|
};
|
|
134
143
|
/**
|
|
135
|
-
* The Yodl SDK instance.
|
|
136
|
-
*
|
|
144
|
+
* The Yodl SDK instance. Holds the resolved app config that `<YodlProvider>`
|
|
145
|
+
* and the components read at runtime. Stateless QR helpers are exported as
|
|
146
|
+
* standalone functions (e.g. {@link isPaymentQr}) rather than instance methods.
|
|
137
147
|
*/
|
|
138
148
|
declare class Yodl {
|
|
139
149
|
readonly config: ResolvedYodlConfig;
|
|
140
150
|
constructor(config: YodlConfig);
|
|
141
|
-
get qr(): {
|
|
142
|
-
/**
|
|
143
|
-
* Returns true if the QR data is a Yodl-supported payment QR code.
|
|
144
|
-
* Accepts a single string or an array — true if any entry is supported.
|
|
145
|
-
*/
|
|
146
|
-
isPaymentQr(qrData: string | string[]): boolean;
|
|
147
|
-
};
|
|
148
|
-
/**
|
|
149
|
-
* Warm up SDK caches ahead of a payment. No-op today — reserved for future
|
|
150
|
-
* prefetching of rates, token lists, and processor metadata.
|
|
151
|
-
*/
|
|
152
|
-
prefetch(): Promise<void>;
|
|
153
151
|
}
|
|
154
152
|
/**
|
|
155
153
|
* Create a Yodl SDK instance. Factory pattern, consistent with
|
|
@@ -181,4 +179,16 @@ declare function YodlProvider({
|
|
|
181
179
|
children
|
|
182
180
|
}: YodlProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
183
181
|
//#endregion
|
|
184
|
-
|
|
182
|
+
//#region src/sdk/qr.d.ts
|
|
183
|
+
/**
|
|
184
|
+
* Returns true if the QR data is a Yodl-supported payment QR code — one the SDK
|
|
185
|
+
* can route to the resolve flow that `<YodlPayment>` renders. Accepts a single
|
|
186
|
+
* string or an array (true if any entry is supported). Provider-hosted
|
|
187
|
+
* `webview`-action QRs are not handled and return false.
|
|
188
|
+
*
|
|
189
|
+
* Pure helper: no SDK instance or config needed, so it can guard a render
|
|
190
|
+
* before `<YodlProvider>` is mounted.
|
|
191
|
+
*/
|
|
192
|
+
declare function isPaymentQr(qrData: string | string[]): boolean;
|
|
193
|
+
//#endregion
|
|
194
|
+
export { type EIP1193Provider, type SupportedChainIds, Yodl, type YodlConfig, YodlDashboard, type YodlDashboardProps, YodlPayment, type YodlPaymentDetails, type YodlPaymentLifecycleStatus, type YodlPaymentProps, YodlProvider, type YodlProviderProps, createSdk, isPaymentQr };
|