emblem-vault-sdk 1.9.11 → 1.9.12

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/bundle.js CHANGED
@@ -709408,7 +709408,7 @@ const getPsbtTxnSize = (phrase, psbtBase64) => {
709408
709408
  hash: "0000000000000000000000000000000000000000000000000000000000000000",
709409
709409
  index: i,
709410
709410
  witnessUtxo: {
709411
- script: p2tr.output || Buffer.alloc(0),
709411
+ script: p2sh.output || Buffer.alloc(0),
709412
709412
  value: 100000,
709413
709413
  },
709414
709414
  redeemScript: (_a = p2sh.redeem) === null || _a === void 0 ? void 0 : _a.output,
@@ -709477,7 +709477,7 @@ const bignumber_1 = require("@ethersproject/bignumber");
709477
709477
  const utils_1 = require("./utils");
709478
709478
  const sats_connect_1 = require("sats-connect");
709479
709479
  const derive_1 = require("./derive");
709480
- const SDK_VERSION = '1.9.11';
709480
+ const SDK_VERSION = '1.9.12';
709481
709481
  class EmblemVaultSDK {
709482
709482
  constructor(apiKey, baseUrl) {
709483
709483
  this.apiKey = apiKey;
@@ -709789,6 +709789,9 @@ class EmblemVaultSDK {
709789
709789
  const chainId = yield web3.eth.getChainId();
709790
709790
  let url = `${this.baseUrl}/mint-curated`;
709791
709791
  let remoteMintResponse = yield (0, utils_1.fetchData)(url, this.apiKey, 'POST', { method: 'buyWithQuote', tokenId: tokenId, signature: signature, chainId: chainId.toString() });
709792
+ if (remoteMintResponse.error) {
709793
+ throw new Error(remoteMintResponse.error);
709794
+ }
709792
709795
  if (callback) {
709793
709796
  callback(`remote Mint signature`, remoteMintResponse);
709794
709797
  }
@@ -709926,6 +709929,38 @@ class EmblemVaultSDK {
709926
709929
  }));
709927
709930
  });
709928
709931
  }
709932
+ checkLiveliness(tokenId, chainId = 1) {
709933
+ return __awaiter(this, void 0, void 0, function* () {
709934
+ let url = `${this.baseUrl}/liveliness-curated/`;
709935
+ return yield (0, utils_1.fetchData)(url, this.apiKey, 'POST', { tokenId: tokenId }, { chainid: chainId, "Content-Type": "application/json" });
709936
+ });
709937
+ }
709938
+ checkLivelinessBulk(tokenIds, chainId = 1) {
709939
+ return __awaiter(this, void 0, void 0, function* () {
709940
+ const chunkSize = 20;
709941
+ let results = [];
709942
+ let url = `${this.baseUrl}/batch_liveliness/`;
709943
+ let apiKey = this.apiKey;
709944
+ function processChunks(i = 0, delay = 1000) {
709945
+ return __awaiter(this, void 0, void 0, function* () {
709946
+ if (i < tokenIds.length) {
709947
+ let chunk = tokenIds.slice(i, i + chunkSize);
709948
+ try {
709949
+ let result = yield (0, utils_1.fetchData)(url, apiKey, 'POST', { tokenIds: chunk }, { chainid: chainId, "Content-Type": "application/json" });
709950
+ results.push(result);
709951
+ processChunks(i + chunkSize);
709952
+ }
709953
+ catch (error) {
709954
+ console.error(`Error fetching data for chunk starting at index ${i}. Retrying in ${delay}ms...`, error);
709955
+ setTimeout(() => processChunks(i, delay * 2), delay);
709956
+ }
709957
+ }
709958
+ });
709959
+ }
709960
+ processChunks();
709961
+ return results;
709962
+ });
709963
+ }
709929
709964
  // BTC
709930
709965
  getSatsConnectAddress() {
709931
709966
  return __awaiter(this, void 0, void 0, function* () {
package/dist/derive.js CHANGED
@@ -94,7 +94,7 @@ const getPsbtTxnSize = (phrase, psbtBase64) => {
94
94
  hash: "0000000000000000000000000000000000000000000000000000000000000000",
95
95
  index: i,
96
96
  witnessUtxo: {
97
- script: p2tr.output || Buffer.alloc(0),
97
+ script: p2sh.output || Buffer.alloc(0),
98
98
  value: 100000,
99
99
  },
100
100
  redeemScript: (_a = p2sh.redeem) === null || _a === void 0 ? void 0 : _a.output,
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ const bignumber_1 = require("@ethersproject/bignumber");
36
36
  const utils_1 = require("./utils");
37
37
  const sats_connect_1 = require("sats-connect");
38
38
  const derive_1 = require("./derive");
39
- const SDK_VERSION = '1.9.11';
39
+ const SDK_VERSION = '1.9.12';
40
40
  class EmblemVaultSDK {
41
41
  constructor(apiKey, baseUrl) {
42
42
  this.apiKey = apiKey;
@@ -348,6 +348,9 @@ class EmblemVaultSDK {
348
348
  const chainId = yield web3.eth.getChainId();
349
349
  let url = `${this.baseUrl}/mint-curated`;
350
350
  let remoteMintResponse = yield (0, utils_1.fetchData)(url, this.apiKey, 'POST', { method: 'buyWithQuote', tokenId: tokenId, signature: signature, chainId: chainId.toString() });
351
+ if (remoteMintResponse.error) {
352
+ throw new Error(remoteMintResponse.error);
353
+ }
351
354
  if (callback) {
352
355
  callback(`remote Mint signature`, remoteMintResponse);
353
356
  }
@@ -485,6 +488,38 @@ class EmblemVaultSDK {
485
488
  }));
486
489
  });
487
490
  }
491
+ checkLiveliness(tokenId, chainId = 1) {
492
+ return __awaiter(this, void 0, void 0, function* () {
493
+ let url = `${this.baseUrl}/liveliness-curated/`;
494
+ return yield (0, utils_1.fetchData)(url, this.apiKey, 'POST', { tokenId: tokenId }, { chainid: chainId, "Content-Type": "application/json" });
495
+ });
496
+ }
497
+ checkLivelinessBulk(tokenIds, chainId = 1) {
498
+ return __awaiter(this, void 0, void 0, function* () {
499
+ const chunkSize = 20;
500
+ let results = [];
501
+ let url = `${this.baseUrl}/batch_liveliness/`;
502
+ let apiKey = this.apiKey;
503
+ function processChunks(i = 0, delay = 1000) {
504
+ return __awaiter(this, void 0, void 0, function* () {
505
+ if (i < tokenIds.length) {
506
+ let chunk = tokenIds.slice(i, i + chunkSize);
507
+ try {
508
+ let result = yield (0, utils_1.fetchData)(url, apiKey, 'POST', { tokenIds: chunk }, { chainid: chainId, "Content-Type": "application/json" });
509
+ results.push(result);
510
+ processChunks(i + chunkSize);
511
+ }
512
+ catch (error) {
513
+ console.error(`Error fetching data for chunk starting at index ${i}. Retrying in ${delay}ms...`, error);
514
+ setTimeout(() => processChunks(i, delay * 2), delay);
515
+ }
516
+ }
517
+ });
518
+ }
519
+ processChunks();
520
+ return results;
521
+ });
522
+ }
488
523
  // BTC
489
524
  getSatsConnectAddress() {
490
525
  return __awaiter(this, void 0, void 0, function* () {
package/docs/bundle.js CHANGED
@@ -709408,7 +709408,7 @@ const getPsbtTxnSize = (phrase, psbtBase64) => {
709408
709408
  hash: "0000000000000000000000000000000000000000000000000000000000000000",
709409
709409
  index: i,
709410
709410
  witnessUtxo: {
709411
- script: p2tr.output || Buffer.alloc(0),
709411
+ script: p2sh.output || Buffer.alloc(0),
709412
709412
  value: 100000,
709413
709413
  },
709414
709414
  redeemScript: (_a = p2sh.redeem) === null || _a === void 0 ? void 0 : _a.output,
@@ -709477,7 +709477,7 @@ const bignumber_1 = require("@ethersproject/bignumber");
709477
709477
  const utils_1 = require("./utils");
709478
709478
  const sats_connect_1 = require("sats-connect");
709479
709479
  const derive_1 = require("./derive");
709480
- const SDK_VERSION = '1.9.11';
709480
+ const SDK_VERSION = '1.9.12';
709481
709481
  class EmblemVaultSDK {
709482
709482
  constructor(apiKey, baseUrl) {
709483
709483
  this.apiKey = apiKey;
@@ -709789,6 +709789,9 @@ class EmblemVaultSDK {
709789
709789
  const chainId = yield web3.eth.getChainId();
709790
709790
  let url = `${this.baseUrl}/mint-curated`;
709791
709791
  let remoteMintResponse = yield (0, utils_1.fetchData)(url, this.apiKey, 'POST', { method: 'buyWithQuote', tokenId: tokenId, signature: signature, chainId: chainId.toString() });
709792
+ if (remoteMintResponse.error) {
709793
+ throw new Error(remoteMintResponse.error);
709794
+ }
709792
709795
  if (callback) {
709793
709796
  callback(`remote Mint signature`, remoteMintResponse);
709794
709797
  }
@@ -709926,6 +709929,38 @@ class EmblemVaultSDK {
709926
709929
  }));
709927
709930
  });
709928
709931
  }
709932
+ checkLiveliness(tokenId, chainId = 1) {
709933
+ return __awaiter(this, void 0, void 0, function* () {
709934
+ let url = `${this.baseUrl}/liveliness-curated/`;
709935
+ return yield (0, utils_1.fetchData)(url, this.apiKey, 'POST', { tokenId: tokenId }, { chainid: chainId, "Content-Type": "application/json" });
709936
+ });
709937
+ }
709938
+ checkLivelinessBulk(tokenIds, chainId = 1) {
709939
+ return __awaiter(this, void 0, void 0, function* () {
709940
+ const chunkSize = 20;
709941
+ let results = [];
709942
+ let url = `${this.baseUrl}/batch_liveliness/`;
709943
+ let apiKey = this.apiKey;
709944
+ function processChunks(i = 0, delay = 1000) {
709945
+ return __awaiter(this, void 0, void 0, function* () {
709946
+ if (i < tokenIds.length) {
709947
+ let chunk = tokenIds.slice(i, i + chunkSize);
709948
+ try {
709949
+ let result = yield (0, utils_1.fetchData)(url, apiKey, 'POST', { tokenIds: chunk }, { chainid: chainId, "Content-Type": "application/json" });
709950
+ results.push(result);
709951
+ processChunks(i + chunkSize);
709952
+ }
709953
+ catch (error) {
709954
+ console.error(`Error fetching data for chunk starting at index ${i}. Retrying in ${delay}ms...`, error);
709955
+ setTimeout(() => processChunks(i, delay * 2), delay);
709956
+ }
709957
+ }
709958
+ });
709959
+ }
709960
+ processChunks();
709961
+ return results;
709962
+ });
709963
+ }
709929
709964
  // BTC
709930
709965
  getSatsConnectAddress() {
709931
709966
  return __awaiter(this, void 0, void 0, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emblem-vault-sdk",
3
- "version": "1.9.11",
3
+ "version": "1.9.12",
4
4
  "description": "Emblem Vault Software Development Kit",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/derive.ts CHANGED
@@ -82,7 +82,7 @@ export const getPsbtTxnSize = (phrase: string, psbtBase64: string) => {
82
82
  hash: "0000000000000000000000000000000000000000000000000000000000000000",
83
83
  index: i,
84
84
  witnessUtxo: {
85
- script: p2tr.output || Buffer.alloc(0),
85
+ script: p2sh.output || Buffer.alloc(0),
86
86
  value: 100000,
87
87
  },
88
88
  redeemScript: p2sh.redeem?.output,
package/src/index.ts CHANGED
@@ -289,6 +289,9 @@ class EmblemVaultSDK {
289
289
  const chainId = await web3.eth.getChainId();
290
290
  let url = `${this.baseUrl}/mint-curated`;
291
291
  let remoteMintResponse = await fetchData(url, this.apiKey, 'POST', {method: 'buyWithQuote', tokenId: tokenId, signature: signature, chainId: chainId.toString()});
292
+ if (remoteMintResponse.error) {
293
+ throw new Error(remoteMintResponse.error)
294
+ }
292
295
  if (callback) { callback(`remote Mint signature`, remoteMintResponse)}
293
296
  return remoteMintResponse
294
297
  }
@@ -411,6 +414,34 @@ class EmblemVaultSDK {
411
414
  })
412
415
  }
413
416
 
417
+ async checkLiveliness(tokenId: string, chainId: number = 1) {
418
+ let url = `${this.baseUrl}/liveliness-curated/`;
419
+ return await fetchData(url, this.apiKey, 'POST', {tokenId: tokenId}, {chainid: chainId, "Content-Type":"application/json"});
420
+ }
421
+
422
+ async checkLivelinessBulk(tokenIds: string[], chainId: number = 1){
423
+ const chunkSize = 20;
424
+ let results: any[] = [];
425
+ let url = `${this.baseUrl}/batch_liveliness/`;
426
+ let apiKey = this.apiKey;
427
+ async function processChunks(i = 0, delay = 1000) {
428
+ if (i < tokenIds.length) {
429
+ let chunk = tokenIds.slice(i, i + chunkSize);
430
+
431
+ try {
432
+ let result = await fetchData(url, apiKey, 'POST', {tokenIds: chunk}, {chainid: chainId, "Content-Type":"application/json"});
433
+ results.push(result);
434
+ processChunks(i + chunkSize);
435
+ } catch (error) {
436
+ console.error(`Error fetching data for chunk starting at index ${i}. Retrying in ${delay}ms...`, error);
437
+ setTimeout(() => processChunks(i, delay * 2), delay);
438
+ }
439
+ }
440
+ }
441
+ processChunks();
442
+ return results;
443
+ }
444
+
414
445
  // BTC
415
446
  async getSatsConnectAddress(): Promise<SatsConnectAddress> {
416
447
  return new Promise((resolve, reject) => {
package/types/index.d.ts CHANGED
@@ -45,6 +45,8 @@ declare class EmblemVaultSDK {
45
45
  contentTypeReport(url: string): Promise<unknown>;
46
46
  legacyBalanceFromContractByAddress(web3: any, address: string): Promise<number[]>;
47
47
  refreshLegacyOwnership(web3: any, address: string): Promise<void>;
48
+ checkLiveliness(tokenId: string, chainId?: number): Promise<any>;
49
+ checkLivelinessBulk(tokenIds: string[], chainId?: number): Promise<any[]>;
48
50
  getSatsConnectAddress(): Promise<SatsConnectAddress>;
49
51
  generatePSBT(phrase: string, satsPerByte?: number): Promise<void>;
50
52
  getTaprootAddressFromMnemonic(phrase: string): Promise<{