emblem-vault-sdk 1.1.3 → 1.2.0

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
@@ -684189,7 +684189,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
684189
684189
  };
684190
684190
  Object.defineProperty(exports, "__esModule", { value: true });
684191
684191
  const utils_1 = require("./utils");
684192
- const SDK_VERSION = '1.1.3';
684192
+ const SDK_VERSION = '1.2.0';
684193
684193
  class EmblemVaultSDK {
684194
684194
  constructor(apiKey, baseUrl) {
684195
684195
  this.apiKey = apiKey;
@@ -684236,6 +684236,15 @@ class EmblemVaultSDK {
684236
684236
  return metadata;
684237
684237
  });
684238
684238
  }
684239
+ fetchVaultsOfType(vaultType, address) {
684240
+ return __awaiter(this, void 0, void 0, function* () {
684241
+ (0, utils_1.genericGuard)(vaultType, "string", "vaultType");
684242
+ (0, utils_1.genericGuard)(address, "string", "address");
684243
+ let url = `${this.baseUrl}/myvaults/${address}?vaultType=${vaultType}`;
684244
+ let vaults = yield (0, utils_1.fetchData)(url, this.apiKey);
684245
+ return vaults;
684246
+ });
684247
+ }
684239
684248
  }
684240
684249
  if (typeof window !== 'undefined') {
684241
684250
  window.EmblemVaultSDK = EmblemVaultSDK;
package/docs/bundle.js CHANGED
@@ -684189,7 +684189,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
684189
684189
  };
684190
684190
  Object.defineProperty(exports, "__esModule", { value: true });
684191
684191
  const utils_1 = require("./utils");
684192
- const SDK_VERSION = '1.1.3';
684192
+ const SDK_VERSION = '1.2.0';
684193
684193
  class EmblemVaultSDK {
684194
684194
  constructor(apiKey, baseUrl) {
684195
684195
  this.apiKey = apiKey;
@@ -684236,6 +684236,15 @@ class EmblemVaultSDK {
684236
684236
  return metadata;
684237
684237
  });
684238
684238
  }
684239
+ fetchVaultsOfType(vaultType, address) {
684240
+ return __awaiter(this, void 0, void 0, function* () {
684241
+ (0, utils_1.genericGuard)(vaultType, "string", "vaultType");
684242
+ (0, utils_1.genericGuard)(address, "string", "address");
684243
+ let url = `${this.baseUrl}/myvaults/${address}?vaultType=${vaultType}`;
684244
+ let vaults = yield (0, utils_1.fetchData)(url, this.apiKey);
684245
+ return vaults;
684246
+ });
684247
+ }
684239
684248
  }
684240
684249
  if (typeof window !== 'undefined') {
684241
684250
  window.EmblemVaultSDK = EmblemVaultSDK;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emblem-vault-sdk",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -41,6 +41,12 @@ const tokenId = 'YOUR_TOKEN_ID'; // replace with your actual token id
41
41
  sdk.fetchMetadata(tokenId).then(metadata => {
42
42
  console.log(metadata);
43
43
  });
44
+
45
+ // Fetch Vaults of type ____ owned by ____
46
+ const TEST_ADDRESS = "0x9dE9ffB62c159A10cbcC19BdAc7962e9C19a1baa"
47
+ sdk.fetchVaultsOfType("created", TEST_ADDRESS).then(vaults => {
48
+ console.log(vaults);
49
+ });
44
50
  ```
45
51
 
46
52
  ## Simple Html Demo
package/src/index.ts CHANGED
@@ -50,6 +50,14 @@ class EmblemVaultSDK {
50
50
  return metadata;
51
51
  }
52
52
 
53
+ async fetchVaultsOfType(vaultType: string, address: string): Promise<any> {
54
+ genericGuard(vaultType, "string", "vaultType");
55
+ genericGuard(address, "string", "address");
56
+ let url = `${this.baseUrl}/myvaults/${address}?vaultType=${vaultType}`;
57
+ let vaults = await fetchData(url, this.apiKey);
58
+ return vaults;
59
+ }
60
+
53
61
  }
54
62
 
55
63
  declare global {
@@ -47,6 +47,13 @@ describe('EmblemVaultSDK', () => {
47
47
  expect(metadata).toBeInstanceOf(Object);
48
48
  expect(metadata.name).toEqual("Patrick's Birthday Vault");
49
49
  });
50
+
51
+ test('should fetch vaults of type', async () => {
52
+ const sdk = new EmblemVaultSDK(apiKey);
53
+ const vaults = await sdk.fetchVaultsOfType("created", TEST_ADDRESS);
54
+ expect(vaults).toBeInstanceOf(Array);
55
+ expect(vaults.length).toBeGreaterThanOrEqual(3);
56
+ });
50
57
  });
51
58
 
52
59
  describe('Vault Creation', () => {
@@ -109,8 +116,7 @@ const mocks = {
109
116
  },
110
117
  "targetAsset": {
111
118
  "name": "Loading...",
112
- "image": "https://emblem.finance/ordinals.png",
113
- "ownedImage": ""
119
+ "image": "https://emblem.finance/ordinals.png"
114
120
  }
115
121
  }
116
122
  }