@getpara/core-sdk 2.24.0 → 2.26.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/cjs/ParaCore.js +12 -0
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/services/ExternalWalletService.js +0 -3
- package/dist/cjs/services/WalletService.js +8 -1
- package/dist/cjs/shares/enclave.js +3 -3
- package/dist/cjs/state/machines/authStateMachine.js +3 -0
- package/dist/cjs/types/coreApi.js +1 -0
- package/dist/cjs/utils/formatting.js +5 -0
- package/dist/esm/ParaCore.js +12 -0
- package/dist/esm/constants.js +1 -1
- package/dist/esm/services/ExternalWalletService.js +0 -3
- package/dist/esm/services/WalletService.js +8 -1
- package/dist/esm/shares/enclave.js +3 -3
- package/dist/esm/state/machines/authStateMachine.js +3 -0
- package/dist/esm/types/coreApi.js +1 -0
- package/dist/esm/utils/formatting.js +4 -0
- package/dist/types/ParaCore.d.ts +9 -1
- package/dist/types/services/WalletService.d.ts +2 -1
- package/dist/types/services/types/WalletServiceTypes.d.ts +12 -0
- package/dist/types/state/machines/authStateMachine.d.ts +6 -0
- package/dist/types/state/machines/coreStateMachine.d.ts +36 -0
- package/dist/types/state/types/auth.d.ts +2 -0
- package/dist/types/types/coreApi.d.ts +6 -2
- package/dist/types/utils/formatting.d.ts +1 -0
- package/package.json +3 -3
package/dist/cjs/ParaCore.js
CHANGED
|
@@ -2159,6 +2159,18 @@ const _ParaCore = class _ParaCore {
|
|
|
2159
2159
|
return yield __privateGet(this, _walletService).getWalletBalance(params);
|
|
2160
2160
|
});
|
|
2161
2161
|
}
|
|
2162
|
+
/**
|
|
2163
|
+
* Requests testnet funds from the faucet for the specified wallet.
|
|
2164
|
+
* @param {RequestFaucetParams} params the options object.
|
|
2165
|
+
* @param {string} params.walletId the id of the wallet to fund.
|
|
2166
|
+
* @param {string} [params.chain] optional chain identifier to target a specific testnet.
|
|
2167
|
+
* @returns the faucet transaction details, including the transaction hash and amount sent.
|
|
2168
|
+
*/
|
|
2169
|
+
requestFaucet(params) {
|
|
2170
|
+
return __async(this, null, function* () {
|
|
2171
|
+
return yield __privateGet(this, _walletService).requestFaucet(params);
|
|
2172
|
+
});
|
|
2173
|
+
}
|
|
2162
2174
|
/**
|
|
2163
2175
|
* Signs a message using one of the current wallets.
|
|
2164
2176
|
*
|
package/dist/cjs/constants.js
CHANGED
|
@@ -46,7 +46,7 @@ __export(constants_exports, {
|
|
|
46
46
|
TRANSACTION_REVIEW_TIMEOUT_MS: () => TRANSACTION_REVIEW_TIMEOUT_MS
|
|
47
47
|
});
|
|
48
48
|
module.exports = __toCommonJS(constants_exports);
|
|
49
|
-
const PARA_CORE_VERSION = "2.
|
|
49
|
+
const PARA_CORE_VERSION = "2.26.0";
|
|
50
50
|
const PREFIX = "@CAPSULE/";
|
|
51
51
|
const PARA_PREFIX = "@PARA/";
|
|
52
52
|
const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
|
|
@@ -160,9 +160,6 @@ class ExternalWalletService {
|
|
|
160
160
|
for (const type of types) {
|
|
161
161
|
const providerInterface = this.externalWalletProviderInterfaces[type];
|
|
162
162
|
if (!providerInterface) {
|
|
163
|
-
console.warn(
|
|
164
|
-
`External wallet provider interface for type ${type} is not initialized. Para connector will not be connected.`
|
|
165
|
-
);
|
|
166
163
|
continue;
|
|
167
164
|
}
|
|
168
165
|
try {
|
|
@@ -183,6 +183,8 @@ class WalletService {
|
|
|
183
183
|
yield this.setCurrentWalletIds(updatedWalletIds, options);
|
|
184
184
|
});
|
|
185
185
|
this.setCurrentWalletIds = (_0, ..._1) => __async(this, [_0, ..._1], function* (currentWalletIds, { needsWallet = false, sessionLookupId, newDeviceSessionLookupId } = {}) {
|
|
186
|
+
var _a;
|
|
187
|
+
const hasChanged = JSON.stringify((_a = this.currentWalletIds) != null ? _a : {}) !== JSON.stringify(currentWalletIds != null ? currentWalletIds : {});
|
|
186
188
|
this.currentWalletIds = currentWalletIds;
|
|
187
189
|
yield __privateGet(this, _paraCoreInterface).localStorageSetItem(
|
|
188
190
|
import_constants.LOCAL_STORAGE_CURRENT_WALLET_IDS,
|
|
@@ -197,7 +199,9 @@ class WalletService {
|
|
|
197
199
|
newDeviceSessionLookupId
|
|
198
200
|
);
|
|
199
201
|
}
|
|
200
|
-
(
|
|
202
|
+
if (hasChanged) {
|
|
203
|
+
(0, import_utils.dispatchEvent)(import_events.ParaEvent.WALLETS_CHANGE_EVENT, null);
|
|
204
|
+
}
|
|
201
205
|
});
|
|
202
206
|
this.createWallet = (..._0) => __async(this, [..._0], function* ({ type: _type, skipDistribute = false } = {}) {
|
|
203
207
|
var _a, _b;
|
|
@@ -449,6 +453,9 @@ class WalletService {
|
|
|
449
453
|
this.getWalletBalance = (_0) => __async(this, [_0], function* ({ walletId, rpcUrl }) {
|
|
450
454
|
return (yield __privateGet(this, _paraCoreInterface).ctx.client.getWalletBalance({ walletId, rpcUrl })).balance;
|
|
451
455
|
});
|
|
456
|
+
this.requestFaucet = (_0) => __async(this, [_0], function* ({ walletId, chain }) {
|
|
457
|
+
return yield __privateGet(this, _paraCoreInterface).ctx.client.requestFaucet({ walletId, chain });
|
|
458
|
+
});
|
|
452
459
|
__privateAdd(this, _encodeWalletBase64, (wallet) => {
|
|
453
460
|
const walletJson = JSON.stringify(wallet);
|
|
454
461
|
const base64Wallet = Buffer.from(walletJson).toString("base64");
|
|
@@ -244,7 +244,7 @@ ${exportedAsBase64}
|
|
|
244
244
|
const response = yield this.userManagementClient.retrieveEnclaveShares(encryptedPayloadStr);
|
|
245
245
|
const encryptedResponse = JSON.parse(response.payload);
|
|
246
246
|
const decryptedData = yield this.decryptForFrontend(encryptedResponse);
|
|
247
|
-
return decryptedData.shares;
|
|
247
|
+
return Array.isArray(decryptedData == null ? void 0 : decryptedData.shares) ? decryptedData.shares : [];
|
|
248
248
|
});
|
|
249
249
|
}
|
|
250
250
|
deleteShares() {
|
|
@@ -286,13 +286,13 @@ ${exportedAsBase64}
|
|
|
286
286
|
};
|
|
287
287
|
const encryptedPayload = yield this.encryptForEnclave(JSON.stringify(payload));
|
|
288
288
|
const encryptedPayloadStr = JSON.stringify(encryptedPayload);
|
|
289
|
-
const response = yield this.userManagementClient.getPregenShares(encryptedPayloadStr);
|
|
289
|
+
const response = yield this.userManagementClient.getPregenShares(encryptedPayloadStr, query.walletIds);
|
|
290
290
|
if (!response.payload) {
|
|
291
291
|
return [];
|
|
292
292
|
}
|
|
293
293
|
const encryptedResponse = JSON.parse(response.payload);
|
|
294
294
|
const decryptedData = yield this.decryptForFrontend(encryptedResponse);
|
|
295
|
-
return decryptedData.shares;
|
|
295
|
+
return Array.isArray(decryptedData == null ? void 0 : decryptedData.shares) ? decryptedData.shares : [];
|
|
296
296
|
} catch (error) {
|
|
297
297
|
throw new Error(
|
|
298
298
|
`Failed to retrieve pregen shares for user ${query.userId}: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
@@ -27,6 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
28
|
var formatting_exports = {};
|
|
29
29
|
__export(formatting_exports, {
|
|
30
|
+
base58ToBase64: () => base58ToBase64,
|
|
30
31
|
compressPubkey: () => compressPubkey,
|
|
31
32
|
decimalToHex: () => decimalToHex,
|
|
32
33
|
getCosmosAddress: () => getCosmosAddress,
|
|
@@ -51,6 +52,9 @@ function hexStringToBase64(hexString) {
|
|
|
51
52
|
}
|
|
52
53
|
return Buffer.from(hexString, "hex").toString("base64");
|
|
53
54
|
}
|
|
55
|
+
function base58ToBase64(base58Str) {
|
|
56
|
+
return Buffer.from(base58Decode(base58Str)).toString("base64");
|
|
57
|
+
}
|
|
54
58
|
function hexToSignature(hexSig) {
|
|
55
59
|
return {
|
|
56
60
|
r: `0x${hexSig.slice(2, 66)}`,
|
|
@@ -202,6 +206,7 @@ function truncateAddress(str, addressType, {
|
|
|
202
206
|
}
|
|
203
207
|
// Annotate the CommonJS export names for ESM import in node:
|
|
204
208
|
0 && (module.exports = {
|
|
209
|
+
base58ToBase64,
|
|
205
210
|
compressPubkey,
|
|
206
211
|
decimalToHex,
|
|
207
212
|
getCosmosAddress,
|
package/dist/esm/ParaCore.js
CHANGED
|
@@ -2101,6 +2101,18 @@ const _ParaCore = class _ParaCore {
|
|
|
2101
2101
|
return yield __privateGet(this, _walletService).getWalletBalance(params);
|
|
2102
2102
|
});
|
|
2103
2103
|
}
|
|
2104
|
+
/**
|
|
2105
|
+
* Requests testnet funds from the faucet for the specified wallet.
|
|
2106
|
+
* @param {RequestFaucetParams} params the options object.
|
|
2107
|
+
* @param {string} params.walletId the id of the wallet to fund.
|
|
2108
|
+
* @param {string} [params.chain] optional chain identifier to target a specific testnet.
|
|
2109
|
+
* @returns the faucet transaction details, including the transaction hash and amount sent.
|
|
2110
|
+
*/
|
|
2111
|
+
requestFaucet(params) {
|
|
2112
|
+
return __async(this, null, function* () {
|
|
2113
|
+
return yield __privateGet(this, _walletService).requestFaucet(params);
|
|
2114
|
+
});
|
|
2115
|
+
}
|
|
2104
2116
|
/**
|
|
2105
2117
|
* Signs a message using one of the current wallets.
|
|
2106
2118
|
*
|
package/dist/esm/constants.js
CHANGED
|
@@ -102,9 +102,6 @@ class ExternalWalletService {
|
|
|
102
102
|
for (const type of types) {
|
|
103
103
|
const providerInterface = this.externalWalletProviderInterfaces[type];
|
|
104
104
|
if (!providerInterface) {
|
|
105
|
-
console.warn(
|
|
106
|
-
`External wallet provider interface for type ${type} is not initialized. Para connector will not be connected.`
|
|
107
|
-
);
|
|
108
105
|
continue;
|
|
109
106
|
}
|
|
110
107
|
try {
|
|
@@ -127,6 +127,8 @@ class WalletService {
|
|
|
127
127
|
yield this.setCurrentWalletIds(updatedWalletIds, options);
|
|
128
128
|
});
|
|
129
129
|
this.setCurrentWalletIds = (_0, ..._1) => __async(this, [_0, ..._1], function* (currentWalletIds, { needsWallet = false, sessionLookupId, newDeviceSessionLookupId } = {}) {
|
|
130
|
+
var _a;
|
|
131
|
+
const hasChanged = JSON.stringify((_a = this.currentWalletIds) != null ? _a : {}) !== JSON.stringify(currentWalletIds != null ? currentWalletIds : {});
|
|
130
132
|
this.currentWalletIds = currentWalletIds;
|
|
131
133
|
yield __privateGet(this, _paraCoreInterface).localStorageSetItem(
|
|
132
134
|
LOCAL_STORAGE_CURRENT_WALLET_IDS,
|
|
@@ -141,7 +143,9 @@ class WalletService {
|
|
|
141
143
|
newDeviceSessionLookupId
|
|
142
144
|
);
|
|
143
145
|
}
|
|
144
|
-
|
|
146
|
+
if (hasChanged) {
|
|
147
|
+
dispatchEvent(ParaEvent.WALLETS_CHANGE_EVENT, null);
|
|
148
|
+
}
|
|
145
149
|
});
|
|
146
150
|
this.createWallet = (..._0) => __async(this, [..._0], function* ({ type: _type, skipDistribute = false } = {}) {
|
|
147
151
|
var _a, _b;
|
|
@@ -393,6 +397,9 @@ class WalletService {
|
|
|
393
397
|
this.getWalletBalance = (_0) => __async(this, [_0], function* ({ walletId, rpcUrl }) {
|
|
394
398
|
return (yield __privateGet(this, _paraCoreInterface).ctx.client.getWalletBalance({ walletId, rpcUrl })).balance;
|
|
395
399
|
});
|
|
400
|
+
this.requestFaucet = (_0) => __async(this, [_0], function* ({ walletId, chain }) {
|
|
401
|
+
return yield __privateGet(this, _paraCoreInterface).ctx.client.requestFaucet({ walletId, chain });
|
|
402
|
+
});
|
|
396
403
|
__privateAdd(this, _encodeWalletBase64, (wallet) => {
|
|
397
404
|
const walletJson = JSON.stringify(wallet);
|
|
398
405
|
const base64Wallet = Buffer.from(walletJson).toString("base64");
|
|
@@ -205,7 +205,7 @@ ${exportedAsBase64}
|
|
|
205
205
|
const response = yield this.userManagementClient.retrieveEnclaveShares(encryptedPayloadStr);
|
|
206
206
|
const encryptedResponse = JSON.parse(response.payload);
|
|
207
207
|
const decryptedData = yield this.decryptForFrontend(encryptedResponse);
|
|
208
|
-
return decryptedData.shares;
|
|
208
|
+
return Array.isArray(decryptedData == null ? void 0 : decryptedData.shares) ? decryptedData.shares : [];
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
211
|
deleteShares() {
|
|
@@ -247,13 +247,13 @@ ${exportedAsBase64}
|
|
|
247
247
|
};
|
|
248
248
|
const encryptedPayload = yield this.encryptForEnclave(JSON.stringify(payload));
|
|
249
249
|
const encryptedPayloadStr = JSON.stringify(encryptedPayload);
|
|
250
|
-
const response = yield this.userManagementClient.getPregenShares(encryptedPayloadStr);
|
|
250
|
+
const response = yield this.userManagementClient.getPregenShares(encryptedPayloadStr, query.walletIds);
|
|
251
251
|
if (!response.payload) {
|
|
252
252
|
return [];
|
|
253
253
|
}
|
|
254
254
|
const encryptedResponse = JSON.parse(response.payload);
|
|
255
255
|
const decryptedData = yield this.decryptForFrontend(encryptedResponse);
|
|
256
|
-
return decryptedData.shares;
|
|
256
|
+
return Array.isArray(decryptedData == null ? void 0 : decryptedData.shares) ? decryptedData.shares : [];
|
|
257
257
|
} catch (error) {
|
|
258
258
|
throw new Error(
|
|
259
259
|
`Failed to retrieve pregen shares for user ${query.userId}: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
@@ -10,6 +10,9 @@ function hexStringToBase64(hexString) {
|
|
|
10
10
|
}
|
|
11
11
|
return Buffer.from(hexString, "hex").toString("base64");
|
|
12
12
|
}
|
|
13
|
+
function base58ToBase64(base58Str) {
|
|
14
|
+
return Buffer.from(base58Decode(base58Str)).toString("base64");
|
|
15
|
+
}
|
|
13
16
|
function hexToSignature(hexSig) {
|
|
14
17
|
return {
|
|
15
18
|
r: `0x${hexSig.slice(2, 66)}`,
|
|
@@ -160,6 +163,7 @@ function truncateAddress(str, addressType, {
|
|
|
160
163
|
return `${str.slice(0, minimum + margin)}...${str.slice(-1 * margin)}`;
|
|
161
164
|
}
|
|
162
165
|
export {
|
|
166
|
+
base58ToBase64,
|
|
163
167
|
compressPubkey,
|
|
164
168
|
decimalToHex,
|
|
165
169
|
getCosmosAddress,
|
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { pki as pkiType } from 'node-forge';
|
|
|
3
3
|
import { Ctx, Environment, Wallet, ConstructorOpts, CoreAuthInfo, CoreMethodParams, CoreMethodResponse, CoreInterface, AccountLinkInProgress, InternalMethodParams, InternalMethodResponse, OAuthResponse, AvailableWallet } from './types/index.js';
|
|
4
4
|
import { PlatformUtils } from './PlatformUtils.js';
|
|
5
5
|
import { AuthServiceInterface, ExternalWalletServiceInterface, PollingServiceInterface, PortalUrlServiceInterface, PregenWalletServiceInterface, SessionManagementServiceInterface, StateMachineInterface, WalletServiceInterface } from './types/serviceInterfaces.js';
|
|
6
|
-
import type { WaitForLoginParams, WaitForLoginResponse, WaitForSignupParams, WaitForWalletCreationParams, VerifyFarcasterParams, VerifyFarcasterResponse, VerifyNewAccountParams, VerifyTelegramParams, AddCredentialParams, GetNewCredentialAndUrlParams, GetNewCredentialAndUrlResponse, LoginExternalWalletParams, ResendVerificationCodeParams, SignUpOrLogInParams, VerifyOAuthProcessParams, VerifyOAuthProcessResponse, GetLoginUrlParams, GetOAuthUrlParams, PortalUrlOptions, PortalUrlType, ClaimPregenWalletsParams, CreatePregenWalletParams, CreatePregenWalletPerTypeParams, GetPregenWalletsParams, HasPregenWalletParams, UpdatePregenWalletIdentifierParams, CreateWalletParams, CreateWalletPerTypeParams, DistributeNewWalletShareParams, FindWalletByAddressParams, FindWalletIdParams, FindWalletParams, GetDisplayAddressParams, GetIdenticonHashParams, GetWalletBalanceParams, GetWalletsByTypeParams, RefreshShareParams, SetCurrentWalletIdsParams, SetWalletsParams, RefreshSessionParams, VerifyExternalWalletParams, InitExternalWalletProviderParams, ConnectExternalWalletParams, ExternalSignMessageParams, AuthenticateWithEmailOrPhoneParams, AuthenticateWithOAuthParams } from './services/types';
|
|
6
|
+
import type { WaitForLoginParams, WaitForLoginResponse, WaitForSignupParams, WaitForWalletCreationParams, VerifyFarcasterParams, VerifyFarcasterResponse, VerifyNewAccountParams, VerifyTelegramParams, AddCredentialParams, GetNewCredentialAndUrlParams, GetNewCredentialAndUrlResponse, LoginExternalWalletParams, ResendVerificationCodeParams, SignUpOrLogInParams, VerifyOAuthProcessParams, VerifyOAuthProcessResponse, GetLoginUrlParams, GetOAuthUrlParams, PortalUrlOptions, PortalUrlType, ClaimPregenWalletsParams, CreatePregenWalletParams, CreatePregenWalletPerTypeParams, GetPregenWalletsParams, HasPregenWalletParams, UpdatePregenWalletIdentifierParams, CreateWalletParams, CreateWalletPerTypeParams, DistributeNewWalletShareParams, FindWalletByAddressParams, FindWalletIdParams, FindWalletParams, GetDisplayAddressParams, GetIdenticonHashParams, GetWalletBalanceParams, GetWalletsByTypeParams, RequestFaucetParams, RequestFaucetResponse, RefreshShareParams, SetCurrentWalletIdsParams, SetWalletsParams, RefreshSessionParams, VerifyExternalWalletParams, InitExternalWalletProviderParams, ConnectExternalWalletParams, ExternalSignMessageParams, AuthenticateWithEmailOrPhoneParams, AuthenticateWithOAuthParams } from './services/types';
|
|
7
7
|
import { CorePhase, StateSnapshot } from './state/types/core.js';
|
|
8
8
|
import { AuthPhase } from './state/types/auth.js';
|
|
9
9
|
import { WalletPhase } from './state/types/wallet.js';
|
|
@@ -746,6 +746,14 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
746
746
|
private getTransactionReviewUrl;
|
|
747
747
|
private getOnRampTransactionUrl;
|
|
748
748
|
getWalletBalance(params: GetWalletBalanceParams): Promise<string>;
|
|
749
|
+
/**
|
|
750
|
+
* Requests testnet funds from the faucet for the specified wallet.
|
|
751
|
+
* @param {RequestFaucetParams} params the options object.
|
|
752
|
+
* @param {string} params.walletId the id of the wallet to fund.
|
|
753
|
+
* @param {string} [params.chain] optional chain identifier to target a specific testnet.
|
|
754
|
+
* @returns the faucet transaction details, including the transaction hash and amount sent.
|
|
755
|
+
*/
|
|
756
|
+
requestFaucet(params: RequestFaucetParams): Promise<RequestFaucetResponse>;
|
|
749
757
|
/**
|
|
750
758
|
* Signs a message using one of the current wallets.
|
|
751
759
|
*
|
|
@@ -5,7 +5,7 @@ import { AuthService } from './AuthService.js';
|
|
|
5
5
|
import { PollingService } from './PollingService.js';
|
|
6
6
|
import { PregenWalletService } from './PregenWalletService.js';
|
|
7
7
|
import { ExternalWalletService } from './ExternalWalletService.js';
|
|
8
|
-
import type { AssertIsValidWalletIdMethod, AssertIsValidWalletTypeMethod, CreateWalletMethod, CreateWalletPerTypeMethod, DistributeNewWalletShareMethod, FetchWalletsMethod, FindWalletByAddressMethod, FindWalletIdMethod, FindWalletMethod, GetDisplayAddressMethod, GetIdenticonHashMethod, GetTypesToCreateMethod, GetUserShareMethod, GetWalletBalanceMethod, GetWalletsByTypeMethod, IsWalletOwnedMethod, IsWalletSupportedMethod, IsWalletUsableMethod, RefreshShareMethod, SetCurrentWalletIdsMethod, SetUserShareMethod, SetWalletsMethod } from './types/WalletServiceTypes.js';
|
|
8
|
+
import type { AssertIsValidWalletIdMethod, AssertIsValidWalletTypeMethod, CreateWalletMethod, CreateWalletPerTypeMethod, DistributeNewWalletShareMethod, FetchWalletsMethod, FindWalletByAddressMethod, FindWalletIdMethod, FindWalletMethod, GetDisplayAddressMethod, GetIdenticonHashMethod, GetTypesToCreateMethod, GetUserShareMethod, GetWalletBalanceMethod, GetWalletsByTypeMethod, RequestFaucetMethod, IsWalletOwnedMethod, IsWalletSupportedMethod, IsWalletUsableMethod, RefreshShareMethod, SetCurrentWalletIdsMethod, SetUserShareMethod, SetWalletsMethod } from './types/WalletServiceTypes.js';
|
|
9
9
|
export declare class WalletService {
|
|
10
10
|
#private;
|
|
11
11
|
get wallets(): Record<string, Wallet>;
|
|
@@ -48,6 +48,7 @@ export declare class WalletService {
|
|
|
48
48
|
assertIsValidWalletType: AssertIsValidWalletTypeMethod;
|
|
49
49
|
fetchWallets: FetchWalletsMethod;
|
|
50
50
|
getWalletBalance: GetWalletBalanceMethod;
|
|
51
|
+
requestFaucet: RequestFaucetMethod;
|
|
51
52
|
getUserShare: GetUserShareMethod;
|
|
52
53
|
setUserShare: SetUserShareMethod;
|
|
53
54
|
distributeNewWalletShare: DistributeNewWalletShareMethod;
|
|
@@ -106,4 +106,16 @@ export interface DistributeNewWalletShareParams {
|
|
|
106
106
|
forceRefresh?: boolean;
|
|
107
107
|
}
|
|
108
108
|
export type DistributeNewWalletShareMethod = (_: DistributeNewWalletShareParams) => Promise<string>;
|
|
109
|
+
export interface RequestFaucetParams {
|
|
110
|
+
walletId: string;
|
|
111
|
+
chain?: string;
|
|
112
|
+
}
|
|
113
|
+
export interface RequestFaucetResponse {
|
|
114
|
+
transactionHash: string;
|
|
115
|
+
amount: string;
|
|
116
|
+
chain: string;
|
|
117
|
+
walletId: string;
|
|
118
|
+
address: string;
|
|
119
|
+
}
|
|
120
|
+
export type RequestFaucetMethod = (_: RequestFaucetParams) => Promise<RequestFaucetResponse>;
|
|
109
121
|
export {};
|
|
@@ -625,6 +625,12 @@ export declare function createAuthStateMachine(paraCoreInterface: StateMachineIn
|
|
|
625
625
|
isLegacy: false;
|
|
626
626
|
retryAttempts: {};
|
|
627
627
|
};
|
|
628
|
+
readonly on: {
|
|
629
|
+
readonly LOGOUT: {
|
|
630
|
+
readonly target: ".unauthenticated";
|
|
631
|
+
readonly actions: readonly ["resetState"];
|
|
632
|
+
};
|
|
633
|
+
};
|
|
628
634
|
readonly states: {
|
|
629
635
|
readonly checking_state: {
|
|
630
636
|
readonly invoke: {
|
|
@@ -625,6 +625,12 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
|
|
|
625
625
|
isLegacy: false;
|
|
626
626
|
retryAttempts: {};
|
|
627
627
|
};
|
|
628
|
+
readonly on: {
|
|
629
|
+
readonly LOGOUT: {
|
|
630
|
+
readonly target: ".unauthenticated";
|
|
631
|
+
readonly actions: readonly ["resetState"];
|
|
632
|
+
};
|
|
633
|
+
};
|
|
628
634
|
readonly states: {
|
|
629
635
|
readonly checking_state: {
|
|
630
636
|
readonly invoke: {
|
|
@@ -4256,6 +4262,12 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
|
|
|
4256
4262
|
isLegacy: false;
|
|
4257
4263
|
retryAttempts: {};
|
|
4258
4264
|
};
|
|
4265
|
+
readonly on: {
|
|
4266
|
+
readonly LOGOUT: {
|
|
4267
|
+
readonly target: ".unauthenticated";
|
|
4268
|
+
readonly actions: readonly ["resetState"];
|
|
4269
|
+
};
|
|
4270
|
+
};
|
|
4259
4271
|
readonly states: {
|
|
4260
4272
|
readonly checking_state: {
|
|
4261
4273
|
readonly invoke: {
|
|
@@ -7965,6 +7977,12 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
|
|
|
7965
7977
|
isLegacy: false;
|
|
7966
7978
|
retryAttempts: {};
|
|
7967
7979
|
};
|
|
7980
|
+
readonly on: {
|
|
7981
|
+
readonly LOGOUT: {
|
|
7982
|
+
readonly target: ".unauthenticated";
|
|
7983
|
+
readonly actions: readonly ["resetState"];
|
|
7984
|
+
};
|
|
7985
|
+
};
|
|
7968
7986
|
readonly states: {
|
|
7969
7987
|
readonly checking_state: {
|
|
7970
7988
|
readonly invoke: {
|
|
@@ -11612,6 +11630,12 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
|
|
|
11612
11630
|
isLegacy: false;
|
|
11613
11631
|
retryAttempts: {};
|
|
11614
11632
|
};
|
|
11633
|
+
readonly on: {
|
|
11634
|
+
readonly LOGOUT: {
|
|
11635
|
+
readonly target: ".unauthenticated";
|
|
11636
|
+
readonly actions: readonly ["resetState"];
|
|
11637
|
+
};
|
|
11638
|
+
};
|
|
11615
11639
|
readonly states: {
|
|
11616
11640
|
readonly checking_state: {
|
|
11617
11641
|
readonly invoke: {
|
|
@@ -15353,6 +15377,12 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
|
|
|
15353
15377
|
isLegacy: false;
|
|
15354
15378
|
retryAttempts: {};
|
|
15355
15379
|
};
|
|
15380
|
+
readonly on: {
|
|
15381
|
+
readonly LOGOUT: {
|
|
15382
|
+
readonly target: ".unauthenticated";
|
|
15383
|
+
readonly actions: readonly ["resetState"];
|
|
15384
|
+
};
|
|
15385
|
+
};
|
|
15356
15386
|
readonly states: {
|
|
15357
15387
|
readonly checking_state: {
|
|
15358
15388
|
readonly invoke: {
|
|
@@ -19001,6 +19031,12 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
|
|
|
19001
19031
|
isLegacy: false;
|
|
19002
19032
|
retryAttempts: {};
|
|
19003
19033
|
};
|
|
19034
|
+
readonly on: {
|
|
19035
|
+
readonly LOGOUT: {
|
|
19036
|
+
readonly target: ".unauthenticated";
|
|
19037
|
+
readonly actions: readonly ["resetState"];
|
|
19038
|
+
};
|
|
19039
|
+
};
|
|
19004
19040
|
readonly states: {
|
|
19005
19041
|
readonly checking_state: {
|
|
19006
19042
|
readonly invoke: {
|
|
@@ -3,8 +3,8 @@ import type { OAuthResponse, WithCustomTheme, WithUseShortUrls, Verify2faParams,
|
|
|
3
3
|
import { ParaCore } from '../ParaCore.js';
|
|
4
4
|
import { FullSignatureRes, Wallet } from './wallet.js';
|
|
5
5
|
import { AccountLinkInProgress } from './accountLinking.js';
|
|
6
|
-
import type { WaitForLoginParams, WaitForLoginResponse, WaitForSignupParams, WaitForWalletCreationParams, WaitForWalletCreationResponse, GetOAuthUrlParams, AddCredentialParams, LoginExternalWalletParams, LoginExternalWalletResponse, ResendVerificationCodeParams, SignUpOrLogInParams, SignUpOrLogInResponse, VerifyOAuthProcessParams, VerifyExternalWalletParams, VerifyExternalWalletResponse, VerifyFarcasterParams, VerifyTelegramParams, ClaimPregenWalletsParams, ClaimPregenWalletsResponse, CreateGuestWalletsResponse, CreatePregenWalletParams, CreatePregenWalletPerTypeParams, CreatePregenWalletPerTypeResponse, CreatePregenWalletResponse, CreateWalletParams, CreateWalletPerTypeParams, CreateWalletPerTypeResponse, CreateWalletResponse, DistributeNewWalletShareParams, GetPregenWalletsParams, GetPregenWalletsResponse, GetWalletBalanceParams, HasPregenWalletParams, PollingCallbacks, RefreshShareParams, RefreshShareResponse, UpdatePregenWalletIdentifierParams, BaseVerifyExternalWalletParams, AuthenticateWithEmailOrPhoneParams, AuthenticateWithEmailOrPhoneResponse, AuthenticateWithOAuthParams, AuthenticateWithOAuthResponse } from '../services/types';
|
|
7
|
-
export declare const PARA_CORE_METHODS: readonly ["getAuthInfo", "signUpOrLogIn", "verifyNewAccount", "waitForLogin", "waitForSignup", "waitForWalletCreation", "getOAuthUrl", "verifyOAuth", "getFarcasterConnectUri", "verifyFarcaster", "verifyTelegram", "resendVerificationCode", "loginExternalWallet", "verifyExternalWallet", "setup2fa", "enable2fa", "verify2fa", "logout", "clearStorage", "isSessionActive", "isFullyLoggedIn", "refreshSession", "keepSessionAlive", "exportSession", "waitAndExportSession", "importSession", "getVerificationToken", "getWallets", "getWalletsByType", "fetchWallets", "createWallet", "createWalletPerType", "getPregenWallets", "hasPregenWallet", "updatePregenWalletIdentifier", "createPregenWallet", "createPregenWalletPerType", "claimPregenWallets", "createGuestWallets", "distributeNewWalletShare", "getUserShare", "setUserShare", "refreshShare", "signMessage", "signTransaction", "initiateOnRampTransaction", "getWalletBalance", "issueJwt", "getLinkedAccounts", "accountLinkInProgress", "addCredential", "exportPrivateKey", "authenticateWithEmailOrPhone", "authenticateWithOAuth"];
|
|
6
|
+
import type { WaitForLoginParams, WaitForLoginResponse, WaitForSignupParams, WaitForWalletCreationParams, WaitForWalletCreationResponse, GetOAuthUrlParams, AddCredentialParams, LoginExternalWalletParams, LoginExternalWalletResponse, ResendVerificationCodeParams, SignUpOrLogInParams, SignUpOrLogInResponse, VerifyOAuthProcessParams, VerifyExternalWalletParams, VerifyExternalWalletResponse, VerifyFarcasterParams, VerifyTelegramParams, ClaimPregenWalletsParams, ClaimPregenWalletsResponse, CreateGuestWalletsResponse, CreatePregenWalletParams, CreatePregenWalletPerTypeParams, CreatePregenWalletPerTypeResponse, CreatePregenWalletResponse, CreateWalletParams, CreateWalletPerTypeParams, CreateWalletPerTypeResponse, CreateWalletResponse, DistributeNewWalletShareParams, GetPregenWalletsParams, GetPregenWalletsResponse, GetWalletBalanceParams, HasPregenWalletParams, PollingCallbacks, RefreshShareParams, RefreshShareResponse, RequestFaucetParams, RequestFaucetResponse, UpdatePregenWalletIdentifierParams, BaseVerifyExternalWalletParams, AuthenticateWithEmailOrPhoneParams, AuthenticateWithEmailOrPhoneResponse, AuthenticateWithOAuthParams, AuthenticateWithOAuthResponse } from '../services/types';
|
|
7
|
+
export declare const PARA_CORE_METHODS: readonly ["getAuthInfo", "signUpOrLogIn", "verifyNewAccount", "waitForLogin", "waitForSignup", "waitForWalletCreation", "getOAuthUrl", "verifyOAuth", "getFarcasterConnectUri", "verifyFarcaster", "verifyTelegram", "resendVerificationCode", "loginExternalWallet", "verifyExternalWallet", "setup2fa", "enable2fa", "verify2fa", "logout", "clearStorage", "isSessionActive", "isFullyLoggedIn", "refreshSession", "keepSessionAlive", "exportSession", "waitAndExportSession", "importSession", "getVerificationToken", "getWallets", "getWalletsByType", "fetchWallets", "createWallet", "createWalletPerType", "getPregenWallets", "hasPregenWallet", "updatePregenWalletIdentifier", "createPregenWallet", "createPregenWalletPerType", "claimPregenWallets", "createGuestWallets", "distributeNewWalletShare", "getUserShare", "setUserShare", "refreshShare", "signMessage", "signTransaction", "initiateOnRampTransaction", "getWalletBalance", "requestFaucet", "issueJwt", "getLinkedAccounts", "accountLinkInProgress", "addCredential", "exportPrivateKey", "authenticateWithEmailOrPhone", "authenticateWithOAuth"];
|
|
8
8
|
export declare const PARA_INTERNAL_METHODS: readonly ["linkAccount", "unlinkAccount", "verifyEmailOrPhoneLink", "verifyOAuthLink", "verifyFarcasterLink", "verifyTelegramLink", "verifyExternalWalletLink", "accountLinkInProgress", "prepareLogin", "sendLoginCode", "supportedUserAuthMethods"];
|
|
9
9
|
export type CoreMethodName = (typeof PARA_CORE_METHODS)[number];
|
|
10
10
|
export type CoreMethodParams<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
|
|
@@ -363,6 +363,10 @@ export type CoreMethods = Record<CoreMethodName, {
|
|
|
363
363
|
params: GetWalletBalanceParams;
|
|
364
364
|
response: string;
|
|
365
365
|
};
|
|
366
|
+
requestFaucet: {
|
|
367
|
+
params: RequestFaucetParams;
|
|
368
|
+
response: RequestFaucetResponse;
|
|
369
|
+
};
|
|
366
370
|
issueJwt: {
|
|
367
371
|
params: IssueJwtParams;
|
|
368
372
|
response: IssueJwtResponse;
|
|
@@ -6,6 +6,7 @@ export interface Signature {
|
|
|
6
6
|
v: bigint;
|
|
7
7
|
}
|
|
8
8
|
export declare function hexStringToBase64(hexString: string): string;
|
|
9
|
+
export declare function base58ToBase64(base58Str: string): string;
|
|
9
10
|
export declare function hexToSignature(hexSig: string): Signature;
|
|
10
11
|
export declare function hexToUint8Array(hex: string): Uint8Array;
|
|
11
12
|
export declare function hexToDecimal(hex: string): string;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.26.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@celo/utils": "^8.0.2",
|
|
6
6
|
"@cosmjs/encoding": "^0.32.4",
|
|
7
7
|
"@ethereumjs/util": "^9.1.0",
|
|
8
|
-
"@getpara/user-management-client": "2.
|
|
8
|
+
"@getpara/user-management-client": "2.26.0",
|
|
9
9
|
"@noble/hashes": "^1.5.0",
|
|
10
10
|
"axios": "^1.8.4",
|
|
11
11
|
"base64url": "^3.0.1",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dist",
|
|
31
31
|
"package.json"
|
|
32
32
|
],
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "02eb43f55b1c5f8bed6685940b6344551610f42a",
|
|
34
34
|
"main": "dist/cjs/index.js",
|
|
35
35
|
"module": "dist/esm/index.js",
|
|
36
36
|
"scripts": {
|