emblem-vault-sdk 2.3.6 → 3.0.0-experimental
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/.traces/blockchain-provider-abstraction-plan.md +302 -0
- package/.traces/notes.md +43 -0
- package/.traces/readme-verification-trace.md +988 -0
- package/.traces/test-migration-status.md +227 -0
- package/.traces/tests-consolidated-trace.md +667 -0
- package/dist/abi/abi.json +53 -0
- package/dist/bundle.js +21602 -17419
- package/dist/clients/emblemVaultSolanaWalletClient.d.ts +74 -0
- package/dist/clients/emblemVaultSolanaWalletClient.js +149 -0
- package/dist/clients/emblemVaultSolanaWalletClient.js.map +1 -0
- package/dist/clients/emblemVaultWalletClient.d.ts +52 -0
- package/dist/clients/emblemVaultWalletClient.js +110 -0
- package/dist/clients/emblemVaultWalletClient.js.map +1 -0
- package/dist/derive.js +7 -0
- package/dist/derive.js.map +1 -0
- package/dist/index.js +319 -114
- package/dist/index.js.map +1 -0
- package/dist/providers/ProviderManager.d.ts +57 -0
- package/dist/providers/ProviderManager.js +283 -0
- package/dist/providers/ProviderManager.js.map +1 -0
- package/dist/providers.d.ts +101 -0
- package/dist/providers.js +96 -0
- package/dist/providers.js.map +1 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.js +61 -58
- package/dist/utils.js.map +1 -0
- package/docs/bundle.js +21602 -17419
- package/docs/index.html +150 -13
- package/docs/local.html +385 -0
- package/docs/steps.html +420 -53
- package/package.json +22 -13
- package/readme.md +795 -21
- package/src/abi/abi.json +54 -1
- package/src/clients/emblemVaultSolanaWalletClient.ts +257 -0
- package/src/clients/emblemVaultWalletClient.ts +159 -0
- package/src/derive.ts +5 -5
- package/src/index.ts +320 -102
- package/src/providers/ProviderManager.ts +254 -0
- package/src/providers.ts +163 -0
- package/src/types.ts +50 -0
- package/src/utils.ts +63 -62
- package/test/.mocharc.js +8 -0
- package/test/README.md +212 -0
- package/test/fixtures/ethscriptions/balance-with-native-first.json +24 -0
- package/test/fixtures/ethscriptions/balance-with-native.json +23 -0
- package/test/fixtures/ethscriptions/balance.json +18 -0
- package/test/helpers/sdkLoader.js +88 -0
- package/test/helpers/setup.js +55 -0
- package/test/integration/ApiOperations.spec.js +102 -0
- package/test/integration/VaultAI.spec.js +57 -0
- package/test/integration/VaultCreation.spec.js +95 -0
- package/test/mocks.js +127 -0
- package/test/tsconfig.json +25 -0
- package/test/unit/AllowedBells.spec.js +53 -0
- package/test/unit/AllowedBitcoinDeGods.spec.js +53 -0
- package/test/unit/AllowedBitcoinOrdinals.spec.js +46 -0
- package/test/unit/AllowedCounterparty.spec.js +66 -0
- package/test/unit/AllowedCursedOrdinals.spec.js +68 -0
- package/test/unit/AllowedEmbells.spec.js +11 -0
- package/test/unit/AllowedEmbels.spec.js +11 -0
- package/test/unit/AllowedEmblemOpen.spec.js +20 -0
- package/test/unit/AllowedEthscriptions.spec.js +53 -0
- package/test/unit/AllowedHardcodedNfts.spec.js +77 -0
- package/test/unit/AllowedNamecoin.spec.js +33 -0
- package/test/unit/AllowedOrdi.spec.js +46 -0
- package/test/unit/AllowedOxbt.spec.js +46 -0
- package/test/unit/AllowedProjectCollection.spec.js +51 -0
- package/test/unit/AllowedProtocolCollection.spec.js +44 -0
- package/test/unit/AllowedStamps.spec.js +78 -0
- package/test/unit/DarkfarmsMetadata.spec.js +10 -0
- package/test/unit/EmblemVaultSdk.spec.js +188 -0
- package/test/unit/Providers.spec.js +290 -0
- package/test/unit/ResourceMonitor.spec.js +111 -0
- package/test/unit/SDKMemoryLeaks.spec.js +176 -0
- package/test/unit/Signing.spec.js +321 -0
- package/test/unit/VaultAI.spec.js +140 -0
- package/test/unit/clients/EmblemVaultSolanaWalletClient.spec.js +296 -0
- package/test/unit/clients/EmblemVaultWalletClient.spec.js +246 -0
- package/test/utils/ResourceMonitor.js +169 -0
- package/test/windsurf-rules.md +68 -0
- package/tsconfig.json +7 -3
- package/types/derive.d.ts +0 -5
- package/types/index.d.ts +152 -32
- package/types/types.d.ts +43 -0
- package/types/utils.d.ts +7 -1
- package/dist/abi/quote.js +0 -29
- package/dist/abi/quote.json +0 -26
- package/jest.config.js +0 -6
- package/tests/AllowedBells.test.ts +0 -53
- package/tests/AllowedBitcoinDeGods.test.ts +0 -53
- package/tests/AllowedBitcoinOrdinals.test.ts +0 -46
- package/tests/AllowedCounterparty.test.ts +0 -45
- package/tests/AllowedCursedOrdinals.test.ts +0 -68
- package/tests/AllowedEmbells.test.ts +0 -12
- package/tests/AllowedEmbels.test.ts +0 -16
- package/tests/AllowedEmblemOpen.test.ts +0 -20
- package/tests/AllowedEthscriptions.test.ts +0 -39
- package/tests/AllowedHardcodedNfts.test.ts +0 -78
- package/tests/AllowedNamecoin.test.ts +0 -33
- package/tests/AllowedOrdi.test.ts +0 -47
- package/tests/AllowedOxbt.test.ts +0 -47
- package/tests/AllowedProjectlCollection.test.ts +0 -51
- package/tests/AllowedProtocolCollection.test.ts +0 -44
- package/tests/AllowedStamps.test.ts +0 -73
- package/tests/DarkfarmsMetadata.test.ts +0 -10
- package/tests/EmblemVaultSdk.test.ts +0 -124
- package/tests/fixtures/embels/balance.json +0 -10
- package/tests/fixtures/ethscriptions/balance-with-native-first.json +0 -69
- package/tests/fixtures/ethscriptions/balance-with-native.json +0 -37
- package/tests/fixtures/ethscriptions/balance.json +0 -64
- /package/{tests → test}/fixtures/bells/balance-with-non-bell-first.json +0 -0
- /package/{tests → test}/fixtures/bells/balance-with-non-bell.json +0 -0
- /package/{tests → test}/fixtures/bells/balance.json +0 -0
- /package/{tests → test}/fixtures/bitcoin-degods/balance-with-non-degods-first.json +0 -0
- /package/{tests → test}/fixtures/bitcoin-degods/balance-with-non-degods.json +0 -0
- /package/{tests → test}/fixtures/bitcoin-degods/balance.json +0 -0
- /package/{tests → test}/fixtures/bitcoin-ordinals/balance-with-native-first.json +0 -0
- /package/{tests → test}/fixtures/bitcoin-ordinals/balance-with-only-native.json +0 -0
- /package/{tests → test}/fixtures/bitcoin-ordinals/balance.json +0 -0
- /package/{tests → test}/fixtures/counterparty/balance-with-multiple.json +0 -0
- /package/{tests → test}/fixtures/counterparty/balance.json +0 -0
- /package/{tests → test}/fixtures/cursed-ordinals/balance-with-native-first.json +0 -0
- /package/{tests → test}/fixtures/cursed-ordinals/balance-with-native.json +0 -0
- /package/{tests → test}/fixtures/cursed-ordinals/balance.json +0 -0
- /package/{tests → test}/fixtures/dogeparty/balance-with-non-dogeparty-first.json +0 -0
- /package/{tests → test}/fixtures/dogeparty/balance-with-non-dogeparty.json +0 -0
- /package/{tests → test}/fixtures/dogeparty/balance.json +0 -0
- /package/{tests → test}/fixtures/emblem-open/balance.json +0 -0
- /package/{tests → test}/fixtures/hardcoded-nfts/balance-witn-non-hardcoded-first.json +0 -0
- /package/{tests → test}/fixtures/hardcoded-nfts/balance-witn-non-hardcoded.json +0 -0
- /package/{tests → test}/fixtures/hardcoded-nfts/balance.json +0 -0
- /package/{tests → test}/fixtures/megapunks/balance-with-non-megapunk-first.json +0 -0
- /package/{tests → test}/fixtures/megapunks/balance-with-non-megapunk.json +0 -0
- /package/{tests → test}/fixtures/megapunks/balance.json +0 -0
- /package/{tests → test}/fixtures/namecoin/balance-with-native-first.json +0 -0
- /package/{tests → test}/fixtures/namecoin/balance-with-native.json +0 -0
- /package/{tests → test}/fixtures/namecoin/balance.json +0 -0
- /package/{tests → test}/fixtures/ordi/balance-with-native-first.json +0 -0
- /package/{tests → test}/fixtures/ordi/balance-with-native.json +0 -0
- /package/{tests → test}/fixtures/ordi/balance.json +0 -0
- /package/{tests → test}/fixtures/oxbt/balance-with-native-first.json +0 -0
- /package/{tests → test}/fixtures/oxbt/balance-with-native.json +0 -0
- /package/{tests → test}/fixtures/oxbt/balance.json +0 -0
- /package/{tests → test}/fixtures/stamps/balance-with-non-stamps-first.json +0 -0
- /package/{tests → test}/fixtures/stamps/balance-with-non-stamps.json +0 -0
- /package/{tests → test}/fixtures/stamps/balance.json +0 -0
|
@@ -0,0 +1,988 @@
|
|
|
1
|
+
# Emblem Vault SDK Documentation Verification Trace
|
|
2
|
+
|
|
3
|
+
This trace document systematically verifies the accuracy of the readme.md against the current codebase, noting any discrepancies or outdated information.
|
|
4
|
+
|
|
5
|
+
## Directory Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
/Users/shannoncode/repo/Emblem.Current/emblem-vault-sdk/src/
|
|
9
|
+
├── abi/
|
|
10
|
+
│ └── abi.json
|
|
11
|
+
├── curated/
|
|
12
|
+
│ ├── darkfarms-metadata.json
|
|
13
|
+
│ ├── dot_id.json
|
|
14
|
+
│ └── metadata.json
|
|
15
|
+
├── derive.ts
|
|
16
|
+
├── index.ts
|
|
17
|
+
├── types.ts
|
|
18
|
+
└── utils.ts
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## File Analysis
|
|
22
|
+
|
|
23
|
+
<details>
|
|
24
|
+
<summary>readme.md (line 1 of 306)</summary>
|
|
25
|
+
|
|
26
|
+
The readme.md file serves as the primary documentation for the Emblem Vault SDK. It includes information about installation, initialization, and various SDK functions. This analysis will verify each section against the actual implementation in the codebase.
|
|
27
|
+
|
|
28
|
+
### Table of Contents
|
|
29
|
+
The readme.md includes a comprehensive table of contents that covers:
|
|
30
|
+
- Installation
|
|
31
|
+
- Initialization
|
|
32
|
+
- Fetching Curated Contracts
|
|
33
|
+
- Creating a Vault
|
|
34
|
+
- Refreshing Vault Balance
|
|
35
|
+
- Validating Mintability
|
|
36
|
+
- Performing a Mint
|
|
37
|
+
- Utility Functions
|
|
38
|
+
- Example Usage
|
|
39
|
+
|
|
40
|
+
This structure appears to be well-organized and covers the main functionality of the SDK.
|
|
41
|
+
|
|
42
|
+
### Installation Section
|
|
43
|
+
The readme states two methods of installation:
|
|
44
|
+
1. Including the `bundle.js` file in an HTML file
|
|
45
|
+
2. Installing via npm with `npm install emblem-vault-sdk`
|
|
46
|
+
|
|
47
|
+
Both methods are valid, but the npm installation method could be more detailed with version information.
|
|
48
|
+
|
|
49
|
+
### Initialization Section
|
|
50
|
+
The readme shows initialization with:
|
|
51
|
+
```javascript
|
|
52
|
+
const sdk = new EmblemVaultSDK('demo');
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This matches the constructor in `index.ts` which requires an API key as the first parameter, with optional parameters for baseUrl, v3Url, and sigUrl.
|
|
56
|
+
|
|
57
|
+
</details>
|
|
58
|
+
|
|
59
|
+
<details>
|
|
60
|
+
<summary>readme.md (line 30 of 306)</summary>
|
|
61
|
+
|
|
62
|
+
### Fetching Curated Contracts Section
|
|
63
|
+
The readme describes fetching curated contracts with:
|
|
64
|
+
```javascript
|
|
65
|
+
sdk.fetchCuratedContracts(false).then(curatedContracts => {
|
|
66
|
+
// Use the curated contracts
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Verification:
|
|
71
|
+
- ✅ The `fetchCuratedContracts` method exists in `index.ts` (line ~54)
|
|
72
|
+
- ✅ It takes a boolean parameter `hideUnMintable` (default: false) and an optional `overrideFunc` parameter
|
|
73
|
+
- ✅ It returns a Promise with curated contracts data
|
|
74
|
+
- ✅ The implementation sorts contracts by name and applies templates to each item
|
|
75
|
+
|
|
76
|
+
### Creating a Vault Section
|
|
77
|
+
The readme shows creating a vault with:
|
|
78
|
+
```javascript
|
|
79
|
+
let contractTemplate = {
|
|
80
|
+
fromAddress: null,
|
|
81
|
+
toAddress: null,
|
|
82
|
+
chainId: 1,
|
|
83
|
+
experimental: true,
|
|
84
|
+
targetContract: {
|
|
85
|
+
"1": "0x345eF9d7E75aEEb979053AA41BB6330683353B7b",
|
|
86
|
+
"5": "0x582699d2c58A38056Cf02875540705137f0bbbF7",
|
|
87
|
+
name: "Bitcoin DeGods",
|
|
88
|
+
description: "Bitcoin DeGods is a collection of 535 Bitcoin Ordinals inscribed in the 77236 to 77770 range. This collection is curated by Emblem Vault."
|
|
89
|
+
},
|
|
90
|
+
targetAsset: {
|
|
91
|
+
image: "https://emblem.finance/btcdegods.jpg",
|
|
92
|
+
name: "Loading...",
|
|
93
|
+
xtra: "anything else you need here"
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
vaultData = await sdk.createCuratedVault(contractTemplate, updateLogCallback);
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Verification:
|
|
101
|
+
- ✅ The `createCuratedVault` method exists in `index.ts` (line ~80)
|
|
102
|
+
- ✅ It takes a template object and an optional callback function
|
|
103
|
+
- ✅ The template structure matches what's expected by the implementation
|
|
104
|
+
- ✅ The method uses `templateGuard` to validate the input
|
|
105
|
+
- ✅ It returns a Promise with the vault data
|
|
106
|
+
|
|
107
|
+
### Refreshing Vault Balance Section
|
|
108
|
+
The readme describes refreshing a vault balance with:
|
|
109
|
+
```javascript
|
|
110
|
+
vaultBalance = await sdk.refreshBalance(vaultData.tokenId, updateLogCallback);
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Verification:
|
|
114
|
+
- ✅ The `refreshBalance` method exists in `index.ts` (line ~104)
|
|
115
|
+
- ✅ It takes a tokenId and an optional callback parameter
|
|
116
|
+
- ✅ It returns a Promise with the balance data
|
|
117
|
+
- ✅ The implementation uses the v3 API endpoint for balance retrieval
|
|
118
|
+
|
|
119
|
+
### Validating Mintability Section
|
|
120
|
+
The readme shows validating mintability with:
|
|
121
|
+
```javascript
|
|
122
|
+
let contractObject = await sdk.fetchCuratedContractByName(contractTemplate.targetContract.name);
|
|
123
|
+
let mintable = contractObject.allowed(vaultBalance, contractObject);
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Verification:
|
|
127
|
+
- ✅ The `fetchCuratedContractByName` method exists in `index.ts` (line ~74)
|
|
128
|
+
- ✅ The returned contract object has an `allowed` method that evaluates mintability
|
|
129
|
+
- ✅ This matches the implementation in the codebase
|
|
130
|
+
- ✅ The example in `steps.html` confirms this usage pattern
|
|
131
|
+
|
|
132
|
+
### Performing a Mint Section
|
|
133
|
+
The readme describes performing a mint with:
|
|
134
|
+
```javascript
|
|
135
|
+
sdk.performMintChain(web3, vaultData.tokenId, contractTemplate.targetContract.name, updateLogCallback)
|
|
136
|
+
.then(result => {
|
|
137
|
+
// Handle success
|
|
138
|
+
})
|
|
139
|
+
.catch(error => {
|
|
140
|
+
// Handle error
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Verification:
|
|
145
|
+
- ✅ The `performMintChain` method exists in `index.ts` (line ~253)
|
|
146
|
+
- ✅ It takes web3, tokenId, collectionName, and callback parameters
|
|
147
|
+
- ✅ It returns a Promise that resolves with the mint response
|
|
148
|
+
- ✅ The implementation follows the chain of operations described in the examples
|
|
149
|
+
- ✅ The example in `steps.html` confirms this usage pattern
|
|
150
|
+
|
|
151
|
+
</details>
|
|
152
|
+
|
|
153
|
+
<details>
|
|
154
|
+
<summary>readme.md (line 100 of 306)</summary>
|
|
155
|
+
|
|
156
|
+
### Utility Functions Section
|
|
157
|
+
The readme lists several utility functions with their signatures and descriptions. Let's verify each one:
|
|
158
|
+
|
|
159
|
+
#### `generateUploadUrl()`
|
|
160
|
+
- ❌ This function is mentioned in the readme but appears to be just a placeholder in `index.ts` (line ~19)
|
|
161
|
+
- ❌ The implementation in the code is empty with a comment "// Implementation goes here"
|
|
162
|
+
- ⚠️ This function should be removed from the readme or properly implemented
|
|
163
|
+
|
|
164
|
+
#### `generateAttributeTemplate(record: any)`
|
|
165
|
+
- ✅ This function exists in `utils.ts` (line ~74)
|
|
166
|
+
- ✅ It takes a record parameter and returns an array of attribute templates
|
|
167
|
+
- ✅ The implementation handles different collection types with specific attribute structures
|
|
168
|
+
- ✅ The function signature matches the readme description
|
|
169
|
+
|
|
170
|
+
#### `generateImageTemplate(record: any)`
|
|
171
|
+
- ✅ This function exists in `utils.ts` (line ~240)
|
|
172
|
+
- ✅ It takes a record parameter and returns an image template object
|
|
173
|
+
- ✅ The implementation handles different collection types with specific image structures
|
|
174
|
+
- ✅ The function signature matches the readme description
|
|
175
|
+
|
|
176
|
+
#### `generateTemplate(record: any)`
|
|
177
|
+
- ✅ This function exists in `utils.ts` (line ~261)
|
|
178
|
+
- ✅ It takes a curated collection record and returns a template object
|
|
179
|
+
- ✅ The implementation creates rules and utilities for the curated collection
|
|
180
|
+
- ✅ The function signature matches the readme description
|
|
181
|
+
|
|
182
|
+
#### `templateGuard(input: { [x: string]: any; hasOwnProperty: (arg0: string) => any; })`
|
|
183
|
+
- ✅ This function exists in `utils.ts` (line ~585)
|
|
184
|
+
- ✅ It validates template input and throws errors for missing/invalid fields
|
|
185
|
+
- ✅ The parameter type matches the readme description
|
|
186
|
+
- ✅ The implementation performs the validation described in the readme
|
|
187
|
+
|
|
188
|
+
#### `genericGuard(input: any, type: string, key: string)`
|
|
189
|
+
- ✅ This function exists in `utils.ts` (line ~616)
|
|
190
|
+
- ✅ It validates input against a specified type and key
|
|
191
|
+
- ✅ The parameter types match the readme description
|
|
192
|
+
- ✅ The implementation performs the validation described in the readme
|
|
193
|
+
|
|
194
|
+
#### `getQuoteContractObject(web3: any)`
|
|
195
|
+
- ✅ This function exists in `utils.ts` (line ~621)
|
|
196
|
+
- ✅ It takes a web3 instance and returns a quote contract object
|
|
197
|
+
- ✅ The parameter type matches the readme description
|
|
198
|
+
- ✅ The example provided in the readme matches the expected usage
|
|
199
|
+
|
|
200
|
+
#### `getHandlerContract(web3: any)`
|
|
201
|
+
- ✅ This function exists in `utils.ts` (line ~627)
|
|
202
|
+
- ✅ It takes a web3 instance and returns a handler contract object
|
|
203
|
+
- ✅ The parameter type matches the readme description
|
|
204
|
+
- ✅ The implementation matches the description in the readme
|
|
205
|
+
|
|
206
|
+
#### `getLegacyContract(web3: any)`
|
|
207
|
+
- ✅ This function exists in `utils.ts` (line ~633)
|
|
208
|
+
- ✅ It takes a web3 instance and returns a legacy contract object
|
|
209
|
+
- ✅ The parameter type matches the readme description
|
|
210
|
+
- ✅ The implementation matches the description in the readme
|
|
211
|
+
|
|
212
|
+
</details>
|
|
213
|
+
|
|
214
|
+
<details>
|
|
215
|
+
<summary>readme.md (line 170 of 306)</summary>
|
|
216
|
+
|
|
217
|
+
#### `checkContentType(url: string)`
|
|
218
|
+
- ✅ This function exists in `utils.ts` (line ~639)
|
|
219
|
+
- ✅ It makes a HEAD request to check the content type of a URL
|
|
220
|
+
- ✅ The parameter type matches the readme description
|
|
221
|
+
- ✅ The implementation returns an object with content type information as described
|
|
222
|
+
|
|
223
|
+
#### `getTorusKeys(verifierId: string, idToken: any, cb: any = null)`
|
|
224
|
+
- ✅ This function exists in `utils.ts` (line ~811)
|
|
225
|
+
- ✅ It retrieves Torus keys using the provided verifier ID and ID token
|
|
226
|
+
- ✅ The parameter types match the readme description
|
|
227
|
+
- ✅ The implementation returns a Promise that resolves to an object with the private key
|
|
228
|
+
|
|
229
|
+
#### `decryptKeys(vaultCiphertextV2: any, keys: any, addresses: any[])`
|
|
230
|
+
- ✅ This function exists in `utils.ts` (line ~822)
|
|
231
|
+
- ✅ It decrypts vault keys using the provided parameters
|
|
232
|
+
- ✅ The parameter types match the readme description
|
|
233
|
+
- ✅ The implementation returns a Promise that resolves to the decrypted payload
|
|
234
|
+
|
|
235
|
+
#### `getSatsConnectAddress()`
|
|
236
|
+
- ✅ This function exists in `utils.ts` (line ~841)
|
|
237
|
+
- ✅ It retrieves the Sats Connect address
|
|
238
|
+
- ✅ The implementation returns a Promise with payment address, payment public key, and ordinals address
|
|
239
|
+
- ✅ The function signature matches the readme description
|
|
240
|
+
|
|
241
|
+
#### `signPSBT(psbtBase64: any, paymentAddress: any, indexes: number[], broadcast: boolean = false)`
|
|
242
|
+
- ✅ This function exists in `utils.ts` (line ~875)
|
|
243
|
+
- ✅ It signs a Partially Signed Bitcoin Transaction with the provided parameters
|
|
244
|
+
- ✅ The parameter types match the readme description
|
|
245
|
+
- ✅ The implementation returns a Promise that resolves to the signed PSBT response
|
|
246
|
+
|
|
247
|
+
### Example Usage Section
|
|
248
|
+
The readme provides a complete example with step-by-step code for:
|
|
249
|
+
1. Creating a vault
|
|
250
|
+
2. Refreshing its balance
|
|
251
|
+
3. Validating mintability
|
|
252
|
+
4. Performing a mint
|
|
253
|
+
|
|
254
|
+
Verification:
|
|
255
|
+
- ✅ The example code matches the API methods available in the SDK
|
|
256
|
+
- ✅ The flow is consistent with the examples in `docs/steps.html`
|
|
257
|
+
- ✅ All functions used in the example are implemented in the codebase
|
|
258
|
+
- ✅ The error handling patterns match the expected usage
|
|
259
|
+
|
|
260
|
+
</details>
|
|
261
|
+
|
|
262
|
+
<details>
|
|
263
|
+
<summary>index.ts (line 1 of 605)</summary>
|
|
264
|
+
|
|
265
|
+
The `index.ts` file is the main entry point for the Emblem Vault SDK. It defines the `EmblemVaultSDK` class and exports it as the default export.
|
|
266
|
+
|
|
267
|
+
### Import Statements
|
|
268
|
+
The file imports:
|
|
269
|
+
- `BigNumber` from '@ethersproject/bignumber'
|
|
270
|
+
- Various types from './types'
|
|
271
|
+
- Utility functions from './utils'
|
|
272
|
+
- Bitcoin-related functions from 'sats-connect'
|
|
273
|
+
- Derivation functions from './derive'
|
|
274
|
+
|
|
275
|
+
### SDK Version
|
|
276
|
+
The SDK version is defined as a constant:
|
|
277
|
+
```typescript
|
|
278
|
+
const SDK_VERSION = '__SDK_VERSION__';
|
|
279
|
+
```
|
|
280
|
+
⚠️ This appears to be a placeholder that should be replaced during the build process.
|
|
281
|
+
|
|
282
|
+
### EmblemVaultSDK Class
|
|
283
|
+
The class constructor requires an API key and has optional parameters for baseUrl, v3Url, and sigUrl:
|
|
284
|
+
```typescript
|
|
285
|
+
constructor(private apiKey: string, baseUrl?: string, v3Url?: string, sigUrl?: string) {
|
|
286
|
+
console.log('EmblemVaultSDK version:', SDK_VERSION)
|
|
287
|
+
if (!apiKey) {
|
|
288
|
+
throw new Error('API key is required');
|
|
289
|
+
}
|
|
290
|
+
this.baseUrl = baseUrl || 'https://v2.emblemvault.io';
|
|
291
|
+
this.v3Url = v3Url || 'https://v3.emblemvault.io';
|
|
292
|
+
this.sigUrl = sigUrl || 'https://tor-us-signer-coval.vercel.app';
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
The class is organized into several sections:
|
|
297
|
+
1. Asset Metadata methods
|
|
298
|
+
2. Curated Collection methods
|
|
299
|
+
3. Vault operations
|
|
300
|
+
4. Web3 integration
|
|
301
|
+
5. Bitcoin-specific functions
|
|
302
|
+
|
|
303
|
+
### Asset Metadata Methods
|
|
304
|
+
- `getAssetMetadata`: Gets metadata for a specific project
|
|
305
|
+
- `getAllAssetMetadata`: Gets all asset metadata
|
|
306
|
+
- `getRemoteAssetMetadataProjectList`: Gets project list from remote API
|
|
307
|
+
- `getRemoteAssetMetadata`: Gets asset metadata for a specific asset from remote API
|
|
308
|
+
- `getRemoteAssetMetadataVaultedProjectList`: Gets vaulted project list from remote API
|
|
309
|
+
- `getAllProjects`: Gets all projects from metadata
|
|
310
|
+
|
|
311
|
+
These methods are not explicitly mentioned in the readme but provide important functionality for working with asset metadata.
|
|
312
|
+
|
|
313
|
+
</details>
|
|
314
|
+
|
|
315
|
+
<details>
|
|
316
|
+
<summary>index.ts (line 150 of 605)</summary>
|
|
317
|
+
|
|
318
|
+
### Curated Collection Methods
|
|
319
|
+
The SDK provides several methods for working with curated collections:
|
|
320
|
+
|
|
321
|
+
- `fetchCuratedContracts(hideUnMintable: boolean = false, overrideFunc: any = null)`: Fetches all curated contracts
|
|
322
|
+
- ✅ This method is documented in the readme
|
|
323
|
+
- ✅ The implementation matches the documentation
|
|
324
|
+
- ✅ It returns a Promise with an array of curated contracts
|
|
325
|
+
|
|
326
|
+
- `fetchCuratedContractByName(name: string)`: Fetches a specific curated contract by name
|
|
327
|
+
- ✅ This method is documented in the readme
|
|
328
|
+
- ✅ The implementation matches the documentation
|
|
329
|
+
- ✅ It returns a Promise with a single curated contract object
|
|
330
|
+
|
|
331
|
+
### Vault Operations
|
|
332
|
+
The SDK provides methods for creating and managing vaults:
|
|
333
|
+
|
|
334
|
+
- `createCuratedVault(template: any, callback: any = null)`: Creates a curated vault
|
|
335
|
+
- ✅ This method is documented in the readme
|
|
336
|
+
- ✅ The implementation matches the documentation
|
|
337
|
+
- ✅ It validates the template using `templateGuard`
|
|
338
|
+
- ✅ It returns a Promise with the created vault data
|
|
339
|
+
|
|
340
|
+
- `refreshBalance(tokenId: string, callback: any = null)`: Refreshes the balance of a vault
|
|
341
|
+
- ✅ This method is documented in the readme
|
|
342
|
+
- ✅ The implementation matches the documentation
|
|
343
|
+
- ✅ It returns a Promise with the updated balance data
|
|
344
|
+
|
|
345
|
+
- `fetchMetadata(tokenId: string, callback: any = null)`: Fetches metadata for a vault
|
|
346
|
+
- ✅ This method is documented in the readme
|
|
347
|
+
- ✅ The implementation matches the documentation
|
|
348
|
+
- ✅ It returns a Promise with the vault metadata
|
|
349
|
+
|
|
350
|
+
- `fetchVaults(address: string, callback: any = null)`: Fetches all vaults for an address
|
|
351
|
+
- ✅ This method is documented in the readme
|
|
352
|
+
- ✅ The implementation matches the documentation
|
|
353
|
+
- ✅ It returns a Promise with an array of vaults
|
|
354
|
+
|
|
355
|
+
### Web3 Integration
|
|
356
|
+
The SDK provides methods for interacting with Web3:
|
|
357
|
+
|
|
358
|
+
- `loadWeb3()`: Loads Web3 and returns a Web3 instance
|
|
359
|
+
- ✅ This method is documented in the readme
|
|
360
|
+
- ✅ The implementation matches the documentation
|
|
361
|
+
- ✅ It returns a Promise with a Web3 instance
|
|
362
|
+
|
|
363
|
+
- `performMintChain(web3: any, tokenId: string, collectionName: string, callback: any = null)`: Performs a mint operation
|
|
364
|
+
- ✅ This method is documented in the readme
|
|
365
|
+
- ✅ The implementation matches the documentation
|
|
366
|
+
- ✅ It returns a Promise with the mint response
|
|
367
|
+
- ✅ The implementation follows the chain of operations described in the examples
|
|
368
|
+
|
|
369
|
+
### Bitcoin-specific Functions
|
|
370
|
+
The SDK provides methods for working with Bitcoin:
|
|
371
|
+
|
|
372
|
+
- `generateTaprootAddressFromMnemonic(phrase: string)`: Generates a Taproot address from a mnemonic
|
|
373
|
+
- ❌ This method is not documented in the readme
|
|
374
|
+
- ✅ The implementation is in `derive.ts`
|
|
375
|
+
- ⚠️ This method should be added to the readme
|
|
376
|
+
|
|
377
|
+
- `getPsbtTxnSize(phrase: string, psbtBase64: string)`: Gets the virtual size of a PSBT transaction
|
|
378
|
+
- ❌ This method is not documented in the readme
|
|
379
|
+
- ✅ The implementation is in `derive.ts`
|
|
380
|
+
- ⚠️ This method should be added to the readme
|
|
381
|
+
|
|
382
|
+
### Additional Methods
|
|
383
|
+
The SDK provides several additional methods that are not documented in the readme:
|
|
384
|
+
|
|
385
|
+
- `fetchVaultsByTokenIds(tokenIds: string[], callback: any = null)`: Fetches vaults by token IDs
|
|
386
|
+
- `fetchVaultsByQuery(query: string, callback: any = null)`: Fetches vaults by query
|
|
387
|
+
- `fetchVaultsByQueryV3(query: string, callback: any = null)`: Fetches vaults by query using V3 API
|
|
388
|
+
- `fetchVaultsByAddressV3(address: string, callback: any = null)`: Fetches vaults by address using V3 API
|
|
389
|
+
- `fetchVaultsByTokenIdsV3(tokenIds: string[], callback: any = null)`: Fetches vaults by token IDs using V3 API
|
|
390
|
+
- `fetchMetadataV3(tokenId: string, callback: any = null)`: Fetches metadata using V3 API
|
|
391
|
+
- `refreshBalanceV3(tokenId: string, callback: any = null)`: Refreshes balance using V3 API
|
|
392
|
+
- `getVaultBalanceByAddress(address: string, coin: string)`: Gets vault balance by address and coin
|
|
393
|
+
- `getVaultBalanceByAddressV3(address: string, coin: string)`: Gets vault balance by address and coin using V3 API
|
|
394
|
+
|
|
395
|
+
⚠️ These methods should be added to the readme for completeness.
|
|
396
|
+
|
|
397
|
+
</details>
|
|
398
|
+
|
|
399
|
+
<details>
|
|
400
|
+
<summary>types.ts (line 1 of 123)</summary>
|
|
401
|
+
|
|
402
|
+
The `types.ts` file defines the types used throughout the SDK. It includes interfaces and types for:
|
|
403
|
+
|
|
404
|
+
### Vault-related Types
|
|
405
|
+
- `Vault`: Represents a vault with properties like tokenId, addresses, and metadata
|
|
406
|
+
- `VaultAddress`: Represents an address in a vault with properties like coin, address, and balance
|
|
407
|
+
- `VaultBalance`: Represents a balance in a vault with properties like coin, balance, and usd
|
|
408
|
+
|
|
409
|
+
### Metadata Types
|
|
410
|
+
- `Metadata`: Represents metadata for a vault with properties like name, description, and image
|
|
411
|
+
- `MetadataAttribute`: Represents an attribute in metadata with properties like trait_type and value
|
|
412
|
+
- `CollectionResponse`: Represents a response from the collection API with properties like name and description
|
|
413
|
+
|
|
414
|
+
### Contract Types
|
|
415
|
+
- `CuratedContract`: Represents a curated contract with properties like name, description, and address
|
|
416
|
+
- `ContractAddress`: Represents an address for a contract with properties like chainId and address
|
|
417
|
+
|
|
418
|
+
### Verification
|
|
419
|
+
- ✅ The types are well-defined and used consistently throughout the codebase
|
|
420
|
+
- ✅ The types match the data structures used in the API responses
|
|
421
|
+
- ❌ The types are not documented in the readme
|
|
422
|
+
- ⚠️ The types should be added to the readme for completeness
|
|
423
|
+
|
|
424
|
+
### Example Type Definition
|
|
425
|
+
```typescript
|
|
426
|
+
export interface Vault {
|
|
427
|
+
tokenId: string;
|
|
428
|
+
addresses: VaultAddress[];
|
|
429
|
+
metadata: Metadata;
|
|
430
|
+
// Other properties...
|
|
431
|
+
}
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
### Discrepancies
|
|
435
|
+
- The readme does not include any type definitions or interfaces
|
|
436
|
+
- The SDK uses TypeScript, but the readme examples are in JavaScript
|
|
437
|
+
- The readme does not mention TypeScript or type safety
|
|
438
|
+
- The readme does not include information about the data structures returned by the API
|
|
439
|
+
|
|
440
|
+
⚠️ The readme should be updated to include information about the types and interfaces used in the SDK.
|
|
441
|
+
|
|
442
|
+
</details>
|
|
443
|
+
|
|
444
|
+
<details>
|
|
445
|
+
<summary>derive.ts (line 1 of 94)</summary>
|
|
446
|
+
|
|
447
|
+
The `derive.ts` file provides Bitcoin-related functionality for the SDK. It includes functions for:
|
|
448
|
+
|
|
449
|
+
### Bitcoin Address Generation
|
|
450
|
+
- `generateTaprootAddressFromMnemonic(phrase: string)`: Generates a Taproot address from a mnemonic
|
|
451
|
+
- Takes a mnemonic phrase as input
|
|
452
|
+
- Returns an object with p2tr, tweakedSigner, pubKey, path, and coin properties
|
|
453
|
+
- Uses the BIP32 and BIP39 libraries for key derivation
|
|
454
|
+
- Uses the Bitcoin.js library for address generation
|
|
455
|
+
|
|
456
|
+
### PSBT Transaction Size Calculation
|
|
457
|
+
- `getPsbtTxnSize(phrase: string, psbtBase64: string)`: Gets the virtual size of a PSBT transaction
|
|
458
|
+
- Takes a mnemonic phrase and a base64-encoded PSBT as input
|
|
459
|
+
- Returns the virtual size of the transaction
|
|
460
|
+
- Uses a dummy key to sign the transaction for size calculation
|
|
461
|
+
- Handles both Taproot and P2SH inputs
|
|
462
|
+
|
|
463
|
+
### Verification
|
|
464
|
+
- ❌ These functions are not documented in the readme
|
|
465
|
+
- ✅ The functions are used in the SDK
|
|
466
|
+
- ⚠️ These functions should be added to the readme for completeness
|
|
467
|
+
|
|
468
|
+
### Dependencies
|
|
469
|
+
The file depends on:
|
|
470
|
+
- `bip32` for BIP32 key derivation
|
|
471
|
+
- `bip39` for mnemonic handling
|
|
472
|
+
- `@bitcoin-js/tiny-secp256k1-asmjs` for elliptic curve operations
|
|
473
|
+
- The global `window.bitcoin` object for Bitcoin operations
|
|
474
|
+
|
|
475
|
+
### Discrepancies
|
|
476
|
+
- The readme does not mention Bitcoin-specific functionality
|
|
477
|
+
- The SDK provides Bitcoin-related functions that are not documented
|
|
478
|
+
- The readme does not include information about the dependencies required for Bitcoin operations
|
|
479
|
+
|
|
480
|
+
⚠️ The readme should be updated to include information about the Bitcoin-related functionality provided by the SDK.
|
|
481
|
+
|
|
482
|
+
</details>
|
|
483
|
+
|
|
484
|
+
<details>
|
|
485
|
+
<summary>docs/index.html (line 1 of 247)</summary>
|
|
486
|
+
|
|
487
|
+
The `docs/index.html` file provides a browser-based test interface for the Emblem Vault SDK. It demonstrates:
|
|
488
|
+
|
|
489
|
+
### SDK Initialization
|
|
490
|
+
```javascript
|
|
491
|
+
const sdk = new EmblemVaultSDK('demo');
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### Fetching Curated Contracts
|
|
495
|
+
```javascript
|
|
496
|
+
sdk.fetchCuratedContracts(false).then(curatedContracts => {
|
|
497
|
+
window.curatedContracts = curatedContracts;
|
|
498
|
+
generateDropdown(curatedContracts);
|
|
499
|
+
});
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
### Creating Vaults
|
|
503
|
+
```javascript
|
|
504
|
+
async function createVault() {
|
|
505
|
+
let vault = await sdk.createCuratedVault(window.template)
|
|
506
|
+
// ...
|
|
507
|
+
}
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
### Fetching Metadata
|
|
511
|
+
```javascript
|
|
512
|
+
async function getMetadata() {
|
|
513
|
+
let metadata = await sdk.fetchMetadata(document.getElementById('tokenId').value)
|
|
514
|
+
// ...
|
|
515
|
+
}
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
### Web3 Integration
|
|
519
|
+
```javascript
|
|
520
|
+
async function connectWeb3() {
|
|
521
|
+
sdk.loadWeb3().then(async (web3) => {
|
|
522
|
+
// ...
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### Verification
|
|
528
|
+
- ✅ The example code matches the API methods available in the SDK
|
|
529
|
+
- ✅ The usage patterns match the documentation in the readme
|
|
530
|
+
- ✅ The example demonstrates the core functionality of the SDK
|
|
531
|
+
- ✅ The example includes error handling and callback usage
|
|
532
|
+
|
|
533
|
+
### Additional Features
|
|
534
|
+
The example demonstrates additional features not explicitly covered in the readme:
|
|
535
|
+
- Creating multiple vaults in sequence
|
|
536
|
+
- Generating CSV data from vault information
|
|
537
|
+
- Working with asset metadata
|
|
538
|
+
- Displaying vault details in a UI
|
|
539
|
+
|
|
540
|
+
⚠️ These additional features could be mentioned in the readme to provide more comprehensive documentation.
|
|
541
|
+
|
|
542
|
+
</details>
|
|
543
|
+
|
|
544
|
+
<details>
|
|
545
|
+
<summary>docs/bels.html (line 1 of 73)</summary>
|
|
546
|
+
|
|
547
|
+
The `docs/bels.html` file provides a simplified example of using the Emblem Vault SDK for the "Embels" collection. It demonstrates:
|
|
548
|
+
|
|
549
|
+
### SDK Initialization
|
|
550
|
+
```javascript
|
|
551
|
+
const sdk = new EmblemVaultSDK('demo');
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
### Template Definition
|
|
555
|
+
```javascript
|
|
556
|
+
let embelsTemplate = {
|
|
557
|
+
"fromAddress": null,
|
|
558
|
+
"toAddress": null,
|
|
559
|
+
"chainId":1,
|
|
560
|
+
"experimental":true,
|
|
561
|
+
"targetContract":{
|
|
562
|
+
"1":"0x25e6CfD042294a716FF60603ca01e92555cA9426",
|
|
563
|
+
"name":"Embels",
|
|
564
|
+
"description":"EmBells is a collection of 10,000 Bellinals from the Bellscoin blockchain. Art is created by Viva La Vandal and this collection is curated by Emblem Vault."
|
|
565
|
+
},
|
|
566
|
+
"targetAsset":{
|
|
567
|
+
"name":"Inscribing...",
|
|
568
|
+
"image":"https://emblem.finance/embells.png"
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
### Creating and Minting a Vault
|
|
574
|
+
```javascript
|
|
575
|
+
async function performCreateAndMint() {
|
|
576
|
+
// populate the template
|
|
577
|
+
embelsTemplate.toAddress = defaultAccount;
|
|
578
|
+
embelsTemplate.fromAddress = defaultAccount;
|
|
579
|
+
|
|
580
|
+
// Create a vault
|
|
581
|
+
let vaultData = await sdk.createCuratedVault(embelsTemplate, updateLogCallback);
|
|
582
|
+
if (vaultData.tokenId) {
|
|
583
|
+
// Perform Mint steps
|
|
584
|
+
sdk.performMintChain(web3, vaultData.tokenId, embelsTemplate.targetContract.name, updateLogCallback).then(result => {
|
|
585
|
+
updateLogCallback('Minting success', 'tokenId: ' + vaultData.tokenId)
|
|
586
|
+
})
|
|
587
|
+
.catch(error => {
|
|
588
|
+
updateLogCallback('',error.message)
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
### Verification
|
|
595
|
+
- ✅ The example code matches the API methods available in the SDK
|
|
596
|
+
- ✅ The usage patterns match the documentation in the readme
|
|
597
|
+
- ✅ The example demonstrates the core functionality of the SDK
|
|
598
|
+
- ✅ The example includes error handling and callback usage
|
|
599
|
+
|
|
600
|
+
### Simplified Workflow
|
|
601
|
+
This example provides a more streamlined workflow compared to the readme example:
|
|
602
|
+
1. It combines the create and mint steps into a single function
|
|
603
|
+
2. It uses a predefined template for the Embels collection
|
|
604
|
+
3. It provides a simpler UI with just a single button to start the process
|
|
605
|
+
|
|
606
|
+
⚠️ This simplified workflow could be mentioned in the readme as an alternative approach for specific collections.
|
|
607
|
+
|
|
608
|
+
</details>
|
|
609
|
+
|
|
610
|
+
<details>
|
|
611
|
+
<summary>docs/steps.html (line 1 of 109)</summary>
|
|
612
|
+
|
|
613
|
+
The `docs/steps.html` file provides a step-by-step example of using the Emblem Vault SDK for the "Bitcoin DeGods" collection. It demonstrates:
|
|
614
|
+
|
|
615
|
+
### SDK Initialization
|
|
616
|
+
```javascript
|
|
617
|
+
const sdk = new EmblemVaultSDK('demo');
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
### Template Definition
|
|
621
|
+
```javascript
|
|
622
|
+
let contractTemplate = {
|
|
623
|
+
"fromAddress": null,
|
|
624
|
+
"toAddress": null,
|
|
625
|
+
"chainId":1,
|
|
626
|
+
"experimental":true,
|
|
627
|
+
"targetContract":{
|
|
628
|
+
"1":"0x345eF9d7E75aEEb979053AA41BB6330683353B7b",
|
|
629
|
+
"5":"0x582699d2c58A38056Cf02875540705137f0bbbF7",
|
|
630
|
+
"name":"Bitcoin DeGods",
|
|
631
|
+
"description":"Bitcoin DeGods is a collection of 535 Bitcoin Ordinals inscribed in the 77236 to 77770 range. This collection is curated by Emblem Vault. "
|
|
632
|
+
},
|
|
633
|
+
"targetAsset":{
|
|
634
|
+
"image":"https://emblem.finance/btcdegods.jpg",
|
|
635
|
+
"name":"Loading...",
|
|
636
|
+
"xtra": "anything else you need here"
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
### Step-by-Step Process
|
|
642
|
+
The example breaks down the process into three steps:
|
|
643
|
+
1. Create a vault
|
|
644
|
+
2. Refresh the vault balance
|
|
645
|
+
3. Validate mintability and perform the mint
|
|
646
|
+
|
|
647
|
+
```javascript
|
|
648
|
+
async function Step1() {
|
|
649
|
+
// Load Web3 and create a vault
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
async function Step2() {
|
|
653
|
+
// Refresh the vault balance
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
async function Step3() {
|
|
657
|
+
// Validate mintability and perform the mint
|
|
658
|
+
}
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
### Verification
|
|
662
|
+
- ✅ The example code matches the API methods available in the SDK
|
|
663
|
+
- ✅ The usage patterns match the documentation in the readme
|
|
664
|
+
- ✅ The example demonstrates the core functionality of the SDK
|
|
665
|
+
- ✅ The example includes error handling and callback usage
|
|
666
|
+
- ✅ The step-by-step process matches the workflow described in the readme
|
|
667
|
+
|
|
668
|
+
### UI Integration
|
|
669
|
+
The example includes UI elements for each step:
|
|
670
|
+
- Buttons for each step that are enabled/disabled based on the current state
|
|
671
|
+
- A log area for displaying progress and results
|
|
672
|
+
- Error handling and user feedback
|
|
673
|
+
|
|
674
|
+
⚠️ The readme could be improved by including more information about UI integration and user feedback.
|
|
675
|
+
|
|
676
|
+
</details>
|
|
677
|
+
|
|
678
|
+
## Comprehensive Documentation Discrepancies Summary
|
|
679
|
+
|
|
680
|
+
Based on the verification of the readme.md against the current codebase, here are the key discrepancies and recommendations for updating the documentation:
|
|
681
|
+
|
|
682
|
+
### 1. Missing Functions and Methods
|
|
683
|
+
- **Bitcoin-related Functions**:
|
|
684
|
+
- `generateTaprootAddressFromMnemonic(phrase: string)` and `getPsbtTxnSize(phrase: string, psbtBase64: string)` from `derive.ts` are not documented
|
|
685
|
+
- These functions provide important Bitcoin functionality that should be included in the readme
|
|
686
|
+
|
|
687
|
+
- **V3 API Methods**:
|
|
688
|
+
- Several V3 API methods are not documented (`fetchVaultsByQueryV3`, `fetchVaultsByAddressV3`, etc.)
|
|
689
|
+
- These methods provide alternative ways to interact with the V3 API and should be included in the readme
|
|
690
|
+
|
|
691
|
+
- **Asset Metadata Functions**:
|
|
692
|
+
- Functions for working with asset metadata (`getAssetMetadata`, `getAllAssetMetadata`, etc.) are not documented
|
|
693
|
+
- These functions provide important functionality for working with asset metadata and should be included in the readme
|
|
694
|
+
|
|
695
|
+
- **Placeholder Functions**:
|
|
696
|
+
- `generateUploadUrl()` is mentioned in the readme but appears to be just a placeholder in the code
|
|
697
|
+
- This function should either be implemented or removed from the readme
|
|
698
|
+
|
|
699
|
+
### 2. TypeScript Types and Interfaces
|
|
700
|
+
- **Type Definitions**:
|
|
701
|
+
- The readme does not include any information about the TypeScript types and interfaces defined in `types.ts`
|
|
702
|
+
- The data structures returned by the API are not documented
|
|
703
|
+
- The readme should include a section on TypeScript types and interfaces
|
|
704
|
+
|
|
705
|
+
- **Type Safety**:
|
|
706
|
+
- The SDK uses TypeScript, but the readme examples are in JavaScript
|
|
707
|
+
- The readme should mention TypeScript support and provide TypeScript examples
|
|
708
|
+
|
|
709
|
+
### 3. Bitcoin Functionality
|
|
710
|
+
- **Bitcoin Operations**:
|
|
711
|
+
- The readme does not mention the Bitcoin-specific functionality provided by the SDK
|
|
712
|
+
- The dependencies required for Bitcoin operations are not documented
|
|
713
|
+
- The readme should include a section on Bitcoin functionality
|
|
714
|
+
|
|
715
|
+
- **PSBT Operations**:
|
|
716
|
+
- The SDK provides functions for working with Partially Signed Bitcoin Transactions
|
|
717
|
+
- These functions are not well-documented in the readme
|
|
718
|
+
- The readme should include more information about PSBT operations
|
|
719
|
+
|
|
720
|
+
### 4. Additional Features and Examples
|
|
721
|
+
- **UI Integration**:
|
|
722
|
+
- The examples in the HTML files demonstrate UI integration that is not covered in the readme
|
|
723
|
+
- The readme should include more information about UI integration and user feedback
|
|
724
|
+
|
|
725
|
+
- **Collection-specific Workflows**:
|
|
726
|
+
- The examples in the HTML files demonstrate simplified workflows for specific collections
|
|
727
|
+
- These workflows should be mentioned in the readme as alternative approaches
|
|
728
|
+
|
|
729
|
+
- **Multiple Vault Creation**:
|
|
730
|
+
- The example in `index.html` demonstrates creating multiple vaults in sequence
|
|
731
|
+
- This functionality should be mentioned in the readme
|
|
732
|
+
|
|
733
|
+
- **CSV Data Generation**:
|
|
734
|
+
- The example in `index.html` demonstrates generating CSV data from vault information
|
|
735
|
+
- This functionality should be mentioned in the readme
|
|
736
|
+
|
|
737
|
+
### 5. API Documentation
|
|
738
|
+
- **API Endpoints**:
|
|
739
|
+
- The readme does not provide detailed information about the API endpoints used by the SDK
|
|
740
|
+
- The readme should include more information about the API endpoints and their parameters
|
|
741
|
+
|
|
742
|
+
- **Error Handling**:
|
|
743
|
+
- The readme does not provide detailed information about error handling
|
|
744
|
+
- The readme should include more information about error handling and error codes
|
|
745
|
+
|
|
746
|
+
### 6. Dependencies and Requirements
|
|
747
|
+
- **Browser Requirements**:
|
|
748
|
+
- The SDK requires a browser environment for some functionality
|
|
749
|
+
- The readme should mention browser requirements and compatibility
|
|
750
|
+
|
|
751
|
+
- **External Dependencies**:
|
|
752
|
+
- The SDK depends on several external libraries
|
|
753
|
+
- The readme should list all dependencies and their versions
|
|
754
|
+
|
|
755
|
+
## Recommendations for Documentation Updates
|
|
756
|
+
|
|
757
|
+
1. **Add Missing Functions**: Add documentation for all missing functions and methods, including Bitcoin-related functions, V3 API methods, and asset metadata functions.
|
|
758
|
+
|
|
759
|
+
2. **Add TypeScript Types**: Add a section on TypeScript types and interfaces, including examples of how to use them.
|
|
760
|
+
|
|
761
|
+
3. **Expand Bitcoin Documentation**: Add a section on Bitcoin functionality, including address generation, PSBT operations, and dependencies.
|
|
762
|
+
|
|
763
|
+
4. **Add UI Integration Examples**: Add examples of UI integration and user feedback, based on the examples in the HTML files.
|
|
764
|
+
|
|
765
|
+
5. **Add Collection-specific Workflows**: Add examples of simplified workflows for specific collections, based on the examples in the HTML files.
|
|
766
|
+
|
|
767
|
+
6. **Update API Documentation**: Add more detailed information about API endpoints, parameters, and error handling.
|
|
768
|
+
|
|
769
|
+
7. **Update Dependencies**: List all dependencies and their versions, including browser requirements.
|
|
770
|
+
|
|
771
|
+
8. **Remove Placeholder Functions**: Remove documentation for placeholder functions that are not implemented.
|
|
772
|
+
|
|
773
|
+
9. **Add TypeScript Examples**: Add TypeScript examples alongside JavaScript examples.
|
|
774
|
+
|
|
775
|
+
10. **Add Data Structure Documentation**: Add documentation for the data structures returned by the API.
|
|
776
|
+
|
|
777
|
+
These updates would significantly improve the accuracy and completeness of the readme.md documentation, making it more aligned with the current codebase and providing better guidance for users of the Emblem Vault SDK.
|
|
778
|
+
|
|
779
|
+
## Left to Study
|
|
780
|
+
- None - all files have been analyzed
|
|
781
|
+
|
|
782
|
+
<details>
|
|
783
|
+
<summary>utils.ts (line 1 of 904)</summary>
|
|
784
|
+
|
|
785
|
+
The `utils.ts` file contains utility functions used throughout the SDK. It's the largest file in the codebase and includes a wide range of functionality.
|
|
786
|
+
|
|
787
|
+
### Import Statements
|
|
788
|
+
The file imports:
|
|
789
|
+
- Various cryptographic libraries (`crypto`, `eccrypto`)
|
|
790
|
+
- HTTP request libraries (`axios`, `node-fetch`)
|
|
791
|
+
- Bitcoin-related libraries (`bip39`, `bitcoinjs-lib`)
|
|
792
|
+
- Ethereum-related libraries (`ethers`, `web3`)
|
|
793
|
+
- Type definitions from './types'
|
|
794
|
+
|
|
795
|
+
### Core Utility Functions
|
|
796
|
+
The file provides several core utility functions:
|
|
797
|
+
|
|
798
|
+
#### Data Fetching
|
|
799
|
+
- `fetchData(url: string, apiKey: string, method: string = 'GET', body: any = null)`: Fetches data from an API endpoint
|
|
800
|
+
- ✅ This function is used throughout the SDK
|
|
801
|
+
- ❌ This function is not documented in the readme
|
|
802
|
+
- ⚠️ This function should be added to the readme
|
|
803
|
+
|
|
804
|
+
#### Template Generation
|
|
805
|
+
- `generateAttributeTemplate(record: any)`: Generates attribute templates for metadata
|
|
806
|
+
- ✅ This function is documented in the readme
|
|
807
|
+
- ✅ The implementation matches the documentation
|
|
808
|
+
|
|
809
|
+
- `generateImageTemplate(record: any)`: Generates image templates for metadata
|
|
810
|
+
- ✅ This function is documented in the readme
|
|
811
|
+
- ✅ The implementation matches the documentation
|
|
812
|
+
|
|
813
|
+
- `generateTemplate(record: any)`: Generates a template for a curated collection
|
|
814
|
+
- ✅ This function is documented in the readme
|
|
815
|
+
- ✅ The implementation matches the documentation
|
|
816
|
+
|
|
817
|
+
#### Input Validation
|
|
818
|
+
- `templateGuard(input: { [x: string]: any; hasOwnProperty: (arg0: string) => any; })`: Validates template input
|
|
819
|
+
- ✅ This function is documented in the readme
|
|
820
|
+
- ✅ The implementation matches the documentation
|
|
821
|
+
|
|
822
|
+
- `genericGuard(input: any, type: string, key: string)`: Validates input against a specified type and key
|
|
823
|
+
- ✅ This function is documented in the readme
|
|
824
|
+
- ✅ The implementation matches the documentation
|
|
825
|
+
|
|
826
|
+
### Contract Interaction
|
|
827
|
+
The file provides functions for interacting with Ethereum contracts:
|
|
828
|
+
|
|
829
|
+
- `getQuoteContractObject(web3: any)`: Gets a quote contract object
|
|
830
|
+
- ✅ This function is documented in the readme
|
|
831
|
+
- ✅ The implementation matches the documentation
|
|
832
|
+
|
|
833
|
+
- `getHandlerContract(web3: any)`: Gets a handler contract object
|
|
834
|
+
- ✅ This function is documented in the readme
|
|
835
|
+
- ✅ The implementation matches the documentation
|
|
836
|
+
|
|
837
|
+
- `getLegacyContract(web3: any)`: Gets a legacy contract object
|
|
838
|
+
- ✅ This function is documented in the readme
|
|
839
|
+
- ✅ The implementation matches the documentation
|
|
840
|
+
|
|
841
|
+
### Bitcoin-related Functions
|
|
842
|
+
The file provides functions for working with Bitcoin:
|
|
843
|
+
|
|
844
|
+
- `getSatsConnectAddress()`: Gets a Sats Connect address
|
|
845
|
+
- ✅ This function is documented in the readme
|
|
846
|
+
- ✅ The implementation matches the documentation
|
|
847
|
+
|
|
848
|
+
- `signPSBT(psbtBase64: any, paymentAddress: any, indexes: number[], broadcast: boolean = false)`: Signs a PSBT
|
|
849
|
+
- ✅ This function is documented in the readme
|
|
850
|
+
- ✅ The implementation matches the documentation
|
|
851
|
+
|
|
852
|
+
### Cryptographic Functions
|
|
853
|
+
The file provides functions for cryptographic operations:
|
|
854
|
+
|
|
855
|
+
- `getTorusKeys(verifierId: string, idToken: any, cb: any = null)`: Gets Torus keys
|
|
856
|
+
- ✅ This function is documented in the readme
|
|
857
|
+
- ✅ The implementation matches the documentation
|
|
858
|
+
|
|
859
|
+
- `decryptKeys(vaultCiphertextV2: any, keys: any, addresses: any[])`: Decrypts vault keys
|
|
860
|
+
- ✅ This function is documented in the readme
|
|
861
|
+
- ✅ The implementation matches the documentation
|
|
862
|
+
|
|
863
|
+
### Additional Functions
|
|
864
|
+
The file provides several additional functions that are not documented in the readme:
|
|
865
|
+
|
|
866
|
+
- `getAssetMetadata(projectName: string)`: Gets metadata for a specific project
|
|
867
|
+
- `getAllAssetMetadata()`: Gets all asset metadata
|
|
868
|
+
- `getRemoteAssetMetadataProjectList()`: Gets project list from remote API
|
|
869
|
+
- `getRemoteAssetMetadata(asset: string)`: Gets asset metadata for a specific asset
|
|
870
|
+
- `getRemoteAssetMetadataVaultedProjectList()`: Gets vaulted project list from remote API
|
|
871
|
+
- `getAllProjects()`: Gets all projects from metadata
|
|
872
|
+
- `getAssetsByProject(projectName: string)`: Gets assets for a specific project
|
|
873
|
+
- `getAssetsByProjectFromRemote(projectName: string)`: Gets assets for a specific project from remote API
|
|
874
|
+
- `getAssetByNameFromRemote(projectName: string, assetName: string)`: Gets a specific asset from remote API
|
|
875
|
+
|
|
876
|
+
⚠️ These functions should be added to the readme for completeness.
|
|
877
|
+
|
|
878
|
+
### Verification
|
|
879
|
+
- ✅ Most utility functions are well-documented in the readme
|
|
880
|
+
- ❌ Some utility functions are not documented in the readme
|
|
881
|
+
- ✅ The implementations match the documentation for the documented functions
|
|
882
|
+
- ⚠️ The readme should be updated to include all utility functions
|
|
883
|
+
|
|
884
|
+
</details>
|
|
885
|
+
|
|
886
|
+
## Comprehensive Documentation Discrepancies Summary
|
|
887
|
+
|
|
888
|
+
Based on the verification of the readme.md against the current codebase, here are the key discrepancies and recommendations for updating the documentation:
|
|
889
|
+
|
|
890
|
+
1. **Missing Functions and Methods**:
|
|
891
|
+
- **Bitcoin-related Functions**:
|
|
892
|
+
- `generateTaprootAddressFromMnemonic(phrase: string)` and `getPsbtTxnSize(phrase: string, psbtBase64: string)` from `derive.ts` are not documented
|
|
893
|
+
- These functions provide important Bitcoin functionality that should be included in the readme
|
|
894
|
+
|
|
895
|
+
- **V3 API Methods**:
|
|
896
|
+
- Several V3 API methods are not documented (`fetchVaultsByQueryV3`, `fetchVaultsByAddressV3`, etc.)
|
|
897
|
+
- These methods provide alternative ways to interact with the V3 API and should be included in the readme
|
|
898
|
+
|
|
899
|
+
- **Asset Metadata Functions**:
|
|
900
|
+
- Functions for working with asset metadata (`getAssetMetadata`, `getAllAssetMetadata`, etc.) are not documented
|
|
901
|
+
- These functions provide important functionality for working with asset metadata and should be included in the readme
|
|
902
|
+
|
|
903
|
+
- **Placeholder Functions**:
|
|
904
|
+
- `generateUploadUrl()` is mentioned in the readme but appears to be just a placeholder in the code
|
|
905
|
+
- This function should either be implemented or removed from the readme
|
|
906
|
+
|
|
907
|
+
2. **TypeScript Types and Interfaces**:
|
|
908
|
+
- **Type Definitions**:
|
|
909
|
+
- The readme does not include any information about the TypeScript types and interfaces defined in `types.ts`
|
|
910
|
+
- The data structures returned by the API are not documented
|
|
911
|
+
- The readme should include a section on TypeScript types and interfaces
|
|
912
|
+
|
|
913
|
+
- **Type Safety**:
|
|
914
|
+
- The SDK uses TypeScript, but the readme examples are in JavaScript
|
|
915
|
+
- The readme should mention TypeScript support and provide TypeScript examples
|
|
916
|
+
|
|
917
|
+
3. **Bitcoin Functionality**:
|
|
918
|
+
- **Bitcoin Operations**:
|
|
919
|
+
- The readme does not mention the Bitcoin-specific functionality provided by the SDK
|
|
920
|
+
- The dependencies required for Bitcoin operations are not documented
|
|
921
|
+
- The readme should include a section on Bitcoin functionality
|
|
922
|
+
|
|
923
|
+
- **PSBT Operations**:
|
|
924
|
+
- The SDK provides functions for working with Partially Signed Bitcoin Transactions
|
|
925
|
+
- These functions are not well-documented in the readme
|
|
926
|
+
- The readme should include more information about PSBT operations
|
|
927
|
+
|
|
928
|
+
4. **Additional Features and Examples**:
|
|
929
|
+
- **UI Integration**:
|
|
930
|
+
- The examples in the HTML files demonstrate UI integration that is not covered in the readme
|
|
931
|
+
- The readme should include more information about UI integration and user feedback
|
|
932
|
+
|
|
933
|
+
- **Collection-specific Workflows**:
|
|
934
|
+
- The examples in the HTML files demonstrate simplified workflows for specific collections
|
|
935
|
+
- These workflows should be mentioned in the readme as alternative approaches
|
|
936
|
+
|
|
937
|
+
- **Multiple Vault Creation**:
|
|
938
|
+
- The example in `index.html` demonstrates creating multiple vaults in sequence
|
|
939
|
+
- This functionality should be mentioned in the readme
|
|
940
|
+
|
|
941
|
+
- **CSV Data Generation**:
|
|
942
|
+
- The example in `index.html` demonstrates generating CSV data from vault information
|
|
943
|
+
- This functionality should be mentioned in the readme
|
|
944
|
+
|
|
945
|
+
5. **API Documentation**:
|
|
946
|
+
- **API Endpoints**:
|
|
947
|
+
- The readme does not provide detailed information about the API endpoints used by the SDK
|
|
948
|
+
- The readme should include more information about the API endpoints and their parameters
|
|
949
|
+
|
|
950
|
+
- **Error Handling**:
|
|
951
|
+
- The readme does not provide detailed information about error handling
|
|
952
|
+
- The readme should include more information about error handling and error codes
|
|
953
|
+
|
|
954
|
+
6. **Dependencies and Requirements**:
|
|
955
|
+
- **Browser Requirements**:
|
|
956
|
+
- The SDK requires a browser environment for some functionality
|
|
957
|
+
- The readme should mention browser requirements and compatibility
|
|
958
|
+
|
|
959
|
+
- **External Dependencies**:
|
|
960
|
+
- The SDK depends on several external libraries
|
|
961
|
+
- The readme should list all dependencies and their versions
|
|
962
|
+
|
|
963
|
+
## Recommendations for Documentation Updates
|
|
964
|
+
|
|
965
|
+
1. **Add Missing Functions**: Add documentation for all missing functions and methods, including Bitcoin-related functions, V3 API methods, and asset metadata functions.
|
|
966
|
+
|
|
967
|
+
2. **Add TypeScript Types**: Add a section on TypeScript types and interfaces, including examples of how to use them.
|
|
968
|
+
|
|
969
|
+
3. **Expand Bitcoin Documentation**: Add a section on Bitcoin functionality, including address generation, PSBT operations, and dependencies.
|
|
970
|
+
|
|
971
|
+
4. **Add UI Integration Examples**: Add examples of UI integration and user feedback, based on the examples in the HTML files.
|
|
972
|
+
|
|
973
|
+
5. **Add Collection-specific Workflows**: Add examples of simplified workflows for specific collections, based on the examples in the HTML files.
|
|
974
|
+
|
|
975
|
+
6. **Update API Documentation**: Add more detailed information about API endpoints, parameters, and error handling.
|
|
976
|
+
|
|
977
|
+
7. **Update Dependencies**: List all dependencies and their versions, including browser requirements.
|
|
978
|
+
|
|
979
|
+
8. **Remove Placeholder Functions**: Remove documentation for placeholder functions that are not implemented.
|
|
980
|
+
|
|
981
|
+
9. **Add TypeScript Examples**: Add TypeScript examples alongside JavaScript examples.
|
|
982
|
+
|
|
983
|
+
10. **Add Data Structure Documentation**: Add documentation for the data structures returned by the API.
|
|
984
|
+
|
|
985
|
+
These updates would significantly improve the accuracy and completeness of the readme.md documentation, making it more aligned with the current codebase and providing better guidance for users of the Emblem Vault SDK.
|
|
986
|
+
|
|
987
|
+
## Left to Study
|
|
988
|
+
- None - all files have been analyzed
|