emblem-vault-sdk 1.12.4 → 1.12.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 +15 -1
- package/dist/index.js +15 -1
- package/docs/bundle.js +15 -1
- package/docs/index.html +7 -0
- package/docs/{DeGods.html → steps.html} +2 -1
- package/package.json +1 -1
- package/src/index.ts +11 -2
- package/src/types.ts +16 -0
- package/types/index.d.ts +3 -2
- package/types/types.d.ts +15 -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.6';
|
|
711425
711425
|
class EmblemVaultSDK {
|
|
711426
711426
|
constructor(apiKey, baseUrl) {
|
|
711427
711427
|
this.apiKey = apiKey;
|
|
@@ -711517,6 +711517,20 @@ class EmblemVaultSDK {
|
|
|
711517
711517
|
(0, utils_1.genericGuard)(tokenId, "string", "tokenId");
|
|
711518
711518
|
let url = `${this.baseUrl}/refreshBalanceForTokenId`;
|
|
711519
711519
|
let response = yield (0, utils_1.fetchData)(url, this.apiKey, 'POST', { tokenId });
|
|
711520
|
+
if (callback) {
|
|
711521
|
+
callback(`Refreshed ownership for`, tokenId);
|
|
711522
|
+
}
|
|
711523
|
+
return response;
|
|
711524
|
+
});
|
|
711525
|
+
}
|
|
711526
|
+
refreshOwnershipForAccount(account_1) {
|
|
711527
|
+
return __awaiter(this, arguments, void 0, function* (account, callback = null) {
|
|
711528
|
+
(0, utils_1.genericGuard)(account, "string", "account");
|
|
711529
|
+
let url = `${this.baseUrl}/refreshBalanceForAccount`;
|
|
711530
|
+
let response = yield (0, utils_1.fetchData)(url, this.apiKey, 'POST', { account });
|
|
711531
|
+
if (callback) {
|
|
711532
|
+
callback(`Refreshed ownership for`, account);
|
|
711533
|
+
}
|
|
711520
711534
|
return response;
|
|
711521
711535
|
});
|
|
711522
711536
|
}
|
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.6';
|
|
39
39
|
class EmblemVaultSDK {
|
|
40
40
|
constructor(apiKey, baseUrl) {
|
|
41
41
|
this.apiKey = apiKey;
|
|
@@ -131,6 +131,20 @@ class EmblemVaultSDK {
|
|
|
131
131
|
(0, utils_1.genericGuard)(tokenId, "string", "tokenId");
|
|
132
132
|
let url = `${this.baseUrl}/refreshBalanceForTokenId`;
|
|
133
133
|
let response = yield (0, utils_1.fetchData)(url, this.apiKey, 'POST', { tokenId });
|
|
134
|
+
if (callback) {
|
|
135
|
+
callback(`Refreshed ownership for`, tokenId);
|
|
136
|
+
}
|
|
137
|
+
return response;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
refreshOwnershipForAccount(account_1) {
|
|
141
|
+
return __awaiter(this, arguments, void 0, function* (account, callback = null) {
|
|
142
|
+
(0, utils_1.genericGuard)(account, "string", "account");
|
|
143
|
+
let url = `${this.baseUrl}/refreshBalanceForAccount`;
|
|
144
|
+
let response = yield (0, utils_1.fetchData)(url, this.apiKey, 'POST', { account });
|
|
145
|
+
if (callback) {
|
|
146
|
+
callback(`Refreshed ownership for`, account);
|
|
147
|
+
}
|
|
134
148
|
return response;
|
|
135
149
|
});
|
|
136
150
|
}
|
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.6';
|
|
711425
711425
|
class EmblemVaultSDK {
|
|
711426
711426
|
constructor(apiKey, baseUrl) {
|
|
711427
711427
|
this.apiKey = apiKey;
|
|
@@ -711517,6 +711517,20 @@ class EmblemVaultSDK {
|
|
|
711517
711517
|
(0, utils_1.genericGuard)(tokenId, "string", "tokenId");
|
|
711518
711518
|
let url = `${this.baseUrl}/refreshBalanceForTokenId`;
|
|
711519
711519
|
let response = yield (0, utils_1.fetchData)(url, this.apiKey, 'POST', { tokenId });
|
|
711520
|
+
if (callback) {
|
|
711521
|
+
callback(`Refreshed ownership for`, tokenId);
|
|
711522
|
+
}
|
|
711523
|
+
return response;
|
|
711524
|
+
});
|
|
711525
|
+
}
|
|
711526
|
+
refreshOwnershipForAccount(account_1) {
|
|
711527
|
+
return __awaiter(this, arguments, void 0, function* (account, callback = null) {
|
|
711528
|
+
(0, utils_1.genericGuard)(account, "string", "account");
|
|
711529
|
+
let url = `${this.baseUrl}/refreshBalanceForAccount`;
|
|
711530
|
+
let response = yield (0, utils_1.fetchData)(url, this.apiKey, 'POST', { account });
|
|
711531
|
+
if (callback) {
|
|
711532
|
+
callback(`Refreshed ownership for`, account);
|
|
711533
|
+
}
|
|
711520
711534
|
return response;
|
|
711521
711535
|
});
|
|
711522
711536
|
}
|
package/docs/index.html
CHANGED
|
@@ -234,7 +234,14 @@
|
|
|
234
234
|
|
|
235
235
|
</div>
|
|
236
236
|
|
|
237
|
+
<div style="margin-top: 20px;">
|
|
238
|
+
<p>For more information and to access the source code, visit our GitHub repository:</p>
|
|
239
|
+
<a href="https://github.com/EmblemCompany/emblem-vault-sdk" target="_blank">Emblem Vault SDK on GitHub</a>
|
|
240
|
+
</div>
|
|
237
241
|
|
|
242
|
+
<div style="margin-top: 20px;">
|
|
243
|
+
<a href="steps.html" target="_blank">Full Create / Mint : Demo</a>
|
|
244
|
+
</div>
|
|
238
245
|
|
|
239
246
|
<script>document.getElementById('ethAddress').value = localStorage.getItem('ethAddress');</script>
|
|
240
247
|
</body>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
-
<title>
|
|
4
|
+
<title>Steps
|
|
5
5
|
</title>
|
|
6
6
|
<style>
|
|
7
7
|
input, select, button {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
</style>
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
|
17
|
+
note: this demo uses 0x345eF9d7E75aEEb979053AA41BB6330683353B7b the BTC DeGods contract on mainnet
|
|
17
18
|
<h1>Vault it</h1>
|
|
18
19
|
<script src="./bundle.js"></script>
|
|
19
20
|
<script>
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BigNumber } from '@ethersproject/bignumber'
|
|
2
|
-
import { Collection, CuratedCollectionsResponse, MetaData, Vault } from './types';
|
|
2
|
+
import { Collection, CuratedCollectionsResponse, MetaData, Ownership, Vault } from './types';
|
|
3
3
|
import { COIN_TO_NETWORK, NFT_DATA, checkContentType, decryptKeys, evaluateFacts, fetchData, generateTemplate, genericGuard, getHandlerContract, getLegacyContract, getQuoteContractObject, getSatsConnectAddress, getTorusKeys, metadataAllProjects, metadataObj2Arr, pad, signPSBT, templateGuard } from './utils';
|
|
4
4
|
import { getAddress, BitcoinNetworkType, AddressPurpose, signTransaction } from "sats-connect";
|
|
5
5
|
import { generateTaprootAddressFromMnemonic, getPsbtTxnSize } from './derive';
|
|
@@ -100,10 +100,19 @@ class EmblemVaultSDK {
|
|
|
100
100
|
return vaultCreationResponse.data
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
async refreshOwnershipForTokenId(tokenId: string, callback: any = null) {
|
|
103
|
+
async refreshOwnershipForTokenId(tokenId: string, callback: any = null): Promise<Ownership[]> {
|
|
104
104
|
genericGuard(tokenId, "string", "tokenId");
|
|
105
105
|
let url = `${this.baseUrl}/refreshBalanceForTokenId`;
|
|
106
106
|
let response = await fetchData(url, this.apiKey, 'POST', {tokenId});
|
|
107
|
+
if (callback) { callback(`Refreshed ownership for`, tokenId)}
|
|
108
|
+
return response;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async refreshOwnershipForAccount(account: string, callback: any = null): Promise<Ownership[]> {
|
|
112
|
+
genericGuard(account, "string", "account");
|
|
113
|
+
let url = `${this.baseUrl}/refreshBalanceForAccount`;
|
|
114
|
+
let response = await fetchData(url, this.apiKey, 'POST', {account});
|
|
115
|
+
if (callback) { callback(`Refreshed ownership for`, account)}
|
|
107
116
|
return response;
|
|
108
117
|
}
|
|
109
118
|
|
package/src/types.ts
CHANGED
|
@@ -125,4 +125,20 @@ export type Vault = {
|
|
|
125
125
|
live: boolean;
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
+
export type Ownership = {
|
|
129
|
+
id: number;
|
|
130
|
+
created_at: string;
|
|
131
|
+
tokenId: string;
|
|
132
|
+
owner: string;
|
|
133
|
+
internalTokenId: string;
|
|
134
|
+
serialNumber: string | null;
|
|
135
|
+
contract: string;
|
|
136
|
+
category: string;
|
|
137
|
+
blockUpdated: string;
|
|
138
|
+
createdBy: string;
|
|
139
|
+
status: string;
|
|
140
|
+
claimedBy: string | null;
|
|
141
|
+
network: string;
|
|
142
|
+
}
|
|
143
|
+
|
|
128
144
|
export type CuratedCollectionsResponse = Collection[];
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BigNumber } from '@ethersproject/bignumber';
|
|
2
|
-
import { Collection, CuratedCollectionsResponse, MetaData, Vault } from './types';
|
|
2
|
+
import { Collection, CuratedCollectionsResponse, MetaData, Ownership, Vault } from './types';
|
|
3
3
|
declare class EmblemVaultSDK {
|
|
4
4
|
private apiKey;
|
|
5
5
|
private baseUrl;
|
|
@@ -17,7 +17,8 @@ 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<
|
|
20
|
+
refreshOwnershipForTokenId(tokenId: string, callback?: any): Promise<Ownership[]>;
|
|
21
|
+
refreshOwnershipForAccount(account: string, callback?: any): Promise<Ownership[]>;
|
|
21
22
|
fetchMetadata(tokenId: string, callback?: any): Promise<MetaData>;
|
|
22
23
|
refreshBalance(tokenId: string, callback?: any): Promise<MetaData>;
|
|
23
24
|
fetchVaultsOfType(vaultType: string, address: string): Promise<any>;
|
package/types/types.d.ts
CHANGED
|
@@ -117,4 +117,19 @@ export type Vault = {
|
|
|
117
117
|
network: string;
|
|
118
118
|
live: boolean;
|
|
119
119
|
};
|
|
120
|
+
export type Ownership = {
|
|
121
|
+
id: number;
|
|
122
|
+
created_at: string;
|
|
123
|
+
tokenId: string;
|
|
124
|
+
owner: string;
|
|
125
|
+
internalTokenId: string;
|
|
126
|
+
serialNumber: string | null;
|
|
127
|
+
contract: string;
|
|
128
|
+
category: string;
|
|
129
|
+
blockUpdated: string;
|
|
130
|
+
createdBy: string;
|
|
131
|
+
status: string;
|
|
132
|
+
claimedBy: string | null;
|
|
133
|
+
network: string;
|
|
134
|
+
};
|
|
120
135
|
export type CuratedCollectionsResponse = Collection[];
|