@pollar/core 0.3.9 → 0.4.1
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.mts +201 -114
- package/dist/index.d.ts +201 -114
- package/dist/index.js +157 -112
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +158 -112
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -174,7 +174,7 @@ interface paths {
|
|
|
174
174
|
patch?: never;
|
|
175
175
|
trace?: never;
|
|
176
176
|
};
|
|
177
|
-
"/config": {
|
|
177
|
+
"/applications/config": {
|
|
178
178
|
parameters: {
|
|
179
179
|
query?: never;
|
|
180
180
|
header?: never;
|
|
@@ -185,7 +185,7 @@ interface paths {
|
|
|
185
185
|
* Get application config
|
|
186
186
|
* @description Returns the public configuration and branding for the application.
|
|
187
187
|
*/
|
|
188
|
-
get: operations["
|
|
188
|
+
get: operations["getApplicationsConfig"];
|
|
189
189
|
put?: never;
|
|
190
190
|
post?: never;
|
|
191
191
|
delete?: never;
|
|
@@ -234,7 +234,7 @@ interface paths {
|
|
|
234
234
|
patch?: never;
|
|
235
235
|
trace?: never;
|
|
236
236
|
};
|
|
237
|
-
"/tx/
|
|
237
|
+
"/tx/sign-and-send": {
|
|
238
238
|
parameters: {
|
|
239
239
|
query?: never;
|
|
240
240
|
header?: never;
|
|
@@ -247,7 +247,7 @@ interface paths {
|
|
|
247
247
|
* Submit signed transaction
|
|
248
248
|
* @description Submits a signed transaction envelope to the Stellar network.
|
|
249
249
|
*/
|
|
250
|
-
post: operations["
|
|
250
|
+
post: operations["postTxSignAndSend"];
|
|
251
251
|
delete?: never;
|
|
252
252
|
options?: never;
|
|
253
253
|
head?: never;
|
|
@@ -292,8 +292,8 @@ interface operations {
|
|
|
292
292
|
};
|
|
293
293
|
content: {
|
|
294
294
|
"application/json": {
|
|
295
|
-
/** @
|
|
296
|
-
code: "
|
|
295
|
+
/** @constant */
|
|
296
|
+
code: "SDK_API_HEALTH_OK";
|
|
297
297
|
/** @constant */
|
|
298
298
|
success: true;
|
|
299
299
|
content: {
|
|
@@ -322,8 +322,8 @@ interface operations {
|
|
|
322
322
|
};
|
|
323
323
|
content: {
|
|
324
324
|
"application/json": {
|
|
325
|
-
/** @
|
|
326
|
-
code: "
|
|
325
|
+
/** @constant */
|
|
326
|
+
code: "SDK_SESSION_CREATED";
|
|
327
327
|
/** @constant */
|
|
328
328
|
success: true;
|
|
329
329
|
content: {
|
|
@@ -593,8 +593,8 @@ interface operations {
|
|
|
593
593
|
};
|
|
594
594
|
content: {
|
|
595
595
|
"application/json": {
|
|
596
|
-
/** @
|
|
597
|
-
code: "
|
|
596
|
+
/** @constant */
|
|
597
|
+
code: "SDK_EMAIL_CODE_SENT";
|
|
598
598
|
/** @constant */
|
|
599
599
|
success: true;
|
|
600
600
|
content: {
|
|
@@ -681,8 +681,8 @@ interface operations {
|
|
|
681
681
|
};
|
|
682
682
|
content: {
|
|
683
683
|
"application/json": {
|
|
684
|
-
/** @
|
|
685
|
-
code: "
|
|
684
|
+
/** @constant */
|
|
685
|
+
code: "SDK_EMAIL_CODE_VERIFIED";
|
|
686
686
|
/** @constant */
|
|
687
687
|
success: true;
|
|
688
688
|
content: {
|
|
@@ -768,8 +768,8 @@ interface operations {
|
|
|
768
768
|
};
|
|
769
769
|
content: {
|
|
770
770
|
"application/json": {
|
|
771
|
-
/** @
|
|
772
|
-
code: "
|
|
771
|
+
/** @constant */
|
|
772
|
+
code: "SDK_WALLET_AUTHENTICATED";
|
|
773
773
|
/** @constant */
|
|
774
774
|
success: true;
|
|
775
775
|
content: {
|
|
@@ -855,8 +855,8 @@ interface operations {
|
|
|
855
855
|
};
|
|
856
856
|
content: {
|
|
857
857
|
"application/json": {
|
|
858
|
-
/** @
|
|
859
|
-
code: "
|
|
858
|
+
/** @constant */
|
|
859
|
+
code: "SDK_LOGIN_SUCCESS";
|
|
860
860
|
/** @constant */
|
|
861
861
|
success: true;
|
|
862
862
|
content: {
|
|
@@ -955,7 +955,7 @@ interface operations {
|
|
|
955
955
|
};
|
|
956
956
|
};
|
|
957
957
|
};
|
|
958
|
-
|
|
958
|
+
getApplicationsConfig: {
|
|
959
959
|
parameters: {
|
|
960
960
|
query?: never;
|
|
961
961
|
header?: never;
|
|
@@ -971,8 +971,8 @@ interface operations {
|
|
|
971
971
|
};
|
|
972
972
|
content: {
|
|
973
973
|
"application/json": {
|
|
974
|
-
/** @
|
|
975
|
-
code: "
|
|
974
|
+
/** @constant */
|
|
975
|
+
code: "SDK_APPLICATION_CONFIG";
|
|
976
976
|
/** @constant */
|
|
977
977
|
success: true;
|
|
978
978
|
content: {
|
|
@@ -1080,7 +1080,42 @@ interface operations {
|
|
|
1080
1080
|
path?: never;
|
|
1081
1081
|
cookie?: never;
|
|
1082
1082
|
};
|
|
1083
|
-
requestBody?:
|
|
1083
|
+
requestBody?: {
|
|
1084
|
+
content: {
|
|
1085
|
+
"application/json": {
|
|
1086
|
+
/** @enum {string} */
|
|
1087
|
+
network: "testnet" | "public";
|
|
1088
|
+
publicKey: string;
|
|
1089
|
+
/** @constant */
|
|
1090
|
+
operation: "payment";
|
|
1091
|
+
params: {
|
|
1092
|
+
destination: string;
|
|
1093
|
+
amount: string;
|
|
1094
|
+
asset: {
|
|
1095
|
+
/** @constant */
|
|
1096
|
+
type: "native";
|
|
1097
|
+
} | {
|
|
1098
|
+
/** @constant */
|
|
1099
|
+
type: "credit_alphanum4";
|
|
1100
|
+
code: string;
|
|
1101
|
+
issuer: string;
|
|
1102
|
+
};
|
|
1103
|
+
};
|
|
1104
|
+
options?: {
|
|
1105
|
+
timeoutSec?: number;
|
|
1106
|
+
memo?: {
|
|
1107
|
+
/** @constant */
|
|
1108
|
+
type: "text";
|
|
1109
|
+
value: string;
|
|
1110
|
+
} | {
|
|
1111
|
+
/** @constant */
|
|
1112
|
+
type: "id";
|
|
1113
|
+
value: string;
|
|
1114
|
+
};
|
|
1115
|
+
};
|
|
1116
|
+
};
|
|
1117
|
+
};
|
|
1118
|
+
};
|
|
1084
1119
|
responses: {
|
|
1085
1120
|
/** @description Unsigned XDR and summary */
|
|
1086
1121
|
200: {
|
|
@@ -1089,8 +1124,8 @@ interface operations {
|
|
|
1089
1124
|
};
|
|
1090
1125
|
content: {
|
|
1091
1126
|
"application/json": {
|
|
1092
|
-
/** @
|
|
1093
|
-
code: "
|
|
1127
|
+
/** @constant */
|
|
1128
|
+
code: "SDK_TX_BUILT";
|
|
1094
1129
|
/** @constant */
|
|
1095
1130
|
success: true;
|
|
1096
1131
|
content: {
|
|
@@ -1133,7 +1168,7 @@ interface operations {
|
|
|
1133
1168
|
};
|
|
1134
1169
|
};
|
|
1135
1170
|
};
|
|
1136
|
-
/** @description
|
|
1171
|
+
/** @description Transaction build error */
|
|
1137
1172
|
502: {
|
|
1138
1173
|
headers: {
|
|
1139
1174
|
[name: string]: unknown;
|
|
@@ -1148,14 +1183,22 @@ interface operations {
|
|
|
1148
1183
|
};
|
|
1149
1184
|
};
|
|
1150
1185
|
};
|
|
1151
|
-
|
|
1186
|
+
postTxSignAndSend: {
|
|
1152
1187
|
parameters: {
|
|
1153
1188
|
query?: never;
|
|
1154
1189
|
header?: never;
|
|
1155
1190
|
path?: never;
|
|
1156
1191
|
cookie?: never;
|
|
1157
1192
|
};
|
|
1158
|
-
requestBody?:
|
|
1193
|
+
requestBody?: {
|
|
1194
|
+
content: {
|
|
1195
|
+
"application/json": {
|
|
1196
|
+
/** @enum {string} */
|
|
1197
|
+
network: "testnet" | "public";
|
|
1198
|
+
signedXdr: string;
|
|
1199
|
+
};
|
|
1200
|
+
};
|
|
1201
|
+
};
|
|
1159
1202
|
responses: {
|
|
1160
1203
|
/** @description Submit result (PENDING | SUCCESS | FAILED) */
|
|
1161
1204
|
200: {
|
|
@@ -1164,8 +1207,8 @@ interface operations {
|
|
|
1164
1207
|
};
|
|
1165
1208
|
content: {
|
|
1166
1209
|
"application/json": {
|
|
1167
|
-
/** @
|
|
1168
|
-
code: "
|
|
1210
|
+
/** @constant */
|
|
1211
|
+
code: "SDK_TX_SUBMIT";
|
|
1169
1212
|
/** @constant */
|
|
1170
1213
|
success: true;
|
|
1171
1214
|
content: {
|
|
@@ -1209,7 +1252,7 @@ interface operations {
|
|
|
1209
1252
|
getTxStatus: {
|
|
1210
1253
|
parameters: {
|
|
1211
1254
|
query: {
|
|
1212
|
-
network: "testnet" | "
|
|
1255
|
+
network: "testnet" | "public";
|
|
1213
1256
|
hash: string;
|
|
1214
1257
|
};
|
|
1215
1258
|
header?: never;
|
|
@@ -1225,8 +1268,8 @@ interface operations {
|
|
|
1225
1268
|
};
|
|
1226
1269
|
content: {
|
|
1227
1270
|
"application/json": {
|
|
1228
|
-
/** @
|
|
1229
|
-
code: "
|
|
1271
|
+
/** @constant */
|
|
1272
|
+
code: "SDK_TX_STATUS";
|
|
1230
1273
|
/** @constant */
|
|
1231
1274
|
success: true;
|
|
1232
1275
|
content: {
|
|
@@ -1273,6 +1316,72 @@ interface operations {
|
|
|
1273
1316
|
type PollarApiClient = ReturnType<typeof createApiClient>;
|
|
1274
1317
|
declare function createApiClient(baseUrl: string): openapi_fetch.Client<paths, `${string}/${string}`>;
|
|
1275
1318
|
|
|
1319
|
+
declare const StateStatus: {
|
|
1320
|
+
readonly NONE: "NONE";
|
|
1321
|
+
readonly LOADING: "LOADING";
|
|
1322
|
+
readonly SUCCESS: "SUCCESS";
|
|
1323
|
+
readonly ERROR: "ERROR";
|
|
1324
|
+
};
|
|
1325
|
+
type StateStatus = (typeof StateStatus)[keyof typeof StateStatus];
|
|
1326
|
+
declare const PollarStateVar: {
|
|
1327
|
+
readonly NETWORK: "network";
|
|
1328
|
+
readonly AUTHENTICATION: "authentication";
|
|
1329
|
+
readonly TRANSACTION: "transaction";
|
|
1330
|
+
};
|
|
1331
|
+
type PollarStateVar = (typeof PollarStateVar)[keyof typeof PollarStateVar];
|
|
1332
|
+
declare const STATE_VAR_CODES: {
|
|
1333
|
+
readonly authentication: {
|
|
1334
|
+
readonly NONE: "NONE";
|
|
1335
|
+
readonly LOGOUT: "LOGOUT";
|
|
1336
|
+
readonly CREATE_SESSION_START: "CREATE_SESSION_START";
|
|
1337
|
+
readonly CREATE_SESSION_ERROR: "CREATE_SESSION_ERROR";
|
|
1338
|
+
readonly CREATE_SESSION_SUCCESS: "CREATE_SESSION_SUCCESS";
|
|
1339
|
+
readonly EMAIL_AUTH_START: "EMAIL_AUTH_START";
|
|
1340
|
+
readonly EMAIL_AUTH_START_ERROR: "EMAIL_AUTH_START_ERROR";
|
|
1341
|
+
readonly EMAIL_AUTH_START_SUCCESS: "EMAIL_AUTH_START_SUCCESS";
|
|
1342
|
+
readonly EMAIL_AUTH_CODE_ERROR: "EMAIL_AUTH_CODE_ERROR";
|
|
1343
|
+
readonly EMAIL_AUTH_CODE_SUCCESS: "EMAIL_AUTH_CODE_SUCCESS";
|
|
1344
|
+
readonly WALLET_AUTH_START: "WALLET_AUTH_START";
|
|
1345
|
+
readonly WALLET_AUTH_FREIGHTER_NOT_INSTALLED: "WALLET_AUTH_FREIGHTER_NOT_INSTALLED";
|
|
1346
|
+
readonly WALLET_AUTH_ALBEDO_NOT_INSTALLED: "WALLET_AUTH_ALBEDO_NOT_INSTALLED";
|
|
1347
|
+
readonly WALLET_AUTH_CONNECTED: "WALLET_AUTH_CONNECTED";
|
|
1348
|
+
readonly WALLET_AUTH_LOGIN_START: "WALLET_AUTH_LOGIN_START";
|
|
1349
|
+
readonly WALLET_AUTH_LOGIN_START_SUCCESS: "WALLET_AUTH_LOGIN_START_SUCCESS";
|
|
1350
|
+
readonly WALLET_AUTH_LOGIN_START_ERROR: "WALLET_AUTH_LOGIN_START_ERROR";
|
|
1351
|
+
readonly WALLET_AUTH_ERROR: "WALLET_AUTH_ERROR";
|
|
1352
|
+
readonly STREAM_POLL_START: "STREAM_POLL_START";
|
|
1353
|
+
readonly STREAM_POLL_EVENT: "STREAM_POLL_EVENT";
|
|
1354
|
+
readonly STREAM_POLL_READY: "STREAM_POLL_READY";
|
|
1355
|
+
readonly FETCH_SESSION_START: "FETCH_SESSION_START";
|
|
1356
|
+
readonly FETCH_SESSION_SUCCESS: "FETCH_SESSION_SUCCESS";
|
|
1357
|
+
readonly FETCH_SESSION_ERROR: "FETCH_SESSION_ERROR";
|
|
1358
|
+
readonly RESTORED_SESSION_SUCCESS: "RESTORED_SESSION_SUCCESS";
|
|
1359
|
+
readonly RESTORED_SESSION_ERROR: "RESTORED_SESSION_ERROR";
|
|
1360
|
+
readonly SESSION_STORED: "SESSION_STORED";
|
|
1361
|
+
readonly ERROR_ABORTED: "ABORTED";
|
|
1362
|
+
readonly ERROR_UNKNOWN: "ERROR_UNKNOWN";
|
|
1363
|
+
};
|
|
1364
|
+
readonly walletAddress: {
|
|
1365
|
+
readonly NONE: "NONE";
|
|
1366
|
+
readonly REMOVED_ADDRESS: "REMOVED_ADDRESS";
|
|
1367
|
+
readonly UPDATED_ADDRESS: "UPDATED_ADDRESS";
|
|
1368
|
+
};
|
|
1369
|
+
readonly transaction: {
|
|
1370
|
+
readonly NONE: "NONE";
|
|
1371
|
+
readonly BUILD_TRANSACTION_ERROR_NO_WALLET: "BUILD_TRANSACTION_ERROR_NO_WALLET";
|
|
1372
|
+
readonly BUILD_TRANSACTION_START: "BUILD_TRANSACTION_START";
|
|
1373
|
+
readonly BUILD_TRANSACTION_SUCCESS: "BUILD_TRANSACTION_SUCCESS";
|
|
1374
|
+
readonly BUILD_TRANSACTION_ERROR: "BUILD_TRANSACTION_ERROR";
|
|
1375
|
+
readonly SIGN_SEND_TRANSACTION_START: "SIGN_SEND_TRANSACTION_START";
|
|
1376
|
+
readonly SIGN_SEND_TRANSACTION_SUCCESS: "SIGN_SEND_TRANSACTION_SUCCESS";
|
|
1377
|
+
readonly SIGN_SEND_TRANSACTION_ERROR: "SIGN_SEND_TRANSACTION_ERROR";
|
|
1378
|
+
};
|
|
1379
|
+
readonly network: {
|
|
1380
|
+
readonly NONE: "NONE";
|
|
1381
|
+
readonly NETWORK_UPDATED: "NETWORK_UPDATED";
|
|
1382
|
+
};
|
|
1383
|
+
};
|
|
1384
|
+
|
|
1276
1385
|
declare enum WalletType {
|
|
1277
1386
|
FREIGHTER = "freighter",
|
|
1278
1387
|
ALBEDO = "albedo"
|
|
@@ -1327,40 +1436,17 @@ declare class AlbedoAdapter implements WalletAdapter {
|
|
|
1327
1436
|
signAuthEntry(entryXdr: string, _options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse>;
|
|
1328
1437
|
}
|
|
1329
1438
|
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
password: string;
|
|
1333
|
-
}
|
|
1334
|
-
interface AuthToken {
|
|
1335
|
-
accessToken: string;
|
|
1336
|
-
refreshToken: string;
|
|
1337
|
-
expiresAt: number;
|
|
1338
|
-
}
|
|
1339
|
-
interface AuthUser {
|
|
1340
|
-
id: string;
|
|
1341
|
-
}
|
|
1342
|
-
interface AuthWallet {
|
|
1343
|
-
publicKey: string | null;
|
|
1344
|
-
}
|
|
1345
|
-
type ConfigResponse = paths['/auth/login']['post']['responses'][200]['content']['application/json'];
|
|
1346
|
-
type PollarLoginState = ConfigResponse['content'];
|
|
1439
|
+
type PollarApplicationConfigResponse = paths['/auth/login']['post']['responses'][200]['content']['application/json'];
|
|
1440
|
+
type PollarApplicationConfigContent = PollarApplicationConfigResponse['content'];
|
|
1347
1441
|
interface PollarClientConfig {
|
|
1348
1442
|
stellarNetwork?: StellarNetwork;
|
|
1349
1443
|
baseUrl?: string;
|
|
1350
1444
|
apiKey: string;
|
|
1351
1445
|
}
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
declare class PollarError extends Error {
|
|
1357
|
-
readonly code: string;
|
|
1358
|
-
constructor(code: string, message?: string);
|
|
1359
|
-
}
|
|
1360
|
-
type Status = 'unauthenticated' | 'restored' | 'authenticated' | 'awaiting_auth' | 'logging_in';
|
|
1361
|
-
interface PollarState {
|
|
1362
|
-
session: PollarLoginState | null;
|
|
1363
|
-
}
|
|
1446
|
+
type TxBuildBody = NonNullable<paths['/tx/build']['post']['requestBody']>['content']['application/json'];
|
|
1447
|
+
type TxBuildResponse = paths['/tx/build']['post']['responses'][200]['content']['application/json'];
|
|
1448
|
+
type TxSignAndSendBody = NonNullable<paths['/tx/sign-and-send']['post']['requestBody']>['content']['application/json'];
|
|
1449
|
+
type TxSignSendResponse = paths['/tx/sign-and-send']['post']['responses'][200]['content']['application/json'];
|
|
1364
1450
|
type PollarLoginOptions = {
|
|
1365
1451
|
provider: 'google';
|
|
1366
1452
|
} | {
|
|
@@ -1372,58 +1458,13 @@ type PollarLoginOptions = {
|
|
|
1372
1458
|
provider: 'wallet';
|
|
1373
1459
|
type: WalletType;
|
|
1374
1460
|
};
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
type
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
readonly NONE: "NONE";
|
|
1383
|
-
readonly LOGOUT: "LOGOUT";
|
|
1384
|
-
readonly CREATE_SESSION_START: "CREATE_SESSION_START";
|
|
1385
|
-
readonly CREATE_SESSION_ERROR: "CREATE_SESSION_ERROR";
|
|
1386
|
-
readonly CREATE_SESSION_SUCCESS: "CREATE_SESSION_SUCCESS";
|
|
1387
|
-
readonly EMAIL_AUTH_START: "EMAIL_AUTH_START";
|
|
1388
|
-
readonly EMAIL_AUTH_START_ERROR: "EMAIL_AUTH_START_ERROR";
|
|
1389
|
-
readonly EMAIL_AUTH_START_SUCCESS: "EMAIL_AUTH_START_SUCCESS";
|
|
1390
|
-
readonly EMAIL_AUTH_CODE_ERROR: "EMAIL_AUTH_CODE_ERROR";
|
|
1391
|
-
readonly EMAIL_AUTH_CODE_SUCCESS: "EMAIL_AUTH_CODE_SUCCESS";
|
|
1392
|
-
readonly WALLET_AUTH_START: "WALLET_AUTH_START";
|
|
1393
|
-
readonly WALLET_AUTH_FREIGHTER_NOT_INSTALLED: "WALLET_AUTH_FREIGHTER_NOT_INSTALLED";
|
|
1394
|
-
readonly WALLET_AUTH_ALBEDO_NOT_INSTALLED: "WALLET_AUTH_ALBEDO_NOT_INSTALLED";
|
|
1395
|
-
readonly WALLET_AUTH_CONNECTED: "WALLET_AUTH_CONNECTED";
|
|
1396
|
-
readonly WALLET_AUTH_LOGIN_START: "WALLET_AUTH_LOGIN_START";
|
|
1397
|
-
readonly WALLET_AUTH_LOGIN_START_SUCCESS: "WALLET_AUTH_LOGIN_START_SUCCESS";
|
|
1398
|
-
readonly WALLET_AUTH_LOGIN_START_ERROR: "WALLET_AUTH_LOGIN_START_ERROR";
|
|
1399
|
-
readonly WALLET_AUTH_ERROR: "WALLET_AUTH_ERROR";
|
|
1400
|
-
readonly STREAM_POLL_START: "STREAM_POLL_START";
|
|
1401
|
-
readonly STREAM_POLL_EVENT: "STREAM_POLL_EVENT";
|
|
1402
|
-
readonly STREAM_POLL_READY: "STREAM_POLL_READY";
|
|
1403
|
-
readonly FETCH_SESSION_START: "FETCH_SESSION_START";
|
|
1404
|
-
readonly FETCH_SESSION_SUCCESS: "FETCH_SESSION_SUCCESS";
|
|
1405
|
-
readonly FETCH_SESSION_ERROR: "FETCH_SESSION_ERROR";
|
|
1406
|
-
readonly ERROR_ABORTED: "ABORTED";
|
|
1407
|
-
readonly ERROR_UNKNOWN: "ERROR_UNKNOWN";
|
|
1408
|
-
};
|
|
1409
|
-
readonly WALLET_ADDRESS: {
|
|
1410
|
-
readonly NONE: "NONE";
|
|
1411
|
-
readonly REMOVED_ADDRESS: "REMOVED_ADDRESS";
|
|
1412
|
-
readonly UPDATED_ADDRESS: "UPDATED_ADDRESS";
|
|
1413
|
-
};
|
|
1414
|
-
};
|
|
1415
|
-
type LoginCodes = (typeof STATE_VAR_CODES)[typeof PollarStateVar.LOGIN];
|
|
1416
|
-
type StateLoginCodes = LoginCodes[keyof (typeof STATE_VAR_CODES)[typeof PollarStateVar.LOGIN]];
|
|
1417
|
-
type WalletAddressCodes = (typeof STATE_VAR_CODES)[typeof PollarStateVar.WALLET_ADDRESS];
|
|
1418
|
-
type StateWalletAddressCodes = WalletAddressCodes[keyof (typeof STATE_VAR_CODES)[typeof PollarStateVar.WALLET_ADDRESS]];
|
|
1419
|
-
type StateVarCodes = StateLoginCodes | StateWalletAddressCodes;
|
|
1420
|
-
declare const StateStatus: {
|
|
1421
|
-
readonly NONE: "NONE";
|
|
1422
|
-
readonly LOADING: "LOADING";
|
|
1423
|
-
readonly SUCCESS: "SUCCESS";
|
|
1424
|
-
readonly ERROR: "ERROR";
|
|
1425
|
-
};
|
|
1426
|
-
type StateStatus = (typeof StateStatus)[keyof typeof StateStatus];
|
|
1461
|
+
type NetworkCodes = (typeof STATE_VAR_CODES)[typeof PollarStateVar.NETWORK];
|
|
1462
|
+
type StateNetworkCodes = NetworkCodes[keyof (typeof STATE_VAR_CODES)[typeof PollarStateVar.NETWORK]];
|
|
1463
|
+
type AuthenticationCodes = (typeof STATE_VAR_CODES)[typeof PollarStateVar.AUTHENTICATION];
|
|
1464
|
+
type StateAuthenticationCodes = AuthenticationCodes[keyof (typeof STATE_VAR_CODES)[typeof PollarStateVar.AUTHENTICATION]];
|
|
1465
|
+
type TransactionCodes = (typeof STATE_VAR_CODES)[typeof PollarStateVar.TRANSACTION];
|
|
1466
|
+
type StateTransactionCodes = TransactionCodes[keyof (typeof STATE_VAR_CODES)[typeof PollarStateVar.TRANSACTION]];
|
|
1467
|
+
type StateVarCodes = StateNetworkCodes | StateAuthenticationCodes | StateTransactionCodes;
|
|
1427
1468
|
interface PollarStateEntry {
|
|
1428
1469
|
var: PollarStateVar;
|
|
1429
1470
|
code: StateVarCodes;
|
|
@@ -1432,6 +1473,9 @@ interface PollarStateEntry {
|
|
|
1432
1473
|
data?: unknown;
|
|
1433
1474
|
ts: number;
|
|
1434
1475
|
}
|
|
1476
|
+
type PollarState = {
|
|
1477
|
+
[key in PollarStateVar]: PollarStateEntry[];
|
|
1478
|
+
};
|
|
1435
1479
|
|
|
1436
1480
|
declare class PollarClient {
|
|
1437
1481
|
readonly apiKey: string;
|
|
@@ -1443,13 +1487,56 @@ declare class PollarClient {
|
|
|
1443
1487
|
private _state;
|
|
1444
1488
|
constructor(config: PollarClientConfig);
|
|
1445
1489
|
isAuthenticated(): boolean;
|
|
1446
|
-
getState():
|
|
1490
|
+
getState(): {
|
|
1491
|
+
session: {
|
|
1492
|
+
clientSessionId: string;
|
|
1493
|
+
userId: string | null;
|
|
1494
|
+
status: string;
|
|
1495
|
+
token: {
|
|
1496
|
+
accessToken: string;
|
|
1497
|
+
refreshToken: string;
|
|
1498
|
+
expiresAt: number;
|
|
1499
|
+
};
|
|
1500
|
+
user: {
|
|
1501
|
+
id?: string;
|
|
1502
|
+
ready: boolean;
|
|
1503
|
+
};
|
|
1504
|
+
wallet: {
|
|
1505
|
+
publicKey: string | null;
|
|
1506
|
+
existsOnStellar?: boolean;
|
|
1507
|
+
createdAt?: number;
|
|
1508
|
+
};
|
|
1509
|
+
data: {
|
|
1510
|
+
mail: string;
|
|
1511
|
+
first_name: string;
|
|
1512
|
+
last_name: string;
|
|
1513
|
+
avatar: string;
|
|
1514
|
+
providers: {
|
|
1515
|
+
email: {
|
|
1516
|
+
address: string;
|
|
1517
|
+
} | null;
|
|
1518
|
+
google: {
|
|
1519
|
+
id: string;
|
|
1520
|
+
} | null;
|
|
1521
|
+
github: {
|
|
1522
|
+
id: string;
|
|
1523
|
+
} | null;
|
|
1524
|
+
wallet: {
|
|
1525
|
+
address: string;
|
|
1526
|
+
} | null;
|
|
1527
|
+
};
|
|
1528
|
+
};
|
|
1529
|
+
} | null;
|
|
1530
|
+
};
|
|
1447
1531
|
getApi(): PollarApiClient;
|
|
1448
1532
|
login(options: PollarLoginOptions): {
|
|
1449
1533
|
cancelLogin: () => void;
|
|
1450
1534
|
};
|
|
1451
1535
|
onStateChange(cb: (state: PollarStateEntry) => void): () => void;
|
|
1452
1536
|
verifyEmailCode(clientSessionId: string, code: string): Promise<void>;
|
|
1537
|
+
getNetwork(): "testnet" | "public";
|
|
1538
|
+
buildTx(operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']): Promise<void>;
|
|
1539
|
+
submitTx(signedXdr: string): Promise<void>;
|
|
1453
1540
|
logout(): void;
|
|
1454
1541
|
private _readStore;
|
|
1455
1542
|
private _storeSession;
|
|
@@ -1457,7 +1544,7 @@ declare class PollarClient {
|
|
|
1457
1544
|
private _emitState;
|
|
1458
1545
|
}
|
|
1459
1546
|
|
|
1460
|
-
declare function isValidSession(value: unknown): value is
|
|
1547
|
+
declare function isValidSession(value: unknown): value is PollarApplicationConfigContent;
|
|
1461
1548
|
|
|
1462
1549
|
type StellarNetwork = 'mainnet' | 'testnet';
|
|
1463
1550
|
type StellarClientConfig = StellarNetwork | {
|
|
@@ -1482,4 +1569,4 @@ declare class StellarClient {
|
|
|
1482
1569
|
getBalances(publicKey: string): Promise<GetBalancesResult>;
|
|
1483
1570
|
}
|
|
1484
1571
|
|
|
1485
|
-
export { AlbedoAdapter, type
|
|
1572
|
+
export { AlbedoAdapter, type ConnectWalletResponse, FreighterAdapter, type GetBalancesResult, type PollarApiClient, type PollarApplicationConfigContent, type PollarApplicationConfigResponse, PollarClient, type PollarClientConfig, type PollarLoginOptions, type PollarState, type PollarStateEntry, PollarStateVar, STATE_VAR_CODES, type SignAuthEntryOptions, type SignAuthEntryResponse, type SignTransactionOptions, type SignTransactionResponse, type StateAuthenticationCodes, type StateNetworkCodes, StateStatus, type StateTransactionCodes, type StateVarCodes, type StellarBalance, StellarClient, type StellarClientConfig, type StellarNetwork, type TxBuildBody, type TxBuildResponse, type TxSignAndSendBody, type TxSignSendResponse, type WalletAdapter, WalletType, isValidSession, type paths as pollarPaths };
|