emblem-vault-sdk 1.12.2 → 1.12.4
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 +20 -15
- package/dist/index.js +9 -1
- package/dist/utils.js +11 -14
- package/docs/bundle.js +20 -15
- package/package.json +1 -1
- package/src/index.ts +7 -0
- package/src/utils.ts +11 -12
- package/types/index.d.ts +1 -0
package/dist/bundle.js
CHANGED
|
@@ -711421,7 +711421,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
711421
711421
|
const bignumber_1 = require("@ethersproject/bignumber");
|
|
711422
711422
|
const utils_1 = require("./utils");
|
|
711423
711423
|
const derive_1 = require("./derive");
|
|
711424
|
-
const SDK_VERSION = '1.12.
|
|
711424
|
+
const SDK_VERSION = '1.12.4';
|
|
711425
711425
|
class EmblemVaultSDK {
|
|
711426
711426
|
constructor(apiKey, baseUrl) {
|
|
711427
711427
|
this.apiKey = apiKey;
|
|
@@ -711512,6 +711512,14 @@ class EmblemVaultSDK {
|
|
|
711512
711512
|
return vaultCreationResponse.data;
|
|
711513
711513
|
});
|
|
711514
711514
|
}
|
|
711515
|
+
refreshOwnershipForTokenId(tokenId_1) {
|
|
711516
|
+
return __awaiter(this, arguments, void 0, function* (tokenId, callback = null) {
|
|
711517
|
+
(0, utils_1.genericGuard)(tokenId, "string", "tokenId");
|
|
711518
|
+
let url = `${this.baseUrl}/refreshBalanceForTokenId`;
|
|
711519
|
+
let response = yield (0, utils_1.fetchData)(url, this.apiKey, 'POST', { tokenId });
|
|
711520
|
+
return response;
|
|
711521
|
+
});
|
|
711522
|
+
}
|
|
711515
711523
|
fetchMetadata(tokenId_1) {
|
|
711516
711524
|
return __awaiter(this, arguments, void 0, function* (tokenId, callback = null) {
|
|
711517
711525
|
(0, utils_1.genericGuard)(tokenId, "string", "tokenId");
|
|
@@ -712291,7 +712299,6 @@ function generateTemplate(record) {
|
|
|
712291
712299
|
* @param {function} - msgCallback should be a function that takes a string message
|
|
712292
712300
|
*/
|
|
712293
712301
|
allowed: (data, _this, msgCallback = null) => {
|
|
712294
|
-
var _a;
|
|
712295
712302
|
if (recordName == "Embels") {
|
|
712296
712303
|
return true;
|
|
712297
712304
|
}
|
|
@@ -712326,17 +712333,16 @@ function generateTemplate(record) {
|
|
|
712326
712333
|
if (!allowed) {
|
|
712327
712334
|
message = `Load vault with exactly ${balanceQty} ${recordName}`;
|
|
712328
712335
|
}
|
|
712329
|
-
|
|
712330
|
-
|
|
712331
|
-
|
|
712332
|
-
|
|
712333
|
-
|
|
712334
|
-
|
|
712335
|
-
|
|
712336
|
-
|
|
712337
|
-
|
|
712338
|
-
|
|
712339
|
-
allowed = (0, exports.evaluateFacts)(allowed, facts, msgCallback);
|
|
712336
|
+
// } else if (recordName == "Counterparty") {
|
|
712337
|
+
// let facts = [
|
|
712338
|
+
// {
|
|
712339
|
+
// eval: record.nativeAssets.includes(data[0]?.coin),
|
|
712340
|
+
// msg: `Vaults should only contain assets native to ${recordName}`
|
|
712341
|
+
// },
|
|
712342
|
+
// {eval: data.length == 1, msg: `Vaults should only contain a single item`},
|
|
712343
|
+
// // { eval: data[0].projectName && data[0].projectName == recordName, msg: `Vaults should only contain a single item` }
|
|
712344
|
+
// ]
|
|
712345
|
+
// allowed = evaluateFacts(allowed, facts, msgCallback)
|
|
712340
712346
|
}
|
|
712341
712347
|
else if (recordName == "Stamps") {
|
|
712342
712348
|
let allowedName = assetName.toLowerCase().includes("stamp");
|
|
@@ -712417,8 +712423,7 @@ function generateTemplate(record) {
|
|
|
712417
712423
|
let allowedJump = false;
|
|
712418
712424
|
if (hasAnyBalance && recordName != "Rinkeby") {
|
|
712419
712425
|
let filteredBalances = _this.filterNativeBalances(ownership_balances, _this);
|
|
712420
|
-
|
|
712421
|
-
if (filteredBalances.length == 1) {
|
|
712426
|
+
if ((_this.vaultCollectionType == "protocol" && filteredBalances.length >= 1 && filteredBalances.every((balance) => balance.coin.toLowerCase() == _this.collectionChain.toLowerCase())) || filteredBalances.length == 1) {
|
|
712422
712427
|
allowedJump = _this.allowed(filteredBalances, _this);
|
|
712423
712428
|
}
|
|
712424
712429
|
else {
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
35
35
|
const bignumber_1 = require("@ethersproject/bignumber");
|
|
36
36
|
const utils_1 = require("./utils");
|
|
37
37
|
const derive_1 = require("./derive");
|
|
38
|
-
const SDK_VERSION = '1.12.
|
|
38
|
+
const SDK_VERSION = '1.12.4';
|
|
39
39
|
class EmblemVaultSDK {
|
|
40
40
|
constructor(apiKey, baseUrl) {
|
|
41
41
|
this.apiKey = apiKey;
|
|
@@ -126,6 +126,14 @@ class EmblemVaultSDK {
|
|
|
126
126
|
return vaultCreationResponse.data;
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
+
refreshOwnershipForTokenId(tokenId_1) {
|
|
130
|
+
return __awaiter(this, arguments, void 0, function* (tokenId, callback = null) {
|
|
131
|
+
(0, utils_1.genericGuard)(tokenId, "string", "tokenId");
|
|
132
|
+
let url = `${this.baseUrl}/refreshBalanceForTokenId`;
|
|
133
|
+
let response = yield (0, utils_1.fetchData)(url, this.apiKey, 'POST', { tokenId });
|
|
134
|
+
return response;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
129
137
|
fetchMetadata(tokenId_1) {
|
|
130
138
|
return __awaiter(this, arguments, void 0, function* (tokenId, callback = null) {
|
|
131
139
|
(0, utils_1.genericGuard)(tokenId, "string", "tokenId");
|
package/dist/utils.js
CHANGED
|
@@ -262,7 +262,6 @@ function generateTemplate(record) {
|
|
|
262
262
|
* @param {function} - msgCallback should be a function that takes a string message
|
|
263
263
|
*/
|
|
264
264
|
allowed: (data, _this, msgCallback = null) => {
|
|
265
|
-
var _a;
|
|
266
265
|
if (recordName == "Embels") {
|
|
267
266
|
return true;
|
|
268
267
|
}
|
|
@@ -297,17 +296,16 @@ function generateTemplate(record) {
|
|
|
297
296
|
if (!allowed) {
|
|
298
297
|
message = `Load vault with exactly ${balanceQty} ${recordName}`;
|
|
299
298
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
allowed = (0, exports.evaluateFacts)(allowed, facts, msgCallback);
|
|
299
|
+
// } else if (recordName == "Counterparty") {
|
|
300
|
+
// let facts = [
|
|
301
|
+
// {
|
|
302
|
+
// eval: record.nativeAssets.includes(data[0]?.coin),
|
|
303
|
+
// msg: `Vaults should only contain assets native to ${recordName}`
|
|
304
|
+
// },
|
|
305
|
+
// {eval: data.length == 1, msg: `Vaults should only contain a single item`},
|
|
306
|
+
// // { eval: data[0].projectName && data[0].projectName == recordName, msg: `Vaults should only contain a single item` }
|
|
307
|
+
// ]
|
|
308
|
+
// allowed = evaluateFacts(allowed, facts, msgCallback)
|
|
311
309
|
}
|
|
312
310
|
else if (recordName == "Stamps") {
|
|
313
311
|
let allowedName = assetName.toLowerCase().includes("stamp");
|
|
@@ -388,8 +386,7 @@ function generateTemplate(record) {
|
|
|
388
386
|
let allowedJump = false;
|
|
389
387
|
if (hasAnyBalance && recordName != "Rinkeby") {
|
|
390
388
|
let filteredBalances = _this.filterNativeBalances(ownership_balances, _this);
|
|
391
|
-
|
|
392
|
-
if ((_this.vaultCollectionType == "protocol" && filteredBalances.length >= 1) || filteredBalances.length == 1) {
|
|
389
|
+
if ((_this.vaultCollectionType == "protocol" && filteredBalances.length >= 1 && filteredBalances.every((balance) => balance.coin.toLowerCase() == _this.collectionChain.toLowerCase())) || filteredBalances.length == 1) {
|
|
393
390
|
allowedJump = _this.allowed(filteredBalances, _this);
|
|
394
391
|
}
|
|
395
392
|
else {
|
package/docs/bundle.js
CHANGED
|
@@ -711421,7 +711421,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
711421
711421
|
const bignumber_1 = require("@ethersproject/bignumber");
|
|
711422
711422
|
const utils_1 = require("./utils");
|
|
711423
711423
|
const derive_1 = require("./derive");
|
|
711424
|
-
const SDK_VERSION = '1.12.
|
|
711424
|
+
const SDK_VERSION = '1.12.4';
|
|
711425
711425
|
class EmblemVaultSDK {
|
|
711426
711426
|
constructor(apiKey, baseUrl) {
|
|
711427
711427
|
this.apiKey = apiKey;
|
|
@@ -711512,6 +711512,14 @@ class EmblemVaultSDK {
|
|
|
711512
711512
|
return vaultCreationResponse.data;
|
|
711513
711513
|
});
|
|
711514
711514
|
}
|
|
711515
|
+
refreshOwnershipForTokenId(tokenId_1) {
|
|
711516
|
+
return __awaiter(this, arguments, void 0, function* (tokenId, callback = null) {
|
|
711517
|
+
(0, utils_1.genericGuard)(tokenId, "string", "tokenId");
|
|
711518
|
+
let url = `${this.baseUrl}/refreshBalanceForTokenId`;
|
|
711519
|
+
let response = yield (0, utils_1.fetchData)(url, this.apiKey, 'POST', { tokenId });
|
|
711520
|
+
return response;
|
|
711521
|
+
});
|
|
711522
|
+
}
|
|
711515
711523
|
fetchMetadata(tokenId_1) {
|
|
711516
711524
|
return __awaiter(this, arguments, void 0, function* (tokenId, callback = null) {
|
|
711517
711525
|
(0, utils_1.genericGuard)(tokenId, "string", "tokenId");
|
|
@@ -712291,7 +712299,6 @@ function generateTemplate(record) {
|
|
|
712291
712299
|
* @param {function} - msgCallback should be a function that takes a string message
|
|
712292
712300
|
*/
|
|
712293
712301
|
allowed: (data, _this, msgCallback = null) => {
|
|
712294
|
-
var _a;
|
|
712295
712302
|
if (recordName == "Embels") {
|
|
712296
712303
|
return true;
|
|
712297
712304
|
}
|
|
@@ -712326,17 +712333,16 @@ function generateTemplate(record) {
|
|
|
712326
712333
|
if (!allowed) {
|
|
712327
712334
|
message = `Load vault with exactly ${balanceQty} ${recordName}`;
|
|
712328
712335
|
}
|
|
712329
|
-
|
|
712330
|
-
|
|
712331
|
-
|
|
712332
|
-
|
|
712333
|
-
|
|
712334
|
-
|
|
712335
|
-
|
|
712336
|
-
|
|
712337
|
-
|
|
712338
|
-
|
|
712339
|
-
allowed = (0, exports.evaluateFacts)(allowed, facts, msgCallback);
|
|
712336
|
+
// } else if (recordName == "Counterparty") {
|
|
712337
|
+
// let facts = [
|
|
712338
|
+
// {
|
|
712339
|
+
// eval: record.nativeAssets.includes(data[0]?.coin),
|
|
712340
|
+
// msg: `Vaults should only contain assets native to ${recordName}`
|
|
712341
|
+
// },
|
|
712342
|
+
// {eval: data.length == 1, msg: `Vaults should only contain a single item`},
|
|
712343
|
+
// // { eval: data[0].projectName && data[0].projectName == recordName, msg: `Vaults should only contain a single item` }
|
|
712344
|
+
// ]
|
|
712345
|
+
// allowed = evaluateFacts(allowed, facts, msgCallback)
|
|
712340
712346
|
}
|
|
712341
712347
|
else if (recordName == "Stamps") {
|
|
712342
712348
|
let allowedName = assetName.toLowerCase().includes("stamp");
|
|
@@ -712417,8 +712423,7 @@ function generateTemplate(record) {
|
|
|
712417
712423
|
let allowedJump = false;
|
|
712418
712424
|
if (hasAnyBalance && recordName != "Rinkeby") {
|
|
712419
712425
|
let filteredBalances = _this.filterNativeBalances(ownership_balances, _this);
|
|
712420
|
-
|
|
712421
|
-
if (filteredBalances.length == 1) {
|
|
712426
|
+
if ((_this.vaultCollectionType == "protocol" && filteredBalances.length >= 1 && filteredBalances.every((balance) => balance.coin.toLowerCase() == _this.collectionChain.toLowerCase())) || filteredBalances.length == 1) {
|
|
712422
712427
|
allowedJump = _this.allowed(filteredBalances, _this);
|
|
712423
712428
|
}
|
|
712424
712429
|
else {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -100,6 +100,13 @@ class EmblemVaultSDK {
|
|
|
100
100
|
return vaultCreationResponse.data
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
async refreshOwnershipForTokenId(tokenId: string, callback: any = null) {
|
|
104
|
+
genericGuard(tokenId, "string", "tokenId");
|
|
105
|
+
let url = `${this.baseUrl}/refreshBalanceForTokenId`;
|
|
106
|
+
let response = await fetchData(url, this.apiKey, 'POST', {tokenId});
|
|
107
|
+
return response;
|
|
108
|
+
}
|
|
109
|
+
|
|
103
110
|
async fetchMetadata(tokenId: string, callback: any = null): Promise<MetaData> {
|
|
104
111
|
genericGuard(tokenId, "string", "tokenId");
|
|
105
112
|
if (callback) { callback('getting Metadata')}
|
package/src/utils.ts
CHANGED
|
@@ -270,16 +270,16 @@ export function generateTemplate(record: any) {
|
|
|
270
270
|
if (!allowed) {
|
|
271
271
|
message = `Load vault with exactly ${balanceQty} ${recordName}`
|
|
272
272
|
}
|
|
273
|
-
} else if (recordName == "Counterparty") {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
273
|
+
// } else if (recordName == "Counterparty") {
|
|
274
|
+
// let facts = [
|
|
275
|
+
// {
|
|
276
|
+
// eval: record.nativeAssets.includes(data[0]?.coin),
|
|
277
|
+
// msg: `Vaults should only contain assets native to ${recordName}`
|
|
278
|
+
// },
|
|
279
|
+
// {eval: data.length == 1, msg: `Vaults should only contain a single item`},
|
|
280
|
+
// // { eval: data[0].projectName && data[0].projectName == recordName, msg: `Vaults should only contain a single item` }
|
|
281
|
+
// ]
|
|
282
|
+
// allowed = evaluateFacts(allowed, facts, msgCallback)
|
|
283
283
|
} else if (recordName == "Stamps") {
|
|
284
284
|
let allowedName = assetName.toLowerCase().includes("stamp")
|
|
285
285
|
allowed = allowedName &&
|
|
@@ -350,8 +350,7 @@ export function generateTemplate(record: any) {
|
|
|
350
350
|
let allowedJump = false
|
|
351
351
|
if (hasAnyBalance && recordName != "Rinkeby") {
|
|
352
352
|
let filteredBalances = _this.filterNativeBalances(ownership_balances, _this)
|
|
353
|
-
|
|
354
|
-
if ((_this.vaultCollectionType == "protocol" && filteredBalances.length >=1) || filteredBalances.length == 1) {
|
|
353
|
+
if ((_this.vaultCollectionType == "protocol" && filteredBalances.length >= 1 && filteredBalances.every((balance: { coin: string; }) => balance.coin.toLowerCase() == _this.collectionChain.toLowerCase())) || filteredBalances.length == 1) {
|
|
355
354
|
allowedJump = _this.allowed(filteredBalances, _this)
|
|
356
355
|
} else {
|
|
357
356
|
allowedJump = false
|
package/types/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ declare class EmblemVaultSDK {
|
|
|
17
17
|
fetchCuratedContracts(hideUnMintable?: boolean, overrideFunc?: Function | boolean): Promise<CuratedCollectionsResponse>;
|
|
18
18
|
fetchCuratedContractByName(name: string, contracts?: any): Promise<Collection | null>;
|
|
19
19
|
createCuratedVault(template: any, callback?: any): Promise<Vault>;
|
|
20
|
+
refreshOwnershipForTokenId(tokenId: string, callback?: any): Promise<any>;
|
|
20
21
|
fetchMetadata(tokenId: string, callback?: any): Promise<MetaData>;
|
|
21
22
|
refreshBalance(tokenId: string, callback?: any): Promise<MetaData>;
|
|
22
23
|
fetchVaultsOfType(vaultType: string, address: string): Promise<any>;
|