@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.d.cts CHANGED
@@ -1,28 +1,79 @@
1
- import { StartMessageRequest, StartTransactionRequest, CompleteMessageRequest, CompleteTransactionRequest } from '@revibase/core';
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
- type User = {
8
- publicKey: string;
9
- walletAddress: string;
10
- settingsIndexWithAddress: {
11
- index: number | bigint;
12
- settingsAddressTreeIndex: number;
13
- };
14
- hasTxManager: boolean;
15
- username?: string;
16
- image?: string;
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
- id?: string;
21
- message: string;
22
- signature: string;
73
+ rid: string;
23
74
  }>;
24
- (request: StartTransactionRequest): Promise<{
25
- signature: string;
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({ payload, signature, timeoutMs, }: {
50
- payload: StartMessageRequest | StartTransactionRequest;
51
- signature: string;
98
+ sendPayloadToProvider({ rid, timeoutMs, }: {
99
+ rid: string;
52
100
  timeoutMs?: number;
53
- }): Promise<any>;
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?: string;
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: StartTransactionRequest | StartMessageRequest | CompleteTransactionRequest | CompleteMessageRequest, privateKey: CryptoKey, feePayer?: TransactionSigner, expectedOrigin?: string, expectedRPID?: string): Promise<{
81
- signature: string;
82
- message: string;
83
- user?: undefined;
84
- txSig?: undefined;
85
- } | {
86
- signature: string;
87
- message?: undefined;
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: any;
92
- signature?: undefined;
93
- message?: undefined;
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 { StartMessageRequest, StartTransactionRequest, CompleteMessageRequest, CompleteTransactionRequest } from '@revibase/core';
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
- type User = {
8
- publicKey: string;
9
- walletAddress: string;
10
- settingsIndexWithAddress: {
11
- index: number | bigint;
12
- settingsAddressTreeIndex: number;
13
- };
14
- hasTxManager: boolean;
15
- username?: string;
16
- image?: string;
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
- id?: string;
21
- message: string;
22
- signature: string;
73
+ rid: string;
23
74
  }>;
24
- (request: StartTransactionRequest): Promise<{
25
- signature: string;
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({ payload, signature, timeoutMs, }: {
50
- payload: StartMessageRequest | StartTransactionRequest;
51
- signature: string;
98
+ sendPayloadToProvider({ rid, timeoutMs, }: {
99
+ rid: string;
52
100
  timeoutMs?: number;
53
- }): Promise<any>;
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?: string;
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: StartTransactionRequest | StartMessageRequest | CompleteTransactionRequest | CompleteMessageRequest, privateKey: CryptoKey, feePayer?: TransactionSigner, expectedOrigin?: string, expectedRPID?: string): Promise<{
81
- signature: string;
82
- message: string;
83
- user?: undefined;
84
- txSig?: undefined;
85
- } | {
86
- signature: string;
87
- message?: undefined;
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: any;
92
- signature?: undefined;
93
- message?: undefined;
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 };