emblem-vault-sdk 1.9.6 → 1.9.8

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
@@ -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.6';
709480
+ const SDK_VERSION = '1.9.8';
709481
709481
  class EmblemVaultSDK {
709482
709482
  constructor(apiKey, baseUrl) {
709483
709483
  this.apiKey = apiKey;
@@ -709841,7 +709841,7 @@ class EmblemVaultSDK {
709841
709841
  }
709842
709842
  let quoteContract = yield (0, utils_1.getQuoteContractObject)(web3);
709843
709843
  const accounts = yield web3.eth.getAccounts();
709844
- let quote = bignumber_1.BigNumber.from(yield quoteContract.methods.quoteExternalPrice(accounts[0], amount.toString()).call());
709844
+ let quote = bignumber_1.BigNumber.from(yield quoteContract.methods.quoteExternalPrice(accounts[0], Number(amount) / 1000000).call());
709845
709845
  if (callback) {
709846
709846
  callback(`quote`, quote.toString());
709847
709847
  }
@@ -709850,13 +709850,24 @@ class EmblemVaultSDK {
709850
709850
  }
709851
709851
  performMint(web3, quote, remoteMintSig, callback = null) {
709852
709852
  return __awaiter(this, void 0, void 0, function* () {
709853
+ // async performMint(web3, quote, remoteMintSig, callback = null) {
709853
709854
  if (callback) {
709854
709855
  callback('performing Mint');
709855
709856
  }
709856
709857
  const accounts = yield web3.eth.getAccounts();
709857
709858
  let handlerContract = yield (0, utils_1.getHandlerContract)(web3);
709858
- const feeData = yield web3.eth.getGasPrice();
709859
- let mintResponse = yield handlerContract.methods.buyWithQuote(remoteMintSig._nftAddress, remoteMintSig._price, remoteMintSig._to, remoteMintSig._tokenId, remoteMintSig._nonce, remoteMintSig._signature, remoteMintSig.serialNumber, 1).send({ from: accounts[0], value: Number(quote), gasPrice: feeData });
709859
+ // Get current gas price from the network
709860
+ const gasPrice = yield web3.eth.getGasPrice();
709861
+ let createdTxObject = handlerContract.methods.buyWithQuote(remoteMintSig._nftAddress, remoteMintSig._price, remoteMintSig._to, remoteMintSig._tokenId, remoteMintSig._nonce, remoteMintSig._signature, remoteMintSig.serialNumber, 1);
709862
+ // Estimate gas limit for the transaction
709863
+ const gasLimit = yield createdTxObject.estimateGas({ from: accounts[0], value: Number(quote) });
709864
+ // Execute the transaction with the specified gas price and estimated gas limit
709865
+ let mintResponse = yield createdTxObject.send({
709866
+ from: accounts[0],
709867
+ value: Number(quote),
709868
+ gasPrice: gasPrice, // Use the current gas price
709869
+ gas: gasLimit // Use the estimated gas limit
709870
+ });
709860
709871
  if (callback) {
709861
709872
  callback('Mint Complete');
709862
709873
  }
@@ -709874,7 +709885,16 @@ class EmblemVaultSDK {
709874
709885
  const accounts = yield web3.eth.getAccounts();
709875
709886
  const chainId = yield web3.eth.getChainId();
709876
709887
  let handlerContract = yield (0, utils_1.getHandlerContract)(web3);
709877
- let burnResponse = yield handlerContract.methods.claim(targetContract[chainId], targetContract.collectionType == 'ERC721a' ? tokenId : targetContract.tokenId).send({ from: accounts[0] });
709888
+ // Dynamically fetch the current gas price
709889
+ const gasPrice = yield web3.eth.getGasPrice();
709890
+ let createdTxObject = handlerContract.methods.claim(targetContract[chainId], targetContract.collectionType == 'ERC721a' ? tokenId : targetContract.tokenId);
709891
+ // Estimate gas limit for the transaction
709892
+ const estimatedGas = yield createdTxObject.estimateGas({ from: accounts[0] });
709893
+ let burnResponse = yield createdTxObject.send({
709894
+ from: accounts[0],
709895
+ gasPrice: gasPrice,
709896
+ gas: estimatedGas
709897
+ });
709878
709898
  if (callback) {
709879
709899
  callback('Burn Complete');
709880
709900
  }
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.6';
39
+ const SDK_VERSION = '1.9.8';
40
40
  class EmblemVaultSDK {
41
41
  constructor(apiKey, baseUrl) {
42
42
  this.apiKey = apiKey;
@@ -400,7 +400,7 @@ class EmblemVaultSDK {
400
400
  }
401
401
  let quoteContract = yield (0, utils_1.getQuoteContractObject)(web3);
402
402
  const accounts = yield web3.eth.getAccounts();
403
- let quote = bignumber_1.BigNumber.from(yield quoteContract.methods.quoteExternalPrice(accounts[0], amount.toString()).call());
403
+ let quote = bignumber_1.BigNumber.from(yield quoteContract.methods.quoteExternalPrice(accounts[0], Number(amount) / 1000000).call());
404
404
  if (callback) {
405
405
  callback(`quote`, quote.toString());
406
406
  }
@@ -409,13 +409,24 @@ class EmblemVaultSDK {
409
409
  }
410
410
  performMint(web3, quote, remoteMintSig, callback = null) {
411
411
  return __awaiter(this, void 0, void 0, function* () {
412
+ // async performMint(web3, quote, remoteMintSig, callback = null) {
412
413
  if (callback) {
413
414
  callback('performing Mint');
414
415
  }
415
416
  const accounts = yield web3.eth.getAccounts();
416
417
  let handlerContract = yield (0, utils_1.getHandlerContract)(web3);
417
- const feeData = yield web3.eth.getGasPrice();
418
- let mintResponse = yield handlerContract.methods.buyWithQuote(remoteMintSig._nftAddress, remoteMintSig._price, remoteMintSig._to, remoteMintSig._tokenId, remoteMintSig._nonce, remoteMintSig._signature, remoteMintSig.serialNumber, 1).send({ from: accounts[0], value: Number(quote), gasPrice: feeData });
418
+ // Get current gas price from the network
419
+ const gasPrice = yield web3.eth.getGasPrice();
420
+ let createdTxObject = handlerContract.methods.buyWithQuote(remoteMintSig._nftAddress, remoteMintSig._price, remoteMintSig._to, remoteMintSig._tokenId, remoteMintSig._nonce, remoteMintSig._signature, remoteMintSig.serialNumber, 1);
421
+ // Estimate gas limit for the transaction
422
+ const gasLimit = yield createdTxObject.estimateGas({ from: accounts[0], value: Number(quote) });
423
+ // Execute the transaction with the specified gas price and estimated gas limit
424
+ let mintResponse = yield createdTxObject.send({
425
+ from: accounts[0],
426
+ value: Number(quote),
427
+ gasPrice: gasPrice, // Use the current gas price
428
+ gas: gasLimit // Use the estimated gas limit
429
+ });
419
430
  if (callback) {
420
431
  callback('Mint Complete');
421
432
  }
@@ -433,7 +444,16 @@ class EmblemVaultSDK {
433
444
  const accounts = yield web3.eth.getAccounts();
434
445
  const chainId = yield web3.eth.getChainId();
435
446
  let handlerContract = yield (0, utils_1.getHandlerContract)(web3);
436
- let burnResponse = yield handlerContract.methods.claim(targetContract[chainId], targetContract.collectionType == 'ERC721a' ? tokenId : targetContract.tokenId).send({ from: accounts[0] });
447
+ // Dynamically fetch the current gas price
448
+ const gasPrice = yield web3.eth.getGasPrice();
449
+ let createdTxObject = handlerContract.methods.claim(targetContract[chainId], targetContract.collectionType == 'ERC721a' ? tokenId : targetContract.tokenId);
450
+ // Estimate gas limit for the transaction
451
+ const estimatedGas = yield createdTxObject.estimateGas({ from: accounts[0] });
452
+ let burnResponse = yield createdTxObject.send({
453
+ from: accounts[0],
454
+ gasPrice: gasPrice,
455
+ gas: estimatedGas
456
+ });
437
457
  if (callback) {
438
458
  callback('Burn Complete');
439
459
  }
package/docs/bundle.js CHANGED
@@ -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.6';
709480
+ const SDK_VERSION = '1.9.8';
709481
709481
  class EmblemVaultSDK {
709482
709482
  constructor(apiKey, baseUrl) {
709483
709483
  this.apiKey = apiKey;
@@ -709841,7 +709841,7 @@ class EmblemVaultSDK {
709841
709841
  }
709842
709842
  let quoteContract = yield (0, utils_1.getQuoteContractObject)(web3);
709843
709843
  const accounts = yield web3.eth.getAccounts();
709844
- let quote = bignumber_1.BigNumber.from(yield quoteContract.methods.quoteExternalPrice(accounts[0], amount.toString()).call());
709844
+ let quote = bignumber_1.BigNumber.from(yield quoteContract.methods.quoteExternalPrice(accounts[0], Number(amount) / 1000000).call());
709845
709845
  if (callback) {
709846
709846
  callback(`quote`, quote.toString());
709847
709847
  }
@@ -709850,13 +709850,24 @@ class EmblemVaultSDK {
709850
709850
  }
709851
709851
  performMint(web3, quote, remoteMintSig, callback = null) {
709852
709852
  return __awaiter(this, void 0, void 0, function* () {
709853
+ // async performMint(web3, quote, remoteMintSig, callback = null) {
709853
709854
  if (callback) {
709854
709855
  callback('performing Mint');
709855
709856
  }
709856
709857
  const accounts = yield web3.eth.getAccounts();
709857
709858
  let handlerContract = yield (0, utils_1.getHandlerContract)(web3);
709858
- const feeData = yield web3.eth.getGasPrice();
709859
- let mintResponse = yield handlerContract.methods.buyWithQuote(remoteMintSig._nftAddress, remoteMintSig._price, remoteMintSig._to, remoteMintSig._tokenId, remoteMintSig._nonce, remoteMintSig._signature, remoteMintSig.serialNumber, 1).send({ from: accounts[0], value: Number(quote), gasPrice: feeData });
709859
+ // Get current gas price from the network
709860
+ const gasPrice = yield web3.eth.getGasPrice();
709861
+ let createdTxObject = handlerContract.methods.buyWithQuote(remoteMintSig._nftAddress, remoteMintSig._price, remoteMintSig._to, remoteMintSig._tokenId, remoteMintSig._nonce, remoteMintSig._signature, remoteMintSig.serialNumber, 1);
709862
+ // Estimate gas limit for the transaction
709863
+ const gasLimit = yield createdTxObject.estimateGas({ from: accounts[0], value: Number(quote) });
709864
+ // Execute the transaction with the specified gas price and estimated gas limit
709865
+ let mintResponse = yield createdTxObject.send({
709866
+ from: accounts[0],
709867
+ value: Number(quote),
709868
+ gasPrice: gasPrice, // Use the current gas price
709869
+ gas: gasLimit // Use the estimated gas limit
709870
+ });
709860
709871
  if (callback) {
709861
709872
  callback('Mint Complete');
709862
709873
  }
@@ -709874,7 +709885,16 @@ class EmblemVaultSDK {
709874
709885
  const accounts = yield web3.eth.getAccounts();
709875
709886
  const chainId = yield web3.eth.getChainId();
709876
709887
  let handlerContract = yield (0, utils_1.getHandlerContract)(web3);
709877
- let burnResponse = yield handlerContract.methods.claim(targetContract[chainId], targetContract.collectionType == 'ERC721a' ? tokenId : targetContract.tokenId).send({ from: accounts[0] });
709888
+ // Dynamically fetch the current gas price
709889
+ const gasPrice = yield web3.eth.getGasPrice();
709890
+ let createdTxObject = handlerContract.methods.claim(targetContract[chainId], targetContract.collectionType == 'ERC721a' ? tokenId : targetContract.tokenId);
709891
+ // Estimate gas limit for the transaction
709892
+ const estimatedGas = yield createdTxObject.estimateGas({ from: accounts[0] });
709893
+ let burnResponse = yield createdTxObject.send({
709894
+ from: accounts[0],
709895
+ gasPrice: gasPrice,
709896
+ gas: estimatedGas
709897
+ });
709878
709898
  if (callback) {
709879
709899
  callback('Burn Complete');
709880
709900
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emblem-vault-sdk",
3
- "version": "1.9.6",
3
+ "version": "1.9.8",
4
4
  "description": "Emblem Vault Software Development Kit",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -321,21 +321,47 @@ class EmblemVaultSDK {
321
321
  if (callback) { callback('requesting Quote')}
322
322
  let quoteContract = await getQuoteContractObject(web3);
323
323
  const accounts = await web3.eth.getAccounts();
324
- let quote = BigNumber.from(await quoteContract.methods.quoteExternalPrice(accounts[0], amount.toString()).call());
324
+ let quote = BigNumber.from(await quoteContract.methods.quoteExternalPrice(accounts[0], Number(amount)/1000000).call());
325
325
  if (callback) { callback(`quote`, quote.toString())}
326
326
  return quote
327
327
  }
328
328
 
329
329
  async performMint(web3: any, quote: any, remoteMintSig: any, callback: any = null) {
330
- if (callback) { callback('performing Mint')}
330
+ // async performMint(web3, quote, remoteMintSig, callback = null) {
331
+ if (callback) { callback('performing Mint') }
331
332
  const accounts = await web3.eth.getAccounts();
332
333
  let handlerContract = await getHandlerContract(web3);
333
- const feeData = await web3.eth.getGasPrice()
334
- let mintResponse = await handlerContract.methods.buyWithQuote(remoteMintSig._nftAddress, remoteMintSig._price, remoteMintSig._to, remoteMintSig._tokenId, remoteMintSig._nonce, remoteMintSig._signature, remoteMintSig.serialNumber, 1).send({from: accounts[0], value: Number(quote), gasPrice: feeData });
335
- if (callback) { callback('Mint Complete')}
334
+
335
+ // Get current gas price from the network
336
+ const gasPrice = await web3.eth.getGasPrice();
337
+
338
+ let createdTxObject = handlerContract.methods.buyWithQuote(
339
+ remoteMintSig._nftAddress,
340
+ remoteMintSig._price,
341
+ remoteMintSig._to,
342
+ remoteMintSig._tokenId,
343
+ remoteMintSig._nonce,
344
+ remoteMintSig._signature,
345
+ remoteMintSig.serialNumber,
346
+ 1
347
+ )
348
+
349
+ // Estimate gas limit for the transaction
350
+ const gasLimit = await createdTxObject.estimateGas({ from: accounts[0], value: Number(quote) });
351
+
352
+ // Execute the transaction with the specified gas price and estimated gas limit
353
+ let mintResponse = await createdTxObject.send({
354
+ from: accounts[0],
355
+ value: Number(quote),
356
+ gasPrice: gasPrice, // Use the current gas price
357
+ gas: gasLimit // Use the estimated gas limit
358
+ });
359
+
360
+ if (callback) { callback('Mint Complete') }
336
361
  await this.fetchMetadata(remoteMintSig._tokenId);
337
362
  return mintResponse
338
363
  }
364
+
339
365
 
340
366
  async performBurn(web3: any, tokenId: any, callback: any = null) {
341
367
  let metadata: any = await this.fetchMetadata(tokenId);
@@ -344,10 +370,24 @@ class EmblemVaultSDK {
344
370
  const accounts = await web3.eth.getAccounts();
345
371
  const chainId = await web3.eth.getChainId();
346
372
  let handlerContract = await getHandlerContract(web3);
347
- let burnResponse = await handlerContract.methods.claim(targetContract[chainId], targetContract.collectionType == 'ERC721a'? tokenId: targetContract.tokenId).send({from: accounts[0]});
373
+
374
+ // Dynamically fetch the current gas price
375
+ const gasPrice = await web3.eth.getGasPrice();
376
+
377
+ let createdTxObject = handlerContract.methods.claim(targetContract[chainId], targetContract.collectionType == 'ERC721a' ? tokenId : targetContract.tokenId)
378
+ // Estimate gas limit for the transaction
379
+ const estimatedGas = await createdTxObject.estimateGas({from: accounts[0]});
380
+
381
+ let burnResponse = await createdTxObject.send({
382
+ from: accounts[0],
383
+ gasPrice: gasPrice,
384
+ gas: estimatedGas
385
+ });
386
+
348
387
  if (callback) { callback('Burn Complete')}
349
- return burnResponse
388
+ return burnResponse;
350
389
  }
390
+
351
391
 
352
392
  async contentTypeReport(url: string) {
353
393
  return await checkContentType(url)