@revibase/lite 0.5.0 → 0.5.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.
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -106
- package/dist/index.d.ts +23 -106
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { StartMessageRequest, StartTransactionRequest, CompleteMessageRequest, UserInfo, CompleteTransactionRequest } from '@revibase/core';
|
|
2
2
|
export { CompleteMessageRequest, CompleteTransactionRequest, StartMessageRequest, StartTransactionRequest, UserInfo } from '@revibase/core';
|
|
3
|
-
import * as _simplewebauthn_browser from '@simplewebauthn/browser';
|
|
4
3
|
import { Instruction, TransactionSigner, AddressesByLookupTableAddress } from 'gill';
|
|
5
4
|
|
|
6
5
|
declare class RevibaseError extends Error {
|
|
@@ -44,14 +43,27 @@ type ClientAuthorizationCallback = {
|
|
|
44
43
|
(request: StartPayload): Promise<{
|
|
45
44
|
signature: string;
|
|
46
45
|
validTill: number;
|
|
47
|
-
rid: string;
|
|
48
46
|
}>;
|
|
49
47
|
(request: CompleteMessageRequest): Promise<{
|
|
50
48
|
user: UserInfo;
|
|
51
49
|
}>;
|
|
52
50
|
(request: CompleteTransactionRequest): Promise<CompleteTransactionRequest>;
|
|
53
51
|
};
|
|
54
|
-
type
|
|
52
|
+
type OnConnectedCallback = (rid: string, clientOrigin: string) => Promise<{
|
|
53
|
+
request: StartMessageRequest | StartTransactionRequest;
|
|
54
|
+
signature: string;
|
|
55
|
+
}>;
|
|
56
|
+
type SuccessMap = {
|
|
57
|
+
message: {
|
|
58
|
+
user: UserInfo;
|
|
59
|
+
};
|
|
60
|
+
transaction: {
|
|
61
|
+
txSig: string;
|
|
62
|
+
user: UserInfo;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
type OnSuccessCallback = ((req: CompleteMessageRequest) => Promise<SuccessMap["message"]>) | ((req: CompleteTransactionRequest) => Promise<SuccessMap["transaction"]>);
|
|
66
|
+
type StartPayload = Omit<StartMessageRequest, "validTill"> | Omit<StartTransactionRequest, "validTill">;
|
|
55
67
|
type SignInAuthorizationFlowOptions = {
|
|
56
68
|
signal?: AbortSignal;
|
|
57
69
|
};
|
|
@@ -70,115 +82,21 @@ type RevibaseProviderOptions = {
|
|
|
70
82
|
};
|
|
71
83
|
|
|
72
84
|
declare class RevibaseProvider {
|
|
73
|
-
private readonly pending;
|
|
74
85
|
onClientAuthorizationCallback: ClientAuthorizationCallback;
|
|
75
86
|
onSendJitoBundleCallback: (request: string[]) => Promise<string>;
|
|
76
87
|
onEstimateJitoTipsCallback: () => Promise<number>;
|
|
77
88
|
private providerOrigin;
|
|
78
89
|
private popUp;
|
|
79
90
|
constructor(options: RevibaseProviderOptions);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
signature: string;
|
|
91
|
+
sendRequestToPopupProvider({ onConnectedCallback, onSuccessCallback, signal, }: {
|
|
92
|
+
onConnectedCallback: OnConnectedCallback;
|
|
93
|
+
onSuccessCallback: OnSuccessCallback;
|
|
84
94
|
signal?: AbortSignal;
|
|
85
95
|
}): Promise<{
|
|
86
|
-
|
|
87
|
-
data: {
|
|
88
|
-
type: "transaction";
|
|
89
|
-
payload: {
|
|
90
|
-
signer: string;
|
|
91
|
-
startRequest: {
|
|
92
|
-
phase: "start";
|
|
93
|
-
clientOrigin: string;
|
|
94
|
-
rid: string;
|
|
95
|
-
validTill: number;
|
|
96
|
-
data: {
|
|
97
|
-
type: "message";
|
|
98
|
-
payload: string;
|
|
99
|
-
};
|
|
100
|
-
signer?: string | undefined;
|
|
101
|
-
} | {
|
|
102
|
-
phase: "start";
|
|
103
|
-
clientOrigin: string;
|
|
104
|
-
rid: string;
|
|
105
|
-
validTill: number;
|
|
106
|
-
data: {
|
|
107
|
-
type: "transaction";
|
|
108
|
-
payload: {
|
|
109
|
-
transactionActionType: "create" | "create_with_preauthorized_execution" | "execute" | "vote" | "sync" | "close" | "decompress" | "transfer_intent" | "change_delegate" | "change_config";
|
|
110
|
-
transactionAddress: string;
|
|
111
|
-
transactionMessageBytes: string;
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
signer?: string | undefined;
|
|
115
|
-
};
|
|
116
|
-
authResponse: _simplewebauthn_browser.AuthenticationResponseJSON;
|
|
117
|
-
client: {
|
|
118
|
-
clientOrigin: string;
|
|
119
|
-
jws: string;
|
|
120
|
-
};
|
|
121
|
-
device: {
|
|
122
|
-
jwk: string;
|
|
123
|
-
jws: string;
|
|
124
|
-
};
|
|
125
|
-
slotHash: string;
|
|
126
|
-
slotNumber: string;
|
|
127
|
-
estimatedSlotHashExpiry: number;
|
|
128
|
-
originIndex: number;
|
|
129
|
-
crossOrigin: boolean;
|
|
130
|
-
userAddressTreeIndex?: number | undefined;
|
|
131
|
-
additionalInfo?: {
|
|
132
|
-
[x: string]: unknown;
|
|
133
|
-
} | undefined;
|
|
134
|
-
};
|
|
135
|
-
};
|
|
96
|
+
user: UserInfo;
|
|
136
97
|
} | {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
type: "message";
|
|
140
|
-
payload: {
|
|
141
|
-
signer: string;
|
|
142
|
-
startRequest: {
|
|
143
|
-
phase: "start";
|
|
144
|
-
clientOrigin: string;
|
|
145
|
-
rid: string;
|
|
146
|
-
validTill: number;
|
|
147
|
-
data: {
|
|
148
|
-
type: "message";
|
|
149
|
-
payload: string;
|
|
150
|
-
};
|
|
151
|
-
signer?: string | undefined;
|
|
152
|
-
} | {
|
|
153
|
-
phase: "start";
|
|
154
|
-
clientOrigin: string;
|
|
155
|
-
rid: string;
|
|
156
|
-
validTill: number;
|
|
157
|
-
data: {
|
|
158
|
-
type: "transaction";
|
|
159
|
-
payload: {
|
|
160
|
-
transactionActionType: "create" | "create_with_preauthorized_execution" | "execute" | "vote" | "sync" | "close" | "decompress" | "transfer_intent" | "change_delegate" | "change_config";
|
|
161
|
-
transactionAddress: string;
|
|
162
|
-
transactionMessageBytes: string;
|
|
163
|
-
};
|
|
164
|
-
};
|
|
165
|
-
signer?: string | undefined;
|
|
166
|
-
};
|
|
167
|
-
authResponse: _simplewebauthn_browser.AuthenticationResponseJSON;
|
|
168
|
-
client: {
|
|
169
|
-
clientOrigin: string;
|
|
170
|
-
jws: string;
|
|
171
|
-
};
|
|
172
|
-
device: {
|
|
173
|
-
jwk: string;
|
|
174
|
-
jws: string;
|
|
175
|
-
};
|
|
176
|
-
userAddressTreeIndex?: number | undefined;
|
|
177
|
-
additionalInfo?: {
|
|
178
|
-
[x: string]: unknown;
|
|
179
|
-
} | undefined;
|
|
180
|
-
};
|
|
181
|
-
};
|
|
98
|
+
txSig: string;
|
|
99
|
+
user: UserInfo;
|
|
182
100
|
}>;
|
|
183
101
|
private attachTransport;
|
|
184
102
|
}
|
|
@@ -216,7 +134,7 @@ declare function transferTokens(provider: RevibaseProvider, args: {
|
|
|
216
134
|
}>;
|
|
217
135
|
|
|
218
136
|
declare function processClientAuthCallback({ request, publicKey, allowedClientOrigins, privateKey, providerOrigin, rpId, }: {
|
|
219
|
-
request: Omit<StartMessageRequest, "
|
|
137
|
+
request: Omit<StartMessageRequest, "validTill"> | Omit<StartTransactionRequest, "validTill"> | CompleteMessageRequest | CompleteTransactionRequest;
|
|
220
138
|
allowedClientOrigins: string[];
|
|
221
139
|
publicKey: string;
|
|
222
140
|
privateKey: string;
|
|
@@ -225,7 +143,6 @@ declare function processClientAuthCallback({ request, publicKey, allowedClientOr
|
|
|
225
143
|
}): Promise<{
|
|
226
144
|
signature: string;
|
|
227
145
|
validTill: number;
|
|
228
|
-
rid: string;
|
|
229
146
|
} | {
|
|
230
147
|
user: UserInfo;
|
|
231
148
|
} | CompleteTransactionRequest>;
|
|
@@ -234,4 +151,4 @@ declare function processEstimateJitoTipsCallback(priority?: string, url?: string
|
|
|
234
151
|
|
|
235
152
|
declare function processSendJitoBundleCallback(serializedTransactions: string[], jitoUUID?: string, url?: string): Promise<string>;
|
|
236
153
|
|
|
237
|
-
export { type ClientAuthorizationCallback, RevibaseAbortedError, RevibaseApiError, RevibaseAuthError, RevibaseEnvironmentError, RevibaseError, RevibaseFlowInProgressError, RevibasePopupBlockedError, RevibasePopupClosedError, RevibasePopupNotOpenError, RevibaseProvider, RevibaseTimeoutError, type SignInAuthorizationFlowOptions, type StartPayload, type TransactionAuthorizationFlowOptions, executeTransaction, processClientAuthCallback, processEstimateJitoTipsCallback, processSendJitoBundleCallback, signIn, transferTokens };
|
|
154
|
+
export { type ClientAuthorizationCallback, type OnConnectedCallback, type OnSuccessCallback, RevibaseAbortedError, RevibaseApiError, RevibaseAuthError, RevibaseEnvironmentError, RevibaseError, RevibaseFlowInProgressError, RevibasePopupBlockedError, RevibasePopupClosedError, RevibasePopupNotOpenError, RevibaseProvider, RevibaseTimeoutError, type SignInAuthorizationFlowOptions, type StartPayload, type TransactionAuthorizationFlowOptions, executeTransaction, processClientAuthCallback, processEstimateJitoTipsCallback, processSendJitoBundleCallback, signIn, transferTokens };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { StartMessageRequest, StartTransactionRequest, CompleteMessageRequest, UserInfo, CompleteTransactionRequest } from '@revibase/core';
|
|
2
2
|
export { CompleteMessageRequest, CompleteTransactionRequest, StartMessageRequest, StartTransactionRequest, UserInfo } from '@revibase/core';
|
|
3
|
-
import * as _simplewebauthn_browser from '@simplewebauthn/browser';
|
|
4
3
|
import { Instruction, TransactionSigner, AddressesByLookupTableAddress } from 'gill';
|
|
5
4
|
|
|
6
5
|
declare class RevibaseError extends Error {
|
|
@@ -44,14 +43,27 @@ type ClientAuthorizationCallback = {
|
|
|
44
43
|
(request: StartPayload): Promise<{
|
|
45
44
|
signature: string;
|
|
46
45
|
validTill: number;
|
|
47
|
-
rid: string;
|
|
48
46
|
}>;
|
|
49
47
|
(request: CompleteMessageRequest): Promise<{
|
|
50
48
|
user: UserInfo;
|
|
51
49
|
}>;
|
|
52
50
|
(request: CompleteTransactionRequest): Promise<CompleteTransactionRequest>;
|
|
53
51
|
};
|
|
54
|
-
type
|
|
52
|
+
type OnConnectedCallback = (rid: string, clientOrigin: string) => Promise<{
|
|
53
|
+
request: StartMessageRequest | StartTransactionRequest;
|
|
54
|
+
signature: string;
|
|
55
|
+
}>;
|
|
56
|
+
type SuccessMap = {
|
|
57
|
+
message: {
|
|
58
|
+
user: UserInfo;
|
|
59
|
+
};
|
|
60
|
+
transaction: {
|
|
61
|
+
txSig: string;
|
|
62
|
+
user: UserInfo;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
type OnSuccessCallback = ((req: CompleteMessageRequest) => Promise<SuccessMap["message"]>) | ((req: CompleteTransactionRequest) => Promise<SuccessMap["transaction"]>);
|
|
66
|
+
type StartPayload = Omit<StartMessageRequest, "validTill"> | Omit<StartTransactionRequest, "validTill">;
|
|
55
67
|
type SignInAuthorizationFlowOptions = {
|
|
56
68
|
signal?: AbortSignal;
|
|
57
69
|
};
|
|
@@ -70,115 +82,21 @@ type RevibaseProviderOptions = {
|
|
|
70
82
|
};
|
|
71
83
|
|
|
72
84
|
declare class RevibaseProvider {
|
|
73
|
-
private readonly pending;
|
|
74
85
|
onClientAuthorizationCallback: ClientAuthorizationCallback;
|
|
75
86
|
onSendJitoBundleCallback: (request: string[]) => Promise<string>;
|
|
76
87
|
onEstimateJitoTipsCallback: () => Promise<number>;
|
|
77
88
|
private providerOrigin;
|
|
78
89
|
private popUp;
|
|
79
90
|
constructor(options: RevibaseProviderOptions);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
signature: string;
|
|
91
|
+
sendRequestToPopupProvider({ onConnectedCallback, onSuccessCallback, signal, }: {
|
|
92
|
+
onConnectedCallback: OnConnectedCallback;
|
|
93
|
+
onSuccessCallback: OnSuccessCallback;
|
|
84
94
|
signal?: AbortSignal;
|
|
85
95
|
}): Promise<{
|
|
86
|
-
|
|
87
|
-
data: {
|
|
88
|
-
type: "transaction";
|
|
89
|
-
payload: {
|
|
90
|
-
signer: string;
|
|
91
|
-
startRequest: {
|
|
92
|
-
phase: "start";
|
|
93
|
-
clientOrigin: string;
|
|
94
|
-
rid: string;
|
|
95
|
-
validTill: number;
|
|
96
|
-
data: {
|
|
97
|
-
type: "message";
|
|
98
|
-
payload: string;
|
|
99
|
-
};
|
|
100
|
-
signer?: string | undefined;
|
|
101
|
-
} | {
|
|
102
|
-
phase: "start";
|
|
103
|
-
clientOrigin: string;
|
|
104
|
-
rid: string;
|
|
105
|
-
validTill: number;
|
|
106
|
-
data: {
|
|
107
|
-
type: "transaction";
|
|
108
|
-
payload: {
|
|
109
|
-
transactionActionType: "create" | "create_with_preauthorized_execution" | "execute" | "vote" | "sync" | "close" | "decompress" | "transfer_intent" | "change_delegate" | "change_config";
|
|
110
|
-
transactionAddress: string;
|
|
111
|
-
transactionMessageBytes: string;
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
signer?: string | undefined;
|
|
115
|
-
};
|
|
116
|
-
authResponse: _simplewebauthn_browser.AuthenticationResponseJSON;
|
|
117
|
-
client: {
|
|
118
|
-
clientOrigin: string;
|
|
119
|
-
jws: string;
|
|
120
|
-
};
|
|
121
|
-
device: {
|
|
122
|
-
jwk: string;
|
|
123
|
-
jws: string;
|
|
124
|
-
};
|
|
125
|
-
slotHash: string;
|
|
126
|
-
slotNumber: string;
|
|
127
|
-
estimatedSlotHashExpiry: number;
|
|
128
|
-
originIndex: number;
|
|
129
|
-
crossOrigin: boolean;
|
|
130
|
-
userAddressTreeIndex?: number | undefined;
|
|
131
|
-
additionalInfo?: {
|
|
132
|
-
[x: string]: unknown;
|
|
133
|
-
} | undefined;
|
|
134
|
-
};
|
|
135
|
-
};
|
|
96
|
+
user: UserInfo;
|
|
136
97
|
} | {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
type: "message";
|
|
140
|
-
payload: {
|
|
141
|
-
signer: string;
|
|
142
|
-
startRequest: {
|
|
143
|
-
phase: "start";
|
|
144
|
-
clientOrigin: string;
|
|
145
|
-
rid: string;
|
|
146
|
-
validTill: number;
|
|
147
|
-
data: {
|
|
148
|
-
type: "message";
|
|
149
|
-
payload: string;
|
|
150
|
-
};
|
|
151
|
-
signer?: string | undefined;
|
|
152
|
-
} | {
|
|
153
|
-
phase: "start";
|
|
154
|
-
clientOrigin: string;
|
|
155
|
-
rid: string;
|
|
156
|
-
validTill: number;
|
|
157
|
-
data: {
|
|
158
|
-
type: "transaction";
|
|
159
|
-
payload: {
|
|
160
|
-
transactionActionType: "create" | "create_with_preauthorized_execution" | "execute" | "vote" | "sync" | "close" | "decompress" | "transfer_intent" | "change_delegate" | "change_config";
|
|
161
|
-
transactionAddress: string;
|
|
162
|
-
transactionMessageBytes: string;
|
|
163
|
-
};
|
|
164
|
-
};
|
|
165
|
-
signer?: string | undefined;
|
|
166
|
-
};
|
|
167
|
-
authResponse: _simplewebauthn_browser.AuthenticationResponseJSON;
|
|
168
|
-
client: {
|
|
169
|
-
clientOrigin: string;
|
|
170
|
-
jws: string;
|
|
171
|
-
};
|
|
172
|
-
device: {
|
|
173
|
-
jwk: string;
|
|
174
|
-
jws: string;
|
|
175
|
-
};
|
|
176
|
-
userAddressTreeIndex?: number | undefined;
|
|
177
|
-
additionalInfo?: {
|
|
178
|
-
[x: string]: unknown;
|
|
179
|
-
} | undefined;
|
|
180
|
-
};
|
|
181
|
-
};
|
|
98
|
+
txSig: string;
|
|
99
|
+
user: UserInfo;
|
|
182
100
|
}>;
|
|
183
101
|
private attachTransport;
|
|
184
102
|
}
|
|
@@ -216,7 +134,7 @@ declare function transferTokens(provider: RevibaseProvider, args: {
|
|
|
216
134
|
}>;
|
|
217
135
|
|
|
218
136
|
declare function processClientAuthCallback({ request, publicKey, allowedClientOrigins, privateKey, providerOrigin, rpId, }: {
|
|
219
|
-
request: Omit<StartMessageRequest, "
|
|
137
|
+
request: Omit<StartMessageRequest, "validTill"> | Omit<StartTransactionRequest, "validTill"> | CompleteMessageRequest | CompleteTransactionRequest;
|
|
220
138
|
allowedClientOrigins: string[];
|
|
221
139
|
publicKey: string;
|
|
222
140
|
privateKey: string;
|
|
@@ -225,7 +143,6 @@ declare function processClientAuthCallback({ request, publicKey, allowedClientOr
|
|
|
225
143
|
}): Promise<{
|
|
226
144
|
signature: string;
|
|
227
145
|
validTill: number;
|
|
228
|
-
rid: string;
|
|
229
146
|
} | {
|
|
230
147
|
user: UserInfo;
|
|
231
148
|
} | CompleteTransactionRequest>;
|
|
@@ -234,4 +151,4 @@ declare function processEstimateJitoTipsCallback(priority?: string, url?: string
|
|
|
234
151
|
|
|
235
152
|
declare function processSendJitoBundleCallback(serializedTransactions: string[], jitoUUID?: string, url?: string): Promise<string>;
|
|
236
153
|
|
|
237
|
-
export { type ClientAuthorizationCallback, RevibaseAbortedError, RevibaseApiError, RevibaseAuthError, RevibaseEnvironmentError, RevibaseError, RevibaseFlowInProgressError, RevibasePopupBlockedError, RevibasePopupClosedError, RevibasePopupNotOpenError, RevibaseProvider, RevibaseTimeoutError, type SignInAuthorizationFlowOptions, type StartPayload, type TransactionAuthorizationFlowOptions, executeTransaction, processClientAuthCallback, processEstimateJitoTipsCallback, processSendJitoBundleCallback, signIn, transferTokens };
|
|
154
|
+
export { type ClientAuthorizationCallback, type OnConnectedCallback, type OnSuccessCallback, RevibaseAbortedError, RevibaseApiError, RevibaseAuthError, RevibaseEnvironmentError, RevibaseError, RevibaseFlowInProgressError, RevibasePopupBlockedError, RevibasePopupClosedError, RevibasePopupNotOpenError, RevibaseProvider, RevibaseTimeoutError, type SignInAuthorizationFlowOptions, type StartPayload, type TransactionAuthorizationFlowOptions, executeTransaction, processClientAuthCallback, processEstimateJitoTipsCallback, processSendJitoBundleCallback, signIn, transferTokens };
|