@pooflabs/core 0.0.44 → 0.0.46
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/client/config.d.ts +5 -0
- package/dist/index.js +58 -49
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -49
- package/dist/index.mjs.map +1 -1
- package/dist/utils/sol/poof4b5pk1L9tmThvBmaABjcyjfhFGbMbQP5BXk2QZpDevnet-program.d.ts +137 -1
- package/dist/utils/sol/poof4b5pk1L9tmThvBmaABjcyjfhFGbMbQP5BXk2QZpMainnet-program.d.ts +227 -31
- package/dist/utils/sol/sol-utils.d.ts +2 -3
- package/package.json +2 -2
package/dist/client/config.d.ts
CHANGED
|
@@ -23,10 +23,15 @@ export interface ClientConfig {
|
|
|
23
23
|
providers?: Array<'injected' | 'google' | 'apple' | 'phantom' | 'deeplink'>;
|
|
24
24
|
redirectUrl?: string;
|
|
25
25
|
autoConnect?: boolean;
|
|
26
|
+
/** Theme for the login modal: 'light' or 'dark'. Defaults to 'dark'. */
|
|
26
27
|
theme?: 'light' | 'dark';
|
|
27
28
|
appName?: string;
|
|
28
29
|
appIcon?: string;
|
|
29
30
|
enablePrivyFallback?: boolean;
|
|
31
|
+
/** Custom title shown at the top of the login modal. */
|
|
32
|
+
modalTitle?: string;
|
|
33
|
+
/** Custom subtitle shown below the title in the login modal. */
|
|
34
|
+
modalSubtitle?: string;
|
|
30
35
|
};
|
|
31
36
|
mobileWalletConfig?: {
|
|
32
37
|
appIdentity?: {
|
package/dist/index.js
CHANGED
|
@@ -3186,6 +3186,12 @@ async function genSolanaMessage(address, nonce) {
|
|
|
3186
3186
|
// Serialization Helpers
|
|
3187
3187
|
// ─────────────────────────────────────────────────────────────
|
|
3188
3188
|
function isHexString(value) {
|
|
3189
|
+
// Only strings can be hex-encoded. Numbers, BNs, and other shapes coming back
|
|
3190
|
+
// from the API for u64Val/i64Val should fall through to `new BN(value)` which
|
|
3191
|
+
// accepts those shapes natively. Without this guard, calling .startsWith on a
|
|
3192
|
+
// non-string blows up with TypeError.
|
|
3193
|
+
if (typeof value !== "string")
|
|
3194
|
+
return false;
|
|
3189
3195
|
// Matches strings containing only 0-9, a-f, or A-F (optionally prefixed with 0x)
|
|
3190
3196
|
let testValue = value;
|
|
3191
3197
|
// Handle negative values
|
|
@@ -3281,8 +3287,11 @@ async function buildSetDocumentsTransaction(connection, idl, anchorProvider, pay
|
|
|
3281
3287
|
}
|
|
3282
3288
|
else if (idl.address === "poof4b5pk1L9tmThvBmaABjcyjfhFGbMbQP5BXk2QZp") {
|
|
3283
3289
|
const program = new anchor.Program(idl, anchorProvider);
|
|
3290
|
+
// Targets `set_documents_v2` (Vec<u8> ra_indices). The on-chain program
|
|
3291
|
+
// also exposes the legacy `set_documents` (Vec<u64>) so SDKs already on npm
|
|
3292
|
+
// continue to work — but new releases of this SDK speak v2 only.
|
|
3284
3293
|
tx = await program.methods
|
|
3285
|
-
.
|
|
3294
|
+
.setDocumentsV2(args.app_id, prepareAnchorArgs(args.documents), args.delete_paths, args.txData, simulate)
|
|
3286
3295
|
.preInstructions(instructions)
|
|
3287
3296
|
.accounts({
|
|
3288
3297
|
payer: payerPublicKey
|
|
@@ -3637,11 +3646,17 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
|
|
|
3637
3646
|
if (_overrides === null || _overrides === void 0 ? void 0 : _overrides.headers) {
|
|
3638
3647
|
Object.assign(headers, _overrides.headers);
|
|
3639
3648
|
}
|
|
3649
|
+
// Writes (PUT/POST/DELETE) can take significantly longer than reads —
|
|
3650
|
+
// server-side they may trigger ad-hoc LUT creation (create + extend +
|
|
3651
|
+
// wait-for-finalization, ~15-30s on mainnet). Use a larger default for
|
|
3652
|
+
// non-GET so the SDK doesn't time out before client-api responds.
|
|
3653
|
+
const isRead = method.toUpperCase() === "GET";
|
|
3654
|
+
const defaultTimeout = isRead ? 30000 : 90000;
|
|
3640
3655
|
const requestConfig = {
|
|
3641
3656
|
method,
|
|
3642
3657
|
url: `${config.apiUrl}${urlPath.startsWith("/") ? urlPath : `/${urlPath}`}`,
|
|
3643
3658
|
headers,
|
|
3644
|
-
timeout: (_a = _overrides === null || _overrides === void 0 ? void 0 : _overrides.timeout) !== null && _a !== void 0 ? _a :
|
|
3659
|
+
timeout: (_a = _overrides === null || _overrides === void 0 ? void 0 : _overrides.timeout) !== null && _a !== void 0 ? _a : defaultTimeout,
|
|
3645
3660
|
};
|
|
3646
3661
|
if (method !== "GET" && method !== "get") {
|
|
3647
3662
|
requestConfig.data = data ? JSON.stringify(data) : {};
|
|
@@ -3753,40 +3768,17 @@ async function getConfig() {
|
|
|
3753
3768
|
return clientConfig;
|
|
3754
3769
|
}
|
|
3755
3770
|
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
3767
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
3768
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
3769
|
-
***************************************************************************** */
|
|
3770
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
function __rest(s, e) {
|
|
3774
|
-
var t = {};
|
|
3775
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
3776
|
-
t[p] = s[p];
|
|
3777
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
3778
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3779
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
3780
|
-
t[p[i]] = s[p[i]];
|
|
3781
|
-
}
|
|
3782
|
-
return t;
|
|
3783
|
-
}
|
|
3784
|
-
|
|
3785
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
3786
|
-
var e = new Error(message);
|
|
3787
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
3771
|
+
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
3772
|
+
var t = {};
|
|
3773
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
3774
|
+
t[p] = s[p];
|
|
3775
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
3776
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3777
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
3778
|
+
t[p[i]] = s[p[i]];
|
|
3779
|
+
}
|
|
3780
|
+
return t;
|
|
3788
3781
|
};
|
|
3789
|
-
|
|
3790
3782
|
/**
|
|
3791
3783
|
* Thrown when a user's wallet doesn't have enough SOL to cover the transaction.
|
|
3792
3784
|
* Apps can catch this to trigger an onramp/funding flow.
|
|
@@ -4309,21 +4301,38 @@ async function setMany(many, options) {
|
|
|
4309
4301
|
setDocumentData: tx.transactionArgs.setDocumentData,
|
|
4310
4302
|
deletePaths: tx.transactionArgs.deletePaths,
|
|
4311
4303
|
idl: tx.idl,
|
|
4312
|
-
txData: (_b = (_a = tx.txData) === null || _a === void 0 ? void 0 : _a.map((txData) => {
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4304
|
+
txData: (_b = (_a = tx.txData) === null || _a === void 0 ? void 0 : _a.map((txData) => ({
|
|
4305
|
+
pluginFunctionKey: txData.pluginFunctionKey,
|
|
4306
|
+
txData: bufferExports.Buffer.from(txData.txData),
|
|
4307
|
+
// raIndices is Vec<u8> on-chain (serialized as Buffer/bytes). The server may send
|
|
4308
|
+
// it as a Buffer, a number[], a Uint8Array, or — over JSON — as Node's serialized
|
|
4309
|
+
// Buffer shape {type: "Buffer", data: number[]} (the default `JSON.stringify(buf)`
|
|
4310
|
+
// output). Normalise all of those to Buffer here. Each value must fit in u8 (matches
|
|
4311
|
+
// Solana's instruction-level account indexing); throw clearly if anything is out of range.
|
|
4312
|
+
raIndices: (() => {
|
|
4313
|
+
const raw = txData.raIndices;
|
|
4314
|
+
if (raw == null)
|
|
4315
|
+
return bufferExports.Buffer.alloc(0);
|
|
4316
|
+
if (bufferExports.Buffer.isBuffer(raw))
|
|
4317
|
+
return raw;
|
|
4318
|
+
if (raw instanceof Uint8Array)
|
|
4319
|
+
return bufferExports.Buffer.from(raw);
|
|
4320
|
+
// Node's JSON-serialised Buffer: {type: "Buffer", data: number[]}
|
|
4321
|
+
const arrayLike = Array.isArray(raw)
|
|
4322
|
+
? raw
|
|
4323
|
+
: (raw && typeof raw === 'object' && Array.isArray(raw.data))
|
|
4324
|
+
? raw.data
|
|
4325
|
+
: (() => { throw new Error(`raIndices has unexpected shape: ${typeof raw}`); })();
|
|
4326
|
+
const bytes = arrayLike.map((raIndex) => {
|
|
4327
|
+
const n = isHexString(raIndex) ? parseInt(raIndex, 16) : Number(raIndex);
|
|
4328
|
+
if (!Number.isInteger(n) || n < 0 || n > 255) {
|
|
4329
|
+
throw new Error(`raIndex ${raIndex} is not a valid u8 (must be integer in 0..255)`);
|
|
4320
4330
|
}
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
})) !== null && _b !== void 0 ? _b : [],
|
|
4331
|
+
return n;
|
|
4332
|
+
});
|
|
4333
|
+
return bufferExports.Buffer.from(bytes);
|
|
4334
|
+
})(),
|
|
4335
|
+
}))) !== null && _b !== void 0 ? _b : [],
|
|
4327
4336
|
};
|
|
4328
4337
|
const config = await getConfig();
|
|
4329
4338
|
const solTransaction = {
|