emblem-vault-sdk 1.9.4 → 1.9.6

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.3';
709480
+ const SDK_VERSION = '1.9.6';
709481
709481
  class EmblemVaultSDK {
709482
709482
  constructor(apiKey, baseUrl) {
709483
709483
  this.apiKey = apiKey;
@@ -709739,8 +709739,9 @@ class EmblemVaultSDK {
709739
709739
  let collection = yield this.fetchCuratedContractByName(collectionName);
709740
709740
  let mintRequestSig = yield this.requestLocalMintSignature(web3, tokenId, callback);
709741
709741
  let remoteMintSig = yield this.requestRemoteMintSignature(web3, tokenId, mintRequestSig, callback);
709742
- let quote = yield this.getQuote(web3, collection ? collection.price : 2000000000, callback);
709743
- let mintResponse = yield this.performMint(web3, quote, remoteMintSig, callback);
709742
+ let quote = yield this.getQuote(web3, collection ? collection.price : remoteMintSig._price / 1000000, callback);
709743
+ let ethToSend = quote.mul(bignumber_1.BigNumber.from(10).pow(6));
709744
+ let mintResponse = yield this.performMint(web3, ethToSend, remoteMintSig, callback);
709744
709745
  return { mintResponse };
709745
709746
  });
709746
709747
  }
@@ -709854,7 +709855,8 @@ class EmblemVaultSDK {
709854
709855
  }
709855
709856
  const accounts = yield web3.eth.getAccounts();
709856
709857
  let handlerContract = yield (0, utils_1.getHandlerContract)(web3);
709857
- 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: quote.toString() });
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 });
709858
709860
  if (callback) {
709859
709861
  callback('Mint Complete');
709860
709862
  }
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.3';
39
+ const SDK_VERSION = '1.9.6';
40
40
  class EmblemVaultSDK {
41
41
  constructor(apiKey, baseUrl) {
42
42
  this.apiKey = apiKey;
@@ -298,8 +298,9 @@ class EmblemVaultSDK {
298
298
  let collection = yield this.fetchCuratedContractByName(collectionName);
299
299
  let mintRequestSig = yield this.requestLocalMintSignature(web3, tokenId, callback);
300
300
  let remoteMintSig = yield this.requestRemoteMintSignature(web3, tokenId, mintRequestSig, callback);
301
- let quote = yield this.getQuote(web3, collection ? collection.price : 2000000000, callback);
302
- let mintResponse = yield this.performMint(web3, quote, remoteMintSig, callback);
301
+ let quote = yield this.getQuote(web3, collection ? collection.price : remoteMintSig._price / 1000000, callback);
302
+ let ethToSend = quote.mul(bignumber_1.BigNumber.from(10).pow(6));
303
+ let mintResponse = yield this.performMint(web3, ethToSend, remoteMintSig, callback);
303
304
  return { mintResponse };
304
305
  });
305
306
  }
@@ -413,7 +414,8 @@ class EmblemVaultSDK {
413
414
  }
414
415
  const accounts = yield web3.eth.getAccounts();
415
416
  let handlerContract = yield (0, utils_1.getHandlerContract)(web3);
416
- 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: quote.toString() });
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 });
417
419
  if (callback) {
418
420
  callback('Mint Complete');
419
421
  }
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.3';
709480
+ const SDK_VERSION = '1.9.6';
709481
709481
  class EmblemVaultSDK {
709482
709482
  constructor(apiKey, baseUrl) {
709483
709483
  this.apiKey = apiKey;
@@ -709739,8 +709739,9 @@ class EmblemVaultSDK {
709739
709739
  let collection = yield this.fetchCuratedContractByName(collectionName);
709740
709740
  let mintRequestSig = yield this.requestLocalMintSignature(web3, tokenId, callback);
709741
709741
  let remoteMintSig = yield this.requestRemoteMintSignature(web3, tokenId, mintRequestSig, callback);
709742
- let quote = yield this.getQuote(web3, collection ? collection.price : 2000000000, callback);
709743
- let mintResponse = yield this.performMint(web3, quote, remoteMintSig, callback);
709742
+ let quote = yield this.getQuote(web3, collection ? collection.price : remoteMintSig._price / 1000000, callback);
709743
+ let ethToSend = quote.mul(bignumber_1.BigNumber.from(10).pow(6));
709744
+ let mintResponse = yield this.performMint(web3, ethToSend, remoteMintSig, callback);
709744
709745
  return { mintResponse };
709745
709746
  });
709746
709747
  }
@@ -709854,7 +709855,8 @@ class EmblemVaultSDK {
709854
709855
  }
709855
709856
  const accounts = yield web3.eth.getAccounts();
709856
709857
  let handlerContract = yield (0, utils_1.getHandlerContract)(web3);
709857
- 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: quote.toString() });
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 });
709858
709860
  if (callback) {
709859
709861
  callback('Mint Complete');
709860
709862
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emblem-vault-sdk",
3
- "version": "1.9.4",
3
+ "version": "1.9.6",
4
4
  "description": "Emblem Vault Software Development Kit",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -1,78 +1,49 @@
1
1
  # Emblem Vault SDK
2
2
 
3
- This SDK provides a set of tools to interact with the Emblem Vault API. It includes methods for fetching curated contracts, creating vaults, and fetching metadata.
3
+ ## Overview
4
+ The EmblemVault SDK provides developers with the tools needed to interact with the EmblemVault API, facilitating the seamless integration of EmblemVault functionalities into applications.
4
5
 
5
- ## Installation
6
+ ## Getting Started
6
7
 
7
- ```
8
- npm i emblem-vault-sdk
9
- ```
8
+ ### Installation
9
+ Install via npm or yarn:
10
+ - `npm install emblemvault-sdk`
11
+ - `yarn add emblemvault-sdk`
10
12
 
11
- ## Getting Started
13
+ ### Initialization
14
+ Initialize with your API key:
15
+ ```javascript
16
+ import EmblemVaultSDK from 'emblemvault-sdk';
17
+ const emblemVaultSDK = new EmblemVaultSDK('YOUR_API_KEY');
12
18
  ```
13
- const EmblemVaultSDK = require('emblem-vault-sdk');
14
- // import EmblemVaultSDK from 'emblem-vault-sdk'
15
- const apiKey = 'YOUR_API_KEY'; // replace with your actual API key
16
19
 
17
- const sdk = new EmblemVaultSDK(apiKey);
18
- ```
20
+ ## API Reference
19
21
 
20
- ## SDK Methods
21
- ```javascript
22
- // Fetch curated contracts
23
- sdk.fetchCuratedContracts().then(contracts => {
24
- console.log(contracts);
25
- });
26
-
27
- // Select a contract create template
28
- sdk.fetchCuratedContracts().then(contracts => {
29
- const contract = contracts.find(contract => contract.name === "Ethscriptions");
30
- const template = contract.generateCreateTemplate(contract);
31
- console.log(template);
32
- });
33
-
34
- // Create a curated vault
35
- const template = {}; // replace with your actual template
36
- sdk.createCuratedVault(template).then(vault => {
37
- console.log(vault);
38
- });
39
-
40
- // Fetch metadata
41
- const tokenId = 'YOUR_TOKEN_ID'; // replace with your actual token id
42
- sdk.fetchMetadata(tokenId).then(metadata => {
43
- console.log(metadata);
44
- });
45
-
46
- // Fetch Vaults of type ____ owned by ____
47
- const TEST_ADDRESS = "0x9dE9ffB62c159A10cbcC19BdAc7962e9C19a1baa"
48
- sdk.fetchVaultsOfType("created", TEST_ADDRESS).then(vaults => {
49
- console.log(vaults);
50
- });
51
-
52
- // Get all projects that contain Asset Metadata
53
- projects = sdk.getAllProjects()
54
- // [
55
- // "Emblem Test",
56
- // "Age of Chains",
57
- // "Age of Rust",
58
- // "..."
59
- // ]
60
-
61
- // Get asset metadata
62
- const projectName = projects[1]; // valid item from getAllProjects() above
63
- assets = sdk.getAssetMetadata(projectName)
64
- console.log(assets)
65
- // [
66
- // {
67
- // "image":"ELECTRUMCARD.jpg",
68
- // "projectName":"Age of Chains",
69
- // "projectLogo":"age-of-chains.jpg",
70
- // "projectSite":"https://www.ageofchains.com/",
71
- // "assetName":"ELECTRUMCARD"
72
- // },...
73
- // ]
22
+ ### Asset Metadata Methods
23
+ - **getAssetMetadata(projectName, strict = false)**: Fetch metadata for assets by project name.
24
+ - **getAllAssetMetadata()**: Retrieve metadata for all assets.
25
+ - **getAllProjects()**: Get a list of all projects.
26
+
27
+ ### Curated Collections Methods
28
+ - **fetchCuratedContracts(hideUnMintable = false, overrideFunc = false)**: Fetch curated contracts, with optional parameters to hide unmintable contracts or override the fetching function.
29
+ - **fetchCuratedContractByName(name, contracts = false)**: Fetch a curated contract by its name.
30
+
31
+ ### Web3 Integration Methods
32
+ - **loadWeb3()**: Dynamically load Web3 and connect to MetaMask.
33
+
34
+ ### Minting, Burning, and Claiming Methods
35
+ - **performMintChain(web3, tokenId, collectionName, callback = null)**: Perform the minting process for a specific token in a collection.
36
+ - **performBurn(web3, tokenId, callback = null)**: Burn a token.
37
+ - **performClaimChain(web3, tokenId, serialNumber, callback = null)**: Claim ownership of a token.
38
+
39
+ ### Bitcoin Network Methods
40
+ - **getSatsConnectAddress()**: Generate a SatsConnect address for Bitcoin transactions.
41
+ - **generatePSBT(phrase, satsPerByte = 20)**: Generate a Partially Signed Bitcoin Transaction (PSBT).
42
+ - **getTaprootAddressFromMnemonic(phrase)**: Generate a Taproot address from a mnemonic phrase.
43
+
44
+ ## Global Declaration
45
+ The `EmblemVaultSDK` is available globally in web applications through the `window` object.
74
46
 
75
- ```
76
47
 
77
48
  ## Simple Html Demo
78
49
 
package/src/index.ts CHANGED
@@ -253,8 +253,9 @@ class EmblemVaultSDK {
253
253
  let collection = await this.fetchCuratedContractByName(collectionName);
254
254
  let mintRequestSig = await this.requestLocalMintSignature(web3, tokenId, callback);
255
255
  let remoteMintSig = await this.requestRemoteMintSignature(web3, tokenId, mintRequestSig, callback);
256
- let quote = await this.getQuote(web3, collection? collection.price: 2000000000, callback);
257
- let mintResponse = await this.performMint(web3, quote, remoteMintSig, callback);
256
+ let quote = await this.getQuote(web3, collection? collection.price: remoteMintSig._price/1000000, callback);
257
+ let ethToSend = quote.mul(BigNumber.from(10).pow(6))
258
+ let mintResponse = await this.performMint(web3, ethToSend, remoteMintSig, callback);
258
259
  return {mintResponse}
259
260
  }
260
261
 
@@ -329,7 +330,8 @@ class EmblemVaultSDK {
329
330
  if (callback) { callback('performing Mint')}
330
331
  const accounts = await web3.eth.getAccounts();
331
332
  let handlerContract = await getHandlerContract(web3);
332
- 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: quote.toString()});
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 });
333
335
  if (callback) { callback('Mint Complete')}
334
336
  await this.fetchMetadata(remoteMintSig._tokenId);
335
337
  return mintResponse