Skip to content

Commit 0b72a9e

Browse files
authored
Merge pull request #320 from ArtBlocks/ab-dep-registry-docs
Add Flex Asset - AB Dep Registry docs
2 parents 8687aba + 1369d49 commit 0b72a9e

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

art-blocks-101/generator.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@ The Art Blocks Generator builds an html document that includes:
1414
- A `tokenData` object that contains on-chain metadata for the NFT, including the token's hash and ID.
1515
- The artist's on-chain project script
1616
- (optional) A dependency used by the script. p5js, for example, is a common dependency.
17+
- (optional) For flex projects, external asset dependencies from the Art Blocks Dependency Registry.
1718

1819
The HTML document created by the Generator may look something like the following:
1920

2021
```html
2122
<html>
2223
<head>
2324
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.0/p5.min.js"></script>
25+
<script>
26+
// Dependencies from the Art Blocks Dependency Registry injected here if populated in the Flex project
27+
</script>
2428
<script>
2529
let tokenData = {
2630
hash: "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",

art-blocks-engine-onboarding/art-blocks-engine-101/Engine-technical-details.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ Your project script can then easily make use of these dependencies by combining
9898

9999
Note that for IPFS/Arweave external asset dependencies if your CID is pointing to a directory of assets, rather than a single asset, your project script will need to be aware of the file naming structure of this directory to fetch the assets individually. Using the previous example, imagine that CID `QmXxgX5Qyhqz1t9wDFkvJtjVKYe1f8Uj714RV2n1LS76Pg` was pointing to a directory of 10 PNG images, with filenames corresponding to the numbers 1-10. Your project script would generate the same full url with the information provided, `https://ipfs.io/ipfs/QmXxgX5Qyhqz1t9wDFkvJtjVKYe1f8Uj714RV2n1LS76Pg`, but also append the specific file you want to fetch by being aware of the naming conventions, ie `https://ipfs.io/ipfs/QmXxgX5Qyhqz1t9wDFkvJtjVKYe1f8Uj714RV2n1LS76Pg/1.png`.
100100

101+
## Leveraging the Art Blocks Dependency Registry
102+
103+
If you want to include additional libraries (e.g., Tone.js) supported by the Art Blocks Dependency Registry, you can add them to your project's external asset dependencies. Libraries that are fully on-chain will be clearly labeled in the drop-down as <script_type_and_version> (fully on-chain).
104+
105+
![The drop-down label for the flex asset.](/static/screenshot4.png)
106+
101107
## Loading JS Libraries As External Asset Dependencies
102108

103109
If you are specifically looking to utilize an IPFS/ARWEAVE type external asset dependency as a JavaScript library in your project script, you cannot simply add it as a script element onto the page. You must load it in a blocking manner so that the browser does not attempt to run your project script code before the lib is fully loaded. Here is an example of how to do this with ES6 dynamic imports (supported by most modern browsers: https://caniuse.com/es6-module-dynamic-import):

static/screenshot4.png

55 KB
Loading

0 commit comments

Comments
 (0)