@pollar/core 0.3.9 → 0.4.0
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 +191 -108
- package/dist/index.d.ts +191 -108
- package/dist/index.js +139 -112
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +140 -112
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -652,20 +652,19 @@ function createApiClient(baseUrl) {
|
|
|
652
652
|
return createClient({ baseUrl });
|
|
653
653
|
}
|
|
654
654
|
|
|
655
|
-
// src/
|
|
656
|
-
var
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
}
|
|
655
|
+
// src/constants.ts
|
|
656
|
+
var StateStatus = {
|
|
657
|
+
NONE: "NONE",
|
|
658
|
+
LOADING: "LOADING",
|
|
659
|
+
SUCCESS: "SUCCESS",
|
|
660
|
+
ERROR: "ERROR"
|
|
662
661
|
};
|
|
663
662
|
var PollarStateVar = {
|
|
664
|
-
|
|
665
|
-
|
|
663
|
+
AUTHENTICATION: "authentication",
|
|
664
|
+
TRANSACTION: "transaction"
|
|
666
665
|
};
|
|
667
666
|
var STATE_VAR_CODES = {
|
|
668
|
-
|
|
667
|
+
authentication: {
|
|
669
668
|
NONE: "NONE",
|
|
670
669
|
LOGOUT: "LOGOUT",
|
|
671
670
|
CREATE_SESSION_START: "CREATE_SESSION_START",
|
|
@@ -690,20 +689,43 @@ var STATE_VAR_CODES = {
|
|
|
690
689
|
FETCH_SESSION_START: "FETCH_SESSION_START",
|
|
691
690
|
FETCH_SESSION_SUCCESS: "FETCH_SESSION_SUCCESS",
|
|
692
691
|
FETCH_SESSION_ERROR: "FETCH_SESSION_ERROR",
|
|
692
|
+
RESTORED_SESSION_SUCCESS: "RESTORED_SESSION_SUCCESS",
|
|
693
|
+
RESTORED_SESSION_ERROR: "RESTORED_SESSION_ERROR",
|
|
694
|
+
SESSION_STORED: "SESSION_STORED",
|
|
693
695
|
ERROR_ABORTED: "ABORTED",
|
|
694
696
|
ERROR_UNKNOWN: "ERROR_UNKNOWN"
|
|
695
697
|
},
|
|
696
|
-
|
|
698
|
+
walletAddress: {
|
|
697
699
|
NONE: "NONE",
|
|
698
700
|
REMOVED_ADDRESS: "REMOVED_ADDRESS",
|
|
699
701
|
UPDATED_ADDRESS: "UPDATED_ADDRESS"
|
|
702
|
+
},
|
|
703
|
+
transaction: {
|
|
704
|
+
NONE: "NONE",
|
|
705
|
+
BUILD_TRANSACTION_ERROR_NO_WALLET: "BUILD_TRANSACTION_ERROR_NO_WALLET",
|
|
706
|
+
BUILD_TRANSACTION_START: "BUILD_TRANSACTION_START",
|
|
707
|
+
BUILD_TRANSACTION_SUCCESS: "BUILD_TRANSACTION_SUCCESS",
|
|
708
|
+
BUILD_TRANSACTION_ERROR: "BUILD_TRANSACTION_ERROR",
|
|
709
|
+
SIGN_TRANSACTION_START: "SIGN_TRANSACTION_START",
|
|
710
|
+
SIGN_TRANSACTION_SUCCESS: "SIGN_TRANSACTION_SUCCESS",
|
|
711
|
+
SIGN_TRANSACTION_ERROR: "SIGN_TRANSACTION_ERROR",
|
|
712
|
+
SEND_TRANSACTION_START: "SEND_TRANSACTION_START",
|
|
713
|
+
SEND_TRANSACTION_SUCCESS: "SEND_TRANSACTION_SUCCESS",
|
|
714
|
+
SEND_TRANSACTION_ERROR: "SEND_TRANSACTION_ERROR"
|
|
700
715
|
}
|
|
701
716
|
};
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
717
|
+
|
|
718
|
+
// src/client/helpers.ts
|
|
719
|
+
var emitResponse = (state, response, success, errorCode, emitLog) => {
|
|
720
|
+
const isSuccess = !response.error && !!response.data && !!response.data?.success;
|
|
721
|
+
emitLog(
|
|
722
|
+
state,
|
|
723
|
+
isSuccess ? success.code : errorCode,
|
|
724
|
+
isSuccess ? "info" : "error",
|
|
725
|
+
isSuccess ? success.status || StateStatus.LOADING : StateStatus.ERROR,
|
|
726
|
+
isSuccess ? response.data : response.error
|
|
727
|
+
);
|
|
728
|
+
return isSuccess;
|
|
707
729
|
};
|
|
708
730
|
|
|
709
731
|
// src/wallets/FreighterAdapter.ts
|
|
@@ -1097,25 +1119,15 @@ function withSignal(promise, signal) {
|
|
|
1097
1119
|
})
|
|
1098
1120
|
]);
|
|
1099
1121
|
}
|
|
1100
|
-
var emitResponse = (response, successCode, errorCode, emitLog) => {
|
|
1101
|
-
const isSuccess = !!response.data && !response.error;
|
|
1102
|
-
emitLog(
|
|
1103
|
-
PollarStateVar.LOGIN,
|
|
1104
|
-
isSuccess ? successCode : errorCode,
|
|
1105
|
-
isSuccess ? "info" : "error",
|
|
1106
|
-
isSuccess ? StateStatus.LOADING : StateStatus.ERROR,
|
|
1107
|
-
isSuccess ? response.data : response.error
|
|
1108
|
-
);
|
|
1109
|
-
return isSuccess;
|
|
1110
|
-
};
|
|
1111
1122
|
async function login(options, deps) {
|
|
1112
1123
|
const { api, basePath, apiKey, signal, emitState, storeSession, clearSession } = deps;
|
|
1113
|
-
emitState(
|
|
1124
|
+
emitState("authentication", STATE_VAR_CODES.authentication.CREATE_SESSION_START, "info", StateStatus.LOADING);
|
|
1114
1125
|
const createSessionResponse = await api.POST("/auth/session", { signal });
|
|
1115
1126
|
if (!emitResponse(
|
|
1127
|
+
PollarStateVar.AUTHENTICATION,
|
|
1116
1128
|
createSessionResponse,
|
|
1117
|
-
STATE_VAR_CODES
|
|
1118
|
-
STATE_VAR_CODES
|
|
1129
|
+
{ code: STATE_VAR_CODES.authentication.CREATE_SESSION_SUCCESS },
|
|
1130
|
+
STATE_VAR_CODES.authentication.CREATE_SESSION_ERROR,
|
|
1119
1131
|
emitState
|
|
1120
1132
|
)) {
|
|
1121
1133
|
return;
|
|
@@ -1123,7 +1135,7 @@ async function login(options, deps) {
|
|
|
1123
1135
|
const clientSessionId = createSessionResponse.data.content.clientSessionId;
|
|
1124
1136
|
switch (options.provider) {
|
|
1125
1137
|
case "email": {
|
|
1126
|
-
emitState(
|
|
1138
|
+
emitState("authentication", STATE_VAR_CODES.authentication.EMAIL_AUTH_START, "info", StateStatus.LOADING, {
|
|
1127
1139
|
email: options.email
|
|
1128
1140
|
});
|
|
1129
1141
|
const emailRes = await api.POST(`/auth/email`, {
|
|
@@ -1131,9 +1143,10 @@ async function login(options, deps) {
|
|
|
1131
1143
|
signal
|
|
1132
1144
|
});
|
|
1133
1145
|
if (!emitResponse(
|
|
1146
|
+
PollarStateVar.AUTHENTICATION,
|
|
1134
1147
|
emailRes,
|
|
1135
|
-
STATE_VAR_CODES
|
|
1136
|
-
STATE_VAR_CODES
|
|
1148
|
+
{ code: STATE_VAR_CODES.authentication.EMAIL_AUTH_START_SUCCESS },
|
|
1149
|
+
STATE_VAR_CODES.authentication.EMAIL_AUTH_START_ERROR,
|
|
1137
1150
|
emitState
|
|
1138
1151
|
)) {
|
|
1139
1152
|
return;
|
|
@@ -1151,15 +1164,15 @@ async function login(options, deps) {
|
|
|
1151
1164
|
}
|
|
1152
1165
|
case "wallet": {
|
|
1153
1166
|
try {
|
|
1154
|
-
emitState(
|
|
1167
|
+
emitState("authentication", STATE_VAR_CODES.authentication.WALLET_AUTH_START, "info", StateStatus.LOADING, {
|
|
1155
1168
|
adapter: options.type
|
|
1156
1169
|
});
|
|
1157
1170
|
const adapter = options.type === "freighter" /* FREIGHTER */ ? new FreighterAdapter() : new AlbedoAdapter();
|
|
1158
1171
|
const available = await withSignal(adapter.isAvailable(), signal);
|
|
1159
1172
|
if (!available) {
|
|
1160
1173
|
emitState(
|
|
1161
|
-
|
|
1162
|
-
options.type === "freighter" /* FREIGHTER */ ? STATE_VAR_CODES
|
|
1174
|
+
"authentication",
|
|
1175
|
+
options.type === "freighter" /* FREIGHTER */ ? STATE_VAR_CODES.authentication.WALLET_AUTH_FREIGHTER_NOT_INSTALLED : STATE_VAR_CODES.authentication.WALLET_AUTH_ALBEDO_NOT_INSTALLED,
|
|
1163
1176
|
"info",
|
|
1164
1177
|
StateStatus.LOADING,
|
|
1165
1178
|
{
|
|
@@ -1168,47 +1181,36 @@ async function login(options, deps) {
|
|
|
1168
1181
|
);
|
|
1169
1182
|
}
|
|
1170
1183
|
const { publicKey } = await withSignal(adapter.connect(), signal);
|
|
1171
|
-
emitState(
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
}
|
|
1180
|
-
);
|
|
1181
|
-
emitState(
|
|
1182
|
-
PollarStateVar.LOGIN,
|
|
1183
|
-
STATE_VAR_CODES[PollarStateVar.LOGIN].WALLET_AUTH_LOGIN_START,
|
|
1184
|
-
"info",
|
|
1185
|
-
StateStatus.LOADING,
|
|
1186
|
-
{
|
|
1187
|
-
adapter: options.type,
|
|
1188
|
-
publicKey
|
|
1189
|
-
}
|
|
1190
|
-
);
|
|
1184
|
+
emitState("authentication", STATE_VAR_CODES.authentication.WALLET_AUTH_CONNECTED, "info", StateStatus.LOADING, {
|
|
1185
|
+
adapter: options.type,
|
|
1186
|
+
publicKey
|
|
1187
|
+
});
|
|
1188
|
+
emitState("authentication", STATE_VAR_CODES.authentication.WALLET_AUTH_LOGIN_START, "info", StateStatus.LOADING, {
|
|
1189
|
+
adapter: options.type,
|
|
1190
|
+
publicKey
|
|
1191
|
+
});
|
|
1191
1192
|
const emailRes = await api.POST(`/auth/wallet`, {
|
|
1192
1193
|
body: { clientSessionId, walletAddress: publicKey },
|
|
1193
1194
|
signal
|
|
1194
1195
|
});
|
|
1195
1196
|
if (!emitResponse(
|
|
1197
|
+
PollarStateVar.AUTHENTICATION,
|
|
1196
1198
|
emailRes,
|
|
1197
|
-
STATE_VAR_CODES
|
|
1198
|
-
STATE_VAR_CODES
|
|
1199
|
+
{ code: STATE_VAR_CODES.authentication.WALLET_AUTH_LOGIN_START_SUCCESS },
|
|
1200
|
+
STATE_VAR_CODES.authentication.WALLET_AUTH_LOGIN_START_ERROR,
|
|
1199
1201
|
emitState
|
|
1200
1202
|
)) {
|
|
1201
1203
|
return;
|
|
1202
1204
|
}
|
|
1203
1205
|
} catch (error2) {
|
|
1204
|
-
emitState(
|
|
1206
|
+
emitState("authentication", STATE_VAR_CODES.authentication.WALLET_AUTH_ERROR, "error", StateStatus.ERROR, {
|
|
1205
1207
|
clientSessionId
|
|
1206
1208
|
});
|
|
1207
1209
|
}
|
|
1208
1210
|
break;
|
|
1209
1211
|
}
|
|
1210
1212
|
}
|
|
1211
|
-
emitState(
|
|
1213
|
+
emitState("authentication", STATE_VAR_CODES.authentication.STREAM_POLL_START, "info", StateStatus.LOADING, {
|
|
1212
1214
|
clientSessionId
|
|
1213
1215
|
});
|
|
1214
1216
|
await streamUntilFound(
|
|
@@ -1217,12 +1219,12 @@ async function login(options, deps) {
|
|
|
1217
1219
|
(data2) => {
|
|
1218
1220
|
const status = data2?.status;
|
|
1219
1221
|
if (status === "READY") {
|
|
1220
|
-
emitState(
|
|
1222
|
+
emitState("authentication", STATE_VAR_CODES.authentication.STREAM_POLL_READY, "info", StateStatus.LOADING);
|
|
1221
1223
|
return true;
|
|
1222
1224
|
}
|
|
1223
1225
|
emitState(
|
|
1224
|
-
|
|
1225
|
-
STATE_VAR_CODES
|
|
1226
|
+
"authentication",
|
|
1227
|
+
STATE_VAR_CODES.authentication.STREAM_POLL_EVENT + (status ? `/${status}` : ""),
|
|
1226
1228
|
"info",
|
|
1227
1229
|
StateStatus.LOADING,
|
|
1228
1230
|
data2
|
|
@@ -1232,16 +1234,16 @@ async function login(options, deps) {
|
|
|
1232
1234
|
200,
|
|
1233
1235
|
signal
|
|
1234
1236
|
);
|
|
1235
|
-
emitState(
|
|
1237
|
+
emitState("authentication", STATE_VAR_CODES.authentication.FETCH_SESSION_START, "info", StateStatus.LOADING);
|
|
1236
1238
|
const { data, error } = await api.POST(`/auth/login`, {
|
|
1237
1239
|
body: { clientSessionId },
|
|
1238
1240
|
signal
|
|
1239
1241
|
});
|
|
1240
1242
|
if (data?.code === "SDK_LOGIN_SUCCESS" && isValidSession(data?.content)) {
|
|
1241
|
-
emitState(
|
|
1243
|
+
emitState("authentication", STATE_VAR_CODES.authentication.FETCH_SESSION_SUCCESS, "info", StateStatus.SUCCESS);
|
|
1242
1244
|
storeSession(data.content);
|
|
1243
1245
|
} else {
|
|
1244
|
-
emitState(
|
|
1246
|
+
emitState("authentication", STATE_VAR_CODES.authentication.FETCH_SESSION_ERROR, "error", StateStatus.ERROR, {
|
|
1245
1247
|
error,
|
|
1246
1248
|
data
|
|
1247
1249
|
});
|
|
@@ -1261,8 +1263,8 @@ var PollarClient = class {
|
|
|
1261
1263
|
this._session = null;
|
|
1262
1264
|
this._stateListeners = /* @__PURE__ */ new Set();
|
|
1263
1265
|
this._state = {
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
+
authentication: [],
|
|
1267
|
+
transaction: []
|
|
1266
1268
|
};
|
|
1267
1269
|
this.apiKey = config.apiKey;
|
|
1268
1270
|
this.id = crypto.randomUUID();
|
|
@@ -1319,11 +1321,11 @@ var PollarClient = class {
|
|
|
1319
1321
|
}).catch((error) => {
|
|
1320
1322
|
if (error instanceof Error && error.name === "AbortError") {
|
|
1321
1323
|
console.info("[PollarClient] Login aborted by user");
|
|
1322
|
-
this._emitState(
|
|
1324
|
+
this._emitState("authentication", STATE_VAR_CODES.authentication.ERROR_ABORTED, "error", StateStatus.ERROR);
|
|
1323
1325
|
return;
|
|
1324
1326
|
}
|
|
1325
1327
|
console.error("[PollarClient] Login failed with unexpected error", error);
|
|
1326
|
-
this._emitState(
|
|
1328
|
+
this._emitState("authentication", STATE_VAR_CODES.authentication.ERROR_UNKNOWN, "error", StateStatus.ERROR, {
|
|
1327
1329
|
error
|
|
1328
1330
|
});
|
|
1329
1331
|
});
|
|
@@ -1348,37 +1350,74 @@ var PollarClient = class {
|
|
|
1348
1350
|
body: { clientSessionId, code }
|
|
1349
1351
|
});
|
|
1350
1352
|
if (error || !data || data?.code !== "SDK_EMAIL_CODE_VERIFIED") {
|
|
1351
|
-
this._emitState(
|
|
1352
|
-
PollarStateVar.LOGIN,
|
|
1353
|
-
STATE_VAR_CODES[PollarStateVar.LOGIN].EMAIL_AUTH_CODE_ERROR,
|
|
1354
|
-
"error",
|
|
1355
|
-
StateStatus.ERROR,
|
|
1356
|
-
{
|
|
1357
|
-
data,
|
|
1358
|
-
error
|
|
1359
|
-
}
|
|
1360
|
-
);
|
|
1361
|
-
return;
|
|
1362
|
-
}
|
|
1363
|
-
this._emitState(
|
|
1364
|
-
PollarStateVar.LOGIN,
|
|
1365
|
-
STATE_VAR_CODES[PollarStateVar.LOGIN].EMAIL_AUTH_CODE_SUCCESS,
|
|
1366
|
-
"info",
|
|
1367
|
-
StateStatus.SUCCESS,
|
|
1368
|
-
{
|
|
1353
|
+
this._emitState("authentication", STATE_VAR_CODES.authentication.EMAIL_AUTH_CODE_ERROR, "error", StateStatus.ERROR, {
|
|
1369
1354
|
data,
|
|
1370
1355
|
error
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1356
|
+
});
|
|
1357
|
+
return;
|
|
1358
|
+
}
|
|
1359
|
+
this._emitState("authentication", STATE_VAR_CODES.authentication.EMAIL_AUTH_CODE_SUCCESS, "info", StateStatus.SUCCESS, {
|
|
1360
|
+
data,
|
|
1361
|
+
error
|
|
1362
|
+
});
|
|
1373
1363
|
} catch (error) {
|
|
1374
1364
|
this._emitState(
|
|
1375
|
-
|
|
1376
|
-
STATE_VAR_CODES
|
|
1365
|
+
"authentication",
|
|
1366
|
+
STATE_VAR_CODES.authentication.WALLET_AUTH_ALBEDO_NOT_INSTALLED,
|
|
1377
1367
|
"error",
|
|
1378
1368
|
StateStatus.ERROR
|
|
1379
1369
|
);
|
|
1380
1370
|
}
|
|
1381
1371
|
}
|
|
1372
|
+
async buildTx(operation, params, options) {
|
|
1373
|
+
if (!this._session?.wallet?.publicKey) {
|
|
1374
|
+
this._emitState("transaction", STATE_VAR_CODES.transaction.BUILD_TRANSACTION_ERROR_NO_WALLET, "error", StateStatus.ERROR);
|
|
1375
|
+
return;
|
|
1376
|
+
}
|
|
1377
|
+
const body = {
|
|
1378
|
+
network: "testnet",
|
|
1379
|
+
publicKey: this._session?.wallet?.publicKey,
|
|
1380
|
+
operation,
|
|
1381
|
+
params,
|
|
1382
|
+
options: options || {}
|
|
1383
|
+
};
|
|
1384
|
+
try {
|
|
1385
|
+
this._emitState("transaction", STATE_VAR_CODES.transaction.BUILD_TRANSACTION_START, "info", StateStatus.LOADING);
|
|
1386
|
+
const response = await this._api.POST("/tx/build", { body });
|
|
1387
|
+
console.log({ response });
|
|
1388
|
+
if (!emitResponse(
|
|
1389
|
+
PollarStateVar.TRANSACTION,
|
|
1390
|
+
response,
|
|
1391
|
+
{ code: STATE_VAR_CODES.transaction.BUILD_TRANSACTION_SUCCESS, status: StateStatus.SUCCESS },
|
|
1392
|
+
STATE_VAR_CODES.transaction.BUILD_TRANSACTION_ERROR,
|
|
1393
|
+
this._emitState.bind(this)
|
|
1394
|
+
)) {
|
|
1395
|
+
return;
|
|
1396
|
+
}
|
|
1397
|
+
} catch (error) {
|
|
1398
|
+
this._emitState("transaction", STATE_VAR_CODES.transaction.BUILD_TRANSACTION_ERROR, "error", StateStatus.ERROR, {
|
|
1399
|
+
body,
|
|
1400
|
+
error
|
|
1401
|
+
});
|
|
1402
|
+
return;
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
async submitTx(signedXdr) {
|
|
1406
|
+
try {
|
|
1407
|
+
console.info("[PollarClient] Submitting signed transaction");
|
|
1408
|
+
const { data, error } = await this._api.POST("/tx/submit", { body: { signedXdr } });
|
|
1409
|
+
if (error || !data?.success) {
|
|
1410
|
+
const msg = error?.message ?? data?.error ?? "Failed to submit transaction";
|
|
1411
|
+
console.warn("[PollarClient] submitTx error \u2014", msg);
|
|
1412
|
+
return { success: false, error: msg };
|
|
1413
|
+
}
|
|
1414
|
+
return { success: true, ...data.content };
|
|
1415
|
+
} catch (err) {
|
|
1416
|
+
const msg = err instanceof Error ? err.message : "Network error";
|
|
1417
|
+
console.warn("[PollarClient] submitTx network error \u2014", msg);
|
|
1418
|
+
return { success: false, error: msg };
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1382
1421
|
logout() {
|
|
1383
1422
|
if (!isBrowser) {
|
|
1384
1423
|
warnServerSide("logout");
|
|
@@ -1391,20 +1430,15 @@ var PollarClient = class {
|
|
|
1391
1430
|
this._session = readStorage();
|
|
1392
1431
|
if (this._session) {
|
|
1393
1432
|
this._emitState(
|
|
1394
|
-
|
|
1395
|
-
STATE_VAR_CODES
|
|
1433
|
+
"authentication",
|
|
1434
|
+
STATE_VAR_CODES.authentication.RESTORED_SESSION_SUCCESS,
|
|
1396
1435
|
"info",
|
|
1397
1436
|
StateStatus.SUCCESS,
|
|
1398
1437
|
this._session
|
|
1399
1438
|
);
|
|
1400
1439
|
console.info("[PollarClient] Session restored from storage");
|
|
1401
1440
|
} else {
|
|
1402
|
-
this._emitState(
|
|
1403
|
-
PollarStateVar.WALLET_ADDRESS,
|
|
1404
|
-
STATE_VAR_CODES[PollarStateVar.WALLET_ADDRESS].REMOVED_ADDRESS,
|
|
1405
|
-
"info",
|
|
1406
|
-
StateStatus.SUCCESS
|
|
1407
|
-
);
|
|
1441
|
+
this._emitState("authentication", STATE_VAR_CODES.authentication.RESTORED_SESSION_SUCCESS, "warn", StateStatus.ERROR);
|
|
1408
1442
|
console.info("[PollarClient] Session NO restored from storage");
|
|
1409
1443
|
}
|
|
1410
1444
|
}
|
|
@@ -1413,8 +1447,8 @@ var PollarClient = class {
|
|
|
1413
1447
|
this._session = session;
|
|
1414
1448
|
writeStorage(session);
|
|
1415
1449
|
this._emitState(
|
|
1416
|
-
|
|
1417
|
-
STATE_VAR_CODES
|
|
1450
|
+
"authentication",
|
|
1451
|
+
STATE_VAR_CODES.authentication.SESSION_STORED,
|
|
1418
1452
|
"info",
|
|
1419
1453
|
StateStatus.SUCCESS,
|
|
1420
1454
|
this._session
|
|
@@ -1425,16 +1459,10 @@ var PollarClient = class {
|
|
|
1425
1459
|
this._session = null;
|
|
1426
1460
|
removeStorage();
|
|
1427
1461
|
this._state = {
|
|
1428
|
-
|
|
1429
|
-
|
|
1462
|
+
authentication: [],
|
|
1463
|
+
transaction: []
|
|
1430
1464
|
};
|
|
1431
|
-
this._emitState(
|
|
1432
|
-
this._emitState(
|
|
1433
|
-
PollarStateVar.WALLET_ADDRESS,
|
|
1434
|
-
STATE_VAR_CODES[PollarStateVar.WALLET_ADDRESS].REMOVED_ADDRESS,
|
|
1435
|
-
"info",
|
|
1436
|
-
StateStatus.NONE
|
|
1437
|
-
);
|
|
1465
|
+
this._emitState("authentication", STATE_VAR_CODES.authentication.LOGOUT, "info", StateStatus.NONE);
|
|
1438
1466
|
}
|
|
1439
1467
|
_emitState(fn, code, level, status, data) {
|
|
1440
1468
|
const stateEntry = { var: fn, code, level, data, status, ts: Date.now() };
|
|
@@ -1485,7 +1513,6 @@ var StellarClient = class {
|
|
|
1485
1513
|
exports.AlbedoAdapter = AlbedoAdapter;
|
|
1486
1514
|
exports.FreighterAdapter = FreighterAdapter;
|
|
1487
1515
|
exports.PollarClient = PollarClient;
|
|
1488
|
-
exports.PollarError = PollarError;
|
|
1489
1516
|
exports.PollarStateVar = PollarStateVar;
|
|
1490
1517
|
exports.STATE_VAR_CODES = STATE_VAR_CODES;
|
|
1491
1518
|
exports.StateStatus = StateStatus;
|