emblem-vault-sdk 1.1.0 → 1.1.2

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.
@@ -14,7 +14,7 @@
14
14
  </head>
15
15
  <body>
16
16
  <h1>Testing Emblem Vault SDK in the Browser</h1>
17
- <script src="../dist/bundle.js"></script>
17
+ <script src="./bundle.js"></script>
18
18
  <script>
19
19
  const sdk = new EmblemVaultSDK('demo');
20
20
  sdk.fetchCuratedContracts(false).then(curatedContracts => {
@@ -44,6 +44,7 @@
44
44
  }
45
45
 
46
46
  async function createVault() {
47
+ document.getElementById('vaultDetails').display = 'none';
47
48
  let vault = await sdk.createCuratedVault(window.template)
48
49
  window.vault = vault;
49
50
  console.log("--------- Vault Details ---------");
@@ -75,7 +76,7 @@
75
76
  window.contract = window.curatedContracts.find(contract => contract.name == metadata.targetContract.name)
76
77
  }
77
78
  window.address = window.contract.address(metadata.addresses)
78
- window.vaultBody = contract.generateVaultBody(metadata, metadata.values, contract, ()=>{})
79
+ window.vaultBody = contract.generateVaultBody(metadata, metadata.values? metadata.values: [], contract, ()=>{})
79
80
  document.getElementById('depositAddress').textContent = window.address;
80
81
  document.getElementById('tokenImage').src = window.vaultBody.image;
81
82
  document.getElementById('tokenName').textContent = window.vaultBody.name;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emblem-vault-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -13,7 +13,7 @@
13
13
  "test:all": "npm run test:node && npm run test:browser",
14
14
  "build": "tsc && npm run postbuild",
15
15
  "postbuild": "node ./script/version.js",
16
- "bundle": "npm run build && browserify build/index.js -o dist/bundle.js"
16
+ "bundle": "npm run build && browserify build/index.js -o dist/bundle.js && cp dist/bundle.js docs/bundle.js"
17
17
  },
18
18
  "keywords": [],
19
19
  "author": "",
package/src/utils.ts CHANGED
@@ -364,7 +364,7 @@ export function generateTemplate(record: any) {
364
364
  balanceDescription = '1';
365
365
  }
366
366
  } else {
367
- if (balance && balance[0].balance) {
367
+ if (balance && balance.length > 0 && balance[0].balance) {
368
368
  balanceDescription = balance[0].balance;
369
369
  } else if (balance) {
370
370
  balanceDescription = '1';
@@ -399,7 +399,7 @@ export function generateTemplate(record: any) {
399
399
  name: _this.loadTypes.includes('detailed') ? { type: "user-provided"}: _this.loadTypes.includes('select')? { type: "selection-provided"}: "Loading...",
400
400
  image: _this.loadTypes.includes('detailed') ? { type: "user-provided"}: _this.loadTypes.includes('select')? { type: "selection-provided"}: _this.loading(),
401
401
  description: _this.loadTypes.includes('detailed') ? { type: "user-provided"}: null,
402
- ownedImage: _this.loadTypes.includes('detailed') ? { type: "user-provided"}: "",
402
+ ownedImage: _this.loadTypes.includes('detailed') ? { type: "user-provided"}: null,
403
403
  projectName: _this.loadTypes.includes('select')? _this.name: null
404
404
  }
405
405
  }
@@ -441,6 +441,8 @@ export function templateGuard(input: { [x: string]: any; hasOwnProperty: (arg0:
441
441
  } catch (e: any) {
442
442
  errors.push(e.message);
443
443
  }
444
+ } else if (value == "") {
445
+ errors.push(`'${key}' is a required field`);
444
446
  }
445
447
  if (errors.length > 0) {
446
448
  throw new Error(errors.join(", "));