Skip to content

Commit

Permalink
Add documentation for source imported packages (smartcontractkit#1682)
Browse files Browse the repository at this point in the history
* Add documentation for source imported packages

* Update release notes

* Add service limits

---------

Co-authored-by: aelmanaa <aelmanaa@gmail.com>
Co-authored-by: Morgan Kuphal <87319522+KuphJr@users.noreply.github.com>
  • Loading branch information
3 people authored and thedriftofwords committed Jan 5, 2024
1 parent 864cb3f commit 8783ded
Show file tree
Hide file tree
Showing 13 changed files with 262 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/config/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,10 @@ export const SIDEBAR: Partial<Record<Sections, SectionEntry[]>> = {
title: "Automate your Functions (Custom Logic Automation)",
url: "chainlink-functions/tutorials/automate-functions-custom-logic",
},
{
title: "Using Imports with Functions",
url: "chainlink-functions/tutorials/importing-packages",
},
],
},
{
Expand Down
8 changes: 6 additions & 2 deletions src/content/chainlink-functions/resources/release-notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ title: "Chainlink Functions Release Notes"

import { Aside } from "@components"

## Arbitrum Support - 2023-12-15
## Module imports and new testnets - 2023-12-15

Chainlink Functions is available as an open beta on the [Arbitrum Sepolia](/chainlink-functions/supported-networks#arbitrum-sepolia-testnet) testnet.
- You can use external module imports with Chainlink Functions source code on testnet networks. See the [Using Imports with Functions](/chainlink-functions/tutorials/importing-packages) tutorial to see an example of how to import and use imported modules with your Functions source code. This feature requires the [Functions Toolkit NPM package](https://www.npmjs.com/package/@chainlink/functions-toolkit/v/0.2.7) `v0.2.7` or later.

This feature is available only on testnets. Modules will not import or execute on Functions requests for mainnet networks at this time.

- Chainlink Functions is available on the [Arbitrum Sepolia](/chainlink-functions/supported-networks#arbitrum-sepolia-testnet) testnet.

## Open Beta - 2023-09-29

Expand Down
2 changes: 2 additions & 0 deletions src/content/chainlink-functions/resources/service-limits.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ import { Aside } from "@components"
| HTTP - Maximum response length | The maximum size of an HTTP response | 2 megabytes |
| Max size of request payload CBOR | The maximum size of an encoded request | 30 kilobytes |
| Don-hosted secrets - Maximum Time to live (TTL) | The maximum duration for which a secret hosted on a DON remains valid before it gets deleted | <ul><li>Mainnets: 3 months (2160 hours)</li><li>Testnets: 3 days (72 hours)</li></ul> |
| External module imports - Maximum size | The maximum size in MB that each imported module can be | 10 MB |
| External module imports - Number of imports | The maximum number of external module imports allowed in each request | 100 imports |
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ To run the example:

#### source.js

The Decentralized Oracle Network will run the [JavaScript code](https://github.com/smartcontractkit/smart-contract-examples/blob/main/functions-examples/examples/3-custom-response/source.js). The code is self-explanatory and has comments to help you understand all the steps. **Note**: The custom source code you want to execute in a Functions request can use vanilla [deno](https://deno.land/) but cannot use any require statements or imported modules.
The Decentralized Oracle Network will run the [JavaScript code](https://github.com/smartcontractkit/smart-contract-examples/blob/main/functions-examples/examples/3-custom-response/source.js). The code is self-explanatory and has comments to help you understand all the steps.

<ChainlinkFunctions section="deno-importe-notes" />

This JavaScript source code uses [Functions.makeHttpRequest](/chainlink-functions/api-reference/javascript-source#http-requests) to make HTTP requests. To request the `ETH/USD` price, the source code calls the `https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD` URL. If you read the [Functions.makeHttpRequest](/chainlink-functions/api-reference/javascript-source#http-requests) documentation, you see that you must provide the following parameters:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ To run the example:

#### source.js

The Decentralized Oracle Network will run the [JavaScript code](https://github.com/smartcontractkit/smart-contract-examples/blob/main/functions-examples/examples/8-multiple-apis/source.js). The code is self-explanatory and has comments to help you understand all the steps. **Note**: The custom source code you want to execute in a Functions request can use vanilla [deno](https://deno.land/) but cannot use any require statements or imported modules.
The Decentralized Oracle Network will run the [JavaScript code](https://github.com/smartcontractkit/smart-contract-examples/blob/main/functions-examples/examples/8-multiple-apis/source.js). The code is self-explanatory and has comments to help you understand all the steps.

<ChainlinkFunctions section="deno-importe-notes" />

This JavaScript source code uses [Functions.makeHttpRequest](/chainlink-functions/api-reference/javascript-source#http-requests) to make HTTP requests. The source code fetches the BTC/USD price from different data sources: `https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest/`, `https://api.coingecko.com/api/v3/simple/price`, and `https://api.coinpaprika.com/v1/tickers/btc-bitcoin` and then calculate the median price. you can read the API docs of [CoinMarketCap](https://coinmarketcap.com/api/documentation/v1/), [CoinGecko](https://www.coingecko.com/en/api/documentation), and [CoinPaprika](https://api.coinpaprika.com/) for details.

Expand Down
4 changes: 3 additions & 1 deletion src/content/chainlink-functions/tutorials/api-post-data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ To run the example:

#### source.js

The Decentralized Oracle Network will run the [JavaScript code](https://github.com/smartcontractkit/smart-contract-examples/blob/main/functions-examples/examples/4-post-data/source.js). The code is self-explanatory and has comments to help you understand all the steps. **Note**: The custom source code you want to execute in a Functions request can use vanilla [deno](https://deno.land/) but cannot use any require statements or imported modules.
The Decentralized Oracle Network will run the [JavaScript code](https://github.com/smartcontractkit/smart-contract-examples/blob/main/functions-examples/examples/4-post-data/source.js). The code is self-explanatory and has comments to help you understand all the steps.

<ChainlinkFunctions section="deno-importe-notes" />

This JavaScript source code uses [Functions.makeHttpRequest](/chainlink-functions/api-reference/javascript-source#http-requests) to make HTTP requests. To request the `JP` country information, the source code calls the `https://countries.trevorblades.com/` URL and provides the query data in the HTTP request body. If you read the [Functions.makeHttpRequest](/chainlink-functions/api-reference/javascript-source#http-requests) documentation, you see that you must provide the following parameters:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ To run the example:

#### source.js

The Decentralized Oracle Network will run the [JavaScript code](https://github.com/smartcontractkit/smart-contract-examples/blob/main/functions-examples/examples/2-call-api/source.js). The code is self-explanatory and has comments to help you understand all the steps. **Note**: The custom source code you want to execute in a Functions request can use vanilla [deno](https://deno.land/) but cannot use any require statements or imported modules.
The Decentralized Oracle Network will run the [JavaScript code](https://github.com/smartcontractkit/smart-contract-examples/blob/main/functions-examples/examples/2-call-api/source.js). The code is self-explanatory and has comments to help you understand all the steps.

<ChainlinkFunctions section="deno-importe-notes" />

This JavaScript source code uses [Functions.makeHttpRequest](/chainlink-functions/api-reference/javascript-source#http-requests) to make HTTP requests. To request the `ETH/USD` price, the source code calls the `https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD` URL. If you read the [Functions.makeHttpRequest](/chainlink-functions/api-reference/javascript-source#http-requests) documentation, you see that you must provide the following parameters:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ To run the example:

#### source.js

The Decentralized Oracle Network will run the [JavaScript code](https://github.com/smartcontractkit/smart-contract-examples/blob/main/functions-examples/examples/5-use-secrets-threshold/source.js). The code is self-explanatory and has comments to help you understand all the steps. **Note**: The custom source code you want to execute in a Functions request can use vanilla [Deno](https://deno.land/) but cannot use any require statements or imported modules.
The Decentralized Oracle Network will run the [JavaScript code](https://github.com/smartcontractkit/smart-contract-examples/blob/main/functions-examples/examples/5-use-secrets-threshold/source.js). The code is self-explanatory and has comments to help you understand all the steps.

<ChainlinkFunctions section="deno-importe-notes" />

This JavaScript source code uses [Functions.makeHttpRequest](/chainlink-functions/api-reference/javascript-source#http-requests) to make HTTP requests. To request the `BTC` asset price, the source code calls the `https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest/` URL. If you read the [Functions.makeHttpRequest](/chainlink-functions/api-reference/javascript-source#http-requests) documentation, you see that you must provide the following parameters:

Expand Down
Loading

0 comments on commit 8783ded

Please sign in to comment.