@revibase/lite 0.0.13 → 0.0.15
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 +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +91 -44
- package/dist/index.d.ts +91 -44
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,28 +1,79 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _revibase_core from '@revibase/core';
|
|
2
|
+
import { StartMessageRequest } from '@revibase/core';
|
|
2
3
|
export { CompleteMessageRequest, CompleteTransactionRequest, StartMessageRequest, StartTransactionRequest, initialize } from '@revibase/core';
|
|
4
|
+
import z from 'zod';
|
|
5
|
+
import * as gill from 'gill';
|
|
3
6
|
import { TransactionSigner, Instruction, AddressesByLookupTableAddress } from 'gill';
|
|
4
7
|
|
|
5
8
|
declare function getRandomPayer(payerEndpoint: string): Promise<TransactionSigner>;
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
publicKey:
|
|
9
|
-
walletAddress:
|
|
10
|
-
settingsIndexWithAddress: {
|
|
11
|
-
index:
|
|
12
|
-
settingsAddressTreeIndex:
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
declare const UserSchema: z.ZodObject<{
|
|
11
|
+
publicKey: z.ZodString;
|
|
12
|
+
walletAddress: z.ZodString;
|
|
13
|
+
settingsIndexWithAddress: z.ZodObject<{
|
|
14
|
+
index: z.ZodNumber;
|
|
15
|
+
settingsAddressTreeIndex: z.ZodNumber;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
username: z.ZodString;
|
|
18
|
+
image: z.ZodString;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
type User = z.infer<typeof UserSchema>;
|
|
21
|
+
declare const StartTransactionRequestWithOptionalTypeSchema: z.ZodObject<{
|
|
22
|
+
phase: z.ZodLiteral<"start">;
|
|
23
|
+
redirectOrigin: z.ZodString;
|
|
24
|
+
signer: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
publicKey: z.ZodString;
|
|
26
|
+
walletAddress: z.ZodString;
|
|
27
|
+
settingsIndexWithAddress: z.ZodObject<{
|
|
28
|
+
index: z.ZodNumber;
|
|
29
|
+
settingsAddressTreeIndex: z.ZodNumber;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
username: z.ZodString;
|
|
32
|
+
image: z.ZodString;
|
|
33
|
+
}, z.core.$strip>>;
|
|
34
|
+
data: z.ZodObject<{
|
|
35
|
+
type: z.ZodLiteral<"transaction">;
|
|
36
|
+
payload: z.ZodObject<{
|
|
37
|
+
transactionMessageBytes: z.ZodString;
|
|
38
|
+
transactionActionType: z.ZodOptional<z.ZodEnum<{
|
|
39
|
+
create: "create";
|
|
40
|
+
create_with_preauthorized_execution: "create_with_preauthorized_execution";
|
|
41
|
+
execute: "execute";
|
|
42
|
+
vote: "vote";
|
|
43
|
+
sync: "sync";
|
|
44
|
+
close: "close";
|
|
45
|
+
decompress: "decompress";
|
|
46
|
+
transfer_intent: "transfer_intent";
|
|
47
|
+
change_delegate: "change_delegate";
|
|
48
|
+
change_config: "change_config";
|
|
49
|
+
}>>;
|
|
50
|
+
transactionAddress: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strict>;
|
|
52
|
+
}, z.core.$strict>;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
type StartTransactionRequestWithOptionalType = z.infer<typeof StartTransactionRequestWithOptionalTypeSchema>;
|
|
55
|
+
declare const CompleteMessageRequestSchema: z.ZodObject<{
|
|
56
|
+
phase: z.ZodLiteral<"complete">;
|
|
57
|
+
data: z.ZodObject<{
|
|
58
|
+
type: z.ZodLiteral<"message">;
|
|
59
|
+
rid: z.ZodString;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
type CompleteMessageRequest = z.infer<typeof CompleteMessageRequestSchema>;
|
|
63
|
+
declare const CompleteTransactionRequestSchema: z.ZodObject<{
|
|
64
|
+
phase: z.ZodLiteral<"complete">;
|
|
65
|
+
data: z.ZodObject<{
|
|
66
|
+
type: z.ZodLiteral<"transaction">;
|
|
67
|
+
rid: z.ZodString;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
type CompleteTransactionRequest = z.infer<typeof CompleteTransactionRequestSchema>;
|
|
18
71
|
type ClientAuthorizationCallback = {
|
|
19
72
|
(request: StartMessageRequest): Promise<{
|
|
20
|
-
|
|
21
|
-
message: string;
|
|
22
|
-
signature: string;
|
|
73
|
+
rid: string;
|
|
23
74
|
}>;
|
|
24
|
-
(request:
|
|
25
|
-
|
|
75
|
+
(request: StartTransactionRequestWithOptionalType): Promise<{
|
|
76
|
+
rid: string;
|
|
26
77
|
}>;
|
|
27
78
|
(request: CompleteMessageRequest): Promise<{
|
|
28
79
|
user: User;
|
|
@@ -35,24 +86,22 @@ type ClientAuthorizationCallback = {
|
|
|
35
86
|
type Options = {
|
|
36
87
|
onClientAuthorizationCallback: ClientAuthorizationCallback;
|
|
37
88
|
providerOrigin?: string;
|
|
38
|
-
providerFetchResultUrl?: string;
|
|
39
89
|
};
|
|
40
90
|
|
|
41
91
|
declare class RevibaseProvider {
|
|
42
|
-
private pending;
|
|
43
|
-
onClientAuthorizationCallback: ClientAuthorizationCallback;
|
|
44
|
-
private providerOrigin;
|
|
45
|
-
private providerFetchResultUrl;
|
|
92
|
+
private readonly pending;
|
|
93
|
+
readonly onClientAuthorizationCallback: ClientAuthorizationCallback;
|
|
94
|
+
private readonly providerOrigin;
|
|
46
95
|
private popUp;
|
|
47
96
|
constructor(opts: Options);
|
|
48
97
|
openBlankPopUp(): void;
|
|
49
|
-
sendPayloadToProvider({
|
|
50
|
-
|
|
51
|
-
signature: string;
|
|
98
|
+
sendPayloadToProvider({ rid, timeoutMs, }: {
|
|
99
|
+
rid: string;
|
|
52
100
|
timeoutMs?: number;
|
|
53
|
-
}): Promise<
|
|
101
|
+
}): Promise<{
|
|
102
|
+
rid: string;
|
|
103
|
+
}>;
|
|
54
104
|
private openWebPopup;
|
|
55
|
-
private pollForResult;
|
|
56
105
|
}
|
|
57
106
|
|
|
58
107
|
declare function signIn(provider: RevibaseProvider): Promise<{
|
|
@@ -70,33 +119,31 @@ declare function executeTransaction(provider: RevibaseProvider, args: {
|
|
|
70
119
|
declare function transferTokens(provider: RevibaseProvider, args: {
|
|
71
120
|
amount: number | bigint;
|
|
72
121
|
destination: string;
|
|
73
|
-
signer?:
|
|
122
|
+
signer?: User;
|
|
74
123
|
mint?: string;
|
|
75
124
|
tokenProgram?: string;
|
|
76
125
|
}): Promise<{
|
|
77
126
|
txSig: string;
|
|
78
127
|
}>;
|
|
79
128
|
|
|
80
|
-
declare function processClientAuthCallback(request
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
user?: undefined;
|
|
89
|
-
txSig?: undefined;
|
|
129
|
+
declare function processClientAuthCallback({ request, privateKey, feePayer, providerOrigin, rpId, }: {
|
|
130
|
+
request: StartTransactionRequestWithOptionalType | StartMessageRequest | CompleteMessageRequest | CompleteTransactionRequest;
|
|
131
|
+
privateKey: CryptoKey;
|
|
132
|
+
feePayer?: TransactionSigner;
|
|
133
|
+
providerOrigin?: string;
|
|
134
|
+
rpId?: string;
|
|
135
|
+
}): Promise<{
|
|
136
|
+
rid: string;
|
|
90
137
|
} | {
|
|
91
|
-
user:
|
|
92
|
-
|
|
93
|
-
|
|
138
|
+
user: {
|
|
139
|
+
publicKey: string;
|
|
140
|
+
walletAddress: gill.Address<string>;
|
|
141
|
+
settingsIndexWithAddress: _revibase_core.SettingsIndexWithAddressArgs;
|
|
142
|
+
};
|
|
94
143
|
txSig?: undefined;
|
|
95
144
|
} | {
|
|
96
145
|
txSig: string;
|
|
97
|
-
signature?: undefined;
|
|
98
|
-
message?: undefined;
|
|
99
146
|
user?: undefined;
|
|
100
147
|
}>;
|
|
101
148
|
|
|
102
|
-
export { type ClientAuthorizationCallback, RevibaseProvider, type User, executeTransaction, getRandomPayer, processClientAuthCallback, signIn, transferTokens };
|
|
149
|
+
export { type ClientAuthorizationCallback, CompleteMessageRequestSchema, CompleteTransactionRequestSchema, RevibaseProvider, type StartTransactionRequestWithOptionalType, StartTransactionRequestWithOptionalTypeSchema, type User, UserSchema, executeTransaction, getRandomPayer, processClientAuthCallback, signIn, transferTokens };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,79 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _revibase_core from '@revibase/core';
|
|
2
|
+
import { StartMessageRequest } from '@revibase/core';
|
|
2
3
|
export { CompleteMessageRequest, CompleteTransactionRequest, StartMessageRequest, StartTransactionRequest, initialize } from '@revibase/core';
|
|
4
|
+
import z from 'zod';
|
|
5
|
+
import * as gill from 'gill';
|
|
3
6
|
import { TransactionSigner, Instruction, AddressesByLookupTableAddress } from 'gill';
|
|
4
7
|
|
|
5
8
|
declare function getRandomPayer(payerEndpoint: string): Promise<TransactionSigner>;
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
publicKey:
|
|
9
|
-
walletAddress:
|
|
10
|
-
settingsIndexWithAddress: {
|
|
11
|
-
index:
|
|
12
|
-
settingsAddressTreeIndex:
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
declare const UserSchema: z.ZodObject<{
|
|
11
|
+
publicKey: z.ZodString;
|
|
12
|
+
walletAddress: z.ZodString;
|
|
13
|
+
settingsIndexWithAddress: z.ZodObject<{
|
|
14
|
+
index: z.ZodNumber;
|
|
15
|
+
settingsAddressTreeIndex: z.ZodNumber;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
username: z.ZodString;
|
|
18
|
+
image: z.ZodString;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
type User = z.infer<typeof UserSchema>;
|
|
21
|
+
declare const StartTransactionRequestWithOptionalTypeSchema: z.ZodObject<{
|
|
22
|
+
phase: z.ZodLiteral<"start">;
|
|
23
|
+
redirectOrigin: z.ZodString;
|
|
24
|
+
signer: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
publicKey: z.ZodString;
|
|
26
|
+
walletAddress: z.ZodString;
|
|
27
|
+
settingsIndexWithAddress: z.ZodObject<{
|
|
28
|
+
index: z.ZodNumber;
|
|
29
|
+
settingsAddressTreeIndex: z.ZodNumber;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
username: z.ZodString;
|
|
32
|
+
image: z.ZodString;
|
|
33
|
+
}, z.core.$strip>>;
|
|
34
|
+
data: z.ZodObject<{
|
|
35
|
+
type: z.ZodLiteral<"transaction">;
|
|
36
|
+
payload: z.ZodObject<{
|
|
37
|
+
transactionMessageBytes: z.ZodString;
|
|
38
|
+
transactionActionType: z.ZodOptional<z.ZodEnum<{
|
|
39
|
+
create: "create";
|
|
40
|
+
create_with_preauthorized_execution: "create_with_preauthorized_execution";
|
|
41
|
+
execute: "execute";
|
|
42
|
+
vote: "vote";
|
|
43
|
+
sync: "sync";
|
|
44
|
+
close: "close";
|
|
45
|
+
decompress: "decompress";
|
|
46
|
+
transfer_intent: "transfer_intent";
|
|
47
|
+
change_delegate: "change_delegate";
|
|
48
|
+
change_config: "change_config";
|
|
49
|
+
}>>;
|
|
50
|
+
transactionAddress: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strict>;
|
|
52
|
+
}, z.core.$strict>;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
type StartTransactionRequestWithOptionalType = z.infer<typeof StartTransactionRequestWithOptionalTypeSchema>;
|
|
55
|
+
declare const CompleteMessageRequestSchema: z.ZodObject<{
|
|
56
|
+
phase: z.ZodLiteral<"complete">;
|
|
57
|
+
data: z.ZodObject<{
|
|
58
|
+
type: z.ZodLiteral<"message">;
|
|
59
|
+
rid: z.ZodString;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
type CompleteMessageRequest = z.infer<typeof CompleteMessageRequestSchema>;
|
|
63
|
+
declare const CompleteTransactionRequestSchema: z.ZodObject<{
|
|
64
|
+
phase: z.ZodLiteral<"complete">;
|
|
65
|
+
data: z.ZodObject<{
|
|
66
|
+
type: z.ZodLiteral<"transaction">;
|
|
67
|
+
rid: z.ZodString;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
type CompleteTransactionRequest = z.infer<typeof CompleteTransactionRequestSchema>;
|
|
18
71
|
type ClientAuthorizationCallback = {
|
|
19
72
|
(request: StartMessageRequest): Promise<{
|
|
20
|
-
|
|
21
|
-
message: string;
|
|
22
|
-
signature: string;
|
|
73
|
+
rid: string;
|
|
23
74
|
}>;
|
|
24
|
-
(request:
|
|
25
|
-
|
|
75
|
+
(request: StartTransactionRequestWithOptionalType): Promise<{
|
|
76
|
+
rid: string;
|
|
26
77
|
}>;
|
|
27
78
|
(request: CompleteMessageRequest): Promise<{
|
|
28
79
|
user: User;
|
|
@@ -35,24 +86,22 @@ type ClientAuthorizationCallback = {
|
|
|
35
86
|
type Options = {
|
|
36
87
|
onClientAuthorizationCallback: ClientAuthorizationCallback;
|
|
37
88
|
providerOrigin?: string;
|
|
38
|
-
providerFetchResultUrl?: string;
|
|
39
89
|
};
|
|
40
90
|
|
|
41
91
|
declare class RevibaseProvider {
|
|
42
|
-
private pending;
|
|
43
|
-
onClientAuthorizationCallback: ClientAuthorizationCallback;
|
|
44
|
-
private providerOrigin;
|
|
45
|
-
private providerFetchResultUrl;
|
|
92
|
+
private readonly pending;
|
|
93
|
+
readonly onClientAuthorizationCallback: ClientAuthorizationCallback;
|
|
94
|
+
private readonly providerOrigin;
|
|
46
95
|
private popUp;
|
|
47
96
|
constructor(opts: Options);
|
|
48
97
|
openBlankPopUp(): void;
|
|
49
|
-
sendPayloadToProvider({
|
|
50
|
-
|
|
51
|
-
signature: string;
|
|
98
|
+
sendPayloadToProvider({ rid, timeoutMs, }: {
|
|
99
|
+
rid: string;
|
|
52
100
|
timeoutMs?: number;
|
|
53
|
-
}): Promise<
|
|
101
|
+
}): Promise<{
|
|
102
|
+
rid: string;
|
|
103
|
+
}>;
|
|
54
104
|
private openWebPopup;
|
|
55
|
-
private pollForResult;
|
|
56
105
|
}
|
|
57
106
|
|
|
58
107
|
declare function signIn(provider: RevibaseProvider): Promise<{
|
|
@@ -70,33 +119,31 @@ declare function executeTransaction(provider: RevibaseProvider, args: {
|
|
|
70
119
|
declare function transferTokens(provider: RevibaseProvider, args: {
|
|
71
120
|
amount: number | bigint;
|
|
72
121
|
destination: string;
|
|
73
|
-
signer?:
|
|
122
|
+
signer?: User;
|
|
74
123
|
mint?: string;
|
|
75
124
|
tokenProgram?: string;
|
|
76
125
|
}): Promise<{
|
|
77
126
|
txSig: string;
|
|
78
127
|
}>;
|
|
79
128
|
|
|
80
|
-
declare function processClientAuthCallback(request
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
user?: undefined;
|
|
89
|
-
txSig?: undefined;
|
|
129
|
+
declare function processClientAuthCallback({ request, privateKey, feePayer, providerOrigin, rpId, }: {
|
|
130
|
+
request: StartTransactionRequestWithOptionalType | StartMessageRequest | CompleteMessageRequest | CompleteTransactionRequest;
|
|
131
|
+
privateKey: CryptoKey;
|
|
132
|
+
feePayer?: TransactionSigner;
|
|
133
|
+
providerOrigin?: string;
|
|
134
|
+
rpId?: string;
|
|
135
|
+
}): Promise<{
|
|
136
|
+
rid: string;
|
|
90
137
|
} | {
|
|
91
|
-
user:
|
|
92
|
-
|
|
93
|
-
|
|
138
|
+
user: {
|
|
139
|
+
publicKey: string;
|
|
140
|
+
walletAddress: gill.Address<string>;
|
|
141
|
+
settingsIndexWithAddress: _revibase_core.SettingsIndexWithAddressArgs;
|
|
142
|
+
};
|
|
94
143
|
txSig?: undefined;
|
|
95
144
|
} | {
|
|
96
145
|
txSig: string;
|
|
97
|
-
signature?: undefined;
|
|
98
|
-
message?: undefined;
|
|
99
146
|
user?: undefined;
|
|
100
147
|
}>;
|
|
101
148
|
|
|
102
|
-
export { type ClientAuthorizationCallback, RevibaseProvider, type User, executeTransaction, getRandomPayer, processClientAuthCallback, signIn, transferTokens };
|
|
149
|
+
export { type ClientAuthorizationCallback, CompleteMessageRequestSchema, CompleteTransactionRequestSchema, RevibaseProvider, type StartTransactionRequestWithOptionalType, StartTransactionRequestWithOptionalTypeSchema, type User, UserSchema, executeTransaction, getRandomPayer, processClientAuthCallback, signIn, transferTokens };
|