diff --git a/docs/.nojekyll b/docs/.nojekyll new file mode 100644 index 0000000..e2ac661 --- /dev/null +++ b/docs/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..7fd97c5 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,891 @@ +@chainlink/functions-toolkit + +# @chainlink/functions-toolkit + +## Table of contents + +### Enumerations + +- [CodeLanguage](enums/CodeLanguage.md) +- [FulfillmentCode](enums/FulfillmentCode.md) +- [Location](enums/Location.md) +- [ReturnType](enums/ReturnType.md) + +### Classes + +- [ResponseListener](classes/ResponseListener.md) +- [SecretsManager](classes/SecretsManager.md) +- [SubscriptionManager](classes/SubscriptionManager.md) + +### Interfaces + +- [RequestEventData](interfaces/RequestEventData.md) +- [SimulationInput](interfaces/SimulationInput.md) + +### Type Aliases + +- [DONStoragePayload](README.md#donstoragepayload) +- [DecodedResult](README.md#decodedresult) +- [EncryptedSecretsEntry](README.md#encryptedsecretsentry) +- [EstimateCostConfig](README.md#estimatecostconfig) +- [FunctionsRequestParams](README.md#functionsrequestparams) +- [FunctionsResponse](README.md#functionsresponse) +- [GatewayMessage](README.md#gatewaymessage) +- [GatewayMessageBody](README.md#gatewaymessagebody) +- [GatewayMessageConfig](README.md#gatewaymessageconfig) +- [GatewayResponse](README.md#gatewayresponse) +- [NodeResponse](README.md#noderesponse) +- [RequestCommitment](README.md#requestcommitment) +- [SimulationResult](README.md#simulationresult) +- [SubCancelConfig](README.md#subcancelconfig) +- [SubConsumerConfig](README.md#subconsumerconfig) +- [SubCreateConfig](README.md#subcreateconfig) +- [SubFundConfig](README.md#subfundconfig) +- [SubTimeoutConfig](README.md#subtimeoutconfig) +- [SubTransferAcceptConfig](README.md#subtransferacceptconfig) +- [SubTransferConfig](README.md#subtransferconfig) +- [SubscriptionInfo](README.md#subscriptioninfo) +- [ThresholdPublicKey](README.md#thresholdpublickey) +- [TransactionOptions](README.md#transactionoptions) + +### Variables + +- [DEFAULT\_MAX\_EXECUTION\_DURATION\_MS](README.md#default_max_execution_duration_ms) +- [DEFAULT\_MAX\_HTTP\_REQUESTS](README.md#default_max_http_requests) +- [DEFAULT\_MAX\_HTTP\_REQUEST\_BYTES](README.md#default_max_http_request_bytes) +- [DEFAULT\_MAX\_HTTP\_REQUEST\_DURATION\_MS](README.md#default_max_http_request_duration_ms) +- [DEFAULT\_MAX\_HTTP\_REQUEST\_URL\_LENGTH](README.md#default_max_http_request_url_length) +- [DEFAULT\_MAX\_HTTP\_RESPONSE\_BYTES](README.md#default_max_http_response_bytes) +- [DEFAULT\_MAX\_MEMORY\_USAGE\_MB](README.md#default_max_memory_usage_mb) +- [DEFAULT\_MAX\_ON\_CHAIN\_RESPONSE\_BYTES](README.md#default_max_on_chain_response_bytes) +- [callReportGasLimit](README.md#callreportgaslimit) +- [simulatedAllowListConfig](README.md#simulatedallowlistconfig) +- [simulatedAllowListId](README.md#simulatedallowlistid) +- [simulatedCoordinatorConfig](README.md#simulatedcoordinatorconfig) +- [simulatedDonId](README.md#simulateddonid) +- [simulatedLinkEthPrice](README.md#simulatedlinkethprice) +- [simulatedRouterConfig](README.md#simulatedrouterconfig) +- [simulatedSecretsKeys](README.md#simulatedsecretskeys) +- [simulatedTransmitters](README.md#simulatedtransmitters) +- [simulatedWallets](README.md#simulatedwallets) + +### Functions + +- [buildRequestCBOR](README.md#buildrequestcbor) +- [createGist](README.md#creategist) +- [decodeResult](README.md#decoderesult) +- [deleteGist](README.md#deletegist) +- [deployFunctionsOracle](README.md#deployfunctionsoracle) +- [simulateScript](README.md#simulatescript) +- [startLocalFunctionsTestnet](README.md#startlocalfunctionstestnet) + +## Type Aliases + +### DONStoragePayload + +Ƭ **DONStoragePayload**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `expiration` | `number` | +| `payload` | `string` | +| `signature` | `string` | +| `slot_id` | `number` | +| `version` | `number` | + +#### Defined in + +[types.ts:112](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L112) + +___ + +### DecodedResult + +Ƭ **DecodedResult**: `BigInt` \| `string` + +#### Defined in + +[decodeResult.ts:3](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/decodeResult.ts#L3) + +___ + +### EncryptedSecretsEntry + +Ƭ **EncryptedSecretsEntry**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `expiration` | `number` | +| `slot_id` | `number` | +| `version` | `number` | + +#### Defined in + +[types.ts:145](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L145) + +___ + +### EstimateCostConfig + +Ƭ **EstimateCostConfig**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `callbackGasLimit` | `number` | +| `donId` | `string` | +| `gasPriceGwei` | `BigInt` | +| `subscriptionId` | `BigInt` \| `number` \| `string` | + +#### Defined in + +[types.ts:82](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L82) + +___ + +### FunctionsRequestParams + +Ƭ **FunctionsRequestParams**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `args?` | `string`[] | +| `bytesArgs?` | `string`[] | +| `codeLanguage` | [`CodeLanguage`](enums/CodeLanguage.md) | +| `codeLocation` | [`Location`](enums/Location.md) | +| `encryptedSecretsReference?` | `string` | +| `secretsLocation?` | [`Location`](enums/Location.md) | +| `source` | `string` | + +#### Defined in + +[types.ts:22](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L22) + +___ + +### FunctionsResponse + +Ƭ **FunctionsResponse**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `errorString` | `string` | +| `fulfillmentCode` | [`FulfillmentCode`](enums/FulfillmentCode.md) | +| `requestId` | `string` | +| `responseBytesHexstring` | `string` | +| `returnDataBytesHexstring` | `string` | +| `subscriptionId` | `number` | +| `totalCostInJuels` | `BigInt` | + +#### Defined in + +[types.ts:171](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L171) + +___ + +### GatewayMessage + +Ƭ **GatewayMessage**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `id` | `string` | +| `jsonrpc` | ``"2.0"`` | +| `method` | `string` | +| `params` | { `body`: [`GatewayMessageBody`](README.md#gatewaymessagebody) ; `signature`: `string` } | +| `params.body` | [`GatewayMessageBody`](README.md#gatewaymessagebody) | +| `params.signature` | `string` | + +#### Defined in + +[types.ts:135](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L135) + +___ + +### GatewayMessageBody + +Ƭ **GatewayMessageBody**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `don_id` | `string` | +| `message_id` | `string` | +| `method` | `string` | +| `payload?` | [`DONStoragePayload`](README.md#donstoragepayload) | +| `receiver` | `string` | + +#### Defined in + +[types.ts:127](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L127) + +___ + +### GatewayMessageConfig + +Ƭ **GatewayMessageConfig**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `don_id` | `string` | +| `gatewayUrls` | `string`[] | +| `method` | `string` | +| `payload?` | [`DONStoragePayload`](README.md#donstoragepayload) | + +#### Defined in + +[types.ts:120](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L120) + +___ + +### GatewayResponse + +Ƭ **GatewayResponse**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `gatewayUrl` | `string` | +| `nodeResponses` | [`NodeResponse`](README.md#noderesponse)[] | + +#### Defined in + +[types.ts:156](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L156) + +___ + +### NodeResponse + +Ƭ **NodeResponse**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `rows?` | [`EncryptedSecretsEntry`](README.md#encryptedsecretsentry)[] | +| `success` | `boolean` | + +#### Defined in + +[types.ts:151](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L151) + +___ + +### RequestCommitment + +Ƭ **RequestCommitment**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `adminFee` | `BigInt` | +| `callbackGasLimit` | `BigInt` | +| `client` | `string` | +| `coordinator` | `string` | +| `donFee` | `BigInt` | +| `estimatedTotalCostJuels` | `BigInt` | +| `gasOverheadAfterCallback` | `BigInt` | +| `gasOverheadBeforeCallback` | `BigInt` | +| `requestId` | `string` | +| `subscriptionId` | `number` | +| `timeoutTimestamp` | `BigInt` | + +#### Defined in + +[types.ts:98](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L98) + +___ + +### SimulationResult + +Ƭ **SimulationResult**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `capturedTerminalOutput` | `string` | +| `errorString?` | `string` | +| `responseBytesHexstring?` | `string` | + +#### Defined in + +[types.ts:196](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L196) + +___ + +### SubCancelConfig + +Ƭ **SubCancelConfig**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `refundAddress?` | `string` | +| `subscriptionId` | `BigInt` \| `number` \| `string` | +| `txOptions?` | [`TransactionOptions`](README.md#transactionoptions) | + +#### Defined in + +[types.ts:61](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L61) + +___ + +### SubConsumerConfig + +Ƭ **SubConsumerConfig**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `consumerAddress` | `string` | +| `subscriptionId` | `BigInt` \| `number` \| `string` | +| `txOptions?` | [`TransactionOptions`](README.md#transactionoptions) | + +#### Defined in + +[types.ts:49](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L49) + +___ + +### SubCreateConfig + +Ƭ **SubCreateConfig**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `consumerAddress?` | `string` | +| `txOptions?` | [`TransactionOptions`](README.md#transactionoptions) | + +#### Defined in + +[types.ts:44](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L44) + +___ + +### SubFundConfig + +Ƭ **SubFundConfig**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `juelsAmount` | `BigInt` \| `string` | +| `subscriptionId` | `BigInt` \| `number` \| `string` | +| `txOptions?` | [`TransactionOptions`](README.md#transactionoptions) | + +#### Defined in + +[types.ts:55](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L55) + +___ + +### SubTimeoutConfig + +Ƭ **SubTimeoutConfig**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `requestCommitments` | [`RequestCommitment`](README.md#requestcommitment)[] | +| `txOptions?` | [`TransactionOptions`](README.md#transactionoptions) | + +#### Defined in + +[types.ts:77](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L77) + +___ + +### SubTransferAcceptConfig + +Ƭ **SubTransferAcceptConfig**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `subscriptionId` | `BigInt` \| `number` \| `string` | +| `txOptions?` | [`TransactionOptions`](README.md#transactionoptions) | + +#### Defined in + +[types.ts:72](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L72) + +___ + +### SubTransferConfig + +Ƭ **SubTransferConfig**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `newOwner` | `string` | +| `subscriptionId` | `BigInt` \| `number` \| `string` | +| `txOptions?` | [`TransactionOptions`](README.md#transactionoptions) | + +#### Defined in + +[types.ts:66](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L66) + +___ + +### SubscriptionInfo + +Ƭ **SubscriptionInfo**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `balance` | `BigInt` | +| `blockedBalance` | `BigInt` | +| `consumers` | `string`[] | +| `flags` | `string` | +| `owner` | `string` | +| `proposedOwner` | `string` | + +#### Defined in + +[types.ts:89](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L89) + +___ + +### ThresholdPublicKey + +Ƭ **ThresholdPublicKey**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `G_bar` | `string` | +| `Group` | `string` | +| `H` | `string` | +| `HArray` | `string`[] | + +#### Defined in + +[types.ts:32](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L32) + +___ + +### TransactionOptions + +Ƭ **TransactionOptions**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `confirmations?` | `number` | +| `overrides?` | `Overrides` | + +#### Defined in + +[types.ts:39](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L39) + +## Variables + +### DEFAULT\_MAX\_EXECUTION\_DURATION\_MS + +• `Const` **DEFAULT\_MAX\_EXECUTION\_DURATION\_MS**: ``10000`` + +#### Defined in + +[simulationConfig.ts:84](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulationConfig.ts#L84) + +___ + +### DEFAULT\_MAX\_HTTP\_REQUESTS + +• `Const` **DEFAULT\_MAX\_HTTP\_REQUESTS**: ``5`` + +#### Defined in + +[simulationConfig.ts:86](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulationConfig.ts#L86) + +___ + +### DEFAULT\_MAX\_HTTP\_REQUEST\_BYTES + +• `Const` **DEFAULT\_MAX\_HTTP\_REQUEST\_BYTES**: ``2048`` + +#### Defined in + +[simulationConfig.ts:89](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulationConfig.ts#L89) + +___ + +### DEFAULT\_MAX\_HTTP\_REQUEST\_DURATION\_MS + +• `Const` **DEFAULT\_MAX\_HTTP\_REQUEST\_DURATION\_MS**: ``9000`` + +#### Defined in + +[simulationConfig.ts:87](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulationConfig.ts#L87) + +___ + +### DEFAULT\_MAX\_HTTP\_REQUEST\_URL\_LENGTH + +• `Const` **DEFAULT\_MAX\_HTTP\_REQUEST\_URL\_LENGTH**: ``2048`` + +#### Defined in + +[simulationConfig.ts:88](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulationConfig.ts#L88) + +___ + +### DEFAULT\_MAX\_HTTP\_RESPONSE\_BYTES + +• `Const` **DEFAULT\_MAX\_HTTP\_RESPONSE\_BYTES**: ``2097152`` + +#### Defined in + +[simulationConfig.ts:90](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulationConfig.ts#L90) + +___ + +### DEFAULT\_MAX\_MEMORY\_USAGE\_MB + +• `Const` **DEFAULT\_MAX\_MEMORY\_USAGE\_MB**: ``128`` + +#### Defined in + +[simulationConfig.ts:85](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulationConfig.ts#L85) + +___ + +### DEFAULT\_MAX\_ON\_CHAIN\_RESPONSE\_BYTES + +• `Const` **DEFAULT\_MAX\_ON\_CHAIN\_RESPONSE\_BYTES**: ``256`` + +#### Defined in + +[simulationConfig.ts:83](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulationConfig.ts#L83) + +___ + +### callReportGasLimit + +• `Const` **callReportGasLimit**: ``5000000`` + +#### Defined in + +[simulationConfig.ts:32](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulationConfig.ts#L32) + +___ + +### simulatedAllowListConfig + +• `Const` **simulatedAllowListConfig**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `enabled` | `boolean` | +| `signerPublicKey` | `string` | + +#### Defined in + +[simulationConfig.ts:27](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulationConfig.ts#L27) + +___ + +### simulatedAllowListId + +• `Const` **simulatedAllowListId**: ``"allowlist1"`` + +#### Defined in + +[simulationConfig.ts:5](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulationConfig.ts#L5) + +___ + +### simulatedCoordinatorConfig + +• `Const` **simulatedCoordinatorConfig**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `donFee` | `number` | +| `fallbackNativePerUnitLink` | `bigint` | +| `feedStalenessSeconds` | `number` | +| `fulfillmentGasPriceOverEstimationBP` | `number` | +| `gasOverheadAfterCallback` | `number` | +| `gasOverheadBeforeCallback` | `number` | +| `maxCallbackGasLimit` | `number` | +| `maxSupportedRequestDataVersion` | `number` | +| `requestTimeoutSeconds` | `number` | + +#### Defined in + +[simulationConfig.ts:15](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulationConfig.ts#L15) + +___ + +### simulatedDonId + +• `Const` **simulatedDonId**: ``"coordinator1"`` + +#### Defined in + +[simulationConfig.ts:3](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulationConfig.ts#L3) + +___ + +### simulatedLinkEthPrice + +• `Const` **simulatedLinkEthPrice**: `bigint` + +#### Defined in + +[simulationConfig.ts:1](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulationConfig.ts#L1) + +___ + +### simulatedRouterConfig + +• `Const` **simulatedRouterConfig**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `adminFee` | `number` | +| `gasForCallExactCheck` | `number` | +| `handleOracleFulfillmentSelector` | `string` | +| `maxCallbackGasLimits` | `number`[] | +| `maxConsumersPerSubscription` | `number` | + +#### Defined in + +[simulationConfig.ts:7](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulationConfig.ts#L7) + +___ + +### simulatedSecretsKeys + +• `Const` **simulatedSecretsKeys**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `donKey` | { `privateKey`: `string` ; `publicKey`: `string` } | +| `donKey.privateKey` | `string` | +| `donKey.publicKey` | `string` | +| `thresholdKeys` | { `privateKeyShares`: { `[address: string]`: `string`; } ; `publicKey`: `string` } | +| `thresholdKeys.privateKeyShares` | { `[address: string]`: `string`; } | +| `thresholdKeys.publicKey` | `string` | + +#### Defined in + +[simulationConfig.ts:55](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulationConfig.ts#L55) + +___ + +### simulatedTransmitters + +• `Const` **simulatedTransmitters**: `string`[] + +#### Defined in + +[simulationConfig.ts:53](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulationConfig.ts#L53) + +___ + +### simulatedWallets + +• `Const` **simulatedWallets**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `node0` | { `address`: `string` = '0xAe24F6e7e046a0C764DF51F333dE5e2fE360AC72'; `privateKey`: `string` = '0x493f20c367e9c5190b14b8071a6c765da973d41428b841c25e4aaba3577f8ece' } | +| `node0.address` | `string` | +| `node0.privateKey` | `string` | +| `node1` | { `address`: `string` = '0x37d7bf16f6fd8c37b766Fa87e047c68c51dfdf4a'; `privateKey`: `string` = '0x7abd90843922984dda18358a179679e5cabda5ad8d0ebab5714ac044663a6a14' } | +| `node1.address` | `string` | +| `node1.privateKey` | `string` | +| `node2` | { `address`: `string` = '0x6e7EF53D9811B70834902D2D9137DaD2720eAC47'; `privateKey`: `string` = '0xcb8801121add786869aac78ceb4003bf3aa8a68ae8dd31f80d61f5f98eace3c5' } | +| `node2.address` | `string` | +| `node2.privateKey` | `string` | +| `node3` | { `address`: `string` = '0xBe83eA9868AE964f8C46EFa0fea798EbE16441c5'; `privateKey`: `string` = '0x06c7ca21f24edf450251e87097264b1fd184c9570084a78aa3300e937e1954b8' } | +| `node3.address` | `string` | +| `node3.privateKey` | `string` | + +#### Defined in + +[simulationConfig.ts:34](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulationConfig.ts#L34) + +## Functions + +### buildRequestCBOR + +▸ **buildRequestCBOR**(`requestParams`): `string` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `requestParams` | [`FunctionsRequestParams`](README.md#functionsrequestparams) | + +#### Returns + +`string` + +#### Defined in + +[buildRequestCBOR.ts:8](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/buildRequestCBOR.ts#L8) + +___ + +### createGist + +▸ **createGist**(`githubApiToken`, `content`): `Promise`<`string`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `githubApiToken` | `string` | +| `content` | `string` | + +#### Returns + +`Promise`<`string`\> + +#### Defined in + +[offchain_storage/github.ts:3](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/offchain_storage/github.ts#L3) + +___ + +### decodeResult + +▸ **decodeResult**(`resultHexstring`, `expectedReturnType`): [`DecodedResult`](README.md#decodedresult) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `resultHexstring` | `string` | +| `expectedReturnType` | [`ReturnType`](enums/ReturnType.md) | + +#### Returns + +[`DecodedResult`](README.md#decodedresult) + +#### Defined in + +[decodeResult.ts:5](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/decodeResult.ts#L5) + +___ + +### deleteGist + +▸ **deleteGist**(`githubApiToken`, `gistURL`): `Promise`<`boolean`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `githubApiToken` | `string` | +| `gistURL` | `string` | + +#### Returns + +`Promise`<`boolean`\> + +#### Defined in + +[offchain_storage/github.ts:69](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/offchain_storage/github.ts#L69) + +___ + +### deployFunctionsOracle + +▸ **deployFunctionsOracle**(`deployer`): `Promise`<`FunctionsContracts`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `deployer` | `Wallet` | + +#### Returns + +`Promise`<`FunctionsContracts`\> + +#### Defined in + +[localFunctionsTestnet.ts:264](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/localFunctionsTestnet.ts#L264) + +___ + +### simulateScript + +▸ **simulateScript**(`«destructured»`): `Promise`<[`SimulationResult`](README.md#simulationresult)\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `«destructured»` | [`SimulationInput`](interfaces/SimulationInput.md) | + +#### Returns + +`Promise`<[`SimulationResult`](README.md#simulationresult)\> + +#### Defined in + +[simulateScript/simulateScript.ts:28](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/simulateScript/simulateScript.ts#L28) + +___ + +### startLocalFunctionsTestnet + +▸ **startLocalFunctionsTestnet**(`port?`): `Promise`<{ `adminWallet`: { `address`: `string` ; `privateKey`: `string` } ; `close`: () => `Promise`<`void`\> ; `getFunds`: (`address`: `string`, `__namedParameters`: { `ethAmount`: `number` ; `linkAmount`: `number` }) => `Promise`<`void`\> ; `server`: `Server`<`EthereumFlavor`\> } & `FunctionsContracts`\> + +#### Parameters + +| Name | Type | Default value | +| :------ | :------ | :------ | +| `port` | `number` | `8545` | + +#### Returns + +`Promise`<{ `adminWallet`: { `address`: `string` ; `privateKey`: `string` } ; `close`: () => `Promise`<`void`\> ; `getFunds`: (`address`: `string`, `__namedParameters`: { `ethAmount`: `number` ; `linkAmount`: `number` }) => `Promise`<`void`\> ; `server`: `Server`<`EthereumFlavor`\> } & `FunctionsContracts`\> + +#### Defined in + +[localFunctionsTestnet.ts:50](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/localFunctionsTestnet.ts#L50) diff --git a/docs/classes/ResponseListener.md b/docs/classes/ResponseListener.md new file mode 100644 index 0000000..7c8ab55 --- /dev/null +++ b/docs/classes/ResponseListener.md @@ -0,0 +1,103 @@ +[@chainlink/functions-toolkit](../README.md) / ResponseListener + +# Class: ResponseListener + +## Table of contents + +### Constructors + +- [constructor](ResponseListener.md#constructor) + +### Properties + +- [functionsRouter](ResponseListener.md#functionsrouter) + +### Methods + +- [listenForResponse](ResponseListener.md#listenforresponse) +- [listenForResponses](ResponseListener.md#listenforresponses) +- [stopListeningForResponses](ResponseListener.md#stoplisteningforresponses) + +## Constructors + +### constructor + +• **new ResponseListener**(`«destructured»`) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `«destructured»` | `Object` | +| › `functionsRouterAddress` | `string` | +| › `provider` | `Provider` | + +#### Defined in + +[ResponseListener.ts:12](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/ResponseListener.ts#L12) + +## Properties + +### functionsRouter + +• `Private` **functionsRouter**: `Contract` + +#### Defined in + +[ResponseListener.ts:10](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/ResponseListener.ts#L10) + +## Methods + +### listenForResponse + +▸ **listenForResponse**(`requestId`, `timeout?`): `Promise`<[`FunctionsResponse`](../README.md#functionsresponse)\> + +#### Parameters + +| Name | Type | Default value | +| :------ | :------ | :------ | +| `requestId` | `string` | `undefined` | +| `timeout` | `number` | `300000` | + +#### Returns + +`Promise`<[`FunctionsResponse`](../README.md#functionsresponse)\> + +#### Defined in + +[ResponseListener.ts:22](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/ResponseListener.ts#L22) + +___ + +### listenForResponses + +▸ **listenForResponses**(`subscriptionId`, `callback`): `void` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `subscriptionId` | `number` | +| `callback` | (`functionsResponse`: [`FunctionsResponse`](../README.md#functionsresponse)) => `any` | + +#### Returns + +`void` + +#### Defined in + +[ResponseListener.ts:61](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/ResponseListener.ts#L61) + +___ + +### stopListeningForResponses + +▸ **stopListeningForResponses**(): `void` + +#### Returns + +`void` + +#### Defined in + +[ResponseListener.ts:96](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/ResponseListener.ts#L96) diff --git a/docs/classes/SecretsManager.md b/docs/classes/SecretsManager.md new file mode 100644 index 0000000..d13871e --- /dev/null +++ b/docs/classes/SecretsManager.md @@ -0,0 +1,394 @@ +[@chainlink/functions-toolkit](../README.md) / SecretsManager + +# Class: SecretsManager + +## Table of contents + +### Constructors + +- [constructor](SecretsManager.md#constructor) + +### Properties + +- [donId](SecretsManager.md#donid) +- [functionsCoordinator](SecretsManager.md#functionscoordinator) +- [functionsRouter](SecretsManager.md#functionsrouter) +- [initialized](SecretsManager.md#initialized) +- [signer](SecretsManager.md#signer) + +### Methods + +- [buildDONHostedEncryptedSecretsReference](SecretsManager.md#builddonhostedencryptedsecretsreference) +- [createGatewayMessage](SecretsManager.md#creategatewaymessage) +- [createGatewayMessageBody](SecretsManager.md#creategatewaymessagebody) +- [encryptSecrets](SecretsManager.md#encryptsecrets) +- [encryptSecretsUrls](SecretsManager.md#encryptsecretsurls) +- [extractNodeResponses](SecretsManager.md#extractnoderesponses) +- [fetchKeys](SecretsManager.md#fetchkeys) +- [initialize](SecretsManager.md#initialize) +- [isInitialized](SecretsManager.md#isinitialized) +- [listDONHostedEncryptedSecrets](SecretsManager.md#listdonhostedencryptedsecrets) +- [sendMessageToGateways](SecretsManager.md#sendmessagetogateways) +- [uploadEncryptedSecretsToDON](SecretsManager.md#uploadencryptedsecretstodon) +- [validateGatewayUrls](SecretsManager.md#validategatewayurls) +- [verifyDONHostedSecrets](SecretsManager.md#verifydonhostedsecrets) +- [verifyOffchainSecrets](SecretsManager.md#verifyoffchainsecrets) + +## Constructors + +### constructor + +• **new SecretsManager**(`«destructured»`) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `«destructured»` | `Object` | +| › `donId` | `string` | +| › `functionsRouterAddress` | `string` | +| › `signer` | `Signer` | + +#### Defined in + +[SecretsManager.ts:27](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L27) + +## Properties + +### donId + +• `Private` `Optional` **donId**: `string` + +#### Defined in + +[SecretsManager.ts:24](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L24) + +___ + +### functionsCoordinator + +• `Private` **functionsCoordinator**: `Contract` + +#### Defined in + +[SecretsManager.ts:23](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L23) + +___ + +### functionsRouter + +• `Private` **functionsRouter**: `Contract` + +#### Defined in + +[SecretsManager.ts:22](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L22) + +___ + +### initialized + +• `Private` **initialized**: `boolean` = `false` + +#### Defined in + +[SecretsManager.ts:25](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L25) + +___ + +### signer + +• `Private` **signer**: `Signer` + +#### Defined in + +[SecretsManager.ts:21](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L21) + +## Methods + +### buildDONHostedEncryptedSecretsReference + +▸ **buildDONHostedEncryptedSecretsReference**(`«destructured»`): `string` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `«destructured»` | `Object` | +| › `slotId` | `number` | +| › `version` | `number` | + +#### Returns + +`string` + +#### Defined in + +[SecretsManager.ts:464](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L464) + +___ + +### createGatewayMessage + +▸ `Private` **createGatewayMessage**(`«destructured»`): `Promise`<`string`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `«destructured»` | [`GatewayMessageConfig`](../README.md#gatewaymessageconfig) | + +#### Returns + +`Promise`<`string`\> + +#### Defined in + +[SecretsManager.ts:317](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L317) + +___ + +### createGatewayMessageBody + +▸ `Private` **createGatewayMessageBody**(`«destructured»`): `Buffer` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `«destructured»` | [`GatewayMessageBody`](../README.md#gatewaymessagebody) | + +#### Returns + +`Buffer` + +#### Defined in + +[SecretsManager.ts:343](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L343) + +___ + +### encryptSecrets + +▸ **encryptSecrets**(`secrets?`): `Promise`<{ `encryptedSecrets`: `string` }\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `secrets?` | `Record`<`string`, `string`\> | + +#### Returns + +`Promise`<{ `encryptedSecrets`: `string` }\> + +#### Defined in + +[SecretsManager.ts:141](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L141) + +___ + +### encryptSecretsUrls + +▸ **encryptSecretsUrls**(`secretsUrls`): `Promise`<`string`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `secretsUrls` | `string`[] | + +#### Returns + +`Promise`<`string`\> + +#### Defined in + +[SecretsManager.ts:92](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L92) + +___ + +### extractNodeResponses + +▸ `Private` **extractNodeResponses**(`gatewayResponse`): [`NodeResponse`](../README.md#noderesponse)[] + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `gatewayResponse` | `AxiosResponse`<`any`, `any`\> | + +#### Returns + +[`NodeResponse`](../README.md#noderesponse)[] + +#### Defined in + +[SecretsManager.ts:381](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L381) + +___ + +### fetchKeys + +▸ **fetchKeys**(): `Promise`<{ `donPublicKey`: `string` ; `thresholdPublicKey`: [`ThresholdPublicKey`](../README.md#thresholdpublickey) }\> + +#### Returns + +`Promise`<{ `donPublicKey`: `string` ; `thresholdPublicKey`: [`ThresholdPublicKey`](../README.md#thresholdpublickey) }\> + +a Promise that resolves to an object that contains the DONpublicKey and an object that maps node addresses to their public keys + +#### Defined in + +[SecretsManager.ts:76](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L76) + +___ + +### initialize + +▸ **initialize**(): `Promise`<`void`\> + +#### Returns + +`Promise`<`void`\> + +#### Defined in + +[SecretsManager.ts:46](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L46) + +___ + +### isInitialized + +▸ `Private` **isInitialized**(): `void` + +#### Returns + +`void` + +#### Defined in + +[SecretsManager.ts:67](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L67) + +___ + +### listDONHostedEncryptedSecrets + +▸ **listDONHostedEncryptedSecrets**(`gatewayUrls`): `Promise`<{ `error?`: `string` ; `result`: [`GatewayResponse`](../README.md#gatewayresponse)[] }\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `gatewayUrls` | `string`[] | + +#### Returns + +`Promise`<{ `error?`: `string` ; `result`: [`GatewayResponse`](../README.md#gatewayresponse)[] }\> + +#### Defined in + +[SecretsManager.ts:403](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L403) + +___ + +### sendMessageToGateways + +▸ `Private` **sendMessageToGateways**(`gatewayRpcMessageConfig`): `Promise`<[`GatewayResponse`](../README.md#gatewayresponse)[]\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `gatewayRpcMessageConfig` | [`GatewayMessageConfig`](../README.md#gatewaymessageconfig) | + +#### Returns + +`Promise`<[`GatewayResponse`](../README.md#gatewayresponse)[]\> + +#### Defined in + +[SecretsManager.ts:284](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L284) + +___ + +### uploadEncryptedSecretsToDON + +▸ **uploadEncryptedSecretsToDON**(`«destructured»`): `Promise`<{ `success`: `boolean` ; `version`: `number` }\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `«destructured»` | `Object` | +| › `encryptedSecretsHexstring` | `string` | +| › `gatewayUrls` | `string`[] | +| › `minutesUntilExpiration` | `number` | +| › `storageSlotId` | `number` | + +#### Returns + +`Promise`<{ `success`: `boolean` ; `version`: `number` }\> + +#### Defined in + +[SecretsManager.ts:186](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L186) + +___ + +### validateGatewayUrls + +▸ `Private` **validateGatewayUrls**(`gatewayUrls`): `void` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `gatewayUrls` | `string`[] | + +#### Returns + +`void` + +#### Defined in + +[SecretsManager.ts:270](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L270) + +___ + +### verifyDONHostedSecrets + +▸ `Private` **verifyDONHostedSecrets**(`gatewayResponses`): `void` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `gatewayResponses` | [`GatewayResponse`](../README.md#gatewayresponse)[] | + +#### Returns + +`void` + +#### Defined in + +[SecretsManager.ts:423](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L423) + +___ + +### verifyOffchainSecrets + +▸ **verifyOffchainSecrets**(`secretsUrls`): `Promise`<`boolean`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `secretsUrls` | `string`[] | + +#### Returns + +`Promise`<`boolean`\> + +#### Defined in + +[SecretsManager.ts:109](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SecretsManager.ts#L109) diff --git a/docs/classes/SubscriptionManager.md b/docs/classes/SubscriptionManager.md new file mode 100644 index 0000000..b8d54fd --- /dev/null +++ b/docs/classes/SubscriptionManager.md @@ -0,0 +1,350 @@ +[@chainlink/functions-toolkit](../README.md) / SubscriptionManager + +# Class: SubscriptionManager + +## Table of contents + +### Constructors + +- [constructor](SubscriptionManager.md#constructor) + +### Properties + +- [functionsAllowList](SubscriptionManager.md#functionsallowlist) +- [functionsRouter](SubscriptionManager.md#functionsrouter) +- [initialized](SubscriptionManager.md#initialized) +- [linkToken](SubscriptionManager.md#linktoken) +- [signer](SubscriptionManager.md#signer) + +### Methods + +- [acceptSubTransfer](SubscriptionManager.md#acceptsubtransfer) +- [addConsumer](SubscriptionManager.md#addconsumer) +- [cancelSubscription](SubscriptionManager.md#cancelsubscription) +- [createSubscription](SubscriptionManager.md#createsubscription) +- [estimateFunctionsRequestCost](SubscriptionManager.md#estimatefunctionsrequestcost) +- [fundSubscription](SubscriptionManager.md#fundsubscription) +- [getSubscriptionInfo](SubscriptionManager.md#getsubscriptioninfo) +- [initialize](SubscriptionManager.md#initialize) +- [isAllowlisted](SubscriptionManager.md#isallowlisted) +- [isInitialized](SubscriptionManager.md#isinitialized) +- [removeConsumer](SubscriptionManager.md#removeconsumer) +- [requestSubscriptionTransfer](SubscriptionManager.md#requestsubscriptiontransfer) +- [timeoutRequests](SubscriptionManager.md#timeoutrequests) + +## Constructors + +### constructor + +• **new SubscriptionManager**(`«destructured»`) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `«destructured»` | `Object` | +| › `functionsRouterAddress` | `string` | +| › `linkTokenAddress` | `string` | +| › `signer` | `Signer` | + +#### Defined in + +[SubscriptionManager.ts:32](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L32) + +## Properties + +### functionsAllowList + +• `Private` `Optional` **functionsAllowList**: `Contract` + +#### Defined in + +[SubscriptionManager.ts:29](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L29) + +___ + +### functionsRouter + +• `Private` **functionsRouter**: `Contract` + +#### Defined in + +[SubscriptionManager.ts:28](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L28) + +___ + +### initialized + +• `Private` **initialized**: `boolean` = `false` + +#### Defined in + +[SubscriptionManager.ts:30](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L30) + +___ + +### linkToken + +• `Private` **linkToken**: `Contract` + +#### Defined in + +[SubscriptionManager.ts:27](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L27) + +___ + +### signer + +• `Private` **signer**: `Signer` + +#### Defined in + +[SubscriptionManager.ts:26](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L26) + +## Methods + +### acceptSubTransfer + +▸ **acceptSubTransfer**(`«destructured»`): `Promise`<`TransactionReceipt`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `«destructured»` | [`SubTransferAcceptConfig`](../README.md#subtransferacceptconfig) | + +#### Returns + +`Promise`<`TransactionReceipt`\> + +#### Defined in + +[SubscriptionManager.ts:414](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L414) + +___ + +### addConsumer + +▸ **addConsumer**(`«destructured»`): `Promise`<`TransactionReceipt`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `«destructured»` | [`SubConsumerConfig`](../README.md#subconsumerconfig) | + +#### Returns + +`Promise`<`TransactionReceipt`\> + +#### Defined in + +[SubscriptionManager.ts:136](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L136) + +___ + +### cancelSubscription + +▸ **cancelSubscription**(`«destructured»`): `Promise`<`TransactionReceipt`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `«destructured»` | [`SubCancelConfig`](../README.md#subcancelconfig) | + +#### Returns + +`Promise`<`TransactionReceipt`\> + +#### Defined in + +[SubscriptionManager.ts:270](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L270) + +___ + +### createSubscription + +▸ **createSubscription**(`subCreateConfig?`): `Promise`<`number`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `subCreateConfig?` | [`SubCreateConfig`](../README.md#subcreateconfig) | + +#### Returns + +`Promise`<`number`\> + +#### Defined in + +[SubscriptionManager.ts:93](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L93) + +___ + +### estimateFunctionsRequestCost + +▸ **estimateFunctionsRequestCost**(`«destructured»`): `Promise`<`BigInt`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `«destructured»` | [`EstimateCostConfig`](../README.md#estimatecostconfig) | + +#### Returns + +`Promise`<`BigInt`\> + +#### Defined in + +[SubscriptionManager.ts:471](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L471) + +___ + +### fundSubscription + +▸ **fundSubscription**(`config`): `Promise`<`TransactionReceipt`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `config` | [`SubFundConfig`](../README.md#subfundconfig) | + +#### Returns + +`Promise`<`TransactionReceipt`\> + +#### Defined in + +[SubscriptionManager.ts:188](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L188) + +___ + +### getSubscriptionInfo + +▸ **getSubscriptionInfo**(`subscriptionId`): `Promise`<[`SubscriptionInfo`](../README.md#subscriptioninfo)\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `subscriptionId` | `string` \| `number` \| `BigInt` | + +#### Returns + +`Promise`<[`SubscriptionInfo`](../README.md#subscriptioninfo)\> + +#### Defined in + +[SubscriptionManager.ts:248](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L248) + +___ + +### initialize + +▸ **initialize**(): `Promise`<`void`\> + +#### Returns + +`Promise`<`void`\> + +#### Defined in + +[SubscriptionManager.ts:51](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L51) + +___ + +### isAllowlisted + +▸ **isAllowlisted**(`addr`): `Promise`<`void`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `addr` | `string` | + +#### Returns + +`Promise`<`void`\> + +#### Defined in + +[SubscriptionManager.ts:83](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L83) + +___ + +### isInitialized + +▸ `Private` **isInitialized**(): `void` + +#### Returns + +`void` + +#### Defined in + +[SubscriptionManager.ts:75](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L75) + +___ + +### removeConsumer + +▸ **removeConsumer**(`«destructured»`): `Promise`<`TransactionReceipt`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `«destructured»` | [`SubConsumerConfig`](../README.md#subconsumerconfig) | + +#### Returns + +`Promise`<`TransactionReceipt`\> + +#### Defined in + +[SubscriptionManager.ts:318](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L318) + +___ + +### requestSubscriptionTransfer + +▸ **requestSubscriptionTransfer**(`«destructured»`): `Promise`<`TransactionReceipt`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `«destructured»` | [`SubTransferConfig`](../README.md#subtransferconfig) | + +#### Returns + +`Promise`<`TransactionReceipt`\> + +#### Defined in + +[SubscriptionManager.ts:370](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L370) + +___ + +### timeoutRequests + +▸ **timeoutRequests**(`«destructured»`): `Promise`<`TransactionReceipt`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `«destructured»` | [`SubTimeoutConfig`](../README.md#subtimeoutconfig) | + +#### Returns + +`Promise`<`TransactionReceipt`\> + +#### Defined in + +[SubscriptionManager.ts:447](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/SubscriptionManager.ts#L447) diff --git a/docs/enums/CodeLanguage.md b/docs/enums/CodeLanguage.md new file mode 100644 index 0000000..8f624a0 --- /dev/null +++ b/docs/enums/CodeLanguage.md @@ -0,0 +1,19 @@ +[@chainlink/functions-toolkit](../README.md) / CodeLanguage + +# Enumeration: CodeLanguage + +## Table of contents + +### Enumeration Members + +- [JavaScript](CodeLanguage.md#javascript) + +## Enumeration Members + +### JavaScript + +• **JavaScript** = ``0`` + +#### Defined in + +[types.ts:10](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L10) diff --git a/docs/enums/FulfillmentCode.md b/docs/enums/FulfillmentCode.md new file mode 100644 index 0000000..c01236d --- /dev/null +++ b/docs/enums/FulfillmentCode.md @@ -0,0 +1,85 @@ +[@chainlink/functions-toolkit](../README.md) / FulfillmentCode + +# Enumeration: FulfillmentCode + +## Table of contents + +### Enumeration Members + +- [COST\_EXCEEDS\_COMMITMENT](FulfillmentCode.md#cost_exceeds_commitment) +- [FULFILLED](FulfillmentCode.md#fulfilled) +- [INSUFFICIENT\_GAS\_PROVIDED](FulfillmentCode.md#insufficient_gas_provided) +- [INVALID\_COMMITMENT](FulfillmentCode.md#invalid_commitment) +- [INVALID\_REQUEST\_ID](FulfillmentCode.md#invalid_request_id) +- [SUBSCRIPTION\_BALANCE\_INVARIANT\_VIOLATION](FulfillmentCode.md#subscription_balance_invariant_violation) +- [USER\_CALLBACK\_ERROR](FulfillmentCode.md#user_callback_error) + +## Enumeration Members + +### COST\_EXCEEDS\_COMMITMENT + +• **COST\_EXCEEDS\_COMMITMENT** = ``3`` + +#### Defined in + +[types.ts:165](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L165) + +___ + +### FULFILLED + +• **FULFILLED** = ``0`` + +#### Defined in + +[types.ts:162](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L162) + +___ + +### INSUFFICIENT\_GAS\_PROVIDED + +• **INSUFFICIENT\_GAS\_PROVIDED** = ``4`` + +#### Defined in + +[types.ts:166](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L166) + +___ + +### INVALID\_COMMITMENT + +• **INVALID\_COMMITMENT** = ``6`` + +#### Defined in + +[types.ts:168](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L168) + +___ + +### INVALID\_REQUEST\_ID + +• **INVALID\_REQUEST\_ID** = ``2`` + +#### Defined in + +[types.ts:164](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L164) + +___ + +### SUBSCRIPTION\_BALANCE\_INVARIANT\_VIOLATION + +• **SUBSCRIPTION\_BALANCE\_INVARIANT\_VIOLATION** = ``5`` + +#### Defined in + +[types.ts:167](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L167) + +___ + +### USER\_CALLBACK\_ERROR + +• **USER\_CALLBACK\_ERROR** = ``1`` + +#### Defined in + +[types.ts:163](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L163) diff --git a/docs/enums/Location.md b/docs/enums/Location.md new file mode 100644 index 0000000..6ba6952 --- /dev/null +++ b/docs/enums/Location.md @@ -0,0 +1,41 @@ +[@chainlink/functions-toolkit](../README.md) / Location + +# Enumeration: Location + +## Table of contents + +### Enumeration Members + +- [DONHosted](Location.md#donhosted) +- [Inline](Location.md#inline) +- [Remote](Location.md#remote) + +## Enumeration Members + +### DONHosted + +• **DONHosted** = ``2`` + +#### Defined in + +[types.ts:6](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L6) + +___ + +### Inline + +• **Inline** = ``0`` + +#### Defined in + +[types.ts:4](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L4) + +___ + +### Remote + +• **Remote** = ``1`` + +#### Defined in + +[types.ts:5](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L5) diff --git a/docs/enums/ReturnType.md b/docs/enums/ReturnType.md new file mode 100644 index 0000000..43ab43d --- /dev/null +++ b/docs/enums/ReturnType.md @@ -0,0 +1,74 @@ +[@chainlink/functions-toolkit](../README.md) / ReturnType + +# Enumeration: ReturnType + +## Table of contents + +### Enumeration Members + +- [bytes](ReturnType.md#bytes) +- [int](ReturnType.md#int) +- [int256](ReturnType.md#int256) +- [string](ReturnType.md#string) +- [uint](ReturnType.md#uint) +- [uint256](ReturnType.md#uint256) + +## Enumeration Members + +### bytes + +• **bytes** = ``"bytes"`` + +#### Defined in + +[types.ts:19](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L19) + +___ + +### int + +• **int** = ``"int256"`` + +#### Defined in + +[types.ts:16](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L16) + +___ + +### int256 + +• **int256** = ``"int256"`` + +#### Defined in + +[types.ts:17](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L17) + +___ + +### string + +• **string** = ``"string"`` + +#### Defined in + +[types.ts:18](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L18) + +___ + +### uint + +• **uint** = ``"uint256"`` + +#### Defined in + +[types.ts:14](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L14) + +___ + +### uint256 + +• **uint256** = ``"uint256"`` + +#### Defined in + +[types.ts:15](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L15) diff --git a/docs/interfaces/RequestEventData.md b/docs/interfaces/RequestEventData.md new file mode 100644 index 0000000..dd3f115 --- /dev/null +++ b/docs/interfaces/RequestEventData.md @@ -0,0 +1,118 @@ +[@chainlink/functions-toolkit](../README.md) / RequestEventData + +# Interface: RequestEventData + +## Table of contents + +### Properties + +- [callbackGasLimit](RequestEventData.md#callbackgaslimit) +- [commitment](RequestEventData.md#commitment) +- [data](RequestEventData.md#data) +- [dataVersion](RequestEventData.md#dataversion) +- [flags](RequestEventData.md#flags) +- [requestId](RequestEventData.md#requestid) +- [requestInitiator](RequestEventData.md#requestinitiator) +- [requestingContract](RequestEventData.md#requestingcontract) +- [subscriptionId](RequestEventData.md#subscriptionid) +- [subscriptionOwner](RequestEventData.md#subscriptionowner) + +## Properties + +### callbackGasLimit + +• **callbackGasLimit**: `number` + +#### Defined in + +[localFunctionsTestnet.ts:39](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/localFunctionsTestnet.ts#L39) + +___ + +### commitment + +• **commitment**: [`RequestCommitment`](../README.md#requestcommitment) + +#### Defined in + +[localFunctionsTestnet.ts:40](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/localFunctionsTestnet.ts#L40) + +___ + +### data + +• **data**: `string` + +#### Defined in + +[localFunctionsTestnet.ts:36](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/localFunctionsTestnet.ts#L36) + +___ + +### dataVersion + +• **dataVersion**: `number` + +#### Defined in + +[localFunctionsTestnet.ts:37](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/localFunctionsTestnet.ts#L37) + +___ + +### flags + +• **flags**: `string` + +#### Defined in + +[localFunctionsTestnet.ts:38](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/localFunctionsTestnet.ts#L38) + +___ + +### requestId + +• **requestId**: `string` + +#### Defined in + +[localFunctionsTestnet.ts:31](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/localFunctionsTestnet.ts#L31) + +___ + +### requestInitiator + +• **requestInitiator**: `string` + +#### Defined in + +[localFunctionsTestnet.ts:33](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/localFunctionsTestnet.ts#L33) + +___ + +### requestingContract + +• **requestingContract**: `string` + +#### Defined in + +[localFunctionsTestnet.ts:32](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/localFunctionsTestnet.ts#L32) + +___ + +### subscriptionId + +• **subscriptionId**: `any` + +#### Defined in + +[localFunctionsTestnet.ts:34](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/localFunctionsTestnet.ts#L34) + +___ + +### subscriptionOwner + +• **subscriptionOwner**: `string` + +#### Defined in + +[localFunctionsTestnet.ts:35](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/localFunctionsTestnet.ts#L35) diff --git a/docs/interfaces/SimulationInput.md b/docs/interfaces/SimulationInput.md new file mode 100644 index 0000000..5661ec3 --- /dev/null +++ b/docs/interfaces/SimulationInput.md @@ -0,0 +1,140 @@ +[@chainlink/functions-toolkit](../README.md) / SimulationInput + +# Interface: SimulationInput + +## Table of contents + +### Properties + +- [args](SimulationInput.md#args) +- [bytesArgs](SimulationInput.md#bytesargs) +- [maxExecutionTimeMs](SimulationInput.md#maxexecutiontimems) +- [maxMemoryUsageMb](SimulationInput.md#maxmemoryusagemb) +- [maxOnChainResponseBytes](SimulationInput.md#maxonchainresponsebytes) +- [maxQueryDurationMs](SimulationInput.md#maxquerydurationms) +- [maxQueryRequestBytes](SimulationInput.md#maxqueryrequestbytes) +- [maxQueryResponseBytes](SimulationInput.md#maxqueryresponsebytes) +- [maxQueryUrlLength](SimulationInput.md#maxqueryurllength) +- [numAllowedQueries](SimulationInput.md#numallowedqueries) +- [secrets](SimulationInput.md#secrets) +- [source](SimulationInput.md#source) + +## Properties + +### args + +• `Optional` **args**: `string`[] + +#### Defined in + +[types.ts:183](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L183) + +___ + +### bytesArgs + +• `Optional` **bytesArgs**: `string`[] + +#### Defined in + +[types.ts:184](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L184) + +___ + +### maxExecutionTimeMs + +• `Optional` **maxExecutionTimeMs**: `number` + +#### Defined in + +[types.ts:187](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L187) + +___ + +### maxMemoryUsageMb + +• `Optional` **maxMemoryUsageMb**: `number` + +#### Defined in + +[types.ts:188](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L188) + +___ + +### maxOnChainResponseBytes + +• `Optional` **maxOnChainResponseBytes**: `number` + +#### Defined in + +[types.ts:186](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L186) + +___ + +### maxQueryDurationMs + +• `Optional` **maxQueryDurationMs**: `number` + +#### Defined in + +[types.ts:190](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L190) + +___ + +### maxQueryRequestBytes + +• `Optional` **maxQueryRequestBytes**: `number` + +#### Defined in + +[types.ts:192](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L192) + +___ + +### maxQueryResponseBytes + +• `Optional` **maxQueryResponseBytes**: `number` + +#### Defined in + +[types.ts:193](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L193) + +___ + +### maxQueryUrlLength + +• `Optional` **maxQueryUrlLength**: `number` + +#### Defined in + +[types.ts:191](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L191) + +___ + +### numAllowedQueries + +• `Optional` **numAllowedQueries**: `number` + +#### Defined in + +[types.ts:189](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L189) + +___ + +### secrets + +• `Optional` **secrets**: `Record`<`string`, `string`\> + +#### Defined in + +[types.ts:185](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L185) + +___ + +### source + +• **source**: `string` + +#### Defined in + +[types.ts:182](https://github.com/smartcontractkit/functions-toolkit/blob/1164b15/src/types.ts#L182) diff --git a/package-lock.json b/package-lock.json index f6294cb..da1a19e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@chainlink/functions-toolkit", - "version": "0.0.2", + "version": "0.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@chainlink/functions-toolkit", - "version": "0.0.2", + "version": "0.0.3", "license": "MIT", "dependencies": { "axios": "^1.4.0", @@ -35,6 +35,8 @@ "prettier": "^2.8.8", "rimraf": "^5.0.1", "ts-jest": "^29.1.0", + "typedoc": "^0.25.1", + "typedoc-plugin-markdown": "^3.16.0", "typescript": "^5.0.4", "webpack": "5.82.1", "webpack-cli": "5.1.1" @@ -4376,6 +4378,12 @@ "node": ">=8" } }, + "node_modules/ansi-sequence-parser": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz", + "integrity": "sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==", + "dev": true + }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -8662,9 +8670,7 @@ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "extraneous": true, "os": [ - "darwin", - "linux", - "win32" + "darwin" ], "engines": { "node": "^8.16.0 || ^10.6.0 || >=11.0.0" @@ -11057,6 +11063,27 @@ "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", "dev": true }, + "node_modules/handlebars": { + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", + "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", + "dev": true, + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.2", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, "node_modules/hard-rejection": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", @@ -12583,6 +12610,12 @@ "node": ">=6" } }, + "node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true + }, "node_modules/jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -12797,6 +12830,12 @@ "yallist": "^3.0.2" } }, + "node_modules/lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", + "dev": true + }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -12839,6 +12878,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/marked": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "dev": true, + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 12" + } + }, "node_modules/md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -14480,6 +14531,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/shiki": { + "version": "0.14.4", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.4.tgz", + "integrity": "sha512-IXCRip2IQzKwxArNNq1S+On4KPML3Yyn8Zzs/xRgcgOWIr8ntIK3IKzjFPfjy/7kt9ZMjc+FItfqHRBg8b6tNQ==", + "dev": true, + "dependencies": { + "ansi-sequence-parser": "^1.1.0", + "jsonc-parser": "^3.2.0", + "vscode-oniguruma": "^1.7.0", + "vscode-textmate": "^8.0.0" + } + }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -15464,6 +15527,63 @@ "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", "dev": true }, + "node_modules/typedoc": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.25.1.tgz", + "integrity": "sha512-c2ye3YUtGIadxN2O6YwPEXgrZcvhlZ6HlhWZ8jQRNzwLPn2ylhdGqdR8HbyDRyALP8J6lmSANILCkkIdNPFxqA==", + "dev": true, + "dependencies": { + "lunr": "^2.3.9", + "marked": "^4.3.0", + "minimatch": "^9.0.3", + "shiki": "^0.14.1" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 16" + }, + "peerDependencies": { + "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x" + } + }, + "node_modules/typedoc-plugin-markdown": { + "version": "3.16.0", + "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.16.0.tgz", + "integrity": "sha512-eeiC78fDNGFwemPIHiwRC+mEC7W5jwt3fceUev2gJ2nFnXpVHo8eRrpC9BLWZDee6ehnz/sPmNjizbXwpfaTBw==", + "dev": true, + "dependencies": { + "handlebars": "^4.7.7" + }, + "peerDependencies": { + "typedoc": ">=0.24.0" + } + }, + "node_modules/typedoc/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/typedoc/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/typescript": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", @@ -15477,6 +15597,19 @@ "node": ">=12.20" } }, + "node_modules/uglify-js": { + "version": "3.17.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", + "dev": true, + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/umd": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz", @@ -15680,6 +15813,18 @@ "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==", "dev": true }, + "node_modules/vscode-oniguruma": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", + "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", + "dev": true + }, + "node_modules/vscode-textmate": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", + "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", + "dev": true + }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", @@ -15925,6 +16070,12 @@ "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", "dev": true }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", + "dev": true + }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", diff --git a/package.json b/package.json index 83ecc3d..e6dbdf6 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "test:integration": "jest --testPathPattern=integration", "test:package": "jest --config jest.config.package.js", "lint": "prettier --check . && tsc --noEmit", - "lint:fix": "npx prettier -w ." + "lint:fix": "npx prettier -w .", + "docgen": "typedoc --plugin typedoc-plugin-markdown --readme none" }, "repository": { "type": "git", @@ -51,6 +52,8 @@ "prettier": "^2.8.8", "rimraf": "^5.0.1", "ts-jest": "^29.1.0", + "typedoc": "^0.25.1", + "typedoc-plugin-markdown": "^3.16.0", "typescript": "^5.0.4", "webpack": "5.82.1", "webpack-cli": "5.1.1" diff --git a/src/types.ts b/src/types.ts index 02de069..1c37451 100644 --- a/src/types.ts +++ b/src/types.ts @@ -142,7 +142,7 @@ export type GatewayMessage = { } } -type EncryptedSecretsEntry = { +export type EncryptedSecretsEntry = { slot_id: number version: number expiration: number diff --git a/tsconfig.json b/tsconfig.json index 51aedd8..2531a89 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,6 +13,10 @@ "noImplicitAny": true, "skipLibCheck": true }, + "typedocOptions": { + "entryPoints": ["src/index.ts"], + "out": "docs" + }, "include": ["src/**/*", "src/**/*.json", "test/**/*", "test/**/*.json"], "exclude": ["dist", "src/simulateScript/deno-sandbox/**/*.ts"] }