From 95e7365fc69a9aa644bd46aea217b49dc98ca9fa Mon Sep 17 00:00:00 2001 From: Loris Leiva Date: Tue, 2 Sep 2025 15:00:47 +0100 Subject: [PATCH 1/2] Upgrade JS client to Kit v3 --- clients/js/package.json | 11 +- clients/js/pnpm-lock.yaml | 736 ++++---- clients/js/src/cli/commands/close-buffer.ts | 3 +- clients/js/src/cli/commands/close.ts | 3 +- clients/js/src/cli/commands/list-buffers.ts | 5 +- .../js/src/cli/commands/remove-authority.ts | 3 +- clients/js/src/cli/commands/set-authority.ts | 3 +- .../src/cli/commands/set-buffer-authority.ts | 3 +- clients/js/src/cli/commands/set-immutable.ts | 3 +- clients/js/src/cli/utils.ts | 35 +- clients/js/src/createBuffer.ts | 6 +- clients/js/src/createMetadata.ts | 25 +- .../js/src/generated/instructions/allocate.ts | 55 +- .../js/src/generated/instructions/close.ts | 55 +- .../js/src/generated/instructions/extend.ts | 53 +- .../src/generated/instructions/initialize.ts | 42 +- .../generated/instructions/setAuthority.ts | 41 +- .../js/src/generated/instructions/setData.ts | 42 +- .../generated/instructions/setImmutable.ts | 53 +- clients/js/src/generated/instructions/trim.ts | 57 +- .../js/src/generated/instructions/write.ts | 38 +- clients/js/src/generated/pdas/canonical.ts | 1 + clients/js/src/generated/pdas/metadata.ts | 1 + clients/js/src/generated/pdas/nonCanonical.ts | 1 + clients/js/src/generated/shared/index.ts | 12 +- .../generated/types/accountDiscriminator.ts | 12 +- clients/js/src/generated/types/compression.ts | 15 +- clients/js/src/generated/types/dataSource.ts | 15 +- clients/js/src/generated/types/encoding.ts | 12 +- .../js/src/generated/types/externalData.ts | 15 +- clients/js/src/generated/types/format.ts | 12 +- clients/js/src/generated/types/seed.ts | 12 +- clients/js/src/index.ts | 1 - .../instructionPlans/computeBudgetHelpers.ts | 145 -- clients/js/src/instructionPlans/index.ts | 12 - .../src/instructionPlans/instructionPlan.ts | 212 --- clients/js/src/instructionPlans/internal.ts | 22 - .../instructionPlans/transactionHelpers.ts | 47 - .../src/instructionPlans/transactionPlan.ts | 80 - .../transactionPlanExecutor.ts | 7 - .../transactionPlanExecutorBase.ts | 186 -- .../transactionPlanExecutorDecorators.ts | 66 - .../transactionPlanExecutorDefault.ts | 134 -- .../instructionPlans/transactionPlanResult.ts | 38 - .../instructionPlans/transactionPlanner.ts | 19 - .../transactionPlannerBase.ts | 438 ----- .../transactionPlannerDefault.ts | 33 - clients/js/src/internals.ts | 89 +- clients/js/src/updateBuffer.ts | 6 +- clients/js/src/updateMetadata.ts | 20 +- clients/js/src/utils.ts | 10 +- clients/js/src/writeMetadata.ts | 14 +- clients/js/test/_setup.ts | 12 +- .../_instructionPlanHelpers.ts | 113 -- .../_transactionPlanHelpers.ts | 38 - .../_transactionPlanResultHelpers.ts | 63 - .../transactionPlanExecutor.test.ts | 135 -- .../transactionPlanner.test.ts | 1650 ----------------- clients/js/test/loader-v3/deploy.ts | 48 +- clients/js/test/loader-v3/initializeBuffer.ts | 30 +- clients/js/test/loader-v3/shared.ts | 8 +- clients/js/test/loader-v3/write.ts | 34 +- package.json | 6 +- pnpm-lock.yaml | 349 ++-- 64 files changed, 1064 insertions(+), 4381 deletions(-) delete mode 100644 clients/js/src/instructionPlans/computeBudgetHelpers.ts delete mode 100644 clients/js/src/instructionPlans/index.ts delete mode 100644 clients/js/src/instructionPlans/instructionPlan.ts delete mode 100644 clients/js/src/instructionPlans/internal.ts delete mode 100644 clients/js/src/instructionPlans/transactionHelpers.ts delete mode 100644 clients/js/src/instructionPlans/transactionPlan.ts delete mode 100644 clients/js/src/instructionPlans/transactionPlanExecutor.ts delete mode 100644 clients/js/src/instructionPlans/transactionPlanExecutorBase.ts delete mode 100644 clients/js/src/instructionPlans/transactionPlanExecutorDecorators.ts delete mode 100644 clients/js/src/instructionPlans/transactionPlanExecutorDefault.ts delete mode 100644 clients/js/src/instructionPlans/transactionPlanResult.ts delete mode 100644 clients/js/src/instructionPlans/transactionPlanner.ts delete mode 100644 clients/js/src/instructionPlans/transactionPlannerBase.ts delete mode 100644 clients/js/src/instructionPlans/transactionPlannerDefault.ts delete mode 100644 clients/js/test/instructionPlans/_instructionPlanHelpers.ts delete mode 100644 clients/js/test/instructionPlans/_transactionPlanHelpers.ts delete mode 100644 clients/js/test/instructionPlans/_transactionPlanResultHelpers.ts delete mode 100644 clients/js/test/instructionPlans/transactionPlanExecutor.test.ts delete mode 100644 clients/js/test/instructionPlans/transactionPlanner.test.ts diff --git a/clients/js/package.json b/clients/js/package.json index fe3fc79..7011874 100644 --- a/clients/js/package.json +++ b/clients/js/package.json @@ -45,13 +45,14 @@ "homepage": "https://github.com/solana-program/program-metadata#readme", "license": "MIT", "peerDependencies": { - "@solana/kit": "^2.1.0" + "@solana/kit": "^3.0" }, "dependencies": { "@iarna/toml": "^2.2.5", - "@solana-program/compute-budget": "^0.7.0", - "@solana-program/system": "^0.7.0", + "@solana-program/compute-budget": "^0.9.0", + "@solana-program/system": "^0.8.0", "commander": "^13.0.0", + "p-limit": "^7.1.1", "pako": "^2.1.0", "picocolors": "^1.1.1", "yaml": "^2.7.0" @@ -59,8 +60,8 @@ "devDependencies": { "@ava/typescript": "^4.1.0", "@solana/eslint-config-solana": "^3.0.3", - "@solana/kit": "^2.1.0", - "@types/node": "^22", + "@solana/kit": "^3.0", + "@types/node": "^24", "@types/pako": "^2.0.3", "@typescript-eslint/eslint-plugin": "^7.16.1", "@typescript-eslint/parser": "^7.16.1", diff --git a/clients/js/pnpm-lock.yaml b/clients/js/pnpm-lock.yaml index 4fe4fff..7ae058b 100644 --- a/clients/js/pnpm-lock.yaml +++ b/clients/js/pnpm-lock.yaml @@ -12,14 +12,17 @@ importers: specifier: ^2.2.5 version: 2.2.5 '@solana-program/compute-budget': - specifier: ^0.7.0 - version: 0.7.0(@solana/kit@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0)) + specifier: ^0.9.0 + version: 0.9.0(@solana/kit@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0)) '@solana-program/system': - specifier: ^0.7.0 - version: 0.7.0(@solana/kit@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0)) + specifier: ^0.8.0 + version: 0.8.0(@solana/kit@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0)) commander: specifier: ^13.0.0 version: 13.0.0 + p-limit: + specifier: ^7.1.1 + version: 7.1.1 pako: specifier: ^2.1.0 version: 2.1.0 @@ -37,11 +40,11 @@ importers: specifier: ^3.0.3 version: 3.0.6(@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.7.3))(eslint@8.57.1)(typescript@5.7.3))(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.7.3))(eslint-plugin-jest@27.9.0(@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.7.3))(eslint@8.57.1)(typescript@5.7.3))(eslint@8.57.1)(typescript@5.7.3))(eslint-plugin-react-hooks@4.6.2(eslint@8.57.1))(eslint-plugin-simple-import-sort@12.1.1(eslint@8.57.1))(eslint-plugin-sort-keys-fix@1.1.2)(eslint-plugin-typescript-sort-keys@3.3.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.7.3))(eslint@8.57.1)(typescript@5.7.3))(eslint@8.57.1)(typescript@5.7.3) '@solana/kit': - specifier: ^2.1.0 - version: 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0) + specifier: ^3.0 + version: 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0) '@types/node': - specifier: ^22 - version: 22.10.6 + specifier: ^24 + version: 24.3.0 '@types/pako': specifier: ^2.0.3 version: 2.0.3 @@ -418,71 +421,71 @@ packages: resolution: {integrity: sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==} engines: {node: '>=18'} - '@solana-program/compute-budget@0.7.0': - resolution: {integrity: sha512-/JJSE1fKO5zx7Z55Z2tLGWBDDi7tUE+xMlK8qqkHlY51KpqksMsIBzQMkG9Dqhoe2Cnn5/t3QK1nJKqW6eHzpg==} + '@solana-program/compute-budget@0.9.0': + resolution: {integrity: sha512-on7Cs1V48X9E2x1yVmfM6N6Xv0r4oGruXPcWnI50D3D3CIsHNWJ4gsvL4qZ4iey7zAP73FdM21K2CZBi1a/jzg==} peerDependencies: - '@solana/kit': ^2.1.0 + '@solana/kit': ^3.0 - '@solana-program/system@0.7.0': - resolution: {integrity: sha512-FKTBsKHpvHHNc1ATRm7SlC5nF/VdJtOSjldhcyfMN9R7xo712Mo2jHIzvBgn8zQO5Kg0DcWuKB7268Kv1ocicw==} + '@solana-program/system@0.8.0': + resolution: {integrity: sha512-/VJZjFoI+FMrsO5gPgktRIo6Sf/2pMEkkpA6grLtm4Xx52bQDo4fBvhA33FL+3pSf25yHcMcXwrKwqDk6/O1fw==} peerDependencies: - '@solana/kit': ^2.1.0 + '@solana/kit': ^3.0 - '@solana/accounts@2.1.0': - resolution: {integrity: sha512-1JOBiLFeIeHmGx7k1b23UWF9vM1HAh9GBMCzr5rBPrGSBs+QUgxBJ3+yrRg+UPEOSELubqo7qoOVFUKYsb1nXw==} + '@solana/accounts@3.0.1': + resolution: {integrity: sha512-mnSikkN1QFuo77nPnXduynNteP28UnGDJDaSZ7eruyHTNwYymHzadnjkyzdh132pKYcUfyXmoqX2wfBFQ2RQqw==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/addresses@2.1.0': - resolution: {integrity: sha512-IgiRuju2yLz14GnrysOPSNZbZQ8F+7jhx7FYZLrbKogf6NX4wy4ijLHxRsLFqP8o8aY69BZULkM9MwrSjsZi7A==} + '@solana/addresses@3.0.1': + resolution: {integrity: sha512-1trIGrZVOw6pVhusQi9rYigUt2cAxPgcd2fs0wCXN+uRnJWKvZCmqegfHVOvygy5ac65yECeyrinl6TGStbxbw==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/assertions@2.1.0': - resolution: {integrity: sha512-KCYmxFRsg897Ec7yGdpc0rniOlqGD3NpicmIjWIV87uiXX5uFco4t+01sKyFlhsv4T4OgHxngMsxkfQ3AUkFVg==} + '@solana/assertions@3.0.1': + resolution: {integrity: sha512-tTARLS/c01vISXYC3xsU5R+SUiAo+wn59Me4xlqk0d8erWxjEgEj3uHGTO+xEiQyjEhPNv4rfEx+vmk8mAvCUQ==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/codecs-core@2.1.0': - resolution: {integrity: sha512-SR7pKtmJBg2mhmkel2NeHA1pz06QeQXdMv8WJoIR9m8F/hw80K/612uaYbwTt2nkK0jg/Qn/rNSd7EcJ4SBGjw==} + '@solana/codecs-core@3.0.1': + resolution: {integrity: sha512-7U12QJX6VZeq03r0l0SZnGPk+YHbyU9lDjEZpjiSHdWbixy8inoYTsqV523Soy41SnGwvVsfiJf7SUB5kvgGaQ==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/codecs-data-structures@2.1.0': - resolution: {integrity: sha512-oDF5ek54kirqJ09q8k/qEpobBiWOhd3CkkGOTyfjsmTF/IGIigNbdYIakxV3+vudBeaNBw08y0XdBYI4JL/nqA==} + '@solana/codecs-data-structures@3.0.1': + resolution: {integrity: sha512-0VarnZxfxm77iTc5aq7mHxXHa6mlFCpkKboT+oc+8jXOCwLyNIss480qc7QX+2FVFSwB5gRIlR36/RubaIDbLg==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/codecs-numbers@2.1.0': - resolution: {integrity: sha512-XMu4yw5iCgQnMKsxSWPPOrGgtaohmupN3eyAtYv3K3C/MJEc5V90h74k5B1GUCiHvcrdUDO9RclNjD9lgbjFag==} + '@solana/codecs-numbers@3.0.1': + resolution: {integrity: sha512-HdXioWMVc0Ih9N7vuEF11pMwQWHqSF/TQrCDKljr981QQ5q/pBleUZB3hM43zP/ndnTasIxqAuLXIypricAGqg==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/codecs-strings@2.1.0': - resolution: {integrity: sha512-O/eJFLzFrHomcCR1Y5QbIqoPo7iaJaWNnIeskB4mVhVjLyjlJS4WtBP2NBRzM9uJXaXyOxxKroqqO9zFsHOpvQ==} + '@solana/codecs-strings@3.0.1': + resolution: {integrity: sha512-UxaD1Xdxe35Y2B0HnSHe48ok8ew+tyrVI1w65eHj0NzGb9FxLx/KuuEg/b/qXQRUB75JQjDo8IBh5rWZ7rl5qQ==} engines: {node: '>=20.18.0'} peerDependencies: fastestsmallesttextencoderdecoder: ^1.0.22 - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/codecs@2.1.0': - resolution: {integrity: sha512-C0TnfrpbTg7zoIFYfM65ofeL2AWEz80OsD6mjVdcTKpb1Uj7XuBuNLss3dMnatPQaL7RagD9VLA5/WfYayyteQ==} + '@solana/codecs@3.0.1': + resolution: {integrity: sha512-bvSz1L2H/WlTqUvPtEfF4IDhp1PpZeqUdvkfy3X1sj6n/A+k08FyB3T2AbjoeOm1XAg70voYHjal/nE8SAzQFw==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/errors@2.1.0': - resolution: {integrity: sha512-l+GxAv0Ar4d3c3PlZdA9G++wFYZREEbbRyAFP8+n8HSg0vudCuzogh/13io6hYuUhG/9Ve8ARZNamhV7UScKNw==} + '@solana/errors@3.0.1': + resolution: {integrity: sha512-/EhRoJLrO03wj+3/miA6YkBnGjAS12mvilWkQ4LBv/hVqhUF9V8JXpSMnD40hoaMraE23V9IaHNHcfoJmldjwA==} engines: {node: '>=20.18.0'} hasBin: true peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' '@solana/eslint-config-solana@3.0.6': resolution: {integrity: sha512-3u024DkukJCfzUfOgN1EmWzVZLaZtgRLJ52FEdQmIG8NYOzLpaIJFgQvjYXWQlnK6ycIcSn/MesHG6sbKkMtTQ==} @@ -497,162 +500,174 @@ packages: eslint-plugin-typescript-sort-keys: ^3.2.0 typescript: ^5.1.6 - '@solana/fast-stable-stringify@2.1.0': - resolution: {integrity: sha512-a8vR92qbe/VsvQ1BpN3PIEwnoHD2fTHEwCJh9GG58z3R15RIjk73gc0khjcdg4U1tZwTJqWkvk8SbDIgGdOgMA==} + '@solana/fast-stable-stringify@3.0.1': + resolution: {integrity: sha512-/E9Hzk1XcCxp2DDXfzQYcgT6SZtJOzTij01UxSpvmsPYai/WwYtig09B/TTZO7a7C3+pstRZnba4XyFnmlrSUw==} + engines: {node: '>=20.18.0'} + peerDependencies: + typescript: '>=5.3.3' + + '@solana/functional@3.0.1': + resolution: {integrity: sha512-wH0wUWKAB6sVxZ7+JQBVIAsZQWP0G4q/QaI3WGTuVNPNXwnNDkAuKNJFGSqugrWZTn2OKJHMHJUUWPNEKSkhcw==} + engines: {node: '>=20.18.0'} + peerDependencies: + typescript: '>=5.3.3' + + '@solana/instruction-plans@3.0.1': + resolution: {integrity: sha512-YIWApyXGS3lhbI8lN9TzPNm1dBtvJBpPutccABqAVmSo06oi85TtWKLST7bv6qPIAP/iJX/dxMjG+K1Xqognyg==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/functional@2.1.0': - resolution: {integrity: sha512-RVij8Av4F2uUOFcEC8n9lgD72e9gQMritmGHhMh+G91Xops4I6Few+oQ++XgSTiL2t3g3Cs0QZ13onZ0FL45FQ==} + '@solana/instructions@3.0.1': + resolution: {integrity: sha512-JoMW+nXotoRWmN8BR1xt5IjLADOtP9NhNcLkQtwvqq2uVPMwe2WgUgHAlwSBWvVTZ6eN1T9WL57uUahC1CcWaw==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/instructions@2.1.0': - resolution: {integrity: sha512-wfn6e7Rgm0Sw/Th1v/pXsKTvloZvAAQI7j1yc9WcIk9ngqH5p6LhqMMkrwYPB2oTk8+MMr7SZ4E+2eK2gL6ODA==} + '@solana/keys@3.0.1': + resolution: {integrity: sha512-6DdquYFD+btdoM6kwoj/VJvfUmsz+yRkErmqlcIqGS/Ztqsi1cxo+yTYuJD3jFaCl7VIOu3oxrNzjAeaJLhkxg==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/keys@2.1.0': - resolution: {integrity: sha512-esY1+dlZjB18hZML5p+YPec29wi3HH0SzKx7RiqF//dI2cJ6vHfq3F+7ArbNnF6R2YCLFtl7DzS/tkqR2Xkxeg==} + '@solana/kit@3.0.1': + resolution: {integrity: sha512-kQaCLad8ZlFhnJYs2UmhkCULq1XLDYwH9x8VuV6hkD8SJHvRU12SrXN27RcrizAKFkucqyCno/FhqLng7WA8yQ==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/kit@2.1.0': - resolution: {integrity: sha512-vqaHROLKp89xdIbaKVG6BQ44uMN9E6/rSTeltkvquD2qdTObssafGDbAKVFjwZhlNO+sdzHDCLekGabn5VAL6A==} + '@solana/nominal-types@3.0.1': + resolution: {integrity: sha512-EpcR8HMowYUewTgQ7LRS2AcBs+Rqe4t/O4ehyLzdrZJh5yHuEfDFDPXRqJCR0Su5ShxEZhSNNro/4IlctBEjYw==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/options@2.1.0': - resolution: {integrity: sha512-T/vJCr8qnwK6HxriOPXCrx31IpA9ZYecxuOzQ3G74kIayED4spmpXp6PLtRYR/fo2LZ6UcgHN0qSgONnvwEweg==} + '@solana/options@3.0.1': + resolution: {integrity: sha512-BlOmXLh4/NDoq89j4gJLg0lVQNnp2Mn76efCUeh/r99NIoliDJPQFPnjvfbBiAN5BvJksr7RCkAamZQjD2j7rw==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/programs@2.1.0': - resolution: {integrity: sha512-9Y30/yUbTR99+QRN2ukNXQQTGY68oKmVrXnh/et6StM1JF5WHvAJqBigsHG5bt6KxTISoRuncBnH/IRnDqPxKg==} + '@solana/programs@3.0.1': + resolution: {integrity: sha512-Ao2JsRZO6NbxIbKQQWsaetZBotjH1nQ+Ona5FvKxBmTa6p2maM88j+rSJmMtstZGVKiapDIGQESYwZXenUfuhQ==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/promises@2.1.0': - resolution: {integrity: sha512-eQJaQXA2kD4dVyifzhslV3wOvq27fwOJ4az89BQ4Cz83zPbR94xOeDShwcXrKBYqaUf6XqH5MzdEo14t4tKAFQ==} + '@solana/promises@3.0.1': + resolution: {integrity: sha512-2BRbJNiBDenMKOqtvpXbfkCS8VjhZQgaYarff+O7FCn/w7toTHp1H6hqWjSL429omF7oj6fAqq3Lg26ZrUea9g==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/rpc-api@2.1.0': - resolution: {integrity: sha512-4yCnHYHFlz9VffivoY5q/HVeBjT59byB2gmg7UyC3ktxD28AlF9jjsE5tJKiapAKr2J3KWm0D/rH/QwW14cGeA==} + '@solana/rpc-api@3.0.1': + resolution: {integrity: sha512-FEqxaVeUFuhafQCKfFFismEPKGygzbZJmnB1CCIoC3Xs2c/ab0R3H6yFVXONVS/mKFXMHRiJhJMCm2f2VncR3w==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/rpc-parsed-types@2.1.0': - resolution: {integrity: sha512-mRzHemxlWDS9p1fPQNKwL+1vEOUMG8peSUJb0X/NbM12yjowDNdzM++fkOgIyCKDPddfkcoNmNrQmr2jwjdN1Q==} + '@solana/rpc-parsed-types@3.0.1': + resolution: {integrity: sha512-+BXgL5KREoal01M5tGIuVwlO1aenq1jlr2TZeYD/SPFSVRrNQkHnkPWwJzOjuqJ+NuOakBuzgOHY9cfgacz+xg==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/rpc-spec-types@2.1.0': - resolution: {integrity: sha512-NxcZ8piXMyCdbNUL6d36QJfL2UAQEN33StlGku0ltTVe1nrokZ5WRNjSPohU1fODlNaZzTvUFzvUkM1yGCkyzw==} + '@solana/rpc-spec-types@3.0.1': + resolution: {integrity: sha512-UU/blVNDihiC/fkwv4AKqSmiwkTjuJ/xy33D4TmpnByI9J5uRFTDWAo8PlMudQOdMi+j14y8THpKCz+P3di2ZA==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/rpc-spec@2.1.0': - resolution: {integrity: sha512-NPAIM5EY7Jke0mHnmoMpgCEb/nZKIo+bgVFK/u+z74gY0JnCNt0DfocStUUQtlhqSmTyoHamt3lfxp4GT2zXbA==} + '@solana/rpc-spec@3.0.1': + resolution: {integrity: sha512-N/y2Oual+aP+AxR4uYNoZ99nJ4gpeWqWq6w8G/LLR+FWrRUKFeUAJabOLLbIYRPF2Xw3QO5DGa5suDF+UO4O0w==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/rpc-subscriptions-api@2.1.0': - resolution: {integrity: sha512-de1dBRSE2CUwoZHMXQ/0v7iC+/pG0+iYY8jLHGGNxtKrYbTnV08mXQbaAMrmv2Rk8ZFmfJWbqbYZ9dRWdO3P5g==} + '@solana/rpc-subscriptions-api@3.0.1': + resolution: {integrity: sha512-/SfNNYsMcN2EYcnfM1FVRW54I1kLw/6mY+/ET7I1tCiSsPzlueF8cZ+0atHznDyKkjK5LvNTyAGpPCSy2srL0w==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/rpc-subscriptions-channel-websocket@2.1.0': - resolution: {integrity: sha512-goJe9dv0cs967HJ382vSX8yapXgQzRHCmH323LsXrrpj/s3Eb3yUwJq7AcHgoh4gKIqyAfGybq/bE5Aa8Pcm9g==} + '@solana/rpc-subscriptions-channel-websocket@3.0.1': + resolution: {integrity: sha512-ozfc0NxFlPBluqX4W8Tu2xOEncod1cSVFQ3LkTnHv5m8VmShHTuN5r2mY+z27TwQAtUdsvs29sSHMRQUbAONGA==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' ws: ^8.18.0 - '@solana/rpc-subscriptions-spec@2.1.0': - resolution: {integrity: sha512-Uqasfd3Tlr22lC/Vy5dToF0e68dMKPdnt4ks7FwXuPdEbNRM/TDGb0GqG+bt/d3IIrNOCA5Y8vsE0nQHGrWG/w==} + '@solana/rpc-subscriptions-spec@3.0.1': + resolution: {integrity: sha512-OZfd4P9jHabUxLTocJ8QdRJye+tKvBcrf6Kjibvr2E6JAKdJ2qoLTNQN4jeh66VvfHpGfsV3tXfHCIG2XeKUGA==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/rpc-subscriptions@2.1.0': - resolution: {integrity: sha512-dTyI03VlueE3s7mA/OBlA5l6yKUUKHMJd31tpzxV3AFnqE/QPS5NVrF/WY6pPBobLJiCP0UFOe7eR/MKP9SUCA==} + '@solana/rpc-subscriptions@3.0.1': + resolution: {integrity: sha512-ZGehdTl/8rdXJ+oYuIx1c96VJN/QLqUdaWkawGO9ydYsJGVEMEzuMXhEPmfOr7Tua7LxLUsKVH3ZE7Fr1YVVVg==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/rpc-transformers@2.1.0': - resolution: {integrity: sha512-E2xPlaCu6tNO00v4HIJxJCYkoNwgVJYad5sxbIUZOQBWwXnWIcll2jUT4bWKpBGq5vFDYfkzRBr8Rco3DhfXqg==} + '@solana/rpc-transformers@3.0.1': + resolution: {integrity: sha512-AuSLW9f3dcdv6AZtRbupf2Rs5aoMbYJe57MjTTg/D2tq8n5WuJi1/8tzr7hVnz2Pq1Jou5IOw2BgAueDh0fHnA==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/rpc-transport-http@2.1.0': - resolution: {integrity: sha512-E3UovTBid4/S8QDd9FkADVKfyG+v7CW5IqI4c27ZDKfazCsnDLLkqh98C6BvNCqi278HKBui4lI2GoFpCq89Pw==} + '@solana/rpc-transport-http@3.0.1': + resolution: {integrity: sha512-0k9wxFuoHppYQ/pao/Mg9SiR5UnGmWBkEkOaKv0ivg++O/vkirBVrBvFdPMncsoct6NUt3eUiBbd5OfI8ffBkA==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/rpc-types@2.1.0': - resolution: {integrity: sha512-1ODnhmpR1X/GjB7hs4gVR3mcCagfPQV0dzq/2DNuCiMjx2snn64KP5WoAHfBEyoC9/Rb36+JpNj/hLAOikipKA==} + '@solana/rpc-types@3.0.1': + resolution: {integrity: sha512-f9n5YiynR5JxFrLJlnRBhd0wNpns3y2FcLsjS8bEhbRLI8CJcu/2WTZTpJk+2RvUyjWIiW4ib3MBzl+q553/LA==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/rpc@2.1.0': - resolution: {integrity: sha512-myg9qAo6b2WKyHSMXURQykb+ZRnNEXBPLEcwRwkos8STzPPyRFg6ady2s0FCQQTtL/pVjanIU2bObZIzbMGugA==} + '@solana/rpc@3.0.1': + resolution: {integrity: sha512-TZFAUlxYVPFUfoq5boOIaUwT3p/8bDb2hkVtfZCXX2PfvyNw8/6BpDvTejtk9M7XRBJa8ZGjvqsTKqQpiTwVLQ==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/signers@2.1.0': - resolution: {integrity: sha512-Yq0JdJnCecRsSBshNWy+OIRmAGeVfjwIh9Z+H1jv8u8p+dJCOreKakTWuxMt5tnj3q5K1mPcak9O2PqVPZ0teA==} + '@solana/signers@3.0.1': + resolution: {integrity: sha512-VhsMJWr6NfGorBY/aaP+6RGcmCIZQA3R6TPKYFkTFkTGrm+XR2Qlvfj6lTujHSWwvhpUnRFaYD+mIsJaN5LthA==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/subscribable@2.1.0': - resolution: {integrity: sha512-xi12Cm889+uT5sRKnIzr7nLnHAp3hiR3dqIzrT1P7z7iEGp8OnqUQIQCHlgozFHM2cPW+6685NQXk1l1ImuJIw==} + '@solana/subscribable@3.0.1': + resolution: {integrity: sha512-HFLwqL9GHAFrLfIE6d4pCUVY0lcLbN7x6vZpeZHFzGxUZ9GL11EkOBPvX4MTog5VLypCbagxcsJ20ouQLvnkTA==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/sysvars@2.1.0': - resolution: {integrity: sha512-GXu9yS0zIebmM1Unqw/XFpYuvug03m42w98ioOPV/yiHzECggGRGpHGD9RLVYnkyz0eL4NRbnJ5dAEu/fvGe0A==} + '@solana/sysvars@3.0.1': + resolution: {integrity: sha512-zsA9xyXJHtBEtbrSiwrq3ZO6QM0WXGUZbwUYGcM7iXivC3MGb3ZC+ogLwdpC3QYy/UbPPhG5m/47ZNm3ql7WLg==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/transaction-confirmation@2.1.0': - resolution: {integrity: sha512-VxOvtvs2e9h5u73PHyE2TptLAMO5x6dOXlOgvq1Nk6l3rKM2HAsd+KDpN7gjOo8/EgItMMmyEilXygWWRgpSIA==} + '@solana/transaction-confirmation@3.0.1': + resolution: {integrity: sha512-fzrLtlp3J46ankVXup7lVK4s6nXctcv2fljNA7m1akqtUu00wu+4Dhrf0HL7gRtCcrPXieHdIX3oytChpDyvCg==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/transaction-messages@2.1.0': - resolution: {integrity: sha512-+GPzZHLYNFbqHKoiL8mYALp7eAXtAbI6zLViZpIM3zUbVNU3q5+FCKGv6jCBnxs+3QCbeapu+W1OyfDa6BUtTQ==} + '@solana/transaction-messages@3.0.1': + resolution: {integrity: sha512-A5ICJJ0UdfcQucbyEws6a4h6MQIQFNq0n6V8zjMNg24n7G/DHdjWH2C7LoqdjgJyR+bXcbdh/X8Igylvs12RYQ==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' - '@solana/transactions@2.1.0': - resolution: {integrity: sha512-QeM4sCItReeIy5LU7LhGkz7RPfMPTg/Qo8h0LSfhiJiPTOHOhElmh42vkLJmwPl83+MsKtisyPQNK6penM2nAw==} + '@solana/transactions@3.0.1': + resolution: {integrity: sha512-2NjauyVisXse1MyALU+0e9E/VqDkmz4EjyeHHxtEtsRXvWR8+uG+me8k+c94L3a+PptxlWgWann3NRHhX+39vQ==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' '@types/estree@1.0.6': resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} @@ -660,8 +675,8 @@ packages: '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - '@types/node@22.10.6': - resolution: {integrity: sha512-qNiuwC4ZDAUNcY47xgaSuS92cjf8JbSUoaKS77bmLG1rU7MlATVSiw/IlrjtIyyskXBZ8KkNfjK/P5na7rgXbQ==} + '@types/node@24.3.0': + resolution: {integrity: sha512-aPTXCrfwnDLj4VvXrm+UUCQjNEvJgNA8s5F1cvwQU+3KNltTOkBm1j30uNLyqqPNe7gE3KFzImYoZEfLhp4Yow==} '@types/pako@2.0.3': resolution: {integrity: sha512-bq0hMV9opAcrmE0Byyo0fY3Ew4tgOevJmQ9grUhpXQhYfyLJ1Kqg3P33JT5fdbT2AjeAjR51zqqVjAL/HMkx7Q==} @@ -909,6 +924,10 @@ packages: resolution: {integrity: sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==} engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + chalk@5.6.0: + resolution: {integrity: sha512-46QrSQFyVSEyYAgQ22hQ+zDa60YHA4fBstHmtSApj1Y5vKtG27fWowW03jCk5KcbXEWPZUIR894aARCA/G1kfQ==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + chokidar@4.0.3: resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} engines: {node: '>= 14.16.0'} @@ -950,9 +969,9 @@ packages: resolution: {integrity: sha512-oPYleIY8wmTVzkvQq10AEok6YcTC4sRUBl8F9gVuwchGVUCTbl/vhLTaQqutuuySYOsu8YTgV+OxKc/8Yvx+mQ==} engines: {node: '>=18'} - commander@13.1.0: - resolution: {integrity: sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==} - engines: {node: '>=18'} + commander@14.0.0: + resolution: {integrity: sha512-2uM9rYjPvyq39NwLRqaiLtWHyDC1FvryJDa2ATTVims5YAS4PupsEQsDvP14FqhFr0P49CYDugi59xaxJlTXRA==} + engines: {node: '>=20'} commander@4.1.1: resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} @@ -1538,6 +1557,10 @@ packages: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} + p-limit@7.1.1: + resolution: {integrity: sha512-i8PyM2JnsNChVSYWLr2BAjNoLi0BAYC+wecOnZnVV+YSNJkzP7cWmvI34dk0WArWfH9KwBHNoZI3P3MppImlIA==} + engines: {node: '>=20'} + p-locate@5.0.0: resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} engines: {node: '>=10'} @@ -1889,11 +1912,11 @@ packages: engines: {node: '>=14.17'} hasBin: true - undici-types@6.20.0: - resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==} + undici-types@7.10.0: + resolution: {integrity: sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==} - undici-types@7.4.0: - resolution: {integrity: sha512-4tv8DA1nBRW5kF2KBJZzEBjd66kDf3jArNVPoktdlv9Xsgw7EcIMu1bVbAXbX5IWuuZZ3YW3jIM2x85SPgMP6w==} + undici-types@7.15.0: + resolution: {integrity: sha512-Xyn5T99wU4kPhLZMm+ElE6M+IoSeG8Se7eG9xoZ82ZgVHJ07wb/IWcDZeXe2GOPkavcJ8ko5oSlXMDRl/QgY9Q==} unicorn-magic@0.1.0: resolution: {integrity: sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==} @@ -1985,6 +2008,10 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} + yocto-queue@1.2.1: + resolution: {integrity: sha512-AyeEbWOu/TAXdxlV9wmGcR0+yh2j3vYPGOECcIj2S7MkrLyC7ne+oye2BKTItt0ii2PHk4cDy+95+LshzbXnGg==} + engines: {node: '>=12.20'} + snapshots: '@ava/typescript@4.1.0': @@ -2229,82 +2256,83 @@ snapshots: '@sindresorhus/merge-streams@2.3.0': {} - '@solana-program/compute-budget@0.7.0(@solana/kit@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0))': + '@solana-program/compute-budget@0.9.0(@solana/kit@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0))': dependencies: - '@solana/kit': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0) + '@solana/kit': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0) - '@solana-program/system@0.7.0(@solana/kit@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0))': + '@solana-program/system@0.8.0(@solana/kit@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0))': dependencies: - '@solana/kit': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0) + '@solana/kit': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0) - '@solana/accounts@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@solana/accounts@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': dependencies: - '@solana/addresses': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/codecs-strings': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) - '@solana/rpc-spec': 2.1.0(typescript@5.7.3) - '@solana/rpc-types': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/addresses': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/codecs-core': 3.0.1(typescript@5.7.3) + '@solana/codecs-strings': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/rpc-spec': 3.0.1(typescript@5.7.3) + '@solana/rpc-types': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) typescript: 5.7.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - '@solana/addresses@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@solana/addresses@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': dependencies: - '@solana/assertions': 2.1.0(typescript@5.7.3) - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/codecs-strings': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) + '@solana/assertions': 3.0.1(typescript@5.7.3) + '@solana/codecs-core': 3.0.1(typescript@5.7.3) + '@solana/codecs-strings': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/nominal-types': 3.0.1(typescript@5.7.3) typescript: 5.7.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - '@solana/assertions@2.1.0(typescript@5.7.3)': + '@solana/assertions@3.0.1(typescript@5.7.3)': dependencies: - '@solana/errors': 2.1.0(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) typescript: 5.7.3 - '@solana/codecs-core@2.1.0(typescript@5.7.3)': + '@solana/codecs-core@3.0.1(typescript@5.7.3)': dependencies: - '@solana/errors': 2.1.0(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) typescript: 5.7.3 - '@solana/codecs-data-structures@2.1.0(typescript@5.7.3)': + '@solana/codecs-data-structures@3.0.1(typescript@5.7.3)': dependencies: - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/codecs-numbers': 2.1.0(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) + '@solana/codecs-core': 3.0.1(typescript@5.7.3) + '@solana/codecs-numbers': 3.0.1(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) typescript: 5.7.3 - '@solana/codecs-numbers@2.1.0(typescript@5.7.3)': + '@solana/codecs-numbers@3.0.1(typescript@5.7.3)': dependencies: - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) + '@solana/codecs-core': 3.0.1(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) typescript: 5.7.3 - '@solana/codecs-strings@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@solana/codecs-strings@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': dependencies: - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/codecs-numbers': 2.1.0(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) + '@solana/codecs-core': 3.0.1(typescript@5.7.3) + '@solana/codecs-numbers': 3.0.1(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) fastestsmallesttextencoderdecoder: 1.0.22 typescript: 5.7.3 - '@solana/codecs@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@solana/codecs@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': dependencies: - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/codecs-data-structures': 2.1.0(typescript@5.7.3) - '@solana/codecs-numbers': 2.1.0(typescript@5.7.3) - '@solana/codecs-strings': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/options': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/codecs-core': 3.0.1(typescript@5.7.3) + '@solana/codecs-data-structures': 3.0.1(typescript@5.7.3) + '@solana/codecs-numbers': 3.0.1(typescript@5.7.3) + '@solana/codecs-strings': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/options': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) typescript: 5.7.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - '@solana/errors@2.1.0(typescript@5.7.3)': + '@solana/errors@3.0.1(typescript@5.7.3)': dependencies: - chalk: 5.4.1 - commander: 13.1.0 + chalk: 5.6.0 + commander: 14.0.0 typescript: 5.7.3 '@solana/eslint-config-solana@3.0.6(@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.7.3))(eslint@8.57.1)(typescript@5.7.3))(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.7.3))(eslint-plugin-jest@27.9.0(@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.7.3))(eslint@8.57.1)(typescript@5.7.3))(eslint@8.57.1)(typescript@5.7.3))(eslint-plugin-react-hooks@4.6.2(eslint@8.57.1))(eslint-plugin-simple-import-sort@12.1.1(eslint@8.57.1))(eslint-plugin-sort-keys-fix@1.1.2)(eslint-plugin-typescript-sort-keys@3.3.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.7.3))(eslint@8.57.1)(typescript@5.7.3))(eslint@8.57.1)(typescript@5.7.3)': @@ -2319,273 +2347,295 @@ snapshots: eslint-plugin-typescript-sort-keys: 3.3.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.7.3))(eslint@8.57.1)(typescript@5.7.3) typescript: 5.7.3 - '@solana/fast-stable-stringify@2.1.0(typescript@5.7.3)': + '@solana/fast-stable-stringify@3.0.1(typescript@5.7.3)': dependencies: typescript: 5.7.3 - '@solana/functional@2.1.0(typescript@5.7.3)': + '@solana/functional@3.0.1(typescript@5.7.3)': dependencies: typescript: 5.7.3 - '@solana/instructions@2.1.0(typescript@5.7.3)': + '@solana/instruction-plans@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': dependencies: - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/instructions': 3.0.1(typescript@5.7.3) + '@solana/promises': 3.0.1(typescript@5.7.3) + '@solana/transaction-messages': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/transactions': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) typescript: 5.7.3 + transitivePeerDependencies: + - fastestsmallesttextencoderdecoder - '@solana/keys@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@solana/instructions@3.0.1(typescript@5.7.3)': dependencies: - '@solana/assertions': 2.1.0(typescript@5.7.3) - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/codecs-strings': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) + '@solana/codecs-core': 3.0.1(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) + typescript: 5.7.3 + + '@solana/keys@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + dependencies: + '@solana/assertions': 3.0.1(typescript@5.7.3) + '@solana/codecs-core': 3.0.1(typescript@5.7.3) + '@solana/codecs-strings': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/nominal-types': 3.0.1(typescript@5.7.3) typescript: 5.7.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - '@solana/kit@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0)': - dependencies: - '@solana/accounts': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/addresses': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/codecs': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) - '@solana/functional': 2.1.0(typescript@5.7.3) - '@solana/instructions': 2.1.0(typescript@5.7.3) - '@solana/keys': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/programs': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/rpc': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/rpc-parsed-types': 2.1.0(typescript@5.7.3) - '@solana/rpc-spec-types': 2.1.0(typescript@5.7.3) - '@solana/rpc-subscriptions': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0) - '@solana/rpc-types': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/signers': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/sysvars': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/transaction-confirmation': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0) - '@solana/transaction-messages': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/transactions': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/kit@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0)': + dependencies: + '@solana/accounts': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/addresses': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/codecs': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/functional': 3.0.1(typescript@5.7.3) + '@solana/instruction-plans': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/instructions': 3.0.1(typescript@5.7.3) + '@solana/keys': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/programs': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/rpc': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/rpc-parsed-types': 3.0.1(typescript@5.7.3) + '@solana/rpc-spec-types': 3.0.1(typescript@5.7.3) + '@solana/rpc-subscriptions': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0) + '@solana/rpc-types': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/signers': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/sysvars': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/transaction-confirmation': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0) + '@solana/transaction-messages': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/transactions': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) typescript: 5.7.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - ws - '@solana/options@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@solana/nominal-types@3.0.1(typescript@5.7.3)': dependencies: - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/codecs-data-structures': 2.1.0(typescript@5.7.3) - '@solana/codecs-numbers': 2.1.0(typescript@5.7.3) - '@solana/codecs-strings': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) + typescript: 5.7.3 + + '@solana/options@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + dependencies: + '@solana/codecs-core': 3.0.1(typescript@5.7.3) + '@solana/codecs-data-structures': 3.0.1(typescript@5.7.3) + '@solana/codecs-numbers': 3.0.1(typescript@5.7.3) + '@solana/codecs-strings': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) typescript: 5.7.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - '@solana/programs@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@solana/programs@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': dependencies: - '@solana/addresses': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) + '@solana/addresses': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) typescript: 5.7.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - '@solana/promises@2.1.0(typescript@5.7.3)': + '@solana/promises@3.0.1(typescript@5.7.3)': dependencies: typescript: 5.7.3 - '@solana/rpc-api@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': - dependencies: - '@solana/addresses': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/codecs-strings': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) - '@solana/keys': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/rpc-parsed-types': 2.1.0(typescript@5.7.3) - '@solana/rpc-spec': 2.1.0(typescript@5.7.3) - '@solana/rpc-transformers': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/rpc-types': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/transaction-messages': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/transactions': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/rpc-api@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + dependencies: + '@solana/addresses': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/codecs-core': 3.0.1(typescript@5.7.3) + '@solana/codecs-strings': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/keys': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/rpc-parsed-types': 3.0.1(typescript@5.7.3) + '@solana/rpc-spec': 3.0.1(typescript@5.7.3) + '@solana/rpc-transformers': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/rpc-types': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/transaction-messages': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/transactions': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) typescript: 5.7.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - '@solana/rpc-parsed-types@2.1.0(typescript@5.7.3)': + '@solana/rpc-parsed-types@3.0.1(typescript@5.7.3)': dependencies: typescript: 5.7.3 - '@solana/rpc-spec-types@2.1.0(typescript@5.7.3)': + '@solana/rpc-spec-types@3.0.1(typescript@5.7.3)': dependencies: typescript: 5.7.3 - '@solana/rpc-spec@2.1.0(typescript@5.7.3)': + '@solana/rpc-spec@3.0.1(typescript@5.7.3)': dependencies: - '@solana/errors': 2.1.0(typescript@5.7.3) - '@solana/rpc-spec-types': 2.1.0(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/rpc-spec-types': 3.0.1(typescript@5.7.3) typescript: 5.7.3 - '@solana/rpc-subscriptions-api@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@solana/rpc-subscriptions-api@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': dependencies: - '@solana/addresses': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/keys': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/rpc-subscriptions-spec': 2.1.0(typescript@5.7.3) - '@solana/rpc-transformers': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/rpc-types': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/transaction-messages': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/transactions': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/addresses': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/keys': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/rpc-subscriptions-spec': 3.0.1(typescript@5.7.3) + '@solana/rpc-transformers': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/rpc-types': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/transaction-messages': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/transactions': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) typescript: 5.7.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - '@solana/rpc-subscriptions-channel-websocket@2.1.0(typescript@5.7.3)(ws@8.18.0)': + '@solana/rpc-subscriptions-channel-websocket@3.0.1(typescript@5.7.3)(ws@8.18.0)': dependencies: - '@solana/errors': 2.1.0(typescript@5.7.3) - '@solana/functional': 2.1.0(typescript@5.7.3) - '@solana/rpc-subscriptions-spec': 2.1.0(typescript@5.7.3) - '@solana/subscribable': 2.1.0(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/functional': 3.0.1(typescript@5.7.3) + '@solana/rpc-subscriptions-spec': 3.0.1(typescript@5.7.3) + '@solana/subscribable': 3.0.1(typescript@5.7.3) typescript: 5.7.3 ws: 8.18.0 - '@solana/rpc-subscriptions-spec@2.1.0(typescript@5.7.3)': + '@solana/rpc-subscriptions-spec@3.0.1(typescript@5.7.3)': dependencies: - '@solana/errors': 2.1.0(typescript@5.7.3) - '@solana/promises': 2.1.0(typescript@5.7.3) - '@solana/rpc-spec-types': 2.1.0(typescript@5.7.3) - '@solana/subscribable': 2.1.0(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/promises': 3.0.1(typescript@5.7.3) + '@solana/rpc-spec-types': 3.0.1(typescript@5.7.3) + '@solana/subscribable': 3.0.1(typescript@5.7.3) typescript: 5.7.3 - '@solana/rpc-subscriptions@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0)': - dependencies: - '@solana/errors': 2.1.0(typescript@5.7.3) - '@solana/fast-stable-stringify': 2.1.0(typescript@5.7.3) - '@solana/functional': 2.1.0(typescript@5.7.3) - '@solana/promises': 2.1.0(typescript@5.7.3) - '@solana/rpc-spec-types': 2.1.0(typescript@5.7.3) - '@solana/rpc-subscriptions-api': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/rpc-subscriptions-channel-websocket': 2.1.0(typescript@5.7.3)(ws@8.18.0) - '@solana/rpc-subscriptions-spec': 2.1.0(typescript@5.7.3) - '@solana/rpc-transformers': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/rpc-types': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/subscribable': 2.1.0(typescript@5.7.3) + '@solana/rpc-subscriptions@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0)': + dependencies: + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/fast-stable-stringify': 3.0.1(typescript@5.7.3) + '@solana/functional': 3.0.1(typescript@5.7.3) + '@solana/promises': 3.0.1(typescript@5.7.3) + '@solana/rpc-spec-types': 3.0.1(typescript@5.7.3) + '@solana/rpc-subscriptions-api': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/rpc-subscriptions-channel-websocket': 3.0.1(typescript@5.7.3)(ws@8.18.0) + '@solana/rpc-subscriptions-spec': 3.0.1(typescript@5.7.3) + '@solana/rpc-transformers': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/rpc-types': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/subscribable': 3.0.1(typescript@5.7.3) typescript: 5.7.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - ws - '@solana/rpc-transformers@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@solana/rpc-transformers@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': dependencies: - '@solana/errors': 2.1.0(typescript@5.7.3) - '@solana/functional': 2.1.0(typescript@5.7.3) - '@solana/rpc-spec-types': 2.1.0(typescript@5.7.3) - '@solana/rpc-types': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/functional': 3.0.1(typescript@5.7.3) + '@solana/nominal-types': 3.0.1(typescript@5.7.3) + '@solana/rpc-spec-types': 3.0.1(typescript@5.7.3) + '@solana/rpc-types': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) typescript: 5.7.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - '@solana/rpc-transport-http@2.1.0(typescript@5.7.3)': + '@solana/rpc-transport-http@3.0.1(typescript@5.7.3)': dependencies: - '@solana/errors': 2.1.0(typescript@5.7.3) - '@solana/rpc-spec': 2.1.0(typescript@5.7.3) - '@solana/rpc-spec-types': 2.1.0(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/rpc-spec': 3.0.1(typescript@5.7.3) + '@solana/rpc-spec-types': 3.0.1(typescript@5.7.3) typescript: 5.7.3 - undici-types: 7.4.0 + undici-types: 7.15.0 - '@solana/rpc-types@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@solana/rpc-types@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': dependencies: - '@solana/addresses': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/codecs-numbers': 2.1.0(typescript@5.7.3) - '@solana/codecs-strings': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) + '@solana/addresses': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/codecs-core': 3.0.1(typescript@5.7.3) + '@solana/codecs-numbers': 3.0.1(typescript@5.7.3) + '@solana/codecs-strings': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/nominal-types': 3.0.1(typescript@5.7.3) typescript: 5.7.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - '@solana/rpc@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': - dependencies: - '@solana/errors': 2.1.0(typescript@5.7.3) - '@solana/fast-stable-stringify': 2.1.0(typescript@5.7.3) - '@solana/functional': 2.1.0(typescript@5.7.3) - '@solana/rpc-api': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/rpc-spec': 2.1.0(typescript@5.7.3) - '@solana/rpc-spec-types': 2.1.0(typescript@5.7.3) - '@solana/rpc-transformers': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/rpc-transport-http': 2.1.0(typescript@5.7.3) - '@solana/rpc-types': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/rpc@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + dependencies: + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/fast-stable-stringify': 3.0.1(typescript@5.7.3) + '@solana/functional': 3.0.1(typescript@5.7.3) + '@solana/rpc-api': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/rpc-spec': 3.0.1(typescript@5.7.3) + '@solana/rpc-spec-types': 3.0.1(typescript@5.7.3) + '@solana/rpc-transformers': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/rpc-transport-http': 3.0.1(typescript@5.7.3) + '@solana/rpc-types': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) typescript: 5.7.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - '@solana/signers@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@solana/signers@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': dependencies: - '@solana/addresses': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) - '@solana/instructions': 2.1.0(typescript@5.7.3) - '@solana/keys': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/transaction-messages': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/transactions': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/addresses': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/codecs-core': 3.0.1(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/instructions': 3.0.1(typescript@5.7.3) + '@solana/keys': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/nominal-types': 3.0.1(typescript@5.7.3) + '@solana/transaction-messages': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/transactions': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) typescript: 5.7.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - '@solana/subscribable@2.1.0(typescript@5.7.3)': + '@solana/subscribable@3.0.1(typescript@5.7.3)': dependencies: - '@solana/errors': 2.1.0(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) typescript: 5.7.3 - '@solana/sysvars@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@solana/sysvars@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': dependencies: - '@solana/accounts': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/codecs': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) - '@solana/rpc-types': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/accounts': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/codecs': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/rpc-types': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) typescript: 5.7.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - '@solana/transaction-confirmation@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0)': - dependencies: - '@solana/addresses': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/codecs-strings': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) - '@solana/keys': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/promises': 2.1.0(typescript@5.7.3) - '@solana/rpc': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/rpc-subscriptions': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0) - '@solana/rpc-types': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/transaction-messages': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/transactions': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/transaction-confirmation@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0)': + dependencies: + '@solana/addresses': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/codecs-strings': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/keys': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/promises': 3.0.1(typescript@5.7.3) + '@solana/rpc': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/rpc-subscriptions': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)(ws@8.18.0) + '@solana/rpc-types': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/transaction-messages': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/transactions': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) typescript: 5.7.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - ws - '@solana/transaction-messages@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': - dependencies: - '@solana/addresses': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/codecs-data-structures': 2.1.0(typescript@5.7.3) - '@solana/codecs-numbers': 2.1.0(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) - '@solana/functional': 2.1.0(typescript@5.7.3) - '@solana/instructions': 2.1.0(typescript@5.7.3) - '@solana/rpc-types': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/transaction-messages@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + dependencies: + '@solana/addresses': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/codecs-core': 3.0.1(typescript@5.7.3) + '@solana/codecs-data-structures': 3.0.1(typescript@5.7.3) + '@solana/codecs-numbers': 3.0.1(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/functional': 3.0.1(typescript@5.7.3) + '@solana/instructions': 3.0.1(typescript@5.7.3) + '@solana/nominal-types': 3.0.1(typescript@5.7.3) + '@solana/rpc-types': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) typescript: 5.7.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - '@solana/transactions@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': - dependencies: - '@solana/addresses': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/codecs-data-structures': 2.1.0(typescript@5.7.3) - '@solana/codecs-numbers': 2.1.0(typescript@5.7.3) - '@solana/codecs-strings': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) - '@solana/functional': 2.1.0(typescript@5.7.3) - '@solana/instructions': 2.1.0(typescript@5.7.3) - '@solana/keys': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/rpc-types': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/transaction-messages': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/transactions@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + dependencies: + '@solana/addresses': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/codecs-core': 3.0.1(typescript@5.7.3) + '@solana/codecs-data-structures': 3.0.1(typescript@5.7.3) + '@solana/codecs-numbers': 3.0.1(typescript@5.7.3) + '@solana/codecs-strings': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) + '@solana/functional': 3.0.1(typescript@5.7.3) + '@solana/instructions': 3.0.1(typescript@5.7.3) + '@solana/keys': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/nominal-types': 3.0.1(typescript@5.7.3) + '@solana/rpc-types': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@solana/transaction-messages': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) typescript: 5.7.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder @@ -2594,9 +2644,9 @@ snapshots: '@types/json-schema@7.0.15': {} - '@types/node@22.10.6': + '@types/node@24.3.0': dependencies: - undici-types: 6.20.0 + undici-types: 7.10.0 '@types/pako@2.0.3': {} @@ -2906,6 +2956,8 @@ snapshots: chalk@5.4.1: {} + chalk@5.6.0: {} + chokidar@4.0.3: dependencies: readdirp: 4.1.1 @@ -2941,7 +2993,7 @@ snapshots: commander@13.0.0: {} - commander@13.1.0: {} + commander@14.0.0: {} commander@4.1.1: {} @@ -3510,6 +3562,10 @@ snapshots: dependencies: yocto-queue: 0.1.0 + p-limit@7.1.1: + dependencies: + yocto-queue: 1.2.1 + p-locate@5.0.0: dependencies: p-limit: 3.1.0 @@ -3823,9 +3879,9 @@ snapshots: typescript@5.7.3: {} - undici-types@6.20.0: {} + undici-types@7.10.0: {} - undici-types@7.4.0: {} + undici-types@7.15.0: {} unicorn-magic@0.1.0: {} @@ -3900,3 +3956,5 @@ snapshots: yargs-parser: 21.1.1 yocto-queue@0.1.0: {} + + yocto-queue@1.2.1: {} diff --git a/clients/js/src/cli/commands/close-buffer.ts b/clients/js/src/cli/commands/close-buffer.ts index e4a13c2..4b66449 100644 --- a/clients/js/src/cli/commands/close-buffer.ts +++ b/clients/js/src/cli/commands/close-buffer.ts @@ -1,6 +1,5 @@ -import { Address } from '@solana/kit'; +import { Address, sequentialInstructionPlan } from '@solana/kit'; import { fetchMaybeBuffer, getCloseInstruction } from '../../generated'; -import { sequentialInstructionPlan } from '../../instructionPlans'; import { bufferArgument } from '../arguments'; import { logCommand, logErrorAndExit } from '../logs'; import { GlobalOptions } from '../options'; diff --git a/clients/js/src/cli/commands/close.ts b/clients/js/src/cli/commands/close.ts index 6e5ffa1..4875c3c 100644 --- a/clients/js/src/cli/commands/close.ts +++ b/clients/js/src/cli/commands/close.ts @@ -1,6 +1,5 @@ -import { Address } from '@solana/kit'; +import { Address, sequentialInstructionPlan } from '@solana/kit'; import { getCloseInstruction, Seed } from '../../generated'; -import { sequentialInstructionPlan } from '../../instructionPlans'; import { programArgument, seedArgument } from '../arguments'; import { GlobalOptions, diff --git a/clients/js/src/cli/commands/list-buffers.ts b/clients/js/src/cli/commands/list-buffers.ts index d5a5224..8fb48aa 100644 --- a/clients/js/src/cli/commands/list-buffers.ts +++ b/clients/js/src/cli/commands/list-buffers.ts @@ -1,5 +1,6 @@ import { Address, + Base64EncodedBytes, getAddressEncoder, getBase64Decoder, GetProgramAccountsMemcmpFilter, @@ -74,7 +75,7 @@ function getDiscriminatorFilter(): GetProgramAccountsMemcmpFilter { AccountDiscriminator.Buffer, getAccountDiscriminatorEncoder().encode, getBase64Decoder().decode - ), + ) as Base64EncodedBytes, encoding: 'base64', offset: DISCRIMINATOR_OFFSET, }, @@ -90,7 +91,7 @@ function getAuthorityFilter( authority, getAddressEncoder().encode, getBase64Decoder().decode - ), + ) as Base64EncodedBytes, encoding: 'base64', offset: AUTHORITY_OFFSET, }, diff --git a/clients/js/src/cli/commands/remove-authority.ts b/clients/js/src/cli/commands/remove-authority.ts index d20dbc7..dd99c80 100644 --- a/clients/js/src/cli/commands/remove-authority.ts +++ b/clients/js/src/cli/commands/remove-authority.ts @@ -1,6 +1,5 @@ -import { Address } from '@solana/kit'; +import { Address, sequentialInstructionPlan } from '@solana/kit'; import { getSetAuthorityInstruction, Seed } from '../../generated'; -import { sequentialInstructionPlan } from '../../instructionPlans'; import { getPdaDetails } from '../../internals'; import { programArgument, seedArgument } from '../arguments'; import { GlobalOptions } from '../options'; diff --git a/clients/js/src/cli/commands/set-authority.ts b/clients/js/src/cli/commands/set-authority.ts index b4d011b..06cd432 100644 --- a/clients/js/src/cli/commands/set-authority.ts +++ b/clients/js/src/cli/commands/set-authority.ts @@ -1,6 +1,5 @@ -import { Address } from '@solana/kit'; +import { Address, sequentialInstructionPlan } from '@solana/kit'; import { getSetAuthorityInstruction, Seed } from '../../generated'; -import { sequentialInstructionPlan } from '../../instructionPlans'; import { getPdaDetails } from '../../internals'; import { programArgument, seedArgument } from '../arguments'; import { logCommand } from '../logs'; diff --git a/clients/js/src/cli/commands/set-buffer-authority.ts b/clients/js/src/cli/commands/set-buffer-authority.ts index ad136a6..f380e3e 100644 --- a/clients/js/src/cli/commands/set-buffer-authority.ts +++ b/clients/js/src/cli/commands/set-buffer-authority.ts @@ -1,6 +1,5 @@ -import { Address } from '@solana/kit'; +import { Address, sequentialInstructionPlan } from '@solana/kit'; import { getSetAuthorityInstruction } from '../../generated'; -import { sequentialInstructionPlan } from '../../instructionPlans'; import { bufferArgument } from '../arguments'; import { logCommand } from '../logs'; import { diff --git a/clients/js/src/cli/commands/set-immutable.ts b/clients/js/src/cli/commands/set-immutable.ts index 7dc3585..f77e9d5 100644 --- a/clients/js/src/cli/commands/set-immutable.ts +++ b/clients/js/src/cli/commands/set-immutable.ts @@ -1,6 +1,5 @@ -import { Address } from '@solana/kit'; +import { Address, sequentialInstructionPlan } from '@solana/kit'; import { getSetImmutableInstruction, Seed } from '../../generated'; -import { sequentialInstructionPlan } from '../../instructionPlans'; import { programArgument, seedArgument } from '../arguments'; import { logCommand } from '../logs'; import { diff --git a/clients/js/src/cli/utils.ts b/clients/js/src/cli/utils.ts index b5517bc..4b69c83 100644 --- a/clients/js/src/cli/utils.ts +++ b/clients/js/src/cli/utils.ts @@ -6,14 +6,16 @@ import { Account, Address, address, + BaseTransactionMessage, Commitment, - CompilableTransactionMessage, compileTransaction, createKeyPairSignerFromBytes, createNoopSigner, createSolanaRpc, createSolanaRpcSubscriptions, + getAllSingleTransactionPlans, getTransactionEncoder, + InstructionPlan, MessageSigner, pipe, Rpc, @@ -21,6 +23,10 @@ import { setTransactionMessageLifetimeUsingBlockhash, SolanaRpcApi, SolanaRpcSubscriptionsApi, + TransactionMessageWithFeePayer, + TransactionPlan, + TransactionPlanExecutor, + TransactionPlanner, TransactionSigner, } from '@solana/kit'; import { Command } from 'commander'; @@ -28,16 +34,10 @@ import picocolors from 'picocolors'; import { parse as parseYaml } from 'yaml'; import { Buffer, DataSource, fetchBuffer, Format, Seed } from '../generated'; import { - createDefaultTransactionPlanExecutor, - createDefaultTransactionPlanner, - getAllSingleTransactionPlans, - getSetComputeUnitLimitInstructionIndex, - InstructionPlan, - TransactionPlan, - TransactionPlanExecutor, - TransactionPlanner, -} from '../instructionPlans'; -import { getPdaDetails, PdaDetails } from '../internals'; + createDefaultTransactionPlannerAndExecutor, + getPdaDetails, + PdaDetails, +} from '../internals'; import { decodeData, packDirectData, @@ -85,11 +85,9 @@ export async function getClient(options: GlobalOptions): Promise { options, readonlyClient.configs ); - const planner = createDefaultTransactionPlanner({ - feePayer: payer, + const { planner, executor } = createDefaultTransactionPlannerAndExecutor({ computeUnitPrice: options.priorityFees, - }); - const executor = createDefaultTransactionPlanExecutor({ + payer, rpc: readonlyClient.rpc, rpcSubscriptions: readonlyClient.rpcSubscriptions, parallelChunkSize: 5, @@ -129,8 +127,8 @@ async function exportTransactionPlan( for (let i = 0; i < singleTransactions.length; i++) { const transaction = pipe( singleTransactions[i].message, - (tx) => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, tx), - removeComputeUnitLimitInstruction, + (m) => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, m), + (m) => removeComputeUnitLimitInstruction(m), compileTransaction ); const encodedTransaction = decodeData( @@ -143,7 +141,8 @@ async function exportTransactionPlan( } function removeComputeUnitLimitInstruction< - TTransactionMessage extends CompilableTransactionMessage, + TTransactionMessage extends BaseTransactionMessage & + TransactionMessageWithFeePayer, >(message: TTransactionMessage): TTransactionMessage { const index = getSetComputeUnitLimitInstructionIndex(message); if (index === -1) return message; diff --git a/clients/js/src/createBuffer.ts b/clients/js/src/createBuffer.ts index 46b5718..1a53a74 100644 --- a/clients/js/src/createBuffer.ts +++ b/clients/js/src/createBuffer.ts @@ -3,7 +3,9 @@ import { Account, Address, Lamports, + parallelInstructionPlan, ReadonlyUint8Array, + sequentialInstructionPlan, TransactionSigner, } from '@solana/kit'; import { @@ -14,10 +16,6 @@ import { getWriteInstruction, PROGRAM_METADATA_PROGRAM_ADDRESS, } from './generated'; -import { - parallelInstructionPlan, - sequentialInstructionPlan, -} from './instructionPlans'; import { getAccountSize, getWriteInstructionPlan } from './utils'; export function getCreateBufferInstructionPlan(input: { diff --git a/clients/js/src/createMetadata.ts b/clients/js/src/createMetadata.ts index 489a110..c3fb7da 100644 --- a/clients/js/src/createMetadata.ts +++ b/clients/js/src/createMetadata.ts @@ -2,10 +2,15 @@ import { getTransferSolInstruction } from '@solana-program/system'; import { Account, Address, + GetAccountInfoApi, GetMinimumBalanceForRentExemptionApi, + InstructionPlan, Lamports, + parallelInstructionPlan, ReadonlyUint8Array, Rpc, + sequentialInstructionPlan, + TransactionPlanner, TransactionSigner, } from '@solana/kit'; import { @@ -19,16 +24,9 @@ import { PROGRAM_METADATA_PROGRAM_ADDRESS, } from './generated'; import { - createDefaultTransactionPlanExecutor, - InstructionPlan, - isValidInstructionPlan, - parallelInstructionPlan, - sequentialInstructionPlan, - TransactionPlanner, -} from './instructionPlans'; -import { - getDefaultTransactionPlannerAndExecutor, + createDefaultTransactionPlannerAndExecutor, getPdaDetails, + isValidInstructionPlan, REALLOC_LIMIT, } from './internals'; import { @@ -41,14 +39,15 @@ import { export async function createMetadata( input: MetadataInput & { - rpc: Rpc & - Parameters[0]['rpc']; + rpc: Rpc & + Parameters[0]['rpc']; rpcSubscriptions: Parameters< - typeof createDefaultTransactionPlanExecutor + typeof createDefaultTransactionPlannerAndExecutor >[0]['rpcSubscriptions']; } ): Promise { - const { planner, executor } = getDefaultTransactionPlannerAndExecutor(input); + const { planner, executor } = + createDefaultTransactionPlannerAndExecutor(input); const [{ programData, isCanonical, metadata }, buffer] = await Promise.all([ getPdaDetails(input), input.buffer diff --git a/clients/js/src/generated/instructions/allocate.ts b/clients/js/src/generated/instructions/allocate.ts index b5e6182..9e13b99 100644 --- a/clients/js/src/generated/instructions/allocate.ts +++ b/clients/js/src/generated/instructions/allocate.ts @@ -16,19 +16,20 @@ import { getU8Encoder, none, transformEncoder, + type AccountMeta, + type AccountSignerMeta, type Address, - type Codec, - type Decoder, - type Encoder, - type IAccountMeta, - type IAccountSignerMeta, - type IInstruction, - type IInstructionWithAccounts, - type IInstructionWithData, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, type Option, type OptionOrNullable, type ReadonlyAccount, type ReadonlySignerAccount, + type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, } from '@solana/kit'; @@ -49,24 +50,24 @@ export function getAllocateDiscriminatorBytes() { export type AllocateInstruction< TProgram extends string = typeof PROGRAM_METADATA_PROGRAM_ADDRESS, - TAccountBuffer extends string | IAccountMeta = string, - TAccountAuthority extends string | IAccountMeta = string, - TAccountProgram extends string | IAccountMeta = string, - TAccountProgramData extends string | IAccountMeta = string, + TAccountBuffer extends string | AccountMeta = string, + TAccountAuthority extends string | AccountMeta = string, + TAccountProgram extends string | AccountMeta = string, + TAccountProgramData extends string | AccountMeta = string, TAccountSystem extends | string - | IAccountMeta = '11111111111111111111111111111111', - TRemainingAccounts extends readonly IAccountMeta[] = [], -> = IInstruction & - IInstructionWithData & - IInstructionWithAccounts< + | AccountMeta = '11111111111111111111111111111111', + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< [ TAccountBuffer extends string ? WritableAccount : TAccountBuffer, TAccountAuthority extends string ? ReadonlySignerAccount & - IAccountSignerMeta + AccountSignerMeta : TAccountAuthority, TAccountProgram extends string ? ReadonlyAccount @@ -92,7 +93,7 @@ export type AllocateInstructionDataArgs = { seed?: OptionOrNullable; }; -export function getAllocateInstructionDataEncoder(): Encoder { +export function getAllocateInstructionDataEncoder(): FixedSizeEncoder { return transformEncoder( getStructEncoder([ ['discriminator', getU8Encoder()], @@ -106,14 +107,14 @@ export function getAllocateInstructionDataEncoder(): Encoder { +export function getAllocateInstructionDataDecoder(): FixedSizeDecoder { return getStructDecoder([ ['discriminator', getU8Decoder()], ['seed', getOptionDecoder(getSeedDecoder(), { prefix: null })], ]); } -export function getAllocateInstructionDataCodec(): Codec< +export function getAllocateInstructionDataCodec(): FixedSizeCodec< AllocateInstructionDataArgs, AllocateInstructionData > { @@ -220,7 +221,7 @@ export function getAllocateInstruction< export type ParsedAllocateInstruction< TProgram extends string = typeof PROGRAM_METADATA_PROGRAM_ADDRESS, - TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], > = { programAddress: Address; accounts: { @@ -240,11 +241,11 @@ export type ParsedAllocateInstruction< export function parseAllocateInstruction< TProgram extends string, - TAccountMetas extends readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[], >( - instruction: IInstruction & - IInstructionWithAccounts & - IInstructionWithData + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData ): ParsedAllocateInstruction { if (instruction.accounts.length < 5) { // TODO: Coded error. @@ -252,7 +253,7 @@ export function parseAllocateInstruction< } let accountIndex = 0; const getNextAccount = () => { - const accountMeta = instruction.accounts![accountIndex]!; + const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!; accountIndex += 1; return accountMeta; }; diff --git a/clients/js/src/generated/instructions/close.ts b/clients/js/src/generated/instructions/close.ts index 853a96c..e3e755d 100644 --- a/clients/js/src/generated/instructions/close.ts +++ b/clients/js/src/generated/instructions/close.ts @@ -13,17 +13,18 @@ import { getU8Decoder, getU8Encoder, transformEncoder, + type AccountMeta, + type AccountSignerMeta, type Address, - type Codec, - type Decoder, - type Encoder, - type IAccountMeta, - type IAccountSignerMeta, - type IInstruction, - type IInstructionWithAccounts, - type IInstructionWithData, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, type ReadonlyAccount, type ReadonlySignerAccount, + type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, } from '@solana/kit'; @@ -38,22 +39,22 @@ export function getCloseDiscriminatorBytes() { export type CloseInstruction< TProgram extends string = typeof PROGRAM_METADATA_PROGRAM_ADDRESS, - TAccountAccount extends string | IAccountMeta = string, - TAccountAuthority extends string | IAccountMeta = string, - TAccountProgram extends string | IAccountMeta = string, - TAccountProgramData extends string | IAccountMeta = string, - TAccountDestination extends string | IAccountMeta = string, - TRemainingAccounts extends readonly IAccountMeta[] = [], -> = IInstruction & - IInstructionWithData & - IInstructionWithAccounts< + TAccountAccount extends string | AccountMeta = string, + TAccountAuthority extends string | AccountMeta = string, + TAccountProgram extends string | AccountMeta = string, + TAccountProgramData extends string | AccountMeta = string, + TAccountDestination extends string | AccountMeta = string, + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< [ TAccountAccount extends string ? WritableAccount : TAccountAccount, TAccountAuthority extends string ? ReadonlySignerAccount & - IAccountSignerMeta + AccountSignerMeta : TAccountAuthority, TAccountProgram extends string ? ReadonlyAccount @@ -72,18 +73,18 @@ export type CloseInstructionData = { discriminator: number }; export type CloseInstructionDataArgs = {}; -export function getCloseInstructionDataEncoder(): Encoder { +export function getCloseInstructionDataEncoder(): FixedSizeEncoder { return transformEncoder( getStructEncoder([['discriminator', getU8Encoder()]]), (value) => ({ ...value, discriminator: CLOSE_DISCRIMINATOR }) ); } -export function getCloseInstructionDataDecoder(): Decoder { +export function getCloseInstructionDataDecoder(): FixedSizeDecoder { return getStructDecoder([['discriminator', getU8Decoder()]]); } -export function getCloseInstructionDataCodec(): Codec< +export function getCloseInstructionDataCodec(): FixedSizeCodec< CloseInstructionDataArgs, CloseInstructionData > { @@ -178,7 +179,7 @@ export function getCloseInstruction< export type ParsedCloseInstruction< TProgram extends string = typeof PROGRAM_METADATA_PROGRAM_ADDRESS, - TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], > = { programAddress: Address; accounts: { @@ -198,11 +199,11 @@ export type ParsedCloseInstruction< export function parseCloseInstruction< TProgram extends string, - TAccountMetas extends readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[], >( - instruction: IInstruction & - IInstructionWithAccounts & - IInstructionWithData + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData ): ParsedCloseInstruction { if (instruction.accounts.length < 5) { // TODO: Coded error. @@ -210,7 +211,7 @@ export function parseCloseInstruction< } let accountIndex = 0; const getNextAccount = () => { - const accountMeta = instruction.accounts![accountIndex]!; + const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!; accountIndex += 1; return accountMeta; }; diff --git a/clients/js/src/generated/instructions/extend.ts b/clients/js/src/generated/instructions/extend.ts index 1cbbc6c..89008bc 100644 --- a/clients/js/src/generated/instructions/extend.ts +++ b/clients/js/src/generated/instructions/extend.ts @@ -15,17 +15,18 @@ import { getU8Decoder, getU8Encoder, transformEncoder, + type AccountMeta, + type AccountSignerMeta, type Address, - type Codec, - type Decoder, - type Encoder, - type IAccountMeta, - type IAccountSignerMeta, - type IInstruction, - type IInstructionWithAccounts, - type IInstructionWithData, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, type ReadonlyAccount, type ReadonlySignerAccount, + type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, } from '@solana/kit'; @@ -40,21 +41,21 @@ export function getExtendDiscriminatorBytes() { export type ExtendInstruction< TProgram extends string = typeof PROGRAM_METADATA_PROGRAM_ADDRESS, - TAccountAccount extends string | IAccountMeta = string, - TAccountAuthority extends string | IAccountMeta = string, - TAccountProgram extends string | IAccountMeta = string, - TAccountProgramData extends string | IAccountMeta = string, - TRemainingAccounts extends readonly IAccountMeta[] = [], -> = IInstruction & - IInstructionWithData & - IInstructionWithAccounts< + TAccountAccount extends string | AccountMeta = string, + TAccountAuthority extends string | AccountMeta = string, + TAccountProgram extends string | AccountMeta = string, + TAccountProgramData extends string | AccountMeta = string, + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< [ TAccountAccount extends string ? WritableAccount : TAccountAccount, TAccountAuthority extends string ? ReadonlySignerAccount & - IAccountSignerMeta + AccountSignerMeta : TAccountAuthority, TAccountProgram extends string ? ReadonlyAccount @@ -77,7 +78,7 @@ export type ExtendInstructionDataArgs = { length: number; }; -export function getExtendInstructionDataEncoder(): Encoder { +export function getExtendInstructionDataEncoder(): FixedSizeEncoder { return transformEncoder( getStructEncoder([ ['discriminator', getU8Encoder()], @@ -87,14 +88,14 @@ export function getExtendInstructionDataEncoder(): Encoder { +export function getExtendInstructionDataDecoder(): FixedSizeDecoder { return getStructDecoder([ ['discriminator', getU8Decoder()], ['length', getU16Decoder()], ]); } -export function getExtendInstructionDataCodec(): Codec< +export function getExtendInstructionDataCodec(): FixedSizeCodec< ExtendInstructionDataArgs, ExtendInstructionData > { @@ -186,7 +187,7 @@ export function getExtendInstruction< export type ParsedExtendInstruction< TProgram extends string = typeof PROGRAM_METADATA_PROGRAM_ADDRESS, - TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], > = { programAddress: Address; accounts: { @@ -204,11 +205,11 @@ export type ParsedExtendInstruction< export function parseExtendInstruction< TProgram extends string, - TAccountMetas extends readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[], >( - instruction: IInstruction & - IInstructionWithAccounts & - IInstructionWithData + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData ): ParsedExtendInstruction { if (instruction.accounts.length < 4) { // TODO: Coded error. @@ -216,7 +217,7 @@ export function parseExtendInstruction< } let accountIndex = 0; const getNextAccount = () => { - const accountMeta = instruction.accounts![accountIndex]!; + const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!; accountIndex += 1; return accountMeta; }; diff --git a/clients/js/src/generated/instructions/initialize.ts b/clients/js/src/generated/instructions/initialize.ts index dd63358..4ea382d 100644 --- a/clients/js/src/generated/instructions/initialize.ts +++ b/clients/js/src/generated/instructions/initialize.ts @@ -18,15 +18,15 @@ import { getU8Encoder, none, transformEncoder, + type AccountMeta, + type AccountSignerMeta, type Address, type Codec, type Decoder, type Encoder, - type IAccountMeta, - type IAccountSignerMeta, - type IInstruction, - type IInstructionWithAccounts, - type IInstructionWithData, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, type Option, type OptionOrNullable, type ReadonlyAccount, @@ -74,24 +74,24 @@ export function getInitializeDiscriminatorBytes() { export type InitializeInstruction< TProgram extends string = typeof PROGRAM_METADATA_PROGRAM_ADDRESS, - TAccountMetadata extends string | IAccountMeta = string, - TAccountAuthority extends string | IAccountMeta = string, - TAccountProgram extends string | IAccountMeta = string, - TAccountProgramData extends string | IAccountMeta = string, + TAccountMetadata extends string | AccountMeta = string, + TAccountAuthority extends string | AccountMeta = string, + TAccountProgram extends string | AccountMeta = string, + TAccountProgramData extends string | AccountMeta = string, TAccountSystem extends | string - | IAccountMeta = '11111111111111111111111111111111', - TRemainingAccounts extends readonly IAccountMeta[] = [], -> = IInstruction & - IInstructionWithData & - IInstructionWithAccounts< + | AccountMeta = '11111111111111111111111111111111', + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< [ TAccountMetadata extends string ? WritableAccount : TAccountMetadata, TAccountAuthority extends string ? ReadonlySignerAccount & - IAccountSignerMeta + AccountSignerMeta : TAccountAuthority, TAccountProgram extends string ? ReadonlyAccount @@ -384,7 +384,7 @@ export function getInitializeInstruction< export type ParsedInitializeInstruction< TProgram extends string = typeof PROGRAM_METADATA_PROGRAM_ADDRESS, - TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], > = { programAddress: Address; accounts: { @@ -404,11 +404,11 @@ export type ParsedInitializeInstruction< export function parseInitializeInstruction< TProgram extends string, - TAccountMetas extends readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[], >( - instruction: IInstruction & - IInstructionWithAccounts & - IInstructionWithData + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData ): ParsedInitializeInstruction { if (instruction.accounts.length < 5) { // TODO: Coded error. @@ -416,7 +416,7 @@ export function parseInitializeInstruction< } let accountIndex = 0; const getNextAccount = () => { - const accountMeta = instruction.accounts![accountIndex]!; + const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!; accountIndex += 1; return accountMeta; }; diff --git a/clients/js/src/generated/instructions/setAuthority.ts b/clients/js/src/generated/instructions/setAuthority.ts index 9b9b902..dc4b7ad 100644 --- a/clients/js/src/generated/instructions/setAuthority.ts +++ b/clients/js/src/generated/instructions/setAuthority.ts @@ -17,19 +17,20 @@ import { getU8Decoder, getU8Encoder, transformEncoder, + type AccountMeta, + type AccountSignerMeta, type Address, type Codec, type Decoder, type Encoder, - type IAccountMeta, - type IAccountSignerMeta, - type IInstruction, - type IInstructionWithAccounts, - type IInstructionWithData, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, type Option, type OptionOrNullable, type ReadonlyAccount, type ReadonlySignerAccount, + type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, } from '@solana/kit'; @@ -44,21 +45,21 @@ export function getSetAuthorityDiscriminatorBytes() { export type SetAuthorityInstruction< TProgram extends string = typeof PROGRAM_METADATA_PROGRAM_ADDRESS, - TAccountAccount extends string | IAccountMeta = string, - TAccountAuthority extends string | IAccountMeta = string, - TAccountProgram extends string | IAccountMeta = string, - TAccountProgramData extends string | IAccountMeta = string, - TRemainingAccounts extends readonly IAccountMeta[] = [], -> = IInstruction & - IInstructionWithData & - IInstructionWithAccounts< + TAccountAccount extends string | AccountMeta = string, + TAccountAuthority extends string | AccountMeta = string, + TAccountProgram extends string | AccountMeta = string, + TAccountProgramData extends string | AccountMeta = string, + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< [ TAccountAccount extends string ? WritableAccount : TAccountAccount, TAccountAuthority extends string ? ReadonlySignerAccount & - IAccountSignerMeta + AccountSignerMeta : TAccountAuthority, TAccountProgram extends string ? ReadonlyAccount @@ -188,7 +189,7 @@ export function getSetAuthorityInstruction< export type ParsedSetAuthorityInstruction< TProgram extends string = typeof PROGRAM_METADATA_PROGRAM_ADDRESS, - TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], > = { programAddress: Address; accounts: { @@ -206,11 +207,11 @@ export type ParsedSetAuthorityInstruction< export function parseSetAuthorityInstruction< TProgram extends string, - TAccountMetas extends readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[], >( - instruction: IInstruction & - IInstructionWithAccounts & - IInstructionWithData + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData ): ParsedSetAuthorityInstruction { if (instruction.accounts.length < 4) { // TODO: Coded error. @@ -218,7 +219,7 @@ export function parseSetAuthorityInstruction< } let accountIndex = 0; const getNextAccount = () => { - const accountMeta = instruction.accounts![accountIndex]!; + const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!; accountIndex += 1; return accountMeta; }; diff --git a/clients/js/src/generated/instructions/setData.ts b/clients/js/src/generated/instructions/setData.ts index 214334d..2448ad5 100644 --- a/clients/js/src/generated/instructions/setData.ts +++ b/clients/js/src/generated/instructions/setData.ts @@ -18,15 +18,15 @@ import { getU8Encoder, none, transformEncoder, + type AccountMeta, + type AccountSignerMeta, type Address, type Codec, type Decoder, type Encoder, - type IAccountMeta, - type IAccountSignerMeta, - type IInstruction, - type IInstructionWithAccounts, - type IInstructionWithData, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, type Option, type OptionOrNullable, type ReadonlyAccount, @@ -64,22 +64,22 @@ export function getSetDataDiscriminatorBytes() { export type SetDataInstruction< TProgram extends string = typeof PROGRAM_METADATA_PROGRAM_ADDRESS, - TAccountMetadata extends string | IAccountMeta = string, - TAccountAuthority extends string | IAccountMeta = string, - TAccountBuffer extends string | IAccountMeta = string, - TAccountProgram extends string | IAccountMeta = string, - TAccountProgramData extends string | IAccountMeta = string, - TRemainingAccounts extends readonly IAccountMeta[] = [], -> = IInstruction & - IInstructionWithData & - IInstructionWithAccounts< + TAccountMetadata extends string | AccountMeta = string, + TAccountAuthority extends string | AccountMeta = string, + TAccountBuffer extends string | AccountMeta = string, + TAccountProgram extends string | AccountMeta = string, + TAccountProgramData extends string | AccountMeta = string, + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< [ TAccountMetadata extends string ? WritableAccount : TAccountMetadata, TAccountAuthority extends string ? ReadonlySignerAccount & - IAccountSignerMeta + AccountSignerMeta : TAccountAuthority, TAccountBuffer extends string ? WritableAccount @@ -245,7 +245,7 @@ export function getSetDataInstruction< export type ParsedSetDataInstruction< TProgram extends string = typeof PROGRAM_METADATA_PROGRAM_ADDRESS, - TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], > = { programAddress: Address; accounts: { @@ -265,11 +265,11 @@ export type ParsedSetDataInstruction< export function parseSetDataInstruction< TProgram extends string, - TAccountMetas extends readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[], >( - instruction: IInstruction & - IInstructionWithAccounts & - IInstructionWithData + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData ): ParsedSetDataInstruction { if (instruction.accounts.length < 5) { // TODO: Coded error. @@ -277,7 +277,7 @@ export function parseSetDataInstruction< } let accountIndex = 0; const getNextAccount = () => { - const accountMeta = instruction.accounts![accountIndex]!; + const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!; accountIndex += 1; return accountMeta; }; diff --git a/clients/js/src/generated/instructions/setImmutable.ts b/clients/js/src/generated/instructions/setImmutable.ts index d39088a..809943e 100644 --- a/clients/js/src/generated/instructions/setImmutable.ts +++ b/clients/js/src/generated/instructions/setImmutable.ts @@ -13,17 +13,18 @@ import { getU8Decoder, getU8Encoder, transformEncoder, + type AccountMeta, + type AccountSignerMeta, type Address, - type Codec, - type Decoder, - type Encoder, - type IAccountMeta, - type IAccountSignerMeta, - type IInstruction, - type IInstructionWithAccounts, - type IInstructionWithData, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, type ReadonlyAccount, type ReadonlySignerAccount, + type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, } from '@solana/kit'; @@ -38,21 +39,21 @@ export function getSetImmutableDiscriminatorBytes() { export type SetImmutableInstruction< TProgram extends string = typeof PROGRAM_METADATA_PROGRAM_ADDRESS, - TAccountMetadata extends string | IAccountMeta = string, - TAccountAuthority extends string | IAccountMeta = string, - TAccountProgram extends string | IAccountMeta = string, - TAccountProgramData extends string | IAccountMeta = string, - TRemainingAccounts extends readonly IAccountMeta[] = [], -> = IInstruction & - IInstructionWithData & - IInstructionWithAccounts< + TAccountMetadata extends string | AccountMeta = string, + TAccountAuthority extends string | AccountMeta = string, + TAccountProgram extends string | AccountMeta = string, + TAccountProgramData extends string | AccountMeta = string, + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< [ TAccountMetadata extends string ? WritableAccount : TAccountMetadata, TAccountAuthority extends string ? ReadonlySignerAccount & - IAccountSignerMeta + AccountSignerMeta : TAccountAuthority, TAccountProgram extends string ? ReadonlyAccount @@ -68,18 +69,18 @@ export type SetImmutableInstructionData = { discriminator: number }; export type SetImmutableInstructionDataArgs = {}; -export function getSetImmutableInstructionDataEncoder(): Encoder { +export function getSetImmutableInstructionDataEncoder(): FixedSizeEncoder { return transformEncoder( getStructEncoder([['discriminator', getU8Encoder()]]), (value) => ({ ...value, discriminator: SET_IMMUTABLE_DISCRIMINATOR }) ); } -export function getSetImmutableInstructionDataDecoder(): Decoder { +export function getSetImmutableInstructionDataDecoder(): FixedSizeDecoder { return getStructDecoder([['discriminator', getU8Decoder()]]); } -export function getSetImmutableInstructionDataCodec(): Codec< +export function getSetImmutableInstructionDataCodec(): FixedSizeCodec< SetImmutableInstructionDataArgs, SetImmutableInstructionData > { @@ -165,7 +166,7 @@ export function getSetImmutableInstruction< export type ParsedSetImmutableInstruction< TProgram extends string = typeof PROGRAM_METADATA_PROGRAM_ADDRESS, - TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], > = { programAddress: Address; accounts: { @@ -183,11 +184,11 @@ export type ParsedSetImmutableInstruction< export function parseSetImmutableInstruction< TProgram extends string, - TAccountMetas extends readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[], >( - instruction: IInstruction & - IInstructionWithAccounts & - IInstructionWithData + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData ): ParsedSetImmutableInstruction { if (instruction.accounts.length < 4) { // TODO: Coded error. @@ -195,7 +196,7 @@ export function parseSetImmutableInstruction< } let accountIndex = 0; const getNextAccount = () => { - const accountMeta = instruction.accounts![accountIndex]!; + const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!; accountIndex += 1; return accountMeta; }; diff --git a/clients/js/src/generated/instructions/trim.ts b/clients/js/src/generated/instructions/trim.ts index 15cfa54..d39d41b 100644 --- a/clients/js/src/generated/instructions/trim.ts +++ b/clients/js/src/generated/instructions/trim.ts @@ -13,17 +13,18 @@ import { getU8Decoder, getU8Encoder, transformEncoder, + type AccountMeta, + type AccountSignerMeta, type Address, - type Codec, - type Decoder, - type Encoder, - type IAccountMeta, - type IAccountSignerMeta, - type IInstruction, - type IInstructionWithAccounts, - type IInstructionWithData, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, type ReadonlyAccount, type ReadonlySignerAccount, + type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, } from '@solana/kit'; @@ -38,25 +39,25 @@ export function getTrimDiscriminatorBytes() { export type TrimInstruction< TProgram extends string = typeof PROGRAM_METADATA_PROGRAM_ADDRESS, - TAccountAccount extends string | IAccountMeta = string, - TAccountAuthority extends string | IAccountMeta = string, - TAccountProgram extends string | IAccountMeta = string, - TAccountProgramData extends string | IAccountMeta = string, - TAccountDestination extends string | IAccountMeta = string, + TAccountAccount extends string | AccountMeta = string, + TAccountAuthority extends string | AccountMeta = string, + TAccountProgram extends string | AccountMeta = string, + TAccountProgramData extends string | AccountMeta = string, + TAccountDestination extends string | AccountMeta = string, TAccountRent extends | string - | IAccountMeta = 'SysvarRent111111111111111111111111111111111', - TRemainingAccounts extends readonly IAccountMeta[] = [], -> = IInstruction & - IInstructionWithData & - IInstructionWithAccounts< + | AccountMeta = 'SysvarRent111111111111111111111111111111111', + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< [ TAccountAccount extends string ? WritableAccount : TAccountAccount, TAccountAuthority extends string ? ReadonlySignerAccount & - IAccountSignerMeta + AccountSignerMeta : TAccountAuthority, TAccountProgram extends string ? ReadonlyAccount @@ -78,18 +79,18 @@ export type TrimInstructionData = { discriminator: number }; export type TrimInstructionDataArgs = {}; -export function getTrimInstructionDataEncoder(): Encoder { +export function getTrimInstructionDataEncoder(): FixedSizeEncoder { return transformEncoder( getStructEncoder([['discriminator', getU8Encoder()]]), (value) => ({ ...value, discriminator: TRIM_DISCRIMINATOR }) ); } -export function getTrimInstructionDataDecoder(): Decoder { +export function getTrimInstructionDataDecoder(): FixedSizeDecoder { return getStructDecoder([['discriminator', getU8Decoder()]]); } -export function getTrimInstructionDataCodec(): Codec< +export function getTrimInstructionDataCodec(): FixedSizeCodec< TrimInstructionDataArgs, TrimInstructionData > { @@ -199,7 +200,7 @@ export function getTrimInstruction< export type ParsedTrimInstruction< TProgram extends string = typeof PROGRAM_METADATA_PROGRAM_ADDRESS, - TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], > = { programAddress: Address; accounts: { @@ -221,11 +222,11 @@ export type ParsedTrimInstruction< export function parseTrimInstruction< TProgram extends string, - TAccountMetas extends readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[], >( - instruction: IInstruction & - IInstructionWithAccounts & - IInstructionWithData + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData ): ParsedTrimInstruction { if (instruction.accounts.length < 6) { // TODO: Coded error. @@ -233,7 +234,7 @@ export function parseTrimInstruction< } let accountIndex = 0; const getNextAccount = () => { - const accountMeta = instruction.accounts![accountIndex]!; + const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!; accountIndex += 1; return accountMeta; }; diff --git a/clients/js/src/generated/instructions/write.ts b/clients/js/src/generated/instructions/write.ts index 8ab73af..20a599a 100644 --- a/clients/js/src/generated/instructions/write.ts +++ b/clients/js/src/generated/instructions/write.ts @@ -20,15 +20,15 @@ import { getU8Encoder, none, transformEncoder, + type AccountMeta, + type AccountSignerMeta, type Address, type Codec, type Decoder, type Encoder, - type IAccountMeta, - type IAccountSignerMeta, - type IInstruction, - type IInstructionWithAccounts, - type IInstructionWithData, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, type Option, type OptionOrNullable, type ReadonlyAccount, @@ -48,20 +48,20 @@ export function getWriteDiscriminatorBytes() { export type WriteInstruction< TProgram extends string = typeof PROGRAM_METADATA_PROGRAM_ADDRESS, - TAccountBuffer extends string | IAccountMeta = string, - TAccountAuthority extends string | IAccountMeta = string, - TAccountSourceBuffer extends string | IAccountMeta = string, - TRemainingAccounts extends readonly IAccountMeta[] = [], -> = IInstruction & - IInstructionWithData & - IInstructionWithAccounts< + TAccountBuffer extends string | AccountMeta = string, + TAccountAuthority extends string | AccountMeta = string, + TAccountSourceBuffer extends string | AccountMeta = string, + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< [ TAccountBuffer extends string ? WritableAccount : TAccountBuffer, TAccountAuthority extends string ? ReadonlySignerAccount & - IAccountSignerMeta + AccountSignerMeta : TAccountAuthority, TAccountSourceBuffer extends string ? ReadonlyAccount @@ -197,7 +197,7 @@ export function getWriteInstruction< export type ParsedWriteInstruction< TProgram extends string = typeof PROGRAM_METADATA_PROGRAM_ADDRESS, - TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], > = { programAddress: Address; accounts: { @@ -217,11 +217,11 @@ export type ParsedWriteInstruction< export function parseWriteInstruction< TProgram extends string, - TAccountMetas extends readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[], >( - instruction: IInstruction & - IInstructionWithAccounts & - IInstructionWithData + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData ): ParsedWriteInstruction { if (instruction.accounts.length < 3) { // TODO: Coded error. @@ -229,7 +229,7 @@ export function parseWriteInstruction< } let accountIndex = 0; const getNextAccount = () => { - const accountMeta = instruction.accounts![accountIndex]!; + const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!; accountIndex += 1; return accountMeta; }; diff --git a/clients/js/src/generated/pdas/canonical.ts b/clients/js/src/generated/pdas/canonical.ts index 23b06be..af4ac02 100644 --- a/clients/js/src/generated/pdas/canonical.ts +++ b/clients/js/src/generated/pdas/canonical.ts @@ -21,6 +21,7 @@ export type CanonicalSeeds = { seed: SeedArgs; }; +/** The canonical derivation for metadata accounts managed by the program authority itself. */ export async function findCanonicalPda( seeds: CanonicalSeeds, config: { programAddress?: Address | undefined } = {} diff --git a/clients/js/src/generated/pdas/metadata.ts b/clients/js/src/generated/pdas/metadata.ts index ea3f882..5c186fc 100644 --- a/clients/js/src/generated/pdas/metadata.ts +++ b/clients/js/src/generated/pdas/metadata.ts @@ -25,6 +25,7 @@ export type MetadataSeeds = { seed: SeedArgs; }; +/** The derivation for metadata accounts, canonical or not, depending if an authority is provided. */ export async function findMetadataPda( seeds: MetadataSeeds, config: { programAddress?: Address | undefined } = {} diff --git a/clients/js/src/generated/pdas/nonCanonical.ts b/clients/js/src/generated/pdas/nonCanonical.ts index af49b63..cba4486 100644 --- a/clients/js/src/generated/pdas/nonCanonical.ts +++ b/clients/js/src/generated/pdas/nonCanonical.ts @@ -23,6 +23,7 @@ export type NonCanonicalSeeds = { seed: SeedArgs; }; +/** The derivation for metadata accounts managed by third-party authorities. */ export async function findNonCanonicalPda( seeds: NonCanonicalSeeds, config: { programAddress?: Address | undefined } = {} diff --git a/clients/js/src/generated/shared/index.ts b/clients/js/src/generated/shared/index.ts index 7ba9053..8841a27 100644 --- a/clients/js/src/generated/shared/index.ts +++ b/clients/js/src/generated/shared/index.ts @@ -10,9 +10,9 @@ import { AccountRole, isProgramDerivedAddress, isTransactionSigner as kitIsTransactionSigner, + type AccountMeta, + type AccountSignerMeta, type Address, - type IAccountMeta, - type IAccountSignerMeta, type ProgramDerivedAddress, type TransactionSigner, upgradeRoleToSigner, @@ -23,7 +23,7 @@ import { * @internal */ export function expectSome(value: T | null | undefined): T { - if (value == null) { + if (value === null || value === undefined) { throw new Error('Expected a value but received null or undefined.'); } return value; @@ -48,7 +48,7 @@ export function expectAddress( return value.address; } if (Array.isArray(value)) { - return value[0]; + return value[0] as Address; } return value as Address; } @@ -113,7 +113,7 @@ export type ResolvedAccount< * Defines an instruction that stores additional bytes on-chain. * @internal */ -export type IInstructionWithByteDelta = { +export type InstructionWithByteDelta = { byteDelta: number; }; @@ -127,7 +127,7 @@ export function getAccountMetaFactory( ) { return ( account: ResolvedAccount - ): IAccountMeta | IAccountSignerMeta | undefined => { + ): AccountMeta | AccountSignerMeta | undefined => { if (!account.value) { if (optionalAccountStrategy === 'omitted') return; return Object.freeze({ diff --git a/clients/js/src/generated/types/accountDiscriminator.ts b/clients/js/src/generated/types/accountDiscriminator.ts index d70bfdd..ce942fa 100644 --- a/clients/js/src/generated/types/accountDiscriminator.ts +++ b/clients/js/src/generated/types/accountDiscriminator.ts @@ -10,9 +10,9 @@ import { combineCodec, getEnumDecoder, getEnumEncoder, - type Codec, - type Decoder, - type Encoder, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, } from '@solana/kit'; export enum AccountDiscriminator { @@ -23,15 +23,15 @@ export enum AccountDiscriminator { export type AccountDiscriminatorArgs = AccountDiscriminator; -export function getAccountDiscriminatorEncoder(): Encoder { +export function getAccountDiscriminatorEncoder(): FixedSizeEncoder { return getEnumEncoder(AccountDiscriminator); } -export function getAccountDiscriminatorDecoder(): Decoder { +export function getAccountDiscriminatorDecoder(): FixedSizeDecoder { return getEnumDecoder(AccountDiscriminator); } -export function getAccountDiscriminatorCodec(): Codec< +export function getAccountDiscriminatorCodec(): FixedSizeCodec< AccountDiscriminatorArgs, AccountDiscriminator > { diff --git a/clients/js/src/generated/types/compression.ts b/clients/js/src/generated/types/compression.ts index 3cf0260..877a4f6 100644 --- a/clients/js/src/generated/types/compression.ts +++ b/clients/js/src/generated/types/compression.ts @@ -10,9 +10,9 @@ import { combineCodec, getEnumDecoder, getEnumEncoder, - type Codec, - type Decoder, - type Encoder, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, } from '@solana/kit'; export enum Compression { @@ -23,14 +23,17 @@ export enum Compression { export type CompressionArgs = Compression; -export function getCompressionEncoder(): Encoder { +export function getCompressionEncoder(): FixedSizeEncoder { return getEnumEncoder(Compression); } -export function getCompressionDecoder(): Decoder { +export function getCompressionDecoder(): FixedSizeDecoder { return getEnumDecoder(Compression); } -export function getCompressionCodec(): Codec { +export function getCompressionCodec(): FixedSizeCodec< + CompressionArgs, + Compression +> { return combineCodec(getCompressionEncoder(), getCompressionDecoder()); } diff --git a/clients/js/src/generated/types/dataSource.ts b/clients/js/src/generated/types/dataSource.ts index cc98c9b..12c45de 100644 --- a/clients/js/src/generated/types/dataSource.ts +++ b/clients/js/src/generated/types/dataSource.ts @@ -10,9 +10,9 @@ import { combineCodec, getEnumDecoder, getEnumEncoder, - type Codec, - type Decoder, - type Encoder, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, } from '@solana/kit'; export enum DataSource { @@ -23,14 +23,17 @@ export enum DataSource { export type DataSourceArgs = DataSource; -export function getDataSourceEncoder(): Encoder { +export function getDataSourceEncoder(): FixedSizeEncoder { return getEnumEncoder(DataSource); } -export function getDataSourceDecoder(): Decoder { +export function getDataSourceDecoder(): FixedSizeDecoder { return getEnumDecoder(DataSource); } -export function getDataSourceCodec(): Codec { +export function getDataSourceCodec(): FixedSizeCodec< + DataSourceArgs, + DataSource +> { return combineCodec(getDataSourceEncoder(), getDataSourceDecoder()); } diff --git a/clients/js/src/generated/types/encoding.ts b/clients/js/src/generated/types/encoding.ts index 2b12a8c..39e7780 100644 --- a/clients/js/src/generated/types/encoding.ts +++ b/clients/js/src/generated/types/encoding.ts @@ -10,9 +10,9 @@ import { combineCodec, getEnumDecoder, getEnumEncoder, - type Codec, - type Decoder, - type Encoder, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, } from '@solana/kit'; export enum Encoding { @@ -24,14 +24,14 @@ export enum Encoding { export type EncodingArgs = Encoding; -export function getEncodingEncoder(): Encoder { +export function getEncodingEncoder(): FixedSizeEncoder { return getEnumEncoder(Encoding); } -export function getEncodingDecoder(): Decoder { +export function getEncodingDecoder(): FixedSizeDecoder { return getEnumDecoder(Encoding); } -export function getEncodingCodec(): Codec { +export function getEncodingCodec(): FixedSizeCodec { return combineCodec(getEncodingEncoder(), getEncodingDecoder()); } diff --git a/clients/js/src/generated/types/externalData.ts b/clients/js/src/generated/types/externalData.ts index 32018b8..069283f 100644 --- a/clients/js/src/generated/types/externalData.ts +++ b/clients/js/src/generated/types/externalData.ts @@ -17,9 +17,9 @@ import { getU32Decoder, getU32Encoder, type Address, - type Codec, - type Decoder, - type Encoder, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, type Option, type OptionOrNullable, } from '@solana/kit'; @@ -36,7 +36,7 @@ export type ExternalDataArgs = { length: OptionOrNullable; }; -export function getExternalDataEncoder(): Encoder { +export function getExternalDataEncoder(): FixedSizeEncoder { return getStructEncoder([ ['address', getAddressEncoder()], ['offset', getU32Encoder()], @@ -47,7 +47,7 @@ export function getExternalDataEncoder(): Encoder { ]); } -export function getExternalDataDecoder(): Decoder { +export function getExternalDataDecoder(): FixedSizeDecoder { return getStructDecoder([ ['address', getAddressDecoder()], ['offset', getU32Decoder()], @@ -58,6 +58,9 @@ export function getExternalDataDecoder(): Decoder { ]); } -export function getExternalDataCodec(): Codec { +export function getExternalDataCodec(): FixedSizeCodec< + ExternalDataArgs, + ExternalData +> { return combineCodec(getExternalDataEncoder(), getExternalDataDecoder()); } diff --git a/clients/js/src/generated/types/format.ts b/clients/js/src/generated/types/format.ts index 453d8b3..7548528 100644 --- a/clients/js/src/generated/types/format.ts +++ b/clients/js/src/generated/types/format.ts @@ -10,9 +10,9 @@ import { combineCodec, getEnumDecoder, getEnumEncoder, - type Codec, - type Decoder, - type Encoder, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, } from '@solana/kit'; export enum Format { @@ -24,14 +24,14 @@ export enum Format { export type FormatArgs = Format; -export function getFormatEncoder(): Encoder { +export function getFormatEncoder(): FixedSizeEncoder { return getEnumEncoder(Format); } -export function getFormatDecoder(): Decoder { +export function getFormatDecoder(): FixedSizeDecoder { return getEnumDecoder(Format); } -export function getFormatCodec(): Codec { +export function getFormatCodec(): FixedSizeCodec { return combineCodec(getFormatEncoder(), getFormatDecoder()); } diff --git a/clients/js/src/generated/types/seed.ts b/clients/js/src/generated/types/seed.ts index e4109b2..6111c29 100644 --- a/clients/js/src/generated/types/seed.ts +++ b/clients/js/src/generated/types/seed.ts @@ -12,23 +12,23 @@ import { fixEncoderSize, getUtf8Decoder, getUtf8Encoder, - type Codec, - type Decoder, - type Encoder, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, } from '@solana/kit'; export type Seed = string; export type SeedArgs = Seed; -export function getSeedEncoder(): Encoder { +export function getSeedEncoder(): FixedSizeEncoder { return fixEncoderSize(getUtf8Encoder(), 16); } -export function getSeedDecoder(): Decoder { +export function getSeedDecoder(): FixedSizeDecoder { return fixDecoderSize(getUtf8Decoder(), 16); } -export function getSeedCodec(): Codec { +export function getSeedCodec(): FixedSizeCodec { return combineCodec(getSeedEncoder(), getSeedDecoder()); } diff --git a/clients/js/src/index.ts b/clients/js/src/index.ts index ea72bca..75ef88f 100644 --- a/clients/js/src/index.ts +++ b/clients/js/src/index.ts @@ -1,5 +1,4 @@ export * from './generated'; -export * from './instructionPlans'; export * from './createMetadata'; export * from './fetchMetadataContent'; diff --git a/clients/js/src/instructionPlans/computeBudgetHelpers.ts b/clients/js/src/instructionPlans/computeBudgetHelpers.ts deleted file mode 100644 index 4627d47..0000000 --- a/clients/js/src/instructionPlans/computeBudgetHelpers.ts +++ /dev/null @@ -1,145 +0,0 @@ -// TODO: This will need decoupling from `@solana-program/compute-budget` when added to `@solana/instruction-plans` - -// TODO: The function `getComputeUnitEstimateForTransactionMessageFactory` will need to -// move in a granular package so `instruction-plans` can use it. - -import { - COMPUTE_BUDGET_PROGRAM_ADDRESS, - ComputeBudgetInstruction, - getSetComputeUnitLimitInstruction, - getSetComputeUnitPriceInstruction, - identifyComputeBudgetInstruction, -} from '@solana-program/compute-budget'; -import { - appendTransactionMessageInstruction, - BaseTransactionMessage, - CompilableTransactionMessage, - getComputeUnitEstimateForTransactionMessageFactory, - getU32Decoder, - IInstruction, - ITransactionMessageWithFeePayer, - offsetDecoder, - Rpc, - SimulateTransactionApi, - TransactionMessage, -} from '@solana/kit'; - -// Setting it to zero ensures the transaction fails unless it is properly estimated. -export const PROVISORY_COMPUTE_UNIT_LIMIT = 0; - -// This is the maximum compute unit limit that can be set for a transaction. -export const MAX_COMPUTE_UNIT_LIMIT = 1_400_000; - -export function setTransactionMessageComputeUnitPrice< - TTransactionMessage extends BaseTransactionMessage, ->(microLamports: number | bigint, transactionMessage: TTransactionMessage) { - return appendTransactionMessageInstruction( - getSetComputeUnitPriceInstruction({ microLamports }), - transactionMessage - ); -} - -export function fillProvisorySetComputeUnitLimitInstruction< - TTransactionMessage extends BaseTransactionMessage, ->(transactionMessage: TTransactionMessage) { - return updateOrAppendSetComputeUnitLimitInstruction( - (previousUnits) => - previousUnits === null ? PROVISORY_COMPUTE_UNIT_LIMIT : previousUnits, - transactionMessage - ); -} - -export async function estimateAndUpdateProvisorySetComputeUnitLimitInstruction< - TTransactionMessage extends - | CompilableTransactionMessage - | (ITransactionMessageWithFeePayer & TransactionMessage), ->( - rpc: Rpc, - transactionMessage: TTransactionMessage -): Promise { - const getComputeUnitEstimateForTransactionMessage = - getComputeUnitEstimateForTransactionMessageFactory({ rpc }); - - const instructionDetails = - getSetComputeUnitLimitInstructionIndexAndUnits(transactionMessage); - - // If the transaction message already has a compute unit limit instruction - // which is set to a specific value — i.e. not 0 or the maximum limit — - // we don't need to estimate the compute unit limit. - if ( - instructionDetails && - instructionDetails.units !== PROVISORY_COMPUTE_UNIT_LIMIT && - instructionDetails.units !== MAX_COMPUTE_UNIT_LIMIT - ) { - return transactionMessage; - } - - const units = - await getComputeUnitEstimateForTransactionMessage(transactionMessage); - return updateOrAppendSetComputeUnitLimitInstruction( - () => units, - transactionMessage - ); -} - -function updateOrAppendSetComputeUnitLimitInstruction< - TTransactionMessage extends BaseTransactionMessage, ->( - getUnits: (previousUnits: number | null) => number, - transactionMessage: TTransactionMessage -): TTransactionMessage { - const instructionDetails = - getSetComputeUnitLimitInstructionIndexAndUnits(transactionMessage); - - if (!instructionDetails) { - return appendTransactionMessageInstruction( - getSetComputeUnitLimitInstruction({ units: getUnits(null) }), - transactionMessage - ); - } - - const { index, units: previousUnits } = instructionDetails; - const units = getUnits(previousUnits); - if (units === previousUnits) { - return transactionMessage; - } - - const nextInstruction = getSetComputeUnitLimitInstruction({ units }); - const nextInstructions = [...transactionMessage.instructions]; - nextInstructions.splice(index, 1, nextInstruction); - return { ...transactionMessage, instructions: nextInstructions }; -} - -function getSetComputeUnitLimitInstructionIndexAndUnits( - transactionMessage: BaseTransactionMessage -): { index: number; units: number } | null { - const index = getSetComputeUnitLimitInstructionIndex(transactionMessage); - if (index < 0) { - return null; - } - - const units = getSetComputeUnitLimitInstructionUnits( - transactionMessage.instructions[index] - ); - - return { index, units }; -} - -export function getSetComputeUnitLimitInstructionIndex( - transactionMessage: BaseTransactionMessage -) { - return transactionMessage.instructions.findIndex((ix) => { - return ( - ix.programAddress === COMPUTE_BUDGET_PROGRAM_ADDRESS && - identifyComputeBudgetInstruction(ix.data as Uint8Array) === - ComputeBudgetInstruction.SetComputeUnitLimit - ); - }); -} - -function getSetComputeUnitLimitInstructionUnits(instruction: IInstruction) { - const unitsDecoder = offsetDecoder(getU32Decoder(), { - preOffset: ({ preOffset }) => preOffset + 1, - }); - return unitsDecoder.decode(instruction.data as Uint8Array); -} diff --git a/clients/js/src/instructionPlans/index.ts b/clients/js/src/instructionPlans/index.ts deleted file mode 100644 index f2eff47..0000000 --- a/clients/js/src/instructionPlans/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -export * from './computeBudgetHelpers'; -export * from './instructionPlan'; -export * from './transactionHelpers'; -export * from './transactionPlan'; -export * from './transactionPlanExecutor'; -export * from './transactionPlanExecutorBase'; -export * from './transactionPlanExecutorDecorators'; -export * from './transactionPlanExecutorDefault'; -export * from './transactionPlanner'; -export * from './transactionPlannerBase'; -export * from './transactionPlannerDefault'; -export * from './transactionPlanResult'; diff --git a/clients/js/src/instructionPlans/instructionPlan.ts b/clients/js/src/instructionPlans/instructionPlan.ts deleted file mode 100644 index 321a2f5..0000000 --- a/clients/js/src/instructionPlans/instructionPlan.ts +++ /dev/null @@ -1,212 +0,0 @@ -import { - appendTransactionMessageInstruction, - CompilableTransactionMessage, - IInstruction, -} from '@solana/kit'; -import { - getTransactionSize, - TRANSACTION_SIZE_LIMIT, -} from './transactionHelpers'; - -export type InstructionPlan = - | SequentialInstructionPlan - | ParallelInstructionPlan - | SingleInstructionPlan - | MessagePackerInstructionPlan; - -export type SequentialInstructionPlan = Readonly<{ - kind: 'sequential'; - plans: InstructionPlan[]; - divisible: boolean; -}>; - -export type ParallelInstructionPlan = Readonly<{ - kind: 'parallel'; - plans: InstructionPlan[]; -}>; - -export type SingleInstructionPlan< - TInstruction extends IInstruction = IInstruction, -> = Readonly<{ - kind: 'single'; - instruction: TInstruction; -}>; - -export type MessagePackerInstructionPlan = Readonly<{ - kind: 'messagePacker'; - getMessagePacker: () => MessagePacker; -}>; - -export type MessagePacker = Readonly<{ - /** Checks whether there are more instructions to retrieve. */ - done: () => boolean; - /** Pack the provided transaction message with the next instructions or throws if not possible. */ - packMessageToCapacity: ( - transactionMessage: CompilableTransactionMessage - ) => CompilableTransactionMessage; -}>; - -// TODO: Make SolanaError instead. -export class CannotPackUsingProvidedMessageError extends Error { - constructor() { - super('Cannot pack the next instructions using the provided message'); - this.name = 'CannotPackUsingProvidedMessageError'; - } -} - -// TODO: Make SolanaError instead. -export class MessagePackerIsAlreadyDoneError extends Error { - constructor() { - super( - 'Failed to pack the next message because the message packer is already done' - ); - this.name = 'MessagePackerIsAlreadyDoneError'; - } -} - -export function parallelInstructionPlan( - plans: (InstructionPlan | IInstruction)[] -): ParallelInstructionPlan { - return { kind: 'parallel', plans: parseSingleInstructionPlans(plans) }; -} - -export function sequentialInstructionPlan( - plans: (InstructionPlan | IInstruction)[] -): SequentialInstructionPlan { - return { - kind: 'sequential', - divisible: true, - plans: parseSingleInstructionPlans(plans), - }; -} - -export function nonDivisibleSequentialInstructionPlan( - plans: (InstructionPlan | IInstruction)[] -): SequentialInstructionPlan { - return { - kind: 'sequential', - divisible: false, - plans: parseSingleInstructionPlans(plans), - }; -} - -export function singleInstructionPlan( - instruction: IInstruction -): SingleInstructionPlan { - return { kind: 'single', instruction }; -} - -function parseSingleInstructionPlans( - plans: (InstructionPlan | IInstruction)[] -): InstructionPlan[] { - return plans.map((plan) => - 'kind' in plan ? plan : singleInstructionPlan(plan) - ); -} - -export function getLinearMessagePackerInstructionPlan({ - getInstruction, - totalLength: totalBytes, -}: { - getInstruction: (offset: number, length: number) => IInstruction; - totalLength: number; -}): MessagePackerInstructionPlan { - return { - kind: 'messagePacker', - getMessagePacker: () => { - let offset = 0; - return { - done: () => offset >= totalBytes, - packMessageToCapacity: (message: CompilableTransactionMessage) => { - if (offset >= totalBytes) { - throw new MessagePackerIsAlreadyDoneError(); - } - - const baseTransactionSize = getTransactionSize( - appendTransactionMessageInstruction( - getInstruction(offset, 0), - message - ) - ); - const maxLength = - TRANSACTION_SIZE_LIMIT - - baseTransactionSize - - 1; /* Leeway for shortU16 numbers in transaction headers. */ - - if (maxLength <= 0) { - throw new CannotPackUsingProvidedMessageError(); - } - - const length = Math.min(totalBytes - offset, maxLength); - const instruction = getInstruction(offset, length); - offset += length; - return appendTransactionMessageInstruction(instruction, message); - }, - }; - }, - }; -} - -export function getMessagePackerInstructionPlanFromInstructions< - TInstruction extends IInstruction = IInstruction, ->(instructions: TInstruction[]): MessagePackerInstructionPlan { - return { - kind: 'messagePacker', - getMessagePacker: () => { - let instructionIndex = 0; - return { - done: () => instructionIndex >= instructions.length, - packMessageToCapacity: (message: CompilableTransactionMessage) => { - if (instructionIndex >= instructions.length) { - throw new MessagePackerIsAlreadyDoneError(); - } - - let updatedMessage: CompilableTransactionMessage = message; - for ( - let index = instructionIndex; - index < instructions.length; - index++ - ) { - updatedMessage = appendTransactionMessageInstruction( - instructions[index], - message - ); - - if (getTransactionSize(updatedMessage) > TRANSACTION_SIZE_LIMIT) { - if (index === instructionIndex) { - throw new CannotPackUsingProvidedMessageError(); - } - instructionIndex = index; - return updatedMessage; - } - } - - instructionIndex = instructions.length; - return updatedMessage; - }, - }; - }, - }; -} - -const REALLOC_LIMIT = 10_240; - -export function getReallocMessagePackerInstructionPlan({ - getInstruction, - totalSize, -}: { - getInstruction: (size: number) => IInstruction; - totalSize: number; -}): MessagePackerInstructionPlan { - const numberOfInstructions = Math.ceil(totalSize / REALLOC_LIMIT); - const lastInstructionSize = totalSize % REALLOC_LIMIT; - const instructions = new Array(numberOfInstructions) - .fill(0) - .map((_, i) => - getInstruction( - i === numberOfInstructions - 1 ? lastInstructionSize : REALLOC_LIMIT - ) - ); - - return getMessagePackerInstructionPlanFromInstructions(instructions); -} diff --git a/clients/js/src/instructionPlans/internal.ts b/clients/js/src/instructionPlans/internal.ts deleted file mode 100644 index 924a5b9..0000000 --- a/clients/js/src/instructionPlans/internal.ts +++ /dev/null @@ -1,22 +0,0 @@ -export type Mutable = { -readonly [P in keyof T]: T[P] }; - -export function getTimedCacheFunction( - fn: () => Promise, - timeoutInMilliseconds: number -): () => Promise { - let cache: T | null = null; - let lastFetchTime = 0; - return async () => { - const currentTime = Date.now(); - - // Cache hit. - if (cache && currentTime - lastFetchTime < timeoutInMilliseconds) { - return cache; - } - - // Cache miss. - cache = await fn(); - lastFetchTime = currentTime; - return cache; - }; -} diff --git a/clients/js/src/instructionPlans/transactionHelpers.ts b/clients/js/src/instructionPlans/transactionHelpers.ts deleted file mode 100644 index 602b8a8..0000000 --- a/clients/js/src/instructionPlans/transactionHelpers.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * TODO: The helpers in this file would need to be a first-class citizen of @solana/transactions. - */ - -import { - BaseTransactionMessage, - Blockhash, - CompilableTransactionMessage, - compileTransaction, - getTransactionEncoder, - setTransactionMessageLifetimeUsingBlockhash, - TransactionMessageWithBlockhashLifetime, -} from '@solana/kit'; - -export const TRANSACTION_PACKET_SIZE = 1280; - -export const TRANSACTION_PACKET_HEADER = - 40 /* 40 bytes is the size of the IPv6 header. */ + - 8; /* 8 bytes is the size of the fragment header. */ - -export const TRANSACTION_SIZE_LIMIT = - TRANSACTION_PACKET_SIZE - TRANSACTION_PACKET_HEADER; - -// It should accepts both `Transaction` and `CompilableTransactionMessage` instances. -// Over time, efforts should be made to improve the performance of this function. -// E.g. maybe we don't need to compile the transaction message to get the size. -export function getTransactionSize( - message: CompilableTransactionMessage -): number { - const transaction = compileTransaction(message); - return getTransactionEncoder().getSizeFromValue(transaction); -} - -const PROVISORY_BLOCKHASH_LIFETIME_CONSTRAINT: TransactionMessageWithBlockhashLifetime['lifetimeConstraint'] = - { - blockhash: '11111111111111111111111111111111' as Blockhash, - lastValidBlockHeight: 0n, - }; - -export function setTransactionMessageLifetimeUsingProvisoryBlockhash< - TTransactionMessage extends BaseTransactionMessage, ->(transactionMessage: TTransactionMessage) { - return setTransactionMessageLifetimeUsingBlockhash( - PROVISORY_BLOCKHASH_LIFETIME_CONSTRAINT, - transactionMessage - ); -} diff --git a/clients/js/src/instructionPlans/transactionPlan.ts b/clients/js/src/instructionPlans/transactionPlan.ts deleted file mode 100644 index 6af1248..0000000 --- a/clients/js/src/instructionPlans/transactionPlan.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { CompilableTransactionMessage } from '@solana/kit'; - -export type TransactionPlan = - | SequentialTransactionPlan - | ParallelTransactionPlan - | SingleTransactionPlan; - -export type SequentialTransactionPlan = Readonly<{ - kind: 'sequential'; - plans: TransactionPlan[]; - divisible: boolean; -}>; - -export type ParallelTransactionPlan = Readonly<{ - kind: 'parallel'; - plans: TransactionPlan[]; -}>; - -export type SingleTransactionPlan< - TTransactionMessage extends - CompilableTransactionMessage = CompilableTransactionMessage, -> = Readonly<{ - kind: 'single'; - message: TTransactionMessage; -}>; - -export function parallelTransactionPlan( - plans: (CompilableTransactionMessage | TransactionPlan)[] -): ParallelTransactionPlan { - return Object.freeze({ - kind: 'parallel', - plans: parseSingleTransactionPlans(plans), - }); -} - -export function sequentialTransactionPlan( - plans: (CompilableTransactionMessage | TransactionPlan)[] -): SequentialTransactionPlan & { divisible: true } { - return Object.freeze({ - divisible: true, - kind: 'sequential', - plans: parseSingleTransactionPlans(plans), - }); -} - -export function nonDivisibleSequentialTransactionPlan( - plans: (CompilableTransactionMessage | TransactionPlan)[] -): SequentialTransactionPlan & { divisible: false } { - return Object.freeze({ - divisible: false, - kind: 'sequential', - plans: parseSingleTransactionPlans(plans), - }); -} - -export function singleTransactionPlan< - TTransactionMessage extends - CompilableTransactionMessage = CompilableTransactionMessage, ->( - transactionMessage: TTransactionMessage -): SingleTransactionPlan { - return Object.freeze({ kind: 'single', message: transactionMessage }); -} - -function parseSingleTransactionPlans( - plans: (CompilableTransactionMessage | TransactionPlan)[] -): TransactionPlan[] { - return plans.map((plan) => - 'kind' in plan ? plan : singleTransactionPlan(plan) - ); -} - -export function getAllSingleTransactionPlans( - transactionPlan: TransactionPlan -): SingleTransactionPlan[] { - if (transactionPlan.kind === 'single') { - return [transactionPlan]; - } - return transactionPlan.plans.flatMap(getAllSingleTransactionPlans); -} diff --git a/clients/js/src/instructionPlans/transactionPlanExecutor.ts b/clients/js/src/instructionPlans/transactionPlanExecutor.ts deleted file mode 100644 index 27a9b77..0000000 --- a/clients/js/src/instructionPlans/transactionPlanExecutor.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { TransactionPlan } from './transactionPlan'; -import { TransactionPlanResult } from './transactionPlanResult'; - -export type TransactionPlanExecutor = ( - transactionPlan: TransactionPlan, - config?: { abortSignal?: AbortSignal } -) => Promise>; diff --git a/clients/js/src/instructionPlans/transactionPlanExecutorBase.ts b/clients/js/src/instructionPlans/transactionPlanExecutorBase.ts deleted file mode 100644 index 5d60e40..0000000 --- a/clients/js/src/instructionPlans/transactionPlanExecutorBase.ts +++ /dev/null @@ -1,186 +0,0 @@ -import { - CompilableTransactionMessage, - SolanaError, - Transaction, -} from '@solana/kit'; -import { - ParallelTransactionPlan, - SequentialTransactionPlan, - SingleTransactionPlan, - TransactionPlan, -} from './transactionPlan'; -import { TransactionPlanResult } from './transactionPlanResult'; -import { TransactionPlanExecutor } from './transactionPlanExecutor'; - -export type TransactionPlanExecutorSendAndConfirm = < - TTransactionMessage extends CompilableTransactionMessage, - TContext extends object = object, ->( - transactionMessage: TTransactionMessage, - config?: { abortSignal?: AbortSignal } -) => Promise<{ context?: TContext; transaction: Transaction }>; - -type TransactionPlanExecutorConfig = { - parallelChunkSize?: number; - sendAndConfirm: TransactionPlanExecutorSendAndConfirm; -}; - -export function createBaseTransactionPlanExecutor( - executorConfig: TransactionPlanExecutorConfig -): TransactionPlanExecutor { - return async (plan, config): Promise => { - const context: TraverseContext = { - ...executorConfig, - abortSignal: config?.abortSignal, - canceled: config?.abortSignal?.aborted ?? false, - }; - - const cancelHandler = () => { - context.canceled = true; - }; - config?.abortSignal?.addEventListener('abort', cancelHandler); - const result = await traverse(plan, context); - config?.abortSignal?.removeEventListener('abort', cancelHandler); - - if (context.canceled) { - // TODO: Coded error. - const error = new Error('Transaction plan execution failed') as Error & { - result: TransactionPlanResult; - }; - error.result = result; - error.cause = findErrorFromTransactionPlanResult(result); - throw error; - } - - return result; - }; -} - -type TraverseContext = TransactionPlanExecutorConfig & { - abortSignal?: AbortSignal; - canceled: boolean; -}; - -async function traverse( - transactionPlan: TransactionPlan, - context: TraverseContext -): Promise { - switch (transactionPlan.kind) { - case 'sequential': - return await traverseSequential(transactionPlan, context); - case 'parallel': - return await traverseParallel(transactionPlan, context); - case 'single': - return await traverseSingle(transactionPlan, context); - default: - transactionPlan satisfies never; - throw new Error( - `Unknown instruction plan kind: ${(transactionPlan as { kind: string }).kind}` - ); - } -} - -async function traverseSequential( - transactionPlan: SequentialTransactionPlan, - context: TraverseContext -): Promise { - const results: TransactionPlanResult[] = []; - for (const subPlan of transactionPlan.plans) { - const result = await traverse(subPlan, context); - results.push(result); - } - return { - kind: 'sequential', - divisible: transactionPlan.divisible, - plans: results, - }; -} - -async function traverseParallel( - transactionPlan: ParallelTransactionPlan, - context: TraverseContext -): Promise { - const chunks = chunkPlans(transactionPlan.plans, context.parallelChunkSize); - const results: TransactionPlanResult[] = []; - - for (const chunk of chunks) { - const chunkResults = await Promise.all( - chunk.map((plan) => traverse(plan, context)) - ); - results.push(...chunkResults); - } - - return { kind: 'parallel', plans: results }; -} - -function chunkPlans( - plans: TransactionPlan[], - chunkSize?: number -): TransactionPlan[][] { - if (!chunkSize) { - return [plans]; - } - - return plans.reduce( - (chunks, subPlan) => { - const lastChunk = chunks[chunks.length - 1]; - if (lastChunk && lastChunk.length < chunkSize) { - lastChunk.push(subPlan); - } else { - chunks.push([subPlan]); - } - return chunks; - }, - [[]] as TransactionPlan[][] - ); -} - -async function traverseSingle( - transactionPlan: SingleTransactionPlan, - context: TraverseContext -): Promise { - if (context.canceled) { - return { - kind: 'single', - message: transactionPlan.message, - status: { kind: 'canceled' }, - }; - } - - try { - const result = await context.sendAndConfirm(transactionPlan.message, { - abortSignal: context.abortSignal, - }); - - return { - kind: 'single', - message: transactionPlan.message, - status: { - kind: 'successful', - transaction: result.transaction, - context: result.context ?? {}, - }, - }; - } catch (error) { - context.canceled = true; - return { - kind: 'single', - message: transactionPlan.message, - status: { kind: 'failed', error: error as SolanaError }, - }; - } -} - -function findErrorFromTransactionPlanResult( - result: TransactionPlanResult -): Error | undefined { - if (result.kind === 'single') { - return result.status.kind === 'failed' ? result.status.error : undefined; - } - for (const plan of result.plans) { - const error = findErrorFromTransactionPlanResult(plan); - if (error) { - return error; - } - } -} diff --git a/clients/js/src/instructionPlans/transactionPlanExecutorDecorators.ts b/clients/js/src/instructionPlans/transactionPlanExecutorDecorators.ts deleted file mode 100644 index 8f3b348..0000000 --- a/clients/js/src/instructionPlans/transactionPlanExecutorDecorators.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { - GetLatestBlockhashApi, - Rpc, - setTransactionMessageLifetimeUsingBlockhash, - SimulateTransactionApi, -} from '@solana/kit'; -import { estimateAndUpdateProvisorySetComputeUnitLimitInstruction } from './computeBudgetHelpers'; -import { getTimedCacheFunction } from './internal'; -import { TransactionPlanExecutorSendAndConfirm } from './transactionPlanExecutorBase'; - -export function estimateAndUpdateComputeUnitLimitForTransactionPlanExecutor( - rpc: Rpc, - sendAndConfirm: TransactionPlanExecutorSendAndConfirm -): TransactionPlanExecutorSendAndConfirm { - return async (transactionMessage) => { - return await sendAndConfirm( - await estimateAndUpdateProvisorySetComputeUnitLimitInstruction( - rpc, - transactionMessage - ) - ); - }; -} - -export function refreshBlockhashForTransactionPlanExecutor( - rpc: Rpc, - sendAndConfirm: TransactionPlanExecutorSendAndConfirm -): TransactionPlanExecutorSendAndConfirm { - // Cache the latest blockhash for 60 seconds. - const getBlockhash = getTimedCacheFunction(async () => { - const { value } = await rpc.getLatestBlockhash().send(); - return value; - }, 60_000); - - return async (transactionMessage) => { - return await sendAndConfirm( - setTransactionMessageLifetimeUsingBlockhash( - await getBlockhash(), - transactionMessage - ) - ); - }; -} - -export function retryTransactionPlanExecutor( - maxRetries: number, - sendAndConfirm: TransactionPlanExecutorSendAndConfirm -): TransactionPlanExecutorSendAndConfirm { - return async (transactionMessage) => { - let retries = 0; - let lastError: Error | null = null; - - // x retries means x+1 attempts. - while (retries < maxRetries + 1) { - try { - return await sendAndConfirm(transactionMessage); - } catch (error) { - // TODO: Should we not retry on certain error codes? - retries++; - lastError = error as Error; - } - } - - throw lastError; - }; -} diff --git a/clients/js/src/instructionPlans/transactionPlanExecutorDefault.ts b/clients/js/src/instructionPlans/transactionPlanExecutorDefault.ts deleted file mode 100644 index 9c19859..0000000 --- a/clients/js/src/instructionPlans/transactionPlanExecutorDefault.ts +++ /dev/null @@ -1,134 +0,0 @@ -import { - AccountNotificationsApi, - Commitment, - compileTransaction, - FullySignedTransaction, - GetAccountInfoApi, - GetEpochInfoApi, - GetLatestBlockhashApi, - GetSignatureStatusesApi, - isTransactionMessageWithSingleSendingSigner, - pipe, - Rpc, - RpcSubscriptions, - sendAndConfirmDurableNonceTransactionFactory, - sendAndConfirmTransactionFactory, - SendTransactionApi, - signAndSendTransactionMessageWithSigners, - SignatureNotificationsApi, - signTransactionMessageWithSigners, - SimulateTransactionApi, - SlotNotificationsApi, - TransactionWithBlockhashLifetime, - TransactionWithDurableNonceLifetime, - TransactionWithLifetime, -} from '@solana/kit'; -import { TransactionPlanExecutor } from './transactionPlanExecutor'; -import { - createBaseTransactionPlanExecutor, - TransactionPlanExecutorSendAndConfirm, -} from './transactionPlanExecutorBase'; -import { - estimateAndUpdateComputeUnitLimitForTransactionPlanExecutor, - refreshBlockhashForTransactionPlanExecutor, - retryTransactionPlanExecutor, -} from './transactionPlanExecutorDecorators'; - -export function createDefaultTransactionPlanExecutor( - config: SendAndConfirmTransactionFactoryConfig & { - rpc: Rpc; - commitment?: Commitment; - parallelChunkSize?: number; - } -): TransactionPlanExecutor { - return createBaseTransactionPlanExecutor({ - parallelChunkSize: config.parallelChunkSize, - sendAndConfirm: pipe( - getDefaultTransactionPlanExecutorSendAndConfirm({ - ...config, - commitment: config.commitment ?? 'confirmed', - }), - (fn) => - estimateAndUpdateComputeUnitLimitForTransactionPlanExecutor( - config.rpc, - fn - ), - (fn) => refreshBlockhashForTransactionPlanExecutor(config.rpc, fn), - (fn) => retryTransactionPlanExecutor(3, fn) - ), - }); -} - -function getDefaultTransactionPlanExecutorSendAndConfirm( - config: SendAndConfirmTransactionFactoryConfig & { commitment: Commitment } -): TransactionPlanExecutorSendAndConfirm { - const sendAndConfirm = sendAndConfirmTransactionFactoryWithAnyLifetime({ - rpc: config.rpc, - rpcSubscriptions: config.rpcSubscriptions, - }); - return async (transactionMessage, executorConfig) => { - if (isTransactionMessageWithSingleSendingSigner(transactionMessage)) { - await signAndSendTransactionMessageWithSigners(transactionMessage, { - abortSignal: executorConfig?.abortSignal, - }); - return { transaction: compileTransaction(transactionMessage) }; - } - - const transaction = - await signTransactionMessageWithSigners(transactionMessage); - await sendAndConfirm(transaction, { - abortSignal: executorConfig?.abortSignal, - commitment: config.commitment, - }); - - return { transaction }; - }; -} - -type SendAndConfirmTransactionFactoryConfig = { - rpc: Rpc< - GetEpochInfoApi & - GetSignatureStatusesApi & - SendTransactionApi & - GetAccountInfoApi - >; - rpcSubscriptions: RpcSubscriptions< - SignatureNotificationsApi & SlotNotificationsApi & AccountNotificationsApi - >; -}; - -type SendAndConfirmTransactionFunction = ( - transaction: FullySignedTransaction & TransactionWithLifetime, - config: { abortSignal?: AbortSignal; commitment: Commitment } -) => Promise; - -function sendAndConfirmTransactionFactoryWithAnyLifetime( - factoryConfig: SendAndConfirmTransactionFactoryConfig -): SendAndConfirmTransactionFunction { - const sendAndConfirmWithBlockhash = - sendAndConfirmTransactionFactory(factoryConfig); - const sendAndConfirmWithDurableNonce = - sendAndConfirmDurableNonceTransactionFactory(factoryConfig); - - return async (transaction, config) => { - if (!isBlockhashTransaction(transaction)) { - return await sendAndConfirmWithDurableNonce( - transaction as typeof transaction & TransactionWithDurableNonceLifetime, - config - ); - } - return await sendAndConfirmWithBlockhash(transaction, config); - }; -} - -function isBlockhashTransaction( - transaction: TransactionWithLifetime -): transaction is TransactionWithBlockhashLifetime { - return ( - 'lifetimeConstraint' in transaction && - 'blockhash' in transaction.lifetimeConstraint && - 'lastValidBlockHeight' in transaction.lifetimeConstraint && - typeof transaction.lifetimeConstraint.blockhash === 'string' && - typeof transaction.lifetimeConstraint.lastValidBlockHeight === 'bigint' - ); -} diff --git a/clients/js/src/instructionPlans/transactionPlanResult.ts b/clients/js/src/instructionPlans/transactionPlanResult.ts deleted file mode 100644 index 618c441..0000000 --- a/clients/js/src/instructionPlans/transactionPlanResult.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { - CompilableTransactionMessage, - SolanaError, - Transaction, -} from '@solana/kit'; - -export type TransactionPlanResult = - | SequentialTransactionPlanResult - | ParallelTransactionPlanResult - | SingleTransactionPlanResult; - -export type SequentialTransactionPlanResult = - Readonly<{ - kind: 'sequential'; - divisible: boolean; - plans: TransactionPlanResult[]; - }>; - -export type ParallelTransactionPlanResult = - Readonly<{ - kind: 'parallel'; - plans: TransactionPlanResult[]; - }>; - -export type SingleTransactionPlanResult< - TContext extends object = object, - TTransactionMessage extends - CompilableTransactionMessage = CompilableTransactionMessage, -> = Readonly<{ - kind: 'single'; - message: TTransactionMessage; - status: TransactionPlanResultStatus; -}>; - -export type TransactionPlanResultStatus = - | { kind: 'canceled' } - | { kind: 'failed'; error: SolanaError } - | { kind: 'successful'; context: TContext; transaction: Transaction }; diff --git a/clients/js/src/instructionPlans/transactionPlanner.ts b/clients/js/src/instructionPlans/transactionPlanner.ts deleted file mode 100644 index 17e71ce..0000000 --- a/clients/js/src/instructionPlans/transactionPlanner.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { InstructionPlan } from './instructionPlan'; -import { TransactionPlan } from './transactionPlan'; - -export type TransactionPlanner = ( - instructionPlan: InstructionPlan, - config?: { abortSignal?: AbortSignal } -) => Promise; - -export async function isValidInstructionPlan( - instructionPlan: InstructionPlan, - planner: TransactionPlanner -) { - try { - await planner(instructionPlan); - return true; - } catch { - return false; - } -} diff --git a/clients/js/src/instructionPlans/transactionPlannerBase.ts b/clients/js/src/instructionPlans/transactionPlannerBase.ts deleted file mode 100644 index 2b19e63..0000000 --- a/clients/js/src/instructionPlans/transactionPlannerBase.ts +++ /dev/null @@ -1,438 +0,0 @@ -import { - appendTransactionMessageInstructions, - CompilableTransactionMessage, - TransactionMessage, -} from '@solana/kit'; -import { - CannotPackUsingProvidedMessageError as CannotPackUsingProvidedMessageError, - InstructionPlan, - MessagePackerInstructionPlan, - ParallelInstructionPlan, - SequentialInstructionPlan, - SingleInstructionPlan, -} from './instructionPlan'; -import { Mutable } from './internal'; -import { - getTransactionSize, - TRANSACTION_SIZE_LIMIT, -} from './transactionHelpers'; -import { - getAllSingleTransactionPlans, - nonDivisibleSequentialTransactionPlan, - parallelTransactionPlan, - sequentialTransactionPlan, - singleTransactionPlan, - SingleTransactionPlan, - TransactionPlan, -} from './transactionPlan'; -import { TransactionPlanner } from './transactionPlanner'; - -type CreateTransactionMessage = (config?: { - abortSignal?: AbortSignal; -}) => Promise | CompilableTransactionMessage; - -type OnTransactionMessageUpdated = < - TTransactionMessage extends CompilableTransactionMessage, ->( - transactionMessage: TTransactionMessage, - config?: { abortSignal?: AbortSignal } -) => Promise | TTransactionMessage; - -export type TransactionPlannerConfig = { - createTransactionMessage: CreateTransactionMessage; - onTransactionMessageUpdated?: OnTransactionMessageUpdated; -}; - -export function createBaseTransactionPlanner( - config: TransactionPlannerConfig -): TransactionPlanner { - return async ( - instructionPlan, - { abortSignal } = {} - ): Promise => { - const plan = await traverse(instructionPlan, { - abortSignal, - parent: null, - parentCandidates: [], - createTransactionMessage: config.createTransactionMessage, - onTransactionMessageUpdated: - config.onTransactionMessageUpdated ?? ((msg) => msg), - }); - - if (!plan) { - throw new NoInstructionsFoundInInstructionPlanError(); - } - - return freezeTransactionPlan(plan); - }; -} - -type MutableTransactionPlan = Mutable; -type MutableSingleTransactionPlan = Mutable; - -type TraverseContext = { - abortSignal?: AbortSignal; - parent: InstructionPlan | null; - parentCandidates: MutableSingleTransactionPlan[]; - createTransactionMessage: CreateTransactionMessage; - onTransactionMessageUpdated: OnTransactionMessageUpdated; -}; - -async function traverse( - instructionPlan: InstructionPlan, - context: TraverseContext -): Promise { - context.abortSignal?.throwIfAborted(); - switch (instructionPlan.kind) { - case 'sequential': - return await traverseSequential(instructionPlan, context); - case 'parallel': - return await traverseParallel(instructionPlan, context); - case 'single': - return await traverseSingle(instructionPlan, context); - case 'messagePacker': - return await traverseMessagePacker(instructionPlan, context); - default: - instructionPlan satisfies never; - throw new Error( - `Unknown instruction plan kind: ${(instructionPlan as { kind: string }).kind}` - ); - } -} - -async function traverseSequential( - instructionPlan: SequentialInstructionPlan, - context: TraverseContext -): Promise { - let candidate: MutableSingleTransactionPlan | null = null; - - // Check if the sequential plan must fit entirely in its parent candidates - // due to constraints like being inside a parallel plan or not being divisible. - const mustEntirelyFitInParentCandidate = - context.parent && - (context.parent.kind === 'parallel' || !instructionPlan.divisible); - - // If so, try to fit the entire plan inside one of the parent candidates. - if (mustEntirelyFitInParentCandidate) { - const candidate = await selectAndMutateCandidate( - context, - context.parentCandidates, - (message) => fitEntirePlanInsideMessage(instructionPlan, message) - ); - // If that's possible, we the candidate is mutated and we can return null. - // Otherwise, we proceed with the normal traversal and no parent candidate. - if (candidate) { - return null; - } - } else { - // Otherwise, we can use the first parent candidate, if any, - // since we know it must be a divisible sequential plan. - candidate = - context.parentCandidates.length > 0 ? context.parentCandidates[0] : null; - } - - const transactionPlans: TransactionPlan[] = []; - for (const plan of instructionPlan.plans) { - const transactionPlan = await traverse(plan, { - ...context, - parent: instructionPlan, - parentCandidates: candidate ? [candidate] : [], - }); - if (transactionPlan) { - candidate = getSequentialCandidate(transactionPlan); - const newPlans = - transactionPlan.kind === 'sequential' && - (transactionPlan.divisible || !instructionPlan.divisible) - ? transactionPlan.plans - : [transactionPlan]; - transactionPlans.push(...newPlans); - } - } - - // Wrap in a sequential plan or simplify. - if (transactionPlans.length === 1) { - return transactionPlans[0]; - } - if (transactionPlans.length === 0) { - return null; - } - return { - kind: 'sequential', - divisible: instructionPlan.divisible, - plans: transactionPlans, - }; -} - -async function traverseParallel( - instructionPlan: ParallelInstructionPlan, - context: TraverseContext -): Promise { - const candidates: MutableSingleTransactionPlan[] = [ - ...context.parentCandidates, - ]; - const transactionPlans: TransactionPlan[] = []; - - // Reorder children so message packer plans are last. - const sortedChildren = [ - ...instructionPlan.plans.filter((plan) => plan.kind !== 'messagePacker'), - ...instructionPlan.plans.filter((plan) => plan.kind === 'messagePacker'), - ]; - - for (const plan of sortedChildren) { - const transactionPlan = await traverse(plan, { - ...context, - parent: instructionPlan, - parentCandidates: candidates, - }); - if (transactionPlan) { - candidates.push(...getParallelCandidates(transactionPlan)); - const newPlans = - transactionPlan.kind === 'parallel' - ? transactionPlan.plans - : [transactionPlan]; - transactionPlans.push(...newPlans); - } - } - - // Wrap in a parallel plan or simplify. - if (transactionPlans.length === 1) { - return transactionPlans[0]; - } - if (transactionPlans.length === 0) { - return null; - } - return { kind: 'parallel', plans: transactionPlans }; -} - -async function traverseSingle( - instructionPlan: SingleInstructionPlan, - context: TraverseContext -): Promise { - const predicate = (message: CompilableTransactionMessage) => - appendTransactionMessageInstructions( - [instructionPlan.instruction], - message - ); - const candidate = await selectAndMutateCandidate( - context, - context.parentCandidates, - predicate - ); - if (candidate) { - return null; - } - const message = await createNewMessage(context, instructionPlan, predicate); - return { kind: 'single', message }; -} - -async function traverseMessagePacker( - instructionPlan: MessagePackerInstructionPlan, - context: TraverseContext -): Promise { - const messagePacker = instructionPlan.getMessagePacker(); - const transactionPlans: SingleTransactionPlan[] = []; - const candidates = [...context.parentCandidates]; - - while (!messagePacker.done()) { - const candidate = await selectAndMutateCandidate( - context, - candidates, - messagePacker.packMessageToCapacity - ); - if (!candidate) { - const message = await createNewMessage( - context, - instructionPlan, - messagePacker.packMessageToCapacity - ); - const newPlan: MutableSingleTransactionPlan = { kind: 'single', message }; - transactionPlans.push(newPlan); - } - } - - if (transactionPlans.length === 1) { - return transactionPlans[0]; - } - if (transactionPlans.length === 0) { - return null; - } - if (context.parent?.kind === 'parallel') { - return { kind: 'parallel', plans: transactionPlans }; - } - return { - kind: 'sequential', - divisible: - context.parent?.kind === 'sequential' ? context.parent.divisible : true, - plans: transactionPlans, - }; -} - -function getSequentialCandidate( - latestPlan: MutableTransactionPlan -): MutableSingleTransactionPlan | null { - if (latestPlan.kind === 'single') { - return latestPlan; - } - if (latestPlan.kind === 'sequential' && latestPlan.plans.length > 0) { - return getSequentialCandidate( - latestPlan.plans[latestPlan.plans.length - 1] - ); - } - return null; -} - -function getParallelCandidates( - latestPlan: TransactionPlan -): MutableSingleTransactionPlan[] { - return getAllSingleTransactionPlans(latestPlan); -} - -async function selectAndMutateCandidate( - context: Pick, - candidates: MutableSingleTransactionPlan[], - predicate: ( - message: CompilableTransactionMessage - ) => CompilableTransactionMessage -): Promise { - for (const candidate of candidates) { - try { - const message = await context.onTransactionMessageUpdated( - predicate(candidate.message), - { abortSignal: context.abortSignal } - ); - if (getTransactionSize(message) <= TRANSACTION_SIZE_LIMIT) { - candidate.message = message; - return candidate; - } - } catch (error) { - if ( - error instanceof CannotPackUsingProvidedMessageError || - error instanceof CannotFitEntirePlanInsideMessageError - ) { - // Try the next candidate. - } else { - throw error; - } - } - } - return null; -} - -async function createNewMessage( - context: Pick< - TraverseContext, - 'createTransactionMessage' | 'onTransactionMessageUpdated' | 'abortSignal' - >, - instructionPlan: InstructionPlan, - predicate: ( - message: CompilableTransactionMessage - ) => CompilableTransactionMessage -): Promise { - const newMessage = await context.createTransactionMessage({ - abortSignal: context.abortSignal, - }); - const updatedMessage = await context.onTransactionMessageUpdated( - predicate(newMessage), - { abortSignal: context.abortSignal } - ); - if (getTransactionSize(updatedMessage) > TRANSACTION_SIZE_LIMIT) { - throw new FailedToFitPlanInNewMessageError(instructionPlan, updatedMessage); - } - return updatedMessage; -} - -function freezeTransactionPlan(plan: MutableTransactionPlan): TransactionPlan { - switch (plan.kind) { - case 'single': - return singleTransactionPlan(plan.message); - case 'sequential': - return plan.divisible - ? sequentialTransactionPlan(plan.plans.map(freezeTransactionPlan)) - : nonDivisibleSequentialTransactionPlan( - plan.plans.map(freezeTransactionPlan) - ); - case 'parallel': - return parallelTransactionPlan(plan.plans.map(freezeTransactionPlan)); - default: - plan satisfies never; - throw new Error( - `Unknown transaction plan kind: ${(plan as { kind: string }).kind}` - ); - } -} - -function fitEntirePlanInsideMessage( - instructionPlan: InstructionPlan, - message: CompilableTransactionMessage -): CompilableTransactionMessage { - let newMessage: CompilableTransactionMessage = message; - - switch (instructionPlan.kind) { - case 'sequential': - case 'parallel': - for (const plan of instructionPlan.plans) { - newMessage = fitEntirePlanInsideMessage(plan, newMessage); - } - return newMessage; - case 'single': - // eslint-disable-next-line no-case-declarations - newMessage = appendTransactionMessageInstructions( - [instructionPlan.instruction], - message - ); - if (getTransactionSize(newMessage) > TRANSACTION_SIZE_LIMIT) { - throw new CannotFitEntirePlanInsideMessageError(); - } - return newMessage; - case 'messagePacker': - // eslint-disable-next-line no-case-declarations - const messagePacker = instructionPlan.getMessagePacker(); - while (!messagePacker.done()) { - try { - newMessage = messagePacker.packMessageToCapacity(message); - if (getTransactionSize(newMessage) > TRANSACTION_SIZE_LIMIT) { - throw new CannotFitEntirePlanInsideMessageError(); - } - } catch (error) { - if (error instanceof CannotPackUsingProvidedMessageError) { - throw new CannotFitEntirePlanInsideMessageError(); - } - throw error; - } - } - return newMessage; - default: - instructionPlan satisfies never; - throw new Error( - `Unknown instruction plan kind: ${(instructionPlan as { kind: string }).kind}` - ); - } -} - -// TODO: Below should be SolanaErrors. - -export class FailedToFitPlanInNewMessageError extends Error { - constructor( - public readonly instructionPlan: InstructionPlan, - public readonly transactionMessage: TransactionMessage - ) { - super( - `The provided instruction plan could not fit in a new transaction message.` - ); - this.name = 'FailedToFitPlanInNewMessageError'; - } -} - -class NoInstructionsFoundInInstructionPlanError extends Error { - constructor() { - super('No instructions were found in the provided instruction plan.'); - this.name = 'NoInstructionsFoundInInstructionPlanError'; - } -} - -class CannotFitEntirePlanInsideMessageError extends Error { - constructor() { - super('Cannot fit the entire instruction plan inside the provided message'); - this.name = 'CannotFitEntirePlanInsideMessageError'; - } -} diff --git a/clients/js/src/instructionPlans/transactionPlannerDefault.ts b/clients/js/src/instructionPlans/transactionPlannerDefault.ts deleted file mode 100644 index 08d0ea9..0000000 --- a/clients/js/src/instructionPlans/transactionPlannerDefault.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { - createTransactionMessage, - MicroLamports, - pipe, - setTransactionMessageFeePayerSigner, - TransactionSigner, -} from '@solana/kit'; -import { - fillProvisorySetComputeUnitLimitInstruction, - setTransactionMessageComputeUnitPrice, -} from './computeBudgetHelpers'; -import { setTransactionMessageLifetimeUsingProvisoryBlockhash } from './transactionHelpers'; -import { TransactionPlanner } from './transactionPlanner'; -import { createBaseTransactionPlanner } from './transactionPlannerBase'; - -export function createDefaultTransactionPlanner(config: { - feePayer: TransactionSigner; - computeUnitPrice?: MicroLamports; -}): TransactionPlanner { - return createBaseTransactionPlanner({ - createTransactionMessage: () => - pipe( - createTransactionMessage({ version: 0 }), - setTransactionMessageLifetimeUsingProvisoryBlockhash, - fillProvisorySetComputeUnitLimitInstruction, - (tx) => setTransactionMessageFeePayerSigner(config.feePayer, tx), - (tx) => - config.computeUnitPrice - ? setTransactionMessageComputeUnitPrice(config.computeUnitPrice, tx) - : tx - ), - }); -} diff --git a/clients/js/src/internals.ts b/clients/js/src/internals.ts index 56c5436..5f254d8 100644 --- a/clients/js/src/internals.ts +++ b/clients/js/src/internals.ts @@ -1,16 +1,32 @@ +import { + estimateAndUpdateProvisoryComputeUnitLimitFactory, + estimateComputeUnitLimitFactory, + fillProvisorySetComputeUnitLimitInstruction, + setTransactionMessageComputeUnitPrice, +} from '@solana-program/compute-budget'; import { Address, + assertIsSendableTransaction, + createTransactionMessage, + createTransactionPlanExecutor, + createTransactionPlanner, GetAccountInfoApi, + GetLatestBlockhashApi, + InstructionPlan, MicroLamports, + pipe, Rpc, + sendAndConfirmTransactionFactory, + setTransactionMessageFeePayerSigner, + setTransactionMessageLifetimeUsingBlockhash, + signTransactionMessageWithSigners, + SimulateTransactionApi, + TransactionPlanner, TransactionSigner, } from '@solana/kit'; +import { limitFunction } from 'p-limit'; import { findMetadataPda, SeedArgs } from './generated'; import { getProgramAuthority } from './utils'; -import { - createDefaultTransactionPlanExecutor, - createDefaultTransactionPlanner, -} from './instructionPlans'; export const REALLOC_LIMIT = 10_240; @@ -43,22 +59,67 @@ export async function getPdaDetails(input: { return { metadata, isCanonical, programData }; } -export function getDefaultTransactionPlannerAndExecutor(input: { +export function createDefaultTransactionPlannerAndExecutor(input: { + concurrency?: number; payer: TransactionSigner; priorityFees?: MicroLamports; - rpc: Parameters[0]['rpc']; + rpc: Parameters[0]['rpc'] & + Rpc; rpcSubscriptions: Parameters< - typeof createDefaultTransactionPlanExecutor + typeof sendAndConfirmTransactionFactory >[0]['rpcSubscriptions']; }) { - const planner = createDefaultTransactionPlanner({ - feePayer: input.payer, - computeUnitPrice: input.priorityFees, + const sendAndConfirmTransaction = sendAndConfirmTransactionFactory(input); + const estimateCULimit = estimateComputeUnitLimitFactory(input); + const estimateAndSetCULimit = + estimateAndUpdateProvisoryComputeUnitLimitFactory(estimateCULimit); + + const planner = createTransactionPlanner({ + createTransactionMessage: () => + pipe( + createTransactionMessage({ version: 0 }), + (m) => setTransactionMessageFeePayerSigner(input.payer, m), + (m) => fillProvisorySetComputeUnitLimitInstruction(m), + (m) => + input.priorityFees + ? setTransactionMessageComputeUnitPrice(input.priorityFees, m) + : m + ), }); - const executor = createDefaultTransactionPlanExecutor({ - rpc: input.rpc, - rpcSubscriptions: input.rpcSubscriptions, - parallelChunkSize: 5, + + const executor = createTransactionPlanExecutor({ + executeTransactionMessage: limitFunction( + async (message, config) => { + const { value: latestBlockhash } = await input.rpc + .getLatestBlockhash() + .send(); + const transaction = await pipe( + setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, message), + async (m) => await estimateAndSetCULimit(m, config), + async (m) => await signTransactionMessageWithSigners(await m, config) + ); + assertIsSendableTransaction(transaction); + await sendAndConfirmTransaction(transaction, { + ...config, + commitment: 'confirmed', + }); + return { transaction }; + }, + { concurrency: input.concurrency ?? 5 } + ), }); + return { planner, executor }; } + +export async function isValidInstructionPlan( + instructionPlan: InstructionPlan, + planner: TransactionPlanner +) { + try { + await planner(instructionPlan); + return true; + } catch { + return false; + } +} diff --git a/clients/js/src/updateBuffer.ts b/clients/js/src/updateBuffer.ts index d70ac23..977e019 100644 --- a/clients/js/src/updateBuffer.ts +++ b/clients/js/src/updateBuffer.ts @@ -3,7 +3,9 @@ import { Account, Address, Lamports, + parallelInstructionPlan, ReadonlyUint8Array, + sequentialInstructionPlan, TransactionSigner, } from '@solana/kit'; import { @@ -12,10 +14,6 @@ import { getTrimInstruction, getWriteInstruction, } from './generated'; -import { - parallelInstructionPlan, - sequentialInstructionPlan, -} from './instructionPlans'; import { REALLOC_LIMIT } from './internals'; import { getExtendInstructionPlan, getWriteInstructionPlan } from './utils'; diff --git a/clients/js/src/updateMetadata.ts b/clients/js/src/updateMetadata.ts index a7af747..0b13c44 100644 --- a/clients/js/src/updateMetadata.ts +++ b/clients/js/src/updateMetadata.ts @@ -5,10 +5,13 @@ import { generateKeyPairSigner, GetAccountInfoApi, GetMinimumBalanceForRentExemptionApi, + InstructionPlan, lamports, Lamports, ReadonlyUint8Array, Rpc, + sequentialInstructionPlan, + TransactionPlanner, TransactionSigner, } from '@solana/kit'; import { getCreateBufferInstructionPlan } from './createBuffer'; @@ -23,15 +26,9 @@ import { SetDataInput, } from './generated'; import { - createDefaultTransactionPlanExecutor, - InstructionPlan, - isValidInstructionPlan, - sequentialInstructionPlan, - TransactionPlanner, -} from './instructionPlans'; -import { - getDefaultTransactionPlannerAndExecutor, + createDefaultTransactionPlannerAndExecutor, getPdaDetails, + isValidInstructionPlan, REALLOC_LIMIT, } from './internals'; import { @@ -44,13 +41,14 @@ import { export async function updateMetadata( input: MetadataInput & { rpc: Rpc & - Parameters[0]['rpc']; + Parameters[0]['rpc']; rpcSubscriptions: Parameters< - typeof createDefaultTransactionPlanExecutor + typeof createDefaultTransactionPlannerAndExecutor >[0]['rpcSubscriptions']; } ): Promise { - const { planner, executor } = getDefaultTransactionPlannerAndExecutor(input); + const { planner, executor } = + createDefaultTransactionPlannerAndExecutor(input); const { programData, isCanonical, metadata } = await getPdaDetails(input); const [metadataAccount, buffer] = await Promise.all([ fetchMetadata(input.rpc, metadata), diff --git a/clients/js/src/utils.ts b/clients/js/src/utils.ts index 288451c..8871800 100644 --- a/clients/js/src/utils.ts +++ b/clients/js/src/utils.ts @@ -6,14 +6,18 @@ import { GetAccountInfoApi, getAddressDecoder, getAddressEncoder, + getLinearMessagePackerInstructionPlan, getOptionDecoder, getProgramDerivedAddress, + getReallocMessagePackerInstructionPlan, getStructDecoder, getU32Decoder, getU64Decoder, + MessagePackerInstructionPlan, MicroLamports, ReadonlyUint8Array, Rpc, + TransactionPlanResult, TransactionSigner, unwrapOption, } from '@solana/kit'; @@ -26,12 +30,6 @@ import { getWriteInstruction, SeedArgs, } from './generated'; -import { - getLinearMessagePackerInstructionPlan, - getReallocMessagePackerInstructionPlan, - MessagePackerInstructionPlan, - TransactionPlanResult, -} from './instructionPlans'; export const ACCOUNT_HEADER_LENGTH = 96; diff --git a/clients/js/src/writeMetadata.ts b/clients/js/src/writeMetadata.ts index 749d723..82224bf 100644 --- a/clients/js/src/writeMetadata.ts +++ b/clients/js/src/writeMetadata.ts @@ -1,17 +1,14 @@ import { GetAccountInfoApi, GetMinimumBalanceForRentExemptionApi, + InstructionPlan, MaybeAccount, Rpc, } from '@solana/kit'; import { getCreateMetadataInstructionPlan } from './createMetadata'; import { fetchBuffer, fetchMaybeMetadata, Metadata } from './generated'; import { - createDefaultTransactionPlanExecutor, - InstructionPlan, -} from './instructionPlans'; -import { - getDefaultTransactionPlannerAndExecutor, + createDefaultTransactionPlannerAndExecutor, getPdaDetails, } from './internals'; import { getUpdateMetadataInstructionPlan } from './updateMetadata'; @@ -20,13 +17,14 @@ import { MetadataInput, MetadataResponse } from './utils'; export async function writeMetadata( input: MetadataInput & { rpc: Rpc & - Parameters[0]['rpc']; + Parameters[0]['rpc']; rpcSubscriptions: Parameters< - typeof createDefaultTransactionPlanExecutor + typeof createDefaultTransactionPlannerAndExecutor >[0]['rpcSubscriptions']; } ): Promise { - const { planner, executor } = getDefaultTransactionPlannerAndExecutor(input); + const { planner, executor } = + createDefaultTransactionPlannerAndExecutor(input); const { programData, isCanonical, metadata } = await getPdaDetails(input); const [metadataAccount, buffer] = await Promise.all([ fetchMaybeMetadata(input.rpc, metadata), diff --git a/clients/js/test/_setup.ts b/clients/js/test/_setup.ts index 00341c9..ba83558 100644 --- a/clients/js/test/_setup.ts +++ b/clients/js/test/_setup.ts @@ -7,16 +7,17 @@ import { airdropFactory, appendTransactionMessageInstruction, appendTransactionMessageInstructions, + assertIsSendableTransaction, BASE_ACCOUNT_SIZE, + BaseTransactionMessage, Commitment, - CompilableTransactionMessage, createSolanaRpc, createSolanaRpcSubscriptions, createTransactionMessage, generateKeyPairSigner, getBase64Encoder, getSignatureFromTransaction, - IInstruction, + Instruction, isOption, KeyPairSigner, lamports, @@ -32,6 +33,7 @@ import { SolanaRpcApi, SolanaRpcSubscriptionsApi, TransactionMessageWithBlockhashLifetime, + TransactionMessageWithFeePayer, TransactionSigner, unwrapOption, } from '@solana/kit'; @@ -100,13 +102,15 @@ export const createDefaultTransaction = async ( export const signAndSendTransaction = async ( client: Client, - transactionMessage: CompilableTransactionMessage & + transactionMessage: BaseTransactionMessage & + TransactionMessageWithFeePayer & TransactionMessageWithBlockhashLifetime, commitment: Commitment = 'confirmed' ) => { const signedTransaction = await signTransactionMessageWithSigners(transactionMessage); const signature = getSignatureFromTransaction(signedTransaction); + assertIsSendableTransaction(signedTransaction); await sendAndConfirmTransactionFactory(client)(signedTransaction, { commitment, }); @@ -234,7 +238,7 @@ export async function createBuffer( programData, seed, }); - const instructions: IInstruction[] = [preFundIx, allocateIx]; + const instructions: Instruction[] = [preFundIx, allocateIx]; if (dataLenth >= REALLOC_LIMIT) { let offset = 0; while (offset < dataLenth) { diff --git a/clients/js/test/instructionPlans/_instructionPlanHelpers.ts b/clients/js/test/instructionPlans/_instructionPlanHelpers.ts deleted file mode 100644 index 629a252..0000000 --- a/clients/js/test/instructionPlans/_instructionPlanHelpers.ts +++ /dev/null @@ -1,113 +0,0 @@ -import { - Address, - appendTransactionMessageInstruction, - CompilableTransactionMessage, - fixEncoderSize, - getAddressDecoder, - getU64Encoder, - IInstruction, -} from '@solana/kit'; -import { - CannotPackUsingProvidedMessageError, - getTransactionSize, - MessagePackerInstructionPlan, - MessagePackerIsAlreadyDoneError, - TRANSACTION_SIZE_LIMIT, -} from '../../src'; - -const MINIMUM_INSTRUCTION_SIZE = 35; -const MINIMUM_TRANSACTION_SIZE = 136; -const MAXIMUM_TRANSACTION_SIZE = TRANSACTION_SIZE_LIMIT - 1; // (for shortU16) - -export function messagePackerFactory() { - const baseCounter = 1_000_000_000n; - const messagePackerIncrement = 1_000_000_000n; - let messagePackerCounter = 0n; - return ( - totalBytes: number - ): MessagePackerInstructionPlan & { - get: (bytes: number, index: number) => IInstruction; - } => { - const getInstruction = instructionFactory( - baseCounter + messagePackerCounter - ); - messagePackerCounter += messagePackerIncrement; - const baseInstruction = getInstruction(MINIMUM_INSTRUCTION_SIZE, 0); - - return { - get: getInstruction, - kind: 'messagePacker', - getMessagePacker: () => { - let offset = 0; - return { - done: () => offset >= totalBytes, - packMessageToCapacity: (message) => { - if (offset >= totalBytes) { - throw new MessagePackerIsAlreadyDoneError(); - } - - const baseTransactionSize = getTransactionSize( - appendTransactionMessageInstruction(baseInstruction, message) - ); - const maxLength = - TRANSACTION_SIZE_LIMIT - - baseTransactionSize - - 1; /* Leeway for shortU16 numbers in transaction headers. */ - - if (maxLength <= 0) { - throw new CannotPackUsingProvidedMessageError(); - } - - const length = Math.min( - totalBytes - offset, - maxLength + MINIMUM_INSTRUCTION_SIZE - ); - - const instruction = getInstruction(length); - offset += length; - return appendTransactionMessageInstruction(instruction, message); - }, - }; - }, - }; - }; -} - -export function instructionFactory(baseCounter: bigint = 0n) { - const counterEncoder = fixEncoderSize(getU64Encoder(), 32); - const addressDecoder = getAddressDecoder(); - const getProgramAddress = (counter: bigint): Address => - addressDecoder.decode(counterEncoder.encode(counter)); - - let counter = 0n; - return (bytes: number, counterOverride?: number): IInstruction => { - if (bytes < MINIMUM_INSTRUCTION_SIZE) { - throw new Error( - `Instruction size must be at least ${MINIMUM_INSTRUCTION_SIZE} bytes` - ); - } - const currentCounter = - baseCounter + - (counterOverride === undefined ? counter : BigInt(counterOverride)); - if (counterOverride === undefined) { - counter += 1n; - } - return { - programAddress: getProgramAddress(currentCounter), - data: new Uint8Array(bytes - MINIMUM_INSTRUCTION_SIZE), - }; - }; -} - -export function transactionPercentFactory( - createTransactionMessage?: () => CompilableTransactionMessage -) { - const minimumTransactionSize = createTransactionMessage - ? getTransactionSize(createTransactionMessage()) - : MINIMUM_TRANSACTION_SIZE; - return (percent: number) => { - return Math.floor( - ((MAXIMUM_TRANSACTION_SIZE - minimumTransactionSize) * percent) / 100 - ); - }; -} diff --git a/clients/js/test/instructionPlans/_transactionPlanHelpers.ts b/clients/js/test/instructionPlans/_transactionPlanHelpers.ts deleted file mode 100644 index abc0ccd..0000000 --- a/clients/js/test/instructionPlans/_transactionPlanHelpers.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { - Address, - appendTransactionMessageInstructions, - CompilableTransactionMessage, - IInstruction, - createTransactionMessage as kitCreateTransactionMessage, - pipe, - setTransactionMessageFeePayer, -} from '@solana/kit'; -import { - setTransactionMessageLifetimeUsingProvisoryBlockhash, - SingleTransactionPlan, -} from '../../src'; - -const MOCK_FEE_PAYER = - 'Gm1uVH3JxiLgafByNNmnoxLncB7ytpyWNqX3kRM9tSxN' as Address; - -export const getMockCreateTransactionMessage = () => { - return pipe( - kitCreateTransactionMessage({ version: 0 }), - setTransactionMessageLifetimeUsingProvisoryBlockhash, - (tx) => setTransactionMessageFeePayer(MOCK_FEE_PAYER, tx) - ); -}; - -export function singleTransactionPlanFactory( - createTransactionMessage?: () => CompilableTransactionMessage -) { - return (instructions: IInstruction[] = []): SingleTransactionPlan => { - return { - kind: 'single', - message: appendTransactionMessageInstructions( - instructions, - (createTransactionMessage ?? getMockCreateTransactionMessage)() - ), - }; - }; -} diff --git a/clients/js/test/instructionPlans/_transactionPlanResultHelpers.ts b/clients/js/test/instructionPlans/_transactionPlanResultHelpers.ts deleted file mode 100644 index 83429cd..0000000 --- a/clients/js/test/instructionPlans/_transactionPlanResultHelpers.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { compileTransaction, SolanaError, Transaction } from '@solana/kit'; -import { - ParallelTransactionPlanResult, - SequentialTransactionPlanResult, - SingleTransactionPlan, - SingleTransactionPlanResult, - TransactionPlanResult, -} from '../../src'; - -export function parallelTransactionPlanResult( - plans: TransactionPlanResult[] -): ParallelTransactionPlanResult { - return { kind: 'parallel', plans }; -} - -export function sequentialTransactionPlanResult( - plans: TransactionPlanResult[] -): SequentialTransactionPlanResult { - return { kind: 'sequential', divisible: true, plans }; -} - -export function nonDivisibleSequentialTransactionPlanResult( - plans: TransactionPlanResult[] -): SequentialTransactionPlanResult { - return { kind: 'sequential', divisible: false, plans }; -} - -export function successfulSingleTransactionPlan( - plan: SingleTransactionPlan, - transaction?: Transaction, - context?: object -): SingleTransactionPlanResult { - return { - kind: 'single', - message: plan.message, - status: { - kind: 'successful', - transaction: transaction ?? compileTransaction(plan.message), - context: context ?? {}, - }, - }; -} - -export function failedSingleTransactionPlan( - plan: SingleTransactionPlan, - error: SolanaError -): SingleTransactionPlanResult { - return { - kind: 'single', - message: plan.message, - status: { kind: 'failed', error }, - }; -} - -export function canceledSingleTransactionPlan( - plan: SingleTransactionPlan -): SingleTransactionPlanResult { - return { - kind: 'single', - message: plan.message, - status: { kind: 'canceled' }, - }; -} diff --git a/clients/js/test/instructionPlans/transactionPlanExecutor.test.ts b/clients/js/test/instructionPlans/transactionPlanExecutor.test.ts deleted file mode 100644 index 5bdd941..0000000 --- a/clients/js/test/instructionPlans/transactionPlanExecutor.test.ts +++ /dev/null @@ -1,135 +0,0 @@ -import { compileTransaction, SolanaError } from '@solana/kit'; -import test, { Assertions } from 'ava'; -import { - createBaseTransactionPlanExecutor, - parallelTransactionPlan, - sequentialTransactionPlan, - TransactionPlanResult, -} from '../../src'; -import { singleTransactionPlanFactory } from './_transactionPlanHelpers'; -import { - canceledSingleTransactionPlan, - failedSingleTransactionPlan, - parallelTransactionPlanResult, - sequentialTransactionPlanResult, - successfulSingleTransactionPlan, -} from './_transactionPlanResultHelpers'; - -function getMockSolanaError(): SolanaError { - return {} as SolanaError; -} - -async function assertFailedResult( - t: Assertions, - promise: Promise -): Promise { - const executorError = (await t.throwsAsync(promise)) as Error & { - result: TransactionPlanResult; - }; - return executorError.result; -} - -test('it handles successful single transactions', async (t) => { - const singleTransactionPlan = singleTransactionPlanFactory(); - const plan = singleTransactionPlan(); - - const executor = createBaseTransactionPlanExecutor({ - sendAndConfirm: (tx) => - Promise.resolve({ transaction: compileTransaction(tx) }), - }); - - t.deepEqual(await executor(plan), successfulSingleTransactionPlan(plan)); -}); - -test('it handles failed single transactions', async (t) => { - const singleTransactionPlan = singleTransactionPlanFactory(); - const plan = singleTransactionPlan(); - - const planError = getMockSolanaError(); - const executor = createBaseTransactionPlanExecutor({ - sendAndConfirm: () => Promise.reject(planError), - }); - - const result = await assertFailedResult(t, executor(plan)); - - t.deepEqual(result, failedSingleTransactionPlan(plan, planError)); -}); - -test('it handles aborted single transactions', async (t) => { - const singleTransactionPlan = singleTransactionPlanFactory(); - const plan = singleTransactionPlan(); - - const executor = createBaseTransactionPlanExecutor({ - sendAndConfirm: (tx) => - Promise.resolve({ transaction: compileTransaction(tx) }), - }); - - const abortController = new AbortController(); - abortController.abort(); - const promise = executor(plan, { abortSignal: abortController.signal }); - - const result = await assertFailedResult(t, promise); - - t.deepEqual(result, canceledSingleTransactionPlan(plan)); -}); - -test('it cancels transactions after a failed one in a sequential plan', async (t) => { - const singleTransactionPlan = singleTransactionPlanFactory(); - - const planA = singleTransactionPlan(); - const planB = singleTransactionPlan(); - const planC = singleTransactionPlan(); - - const planBError = getMockSolanaError(); - const executor = createBaseTransactionPlanExecutor({ - sendAndConfirm: (tx) => - tx === planB.message - ? Promise.reject(planBError) - : Promise.resolve({ transaction: compileTransaction(tx) }), - }); - - const promise = executor(sequentialTransactionPlan([planA, planB, planC])); - const result = await assertFailedResult(t, promise); - - t.deepEqual( - result, - sequentialTransactionPlanResult([ - successfulSingleTransactionPlan(planA), - failedSingleTransactionPlan(planB, planBError), - canceledSingleTransactionPlan(planC), - ]) - ); -}); - -test('it cancels transactions after a failed chunk in a chunked parallel plans', async (t) => { - const singleTransactionPlan = singleTransactionPlanFactory(); - - const planA = singleTransactionPlan(); - const planB = singleTransactionPlan(); - const planC = singleTransactionPlan(); - const planD = singleTransactionPlan(); - - const planAError = getMockSolanaError(); - const executor = createBaseTransactionPlanExecutor({ - parallelChunkSize: 2, - sendAndConfirm: (tx) => - tx === planA.message - ? Promise.reject(planAError) - : Promise.resolve({ transaction: compileTransaction(tx) }), - }); - - const promise = executor( - parallelTransactionPlan([planA, planB, planC, planD]) - ); - const result = await assertFailedResult(t, promise); - - t.deepEqual( - result, - parallelTransactionPlanResult([ - failedSingleTransactionPlan(planA, planAError), - successfulSingleTransactionPlan(planB), - canceledSingleTransactionPlan(planC), - canceledSingleTransactionPlan(planD), - ]) - ); -}); diff --git a/clients/js/test/instructionPlans/transactionPlanner.test.ts b/clients/js/test/instructionPlans/transactionPlanner.test.ts deleted file mode 100644 index 5ce9c55..0000000 --- a/clients/js/test/instructionPlans/transactionPlanner.test.ts +++ /dev/null @@ -1,1650 +0,0 @@ -import { - appendTransactionMessageInstruction, - CompilableTransactionMessage, -} from '@solana/kit'; -import test from 'ava'; -import { - createBaseTransactionPlanner, - FailedToFitPlanInNewMessageError, - nonDivisibleSequentialInstructionPlan, - nonDivisibleSequentialTransactionPlan, - parallelInstructionPlan, - parallelTransactionPlan, - sequentialInstructionPlan, - sequentialTransactionPlan, - singleInstructionPlan, -} from '../../src'; -import { - instructionFactory, - messagePackerFactory, - transactionPercentFactory, -} from './_instructionPlanHelpers'; -import { - getMockCreateTransactionMessage, - singleTransactionPlanFactory, -} from './_transactionPlanHelpers'; - -function defaultFactories( - createTransactionMessage?: () => CompilableTransactionMessage -) { - const effectiveCreateTransactionMessage = - createTransactionMessage ?? getMockCreateTransactionMessage; - return { - createPlanner: () => - createBaseTransactionPlanner({ - createTransactionMessage: effectiveCreateTransactionMessage, - }), - instruction: instructionFactory(), - messagePacker: messagePackerFactory(), - txPercent: transactionPercentFactory(effectiveCreateTransactionMessage), - singleTransactionPlan: singleTransactionPlanFactory( - effectiveCreateTransactionMessage - ), - }; -} - -/** - * [A: 42] ───────────────────▶ [Tx: A] - */ -test('it plans a single instruction', async (t) => { - const { createPlanner, instruction, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(42); - - t.deepEqual( - await planner(singleInstructionPlan(instructionA)), - singleTransactionPlan([instructionA]) - ); -}); - -/** - * [A: 200%] ───────────────────▶ Error - */ -test('it fail if a single instruction is too large', async (t) => { - const { createPlanner, instruction, txPercent } = defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(200)); - const promise = planner(singleInstructionPlan(instructionA)); - - const error = (await t.throwsAsync(promise, { - message: - 'The provided instruction plan could not fit in a new transaction message.', - })) as FailedToFitPlanInNewMessageError; - - t.deepEqual(error.instructionPlan, singleInstructionPlan(instructionA)); - t.deepEqual( - error.transactionMessage, - appendTransactionMessageInstruction( - instructionA, - getMockCreateTransactionMessage() - ) - ); -}); - -/** - * [Seq] ───────────────────▶ [Tx: A + B] - * │ - * ├── [A: 50%] - * └── [B: 50%] - */ -test('it plans a sequential plan with instructions that all fit in a single transaction', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(50)); - const instructionB = instruction(txPercent(50)); - - t.deepEqual( - await planner( - sequentialInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - ]) - ), - singleTransactionPlan([instructionA, instructionB]) - ); -}); - -/** - * [Seq] ───────────────────▶ [Seq] - * │ │ - * ├── [A: 50%] ├── [Tx: A + B] - * ├── [B: 50%] └── [Tx: C] - * └── [C: 50%] - */ -test('it plans a sequential plan with instructions that must be split accross multiple transactions (v1)', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(50)); - const instructionB = instruction(txPercent(50)); - const instructionC = instruction(txPercent(50)); - - t.deepEqual( - await planner( - sequentialInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - singleInstructionPlan(instructionC), - ]) - ), - sequentialTransactionPlan([ - singleTransactionPlan([instructionA, instructionB]), - singleTransactionPlan([instructionC]), - ]) - ); -}); - -/** - * [Seq] ───────────────────▶ [Seq] - * │ │ - * ├── [A: 60%] ├── [Tx: A] - * ├── [B: 50%] └── [Tx: B + C] - * └── [C: 50%] - */ -test('it plans a sequential plan with instructions that must be split accross multiple transactions (v2)', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(60)); // Tx A cannot have Ix B. - const instructionB = instruction(txPercent(50)); - const instructionC = instruction(txPercent(50)); - - t.deepEqual( - await planner( - sequentialInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - singleInstructionPlan(instructionC), - ]) - ), - sequentialTransactionPlan([ - singleTransactionPlan([instructionA]), - singleTransactionPlan([instructionB, instructionC]), - ]) - ); -}); - -/** - * [Seq] ───────────────────▶ [Tx: A + B] - * │ - * ├── [A: 50%] - * ├── [Seq] - * └── [Seq] - * └── [B: 50%] - */ -test('it simplifies sequential plans with one child or less', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(50)); - const instructionB = instruction(txPercent(50)); - - t.deepEqual( - await planner( - sequentialInstructionPlan([ - singleInstructionPlan(instructionA), - sequentialInstructionPlan([]), - sequentialInstructionPlan([singleInstructionPlan(instructionB)]), - ]) - ), - singleTransactionPlan([instructionA, instructionB]) - ); -}); - -/** - * [Seq] ──────────────────────▶ [Seq] - * │ │ - * ├── [A: 100%] ├── [Tx: A] - * └── [Seq] ├── [Tx: B] - * ├── [B: 100%] └── [Tx: C] - * └── [C: 100%] - */ -test('it simplifies nested sequential plans', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(100)); - const instructionB = instruction(txPercent(100)); - const instructionC = instruction(txPercent(100)); - - t.deepEqual( - await planner( - sequentialInstructionPlan([ - singleInstructionPlan(instructionA), - sequentialInstructionPlan([ - singleInstructionPlan(instructionB), - singleInstructionPlan(instructionC), - ]), - ]) - ), - sequentialTransactionPlan([ - singleTransactionPlan([instructionA]), - singleTransactionPlan([instructionB]), - singleTransactionPlan([instructionC]), - ]) - ); -}); - -/** - * [Seq] ──────────────────────▶ [Seq] - * │ │ - * ├── [A: 50%] ├── [Tx: A + B] - * ├── [Seq] └── [Tx: C + D] - * │ ├── [B: 50%] - * │ └── [C: 50%] - * └── [D: 50%] - */ -test('it simplifies sequential plans nested in the middle', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(50)); - const instructionB = instruction(txPercent(50)); - const instructionC = instruction(txPercent(50)); - const instructionD = instruction(txPercent(50)); - - t.deepEqual( - await planner( - sequentialInstructionPlan([ - singleInstructionPlan(instructionA), - sequentialInstructionPlan([ - singleInstructionPlan(instructionB), - singleInstructionPlan(instructionC), - ]), - singleInstructionPlan(instructionD), - ]) - ), - sequentialTransactionPlan([ - singleTransactionPlan([instructionA, instructionB]), - singleTransactionPlan([instructionC, instructionD]), - ]) - ); -}); - -/** - * [Par] ───────────────────▶ [Tx: A + B] - * │ - * ├── [A: 50%] - * └── [B: 50%] - */ -test('it plans a parallel plan with instructions that all fit in a single transaction', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(50)); - const instructionB = instruction(txPercent(50)); - - t.deepEqual( - await planner( - parallelInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - ]) - ), - singleTransactionPlan([instructionA, instructionB]) - ); -}); - -/** - * [Par] ───────────────────▶ [Par] - * │ │ - * ├── [A: 50%] ├── [Tx: A + B] - * ├── [B: 50%] └── [Tx: C] - * └── [C: 50%] - */ -test('it plans a parallel plan with instructions that must be split accross multiple transactions (v1)', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(50)); - const instructionB = instruction(txPercent(50)); - const instructionC = instruction(txPercent(50)); - - t.deepEqual( - await planner( - parallelInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - singleInstructionPlan(instructionC), - ]) - ), - parallelTransactionPlan([ - singleTransactionPlan([instructionA, instructionB]), - singleTransactionPlan([instructionC]), - ]) - ); -}); - -/** - * [Par] ───────────────────▶ [Par] - * │ │ - * ├── [A: 60%] ├── [Tx: A] - * ├── [B: 50%] └── [Tx: B + C] - * └── [C: 50%] - */ -test('it plans a parallel plan with instructions that must be split accross multiple transactions (v2)', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(60)); // Tx A cannot have Ix B. - const instructionB = instruction(txPercent(50)); - const instructionC = instruction(txPercent(50)); - - t.deepEqual( - await planner( - parallelInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - singleInstructionPlan(instructionC), - ]) - ), - parallelTransactionPlan([ - singleTransactionPlan([instructionA]), - singleTransactionPlan([instructionB, instructionC]), - ]) - ); -}); - -/** - * [Par] ───────────────────▶ [Tx: A + B] - * │ - * ├── [A: 50%] - * ├── [Par] - * └── [Par] - * └── [B: 50%] - */ -test('it simplifies parallel plans with one child or less', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(50)); - const instructionB = instruction(txPercent(50)); - - t.deepEqual( - await planner( - parallelInstructionPlan([ - singleInstructionPlan(instructionA), - parallelInstructionPlan([]), - parallelInstructionPlan([singleInstructionPlan(instructionB)]), - ]) - ), - singleTransactionPlan([instructionA, instructionB]) - ); -}); - -/** - * [Par] ──────────────────────▶ [Par] - * │ │ - * ├── [A: 100%] ├── [Tx: A] - * └── [Par] ├── [Tx: B] - * ├── [B: 100%] └── [Tx: C] - * └── [C: 100%] - */ -test('it simplifies nested parallel plans', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(100)); - const instructionB = instruction(txPercent(100)); - const instructionC = instruction(txPercent(100)); - - t.deepEqual( - await planner( - parallelInstructionPlan([ - singleInstructionPlan(instructionA), - parallelInstructionPlan([ - singleInstructionPlan(instructionB), - singleInstructionPlan(instructionC), - ]), - ]) - ), - parallelTransactionPlan([ - singleTransactionPlan([instructionA]), - singleTransactionPlan([instructionB]), - singleTransactionPlan([instructionC]), - ]) - ); -}); - -/** - * [Par] ───────────────────▶ [Par] - * │ │ - * ├── [Seq] ├── [Tx: A + B + D] - * │ ├── [A: 50%] └── [Tx: C] - * │ └── [B: 25%] - * ├── [C: 90%] - * └── [D: 25%] - */ -test('it re-uses previous parallel transactions if there is space', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(50)); - const instructionB = instruction(txPercent(25)); - const instructionC = instruction(txPercent(90)); - const instructionD = instruction(txPercent(25)); - - t.deepEqual( - await planner( - parallelInstructionPlan([ - sequentialInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - ]), - singleInstructionPlan(instructionC), - singleInstructionPlan(instructionD), - ]) - ), - parallelTransactionPlan([ - singleTransactionPlan([instructionA, instructionB, instructionD]), - singleTransactionPlan([instructionC]), - ]) - ); -}); - -/** - * [Par] ───────────────────▶ [Tx: A + B + C + D] - * │ - * ├── [Seq] - * │ ├── [A: 25%] - * │ └── [B: 25%] - * └── [Seq] - * ├── [C: 25%] - * └── [D: 25%] - */ -test('it can merge sequential plans in a parallel plan if the whole sequential plan fits', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(25)); - const instructionB = instruction(txPercent(25)); - const instructionC = instruction(txPercent(25)); - const instructionD = instruction(txPercent(25)); - - t.deepEqual( - await planner( - parallelInstructionPlan([ - sequentialInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - ]), - sequentialInstructionPlan([ - singleInstructionPlan(instructionC), - singleInstructionPlan(instructionD), - ]), - ]) - ), - singleTransactionPlan([ - instructionA, - instructionB, - instructionC, - instructionD, - ]) - ); -}); - -/** - * [Par] ───────────────────▶ [Par] - * │ │ - * ├── [Seq] ├── [Tx: A + B] - * │ ├── [A: 33%] └── [Tx: C + D] - * │ └── [B: 33%] - * └── [Seq] - * ├── [C: 33%] - * └── [D: 33%] - */ -test('it does not split a sequential plan on a parallel parent', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(33)); - const instructionB = instruction(txPercent(33)); - const instructionC = instruction(txPercent(33)); - const instructionD = instruction(txPercent(33)); - - t.deepEqual( - await planner( - parallelInstructionPlan([ - sequentialInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - ]), - sequentialInstructionPlan([ - singleInstructionPlan(instructionC), - singleInstructionPlan(instructionD), - ]), - ]) - ), - parallelTransactionPlan([ - singleTransactionPlan([instructionA, instructionB]), - singleTransactionPlan([instructionC, instructionD]), - ]) - ); -}); - -/** - * [Seq] ───────────────────▶ [Seq] - * │ │ - * ├── [Par] ├── [Tx: A + B + C] - * │ ├── [A: 33%] └── [Tx: D] - * │ └── [B: 33%] - * └── [Par] - * ├── [C: 33%] - * └── [D: 33%] - */ -test('it can split parallel plans inside sequential plans as long as they follow the sequence', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(33)); - const instructionB = instruction(txPercent(33)); - const instructionC = instruction(txPercent(33)); - const instructionD = instruction(txPercent(33)); - - t.deepEqual( - await planner( - sequentialInstructionPlan([ - parallelInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - ]), - parallelInstructionPlan([ - singleInstructionPlan(instructionC), - singleInstructionPlan(instructionD), - ]), - ]) - ), - sequentialTransactionPlan([ - singleTransactionPlan([instructionA, instructionB, instructionC]), - singleTransactionPlan([instructionD]), - ]) - ); -}); - -/** - * [Seq] ───────────────────▶ [Seq] - * │ │ - * ├── [Par] ├── [Tx: A + B] - * │ ├── [A: 33%] ├── [Tx: C + D] - * │ └── [B: 33%] └── [Tx: E + F] - * ├── [Par] - * │ ├── [C: 50%] - * │ └── [D: 50%] - * └── [Par] - * ├── [E: 33%] - * └── [F: 33%] - */ -test('it cannnot split a parallel plan in a sequential plan if that would break the sequence', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(33)); - const instructionB = instruction(txPercent(33)); - const instructionC = instruction(txPercent(50)); - const instructionD = instruction(txPercent(50)); - const instructionE = instruction(txPercent(33)); - const instructionF = instruction(txPercent(33)); - - t.deepEqual( - await planner( - sequentialInstructionPlan([ - parallelInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - ]), - parallelInstructionPlan([ - singleInstructionPlan(instructionC), - singleInstructionPlan(instructionD), - ]), - parallelInstructionPlan([ - singleInstructionPlan(instructionE), - singleInstructionPlan(instructionF), - ]), - ]) - ), - sequentialTransactionPlan([ - singleTransactionPlan([instructionA, instructionB]), - singleTransactionPlan([instructionC, instructionD]), - singleTransactionPlan([instructionE, instructionF]), - ]) - ); -}); - -/** - * [NonDivSeq] ───────────────────▶ [Tx: A + B] - * │ - * ├── [A: 50%] - * └── [B: 50%] - */ -test('it plans an non-divisible sequential plan with instructions that all fit in a single transaction', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(50)); - const instructionB = instruction(txPercent(50)); - - t.deepEqual( - await planner( - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - ]) - ), - singleTransactionPlan([instructionA, instructionB]) - ); -}); - -/** - * [NonDivSeq] ─────────────▶ [NonDivSeq] - * │ │ - * ├── [A: 50%] ├── [Tx: A + B] - * ├── [B: 50%] └── [Tx: C] - * └── [C: 50%] - */ -test('it plans a non-divisible sequential plan with instructions that must be split accross multiple transactions (v1)', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(50)); - const instructionB = instruction(txPercent(50)); - const instructionC = instruction(txPercent(50)); - - t.deepEqual( - await planner( - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - singleInstructionPlan(instructionC), - ]) - ), - nonDivisibleSequentialTransactionPlan([ - singleTransactionPlan([instructionA, instructionB]), - singleTransactionPlan([instructionC]), - ]) - ); -}); - -/** - * [NonDivSeq] ─────────────▶ [NonDivSeq] - * │ │ - * ├── [A: 60%] ├── [Tx: A] - * ├── [B: 50%] └── [Tx: B + C] - * └── [C: 50%] - */ -test('it plans a non-divisible sequential plan with instructions that must be split accross multiple transactions (v2)', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(60)); // Tx A cannot have Ix B. - const instructionB = instruction(txPercent(50)); - const instructionC = instruction(txPercent(50)); - - t.deepEqual( - await planner( - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - singleInstructionPlan(instructionC), - ]) - ), - nonDivisibleSequentialTransactionPlan([ - singleTransactionPlan([instructionA]), - singleTransactionPlan([instructionB, instructionC]), - ]) - ); -}); - -/** - * [NonDivSeq] ─────────────▶ [Tx: A + B] - * │ - * ├── [A: 50%] - * ├── [NonDivSeq] - * └── [NonDivSeq] - * └── [B: 50%] - */ -test('it simplifies non-divisible sequential plans with one child or less', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(50)); - const instructionB = instruction(txPercent(50)); - - t.deepEqual( - await planner( - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionA), - nonDivisibleSequentialInstructionPlan([]), - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionB), - ]), - ]) - ), - singleTransactionPlan([instructionA, instructionB]) - ); -}); - -/** - * [NonDivSeq] ────────────────▶ [NonDivSeq] - * │ │ - * ├── [A: 100%] ├── [Tx: A] - * └── [NonDivSeq] ├── [Tx: B] - * ├── [B: 100%] └── [Tx: C] - * └── [C: 100%] - */ -test('it simplifies nested non-divisible sequential plans', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(100)); - const instructionB = instruction(txPercent(100)); - const instructionC = instruction(txPercent(100)); - - t.deepEqual( - await planner( - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionA), - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionB), - singleInstructionPlan(instructionC), - ]), - ]) - ), - nonDivisibleSequentialTransactionPlan([ - singleTransactionPlan([instructionA]), - singleTransactionPlan([instructionB]), - singleTransactionPlan([instructionC]), - ]) - ); -}); - -/** - * [NonDivSeq] ────────────────▶ [NonDivSeq] - * │ │ - * ├── [A: 100%] ├── [Tx: A] - * └── [Seq] ├── [Tx: B] - * ├── [B: 100%] └── [Tx: C] - * └── [C: 100%] - */ -test('it simplifies divisible sequential plans inside non-divisible sequential plans', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(100)); - const instructionB = instruction(txPercent(100)); - const instructionC = instruction(txPercent(100)); - - t.deepEqual( - await planner( - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionA), - sequentialInstructionPlan([ - singleInstructionPlan(instructionB), - singleInstructionPlan(instructionC), - ]), - ]) - ), - nonDivisibleSequentialTransactionPlan([ - singleTransactionPlan([instructionA]), - singleTransactionPlan([instructionB]), - singleTransactionPlan([instructionC]), - ]) - ); -}); - -/** - * [Seq] ──────────────────────▶ [Seq] - * │ │ - * ├── [A: 100%] ├── [Tx: A] - * └── [NonDivSeq] └── [NonDivSeq] - * ├── [B: 100%] ├── [Tx: B] - * └── [C: 100%] └── [Tx: C] - */ -test('it does not simplify non-divisible sequential plans inside divisible sequential plans', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(100)); - const instructionB = instruction(txPercent(100)); - const instructionC = instruction(txPercent(100)); - - t.deepEqual( - await planner( - sequentialInstructionPlan([ - singleInstructionPlan(instructionA), - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionB), - singleInstructionPlan(instructionC), - ]), - ]) - ), - sequentialTransactionPlan([ - singleTransactionPlan([instructionA]), - nonDivisibleSequentialTransactionPlan([ - singleTransactionPlan([instructionB]), - singleTransactionPlan([instructionC]), - ]), - ]) - ); -}); - -/** - * [Par] ───────────────────▶ [Tx: A + B + C + D] - * │ - * ├── [NonDivSeq] - * │ ├── [A: 25%] - * │ └── [B: 25%] - * └── [NonDivSeq] - * ├── [C: 25%] - * └── [D: 25%] - */ -test('it can merge non-divisible sequential plans in a parallel plan if the whole sequential plan fits', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(25)); - const instructionB = instruction(txPercent(25)); - const instructionC = instruction(txPercent(25)); - const instructionD = instruction(txPercent(25)); - - t.deepEqual( - await planner( - parallelInstructionPlan([ - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - ]), - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionC), - singleInstructionPlan(instructionD), - ]), - ]) - ), - singleTransactionPlan([ - instructionA, - instructionB, - instructionC, - instructionD, - ]) - ); -}); - -/** - * [Par] ───────────────────▶ [Par] - * │ │ - * ├── [NonDivSeq] ├── [Tx: A + B] - * │ ├── [A: 33%] └── [Tx: C + D] - * │ └── [B: 33%] - * └── [NonDivSeq] - * ├── [C: 33%] - * └── [D: 33%] - */ -test('it does not split a non-divisible sequential plan on a parallel parent', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(33)); - const instructionB = instruction(txPercent(33)); - const instructionC = instruction(txPercent(33)); - const instructionD = instruction(txPercent(33)); - - t.deepEqual( - await planner( - parallelInstructionPlan([ - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - ]), - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionC), - singleInstructionPlan(instructionD), - ]), - ]) - ), - parallelTransactionPlan([ - singleTransactionPlan([instructionA, instructionB]), - singleTransactionPlan([instructionC, instructionD]), - ]) - ); -}); - -/** - * [Seq] ───────────────────▶ [Tx: A + B + C + D] - * │ - * ├── [NonDivSeq] - * │ ├── [A: 25%] - * │ └── [B: 25%] - * └── [NonDivSeq] - * ├── [C: 25%] - * └── [D: 25%] - */ -test('it can merge non-divisible sequential plans in a sequential plan if the whole plan fits', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(25)); - const instructionB = instruction(txPercent(25)); - const instructionC = instruction(txPercent(25)); - const instructionD = instruction(txPercent(25)); - - t.deepEqual( - await planner( - sequentialInstructionPlan([ - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - ]), - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionC), - singleInstructionPlan(instructionD), - ]), - ]) - ), - singleTransactionPlan([ - instructionA, - instructionB, - instructionC, - instructionD, - ]) - ); -}); - -/** - * [Seq] ───────────────────▶ [Seq] - * │ │ - * ├── [NonDivSeq] ├── [Tx: A + B] - * │ ├── [A: 33%] └── [Tx: C + D] - * │ └── [B: 33%] - * └── [NonDivSeq] - * ├── [C: 33%] - * └── [D: 33%] - */ -test('it does not split a non-divisible sequential plan on a sequential parent', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(33)); - const instructionB = instruction(txPercent(33)); - const instructionC = instruction(txPercent(33)); - const instructionD = instruction(txPercent(33)); - - t.deepEqual( - await planner( - sequentialInstructionPlan([ - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - ]), - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionC), - singleInstructionPlan(instructionD), - ]), - ]) - ), - sequentialTransactionPlan([ - singleTransactionPlan([instructionA, instructionB]), - singleTransactionPlan([instructionC, instructionD]), - ]) - ); -}); - -/** - * [NonDivSeq] ─────────────▶ [NonDivSeq] - * │ │ - * ├── [Par] ├── [Tx: A + B] - * │ ├── [A: 50%] └── [Par] - * │ └── [B: 50%] ├── [Tx: C] - * └── [Par] └── [Tx: D] - * ├── [C: 100%] - * └── [D: 100%] - */ -test('it plans non-divisible sequentials plans with parallel children', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(50)); - const instructionB = instruction(txPercent(50)); - const instructionC = instruction(txPercent(100)); - const instructionD = instruction(txPercent(100)); - - t.deepEqual( - await planner( - nonDivisibleSequentialInstructionPlan([ - parallelInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - ]), - parallelInstructionPlan([ - singleInstructionPlan(instructionC), - singleInstructionPlan(instructionD), - ]), - ]) - ), - nonDivisibleSequentialTransactionPlan([ - singleTransactionPlan([instructionA, instructionB]), - parallelTransactionPlan([ - singleTransactionPlan([instructionC]), - singleTransactionPlan([instructionD]), - ]), - ]) - ); -}); - -/** - * [NonDivSeq] ─────────────▶ [NonDivSeq] - * │ │ - * ├── [Seq] ├── [Tx: A + B] - * │ ├── [A: 50%] ├── [Tx: C] - * │ └── [B: 50%] └── [Tx: D] - * └── [Seq] - * ├── [C: 100%] - * └── [D: 100%] - */ -test('it plans non-divisible sequentials plans with divisible sequential children', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(50)); - const instructionB = instruction(txPercent(50)); - const instructionC = instruction(txPercent(100)); - const instructionD = instruction(txPercent(100)); - - t.deepEqual( - await planner( - nonDivisibleSequentialInstructionPlan([ - sequentialInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - ]), - sequentialInstructionPlan([ - singleInstructionPlan(instructionC), - singleInstructionPlan(instructionD), - ]), - ]) - ), - nonDivisibleSequentialTransactionPlan([ - singleTransactionPlan([instructionA, instructionB]), - singleTransactionPlan([instructionC]), - singleTransactionPlan([instructionD]), - ]) - ); -}); - -/** - * [A(x, 250%)] ─────────────▶ [Seq] - * │ - * ├── [Tx: A(1, 100%)] - * ├── [Tx: A(2, 100%)] - * └── [Tx: A(3, 50%)] - */ -test('it iterate over message packer instruction plans', async (t) => { - const { createPlanner, txPercent, messagePacker, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const messagePackerIx = messagePacker(txPercent(250)); - - t.deepEqual( - await planner(messagePackerIx), - sequentialTransactionPlan([ - singleTransactionPlan([messagePackerIx.get(txPercent(100), 0)]), - singleTransactionPlan([messagePackerIx.get(txPercent(100), 1)]), - singleTransactionPlan([messagePackerIx.get(txPercent(50), 2)]), - ]) - ); -}); - -/** - * [Seq] ───────────────────▶ [Tx: A + B(1, 50%)] - * │ - * ├── [A: 50%] - * └── [B(x, 50%)] - */ -test('it combines single instruction plans with message packer instruction plans', async (t) => { - const { - createPlanner, - txPercent, - messagePacker, - instruction, - singleTransactionPlan, - } = defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(50)); - const messagePackerB = messagePacker(txPercent(50)); - - t.deepEqual( - await planner( - sequentialInstructionPlan([ - singleInstructionPlan(instructionA), - messagePackerB, - ]) - ), - singleTransactionPlan([instructionA, messagePackerB.get(txPercent(50), 0)]) - ); -}); - -/** - * [Par] ────────────────────▶ [Par] - * │ │ - * └── [A(x, 250%)] ├── [Tx: A(1, 100%)] - * ├── [Tx: A(2, 100%)] - * └── [Tx: A(3, 50%)] - */ -test('it can handle parallel message packer instruction plans', async (t) => { - const { createPlanner, txPercent, messagePacker, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const messagePackerA = messagePacker(txPercent(250)); - - t.deepEqual( - await planner(parallelInstructionPlan([messagePackerA])), - parallelTransactionPlan([ - singleTransactionPlan([messagePackerA.get(txPercent(100), 0)]), - singleTransactionPlan([messagePackerA.get(txPercent(100), 1)]), - singleTransactionPlan([messagePackerA.get(txPercent(50), 2)]), - ]) - ); -}); - -/** - * [NonDivSeq] ──────────────▶ [NonDivSeq] - * │ │ - * └── [A(x, 250%)] ├── [Tx: A(1, 100%)] - * ├── [Tx: A(2, 100%)] - * └── [Tx: A(3, 50%)] - */ -test('it can handle non-divisible sequential message packer instruction plans', async (t) => { - const { createPlanner, txPercent, messagePacker, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const messagePackerA = messagePacker(txPercent(250)); - - t.deepEqual( - await planner(nonDivisibleSequentialInstructionPlan([messagePackerA])), - nonDivisibleSequentialTransactionPlan([ - singleTransactionPlan([messagePackerA.get(txPercent(100), 0)]), - singleTransactionPlan([messagePackerA.get(txPercent(100), 1)]), - singleTransactionPlan([messagePackerA.get(txPercent(50), 2)]), - ]) - ); -}); - -/** - * [A(x, 100%)] ─────────────▶ [Tx: A(1, 100%)] - */ -test('it simplifies message packer instruction plans that fit in a single transaction', async (t) => { - const { createPlanner, txPercent, messagePacker, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const messagePackerA = messagePacker(txPercent(100)); - - t.deepEqual( - await planner(messagePackerA), - singleTransactionPlan([messagePackerA.get(txPercent(100), 0)]) - ); -}); - -/** - * [Par] ─────────────────────▶ [Par] - * │ │ - * ├── [A: 75%] ├── [Tx: A + C(1, 25%)] - * ├── [B: 50%] ├── [Tx: B + C(2, 50%)] - * └── [C(x, 125%)] └── [Tx: C(3, 50%)] - */ -test('it uses message packer instruction plans to fill gaps in parallel candidates', async (t) => { - const { - createPlanner, - txPercent, - instruction, - messagePacker, - singleTransactionPlan, - } = defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(75)); - const instructionB = instruction(txPercent(50)); - const messagePackerC = messagePacker( - txPercent(25) + txPercent(50) + txPercent(50) - ); // 125% - - t.deepEqual( - await planner( - parallelInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - messagePackerC, - ]) - ), - parallelTransactionPlan([ - singleTransactionPlan([ - instructionA, - messagePackerC.get(txPercent(25), 0), - ]), - singleTransactionPlan([ - instructionB, - messagePackerC.get(txPercent(50), 1), - ]), - singleTransactionPlan([messagePackerC.get(txPercent(50), 2)]), - ]) - ); -}); - -/** - * [Par] ─────────────────────▶ [Par] - * │ │ - * ├── [A(x, 125%)] ├── [Tx: B + A(1, 25%)] - * ├── [C: 50%] ├── [Tx: C + A(2, 50%)] - * └── [B: 75%] └── [Tx: A(3, 50%)] - */ -test('it handles parallel message packer instruction plans last to fill gaps in previous parallel candidates', async (t) => { - const { - createPlanner, - txPercent, - instruction, - messagePacker, - singleTransactionPlan, - } = defaultFactories(); - const planner = createPlanner(); - - const messagePackerA = messagePacker( - txPercent(25) + txPercent(50) + txPercent(50) - ); // 125% - const instructionB = instruction(txPercent(75)); - const instructionC = instruction(txPercent(50)); - - t.deepEqual( - await planner( - parallelInstructionPlan([ - messagePackerA, - singleInstructionPlan(instructionB), - singleInstructionPlan(instructionC), - ]) - ), - parallelTransactionPlan([ - singleTransactionPlan([ - instructionB, - messagePackerA.get(txPercent(25), 0), - ]), - singleTransactionPlan([ - instructionC, - messagePackerA.get(txPercent(50), 1), - ]), - singleTransactionPlan([messagePackerA.get(txPercent(50), 2)]), - ]) - ); -}); - -/** - * [Seq] ─────────────────────▶ [Seq] - * │ │ - * ├── [A: 75%] ├── [Tx: A + B(1, 25%)] - * ├── [B(x, 75%)] └── [Tx: B(2, 50%) + C] - * └── [C: 50%] - */ -test('it uses message packer instruction plans to fill gaps in sequential candidates', async (t) => { - const { - createPlanner, - txPercent, - instruction, - messagePacker, - singleTransactionPlan, - } = defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(75)); - const messagePackerB = messagePacker(txPercent(25) + txPercent(50)); // 75% - const instructionC = instruction(txPercent(50)); - - t.deepEqual( - await planner( - sequentialInstructionPlan([ - singleInstructionPlan(instructionA), - messagePackerB, - singleInstructionPlan(instructionC), - ]) - ), - sequentialTransactionPlan([ - singleTransactionPlan([ - instructionA, - messagePackerB.get(txPercent(25), 0), - ]), - singleTransactionPlan([ - messagePackerB.get(txPercent(50), 1), - instructionC, - ]), - ]) - ); -}); - -/** - * [NonDivSeq] ───────────────▶ [NonDivSeq] - * │ │ - * ├── [A: 75%] ├── [Tx: A + B(1, 25%)] - * ├── [B(x, 75%)] └── [Tx: B(2, 50%) + C] - * └── [C: 50%] - */ -test('it uses message packer instruction plans to fill gaps in non-divisible sequential candidates', async (t) => { - const { - createPlanner, - txPercent, - instruction, - messagePacker, - singleTransactionPlan, - } = defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(75)); - const messagePackerB = messagePacker(txPercent(25) + txPercent(50)); // 75% - const instructionC = instruction(txPercent(50)); - - t.deepEqual( - await planner( - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionA), - messagePackerB, - singleInstructionPlan(instructionC), - ]) - ), - nonDivisibleSequentialTransactionPlan([ - singleTransactionPlan([ - instructionA, - messagePackerB.get(txPercent(25), 0), - ]), - singleTransactionPlan([ - messagePackerB.get(txPercent(50), 1), - instructionC, - ]), - ]) - ); -}); - -/** - * [Seq] ───────────────────────▶ [Seq] - * │ │ - * ├── [A: 75%] ├── [Tx: A + B(1, 25%)] - * └── [Par] └── [Tx: C + B(2, 50%)] - * ├── [B(x, 75%)] - * └── [C: 50%] - */ -test('it uses parallel message packer instruction plans to fill gaps in sequential candidates', async (t) => { - const { - createPlanner, - txPercent, - instruction, - messagePacker, - singleTransactionPlan, - } = defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(75)); - const messagePackerB = messagePacker(txPercent(25) + txPercent(50)); // 75% - const instructionC = instruction(txPercent(50)); - - t.deepEqual( - await planner( - sequentialInstructionPlan([ - singleInstructionPlan(instructionA), - parallelInstructionPlan([ - messagePackerB, - singleInstructionPlan(instructionC), - ]), - ]) - ), - sequentialTransactionPlan([ - singleTransactionPlan([ - instructionA, - messagePackerB.get(txPercent(25), 0), - ]), - singleTransactionPlan([ - instructionC, - messagePackerB.get(txPercent(50), 1), - ]), - ]) - ); -}); - -/** - * [Par] ─────────────────────────▶ [Tx: A + B(1, 50%) + C] - * │ - * ├── [A: 25%] - * └── [Seq] - * ├── [B(x, 50%)] - * └── [C: 25%] - */ -test('it uses the whole sequential message packer instruction plan when it fits in the parent parallel candidate', async (t) => { - const { - createPlanner, - txPercent, - instruction, - messagePacker, - singleTransactionPlan, - } = defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(25)); - const messagePackerB = messagePacker(txPercent(50)); - const instructionC = instruction(txPercent(25)); - - t.deepEqual( - await planner( - parallelInstructionPlan([ - singleInstructionPlan(instructionA), - sequentialInstructionPlan([ - messagePackerB, - singleInstructionPlan(instructionC), - ]), - ]) - ), - singleTransactionPlan([ - instructionA, - messagePackerB.get(txPercent(50), 0), - instructionC, - ]) - ); -}); - -/** - * [Seq] ─────────────────────────▶ [Tx: A + B(1, 50%) + C] - * │ - * ├── [A: 25%] - * └── [NonDivSeq] - * ├── [B(x, 50%)] - * └── [C: 25%] - */ -test('it uses the whole non-divisible sequential message packer instruction plan when it fits in the parent sequential candidate', async (t) => { - const { - createPlanner, - txPercent, - instruction, - messagePacker, - singleTransactionPlan, - } = defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(25)); - const messagePackerB = messagePacker(txPercent(50)); - const instructionC = instruction(txPercent(25)); - - t.deepEqual( - await planner( - sequentialInstructionPlan([ - singleInstructionPlan(instructionA), - nonDivisibleSequentialInstructionPlan([ - messagePackerB, - singleInstructionPlan(instructionC), - ]), - ]) - ), - singleTransactionPlan([ - instructionA, - messagePackerB.get(txPercent(50), 0), - instructionC, - ]) - ); -}); - -/** - * [Par] ───────────────────────────▶ [Par] - * │ │ - * ├── [Seq] ├── [Tx: A + B] - * │ ├── [A: 40%] └── [NonDivSeq] - * │ └── [B: 40%] ├── [Tx: C + D + E + G] - * ├── [NonDivSeq] └── [Tx: F] - * │ ├── [Par] - * │ │ ├── [C: 25%] - * │ │ └── [D: 25%] - * │ └── [Par] - * │ ├── [E: 25%] - * │ └── [F: 50%] - * └── [G: 25%] - */ -test('complex example 1', async (t) => { - const { createPlanner, instruction, txPercent, singleTransactionPlan } = - defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(40)); - const instructionB = instruction(txPercent(40)); - const instructionC = instruction(txPercent(25)); - const instructionD = instruction(txPercent(25)); - const instructionE = instruction(txPercent(25)); - const instructionF = instruction(txPercent(50)); - const instructionG = instruction(txPercent(25)); - - t.deepEqual( - await planner( - parallelInstructionPlan([ - sequentialInstructionPlan([ - singleInstructionPlan(instructionA), - singleInstructionPlan(instructionB), - ]), - nonDivisibleSequentialInstructionPlan([ - parallelInstructionPlan([ - singleInstructionPlan(instructionC), - singleInstructionPlan(instructionD), - ]), - parallelInstructionPlan([ - singleInstructionPlan(instructionE), - singleInstructionPlan(instructionF), - ]), - ]), - singleInstructionPlan(instructionG), - ]) - ), - parallelTransactionPlan([ - singleTransactionPlan([instructionA, instructionB]), - nonDivisibleSequentialTransactionPlan([ - singleTransactionPlan([ - instructionC, - instructionD, - instructionE, - instructionG, - ]), - singleTransactionPlan([instructionF]), - ]), - ]) - ); -}); - -/** - * [Seq] ─────────────────────────────────▶ [Seq] - * │ │ - * ├── [A: 20%] ├── [Tx: A + B + C + E(1, 40%)] - * ├── [NonDivSeq] ├── [Par] - * │ ├── [B: 20%] │ ├── [Tx: D + E(2, 50%)] - * │ └── [C: 20%] │ ├── [Tx: E(3, 100%)] - * ├── [Par] │ └── [Tx: E(4, 60%)] - * │ ├── [D: 50%] └── [Tx: F + G] - * │ └── [E(x, 250%)] - * ├── [F: 50%] - * └── [G: 50%] - */ -test('complex example 2', async (t) => { - const { - createPlanner, - instruction, - messagePacker, - txPercent, - singleTransactionPlan, - } = defaultFactories(); - const planner = createPlanner(); - - const instructionA = instruction(txPercent(20)); - const instructionB = instruction(txPercent(20)); - const instructionC = instruction(txPercent(20)); - const instructionD = instruction(txPercent(50)); - const messagePackerE = messagePacker(txPercent(250)); - const instructionF = instruction(txPercent(50)); - const instructionG = instruction(txPercent(50)); - - t.deepEqual( - await planner( - sequentialInstructionPlan([ - singleInstructionPlan(instructionA), - nonDivisibleSequentialInstructionPlan([ - singleInstructionPlan(instructionB), - singleInstructionPlan(instructionC), - ]), - parallelInstructionPlan([ - singleInstructionPlan(instructionD), - messagePackerE, - ]), - singleInstructionPlan(instructionF), - singleInstructionPlan(instructionG), - ]) - ), - sequentialTransactionPlan([ - singleTransactionPlan([ - instructionA, - instructionB, - instructionC, - messagePackerE.get(txPercent(40) - 3, 0), - ]), - parallelTransactionPlan([ - singleTransactionPlan([ - instructionD, - messagePackerE.get(txPercent(50), 1), - ]), - singleTransactionPlan([messagePackerE.get(txPercent(100), 2)]), - singleTransactionPlan([messagePackerE.get(txPercent(60) + 3, 3)]), - ]), - singleTransactionPlan([instructionF, instructionG]), - ]) - ); -}); diff --git a/clients/js/test/loader-v3/deploy.ts b/clients/js/test/loader-v3/deploy.ts index 9a05e21..f3b455e 100644 --- a/clients/js/test/loader-v3/deploy.ts +++ b/clients/js/test/loader-v3/deploy.ts @@ -11,11 +11,11 @@ import { type Codec, type Decoder, type Encoder, - type IAccountMeta, - type IAccountSignerMeta, - type IInstruction, - type IInstructionWithAccounts, - type IInstructionWithData, + type AccountMeta, + type AccountSignerMeta, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, type ReadonlyAccount, type ReadonlySignerAccount, type TransactionSigner, @@ -33,28 +33,28 @@ export function getDeployWithMaxDataLenDiscriminatorBytes() { export type DeployWithMaxDataLenInstruction< TProgram extends string = typeof LOADER_V3_PROGRAM_ADDRESS, - TAccountPayerAccount extends string | IAccountMeta = string, - TAccountProgramDataAccount extends string | IAccountMeta = string, - TAccountProgramAccount extends string | IAccountMeta = string, - TAccountBufferAccount extends string | IAccountMeta = string, + TAccountPayerAccount extends string | AccountMeta = string, + TAccountProgramDataAccount extends string | AccountMeta = string, + TAccountProgramAccount extends string | AccountMeta = string, + TAccountBufferAccount extends string | AccountMeta = string, TAccountRentSysvar extends | string - | IAccountMeta = 'SysvarRent111111111111111111111111111111111', + | AccountMeta = 'SysvarRent111111111111111111111111111111111', TAccountClockSysvar extends | string - | IAccountMeta = 'SysvarC1ock11111111111111111111111111111111', + | AccountMeta = 'SysvarC1ock11111111111111111111111111111111', TAccountSystemProgram extends | string - | IAccountMeta = '11111111111111111111111111111111', - TAccountAuthority extends string | IAccountMeta = string, - TRemainingAccounts extends readonly IAccountMeta[] = [], -> = IInstruction & - IInstructionWithData & - IInstructionWithAccounts< + | AccountMeta = '11111111111111111111111111111111', + TAccountAuthority extends string | AccountMeta = string, + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< [ TAccountPayerAccount extends string ? WritableSignerAccount & - IAccountSignerMeta + AccountSignerMeta : TAccountPayerAccount, TAccountProgramDataAccount extends string ? WritableAccount @@ -76,7 +76,7 @@ export type DeployWithMaxDataLenInstruction< : TAccountSystemProgram, TAccountAuthority extends string ? ReadonlySignerAccount & - IAccountSignerMeta + AccountSignerMeta : TAccountAuthority, ...TRemainingAccounts, ] @@ -253,7 +253,7 @@ export function getDeployWithMaxDataLenInstruction< export type ParsedDeployWithMaxDataLenInstruction< TProgram extends string = typeof LOADER_V3_PROGRAM_ADDRESS, - TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], > = { programAddress: Address; accounts: { @@ -279,11 +279,11 @@ export type ParsedDeployWithMaxDataLenInstruction< export function parseDeployWithMaxDataLenInstruction< TProgram extends string, - TAccountMetas extends readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[], >( - instruction: IInstruction & - IInstructionWithAccounts & - IInstructionWithData + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData ): ParsedDeployWithMaxDataLenInstruction { if (instruction.accounts.length < 8) { // TODO: Coded error. diff --git a/clients/js/test/loader-v3/initializeBuffer.ts b/clients/js/test/loader-v3/initializeBuffer.ts index 0b556b1..b7206c6 100644 --- a/clients/js/test/loader-v3/initializeBuffer.ts +++ b/clients/js/test/loader-v3/initializeBuffer.ts @@ -9,10 +9,10 @@ import { type Codec, type Decoder, type Encoder, - type IAccountMeta, - type IInstruction, - type IInstructionWithAccounts, - type IInstructionWithData, + type AccountMeta, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, type ReadonlyAccount, type WritableAccount, } from '@solana/kit'; @@ -27,12 +27,12 @@ export function getInitializeBufferDiscriminatorBytes() { export type InitializeBufferInstruction< TProgram extends string = typeof LOADER_V3_PROGRAM_ADDRESS, - TAccountSourceAccount extends string | IAccountMeta = string, - TAccountBufferAuthority extends string | IAccountMeta = string, - TRemainingAccounts extends readonly IAccountMeta[] = [], -> = IInstruction & - IInstructionWithData & - IInstructionWithAccounts< + TAccountSourceAccount extends string | AccountMeta = string, + TAccountBufferAuthority extends string | AccountMeta = string, + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< [ TAccountSourceAccount extends string ? WritableAccount @@ -124,7 +124,7 @@ export function getInitializeBufferInstruction< export type ParsedInitializeBufferInstruction< TProgram extends string = typeof LOADER_V3_PROGRAM_ADDRESS, - TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], > = { programAddress: Address; accounts: { @@ -138,11 +138,11 @@ export type ParsedInitializeBufferInstruction< export function parseInitializeBufferInstruction< TProgram extends string, - TAccountMetas extends readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[], >( - instruction: IInstruction & - IInstructionWithAccounts & - IInstructionWithData + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData ): ParsedInitializeBufferInstruction { if (instruction.accounts.length < 2) { // TODO: Coded error. diff --git a/clients/js/test/loader-v3/shared.ts b/clients/js/test/loader-v3/shared.ts index cf2e811..84a12ca 100644 --- a/clients/js/test/loader-v3/shared.ts +++ b/clients/js/test/loader-v3/shared.ts @@ -3,8 +3,8 @@ import { isProgramDerivedAddress, isTransactionSigner as web3JsIsTransactionSigner, type Address, - type IAccountMeta, - type IAccountSignerMeta, + type AccountMeta, + type AccountSignerMeta, type ProgramDerivedAddress, type TransactionSigner, upgradeRoleToSigner, @@ -105,7 +105,7 @@ export type ResolvedAccount< * Defines an instruction that stores additional bytes on-chain. * @internal */ -export type IInstructionWithByteDelta = { +export type InstructionWithByteDelta = { byteDelta: number; }; @@ -119,7 +119,7 @@ export function getAccountMetaFactory( ) { return ( account: ResolvedAccount - ): IAccountMeta | IAccountSignerMeta | undefined => { + ): AccountMeta | AccountSignerMeta | undefined => { if (!account.value) { if (optionalAccountStrategy === 'omitted') return; return Object.freeze({ diff --git a/clients/js/test/loader-v3/write.ts b/clients/js/test/loader-v3/write.ts index a8bbf6e..51268c4 100644 --- a/clients/js/test/loader-v3/write.ts +++ b/clients/js/test/loader-v3/write.ts @@ -15,11 +15,11 @@ import { type Codec, type Decoder, type Encoder, - type IAccountMeta, - type IAccountSignerMeta, - type IInstruction, - type IInstructionWithAccounts, - type IInstructionWithData, + type AccountMeta, + type AccountSignerMeta, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, type ReadonlySignerAccount, type ReadonlyUint8Array, type TransactionSigner, @@ -36,19 +36,19 @@ export function getWriteDiscriminatorBytes() { export type WriteInstruction< TProgram extends string = typeof LOADER_V3_PROGRAM_ADDRESS, - TAccountBufferAccount extends string | IAccountMeta = string, - TAccountBufferAuthority extends string | IAccountMeta = string, - TRemainingAccounts extends readonly IAccountMeta[] = [], -> = IInstruction & - IInstructionWithData & - IInstructionWithAccounts< + TAccountBufferAccount extends string | AccountMeta = string, + TAccountBufferAuthority extends string | AccountMeta = string, + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< [ TAccountBufferAccount extends string ? WritableAccount : TAccountBufferAccount, TAccountBufferAuthority extends string ? ReadonlySignerAccount & - IAccountSignerMeta + AccountSignerMeta : TAccountBufferAuthority, ...TRemainingAccounts, ] @@ -156,7 +156,7 @@ export function getWriteInstruction< export type ParsedWriteInstruction< TProgram extends string = typeof LOADER_V3_PROGRAM_ADDRESS, - TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], > = { programAddress: Address; accounts: { @@ -170,11 +170,11 @@ export type ParsedWriteInstruction< export function parseWriteInstruction< TProgram extends string, - TAccountMetas extends readonly IAccountMeta[], + TAccountMetas extends readonly AccountMeta[], >( - instruction: IInstruction & - IInstructionWithAccounts & - IInstructionWithData + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData ): ParsedWriteInstruction { if (instruction.accounts.length < 2) { // TODO: Coded error. diff --git a/package.json b/package.json index 142e369..3ae3fcb 100644 --- a/package.json +++ b/package.json @@ -26,10 +26,10 @@ "rust:semver": "cargo semver-checks" }, "devDependencies": { - "@codama/renderers-js": "^1.2.10", - "@codama/renderers-rust": "^1.0.19", + "@codama/renderers-js": "^1.3", + "@codama/renderers-rust": "~1.0", "@iarna/toml": "^2.2.5", - "codama": "^1.2.11", + "codama": "^1.3", "typescript": "^5.5.2", "zx": "^7.2.3" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 524ae4d..9c2a5e5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,17 +9,17 @@ importers: .: devDependencies: '@codama/renderers-js': - specifier: ^1.2.10 - version: 1.2.10(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + specifier: ^1.3 + version: 1.3.4(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) '@codama/renderers-rust': - specifier: ^1.0.19 + specifier: ~1.0 version: 1.0.19(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) '@iarna/toml': specifier: ^2.2.5 version: 2.2.5 codama: - specifier: ^1.2.11 - version: 1.2.11(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + specifier: ^1.3 + version: 1.3.3 typescript: specifier: ^5.5.2 version: 5.7.3 @@ -29,53 +29,57 @@ importers: packages: - '@codama/cli@1.0.10': - resolution: {integrity: sha512-zKfQZYIqu834fno5ra6H/rlqFlNWNJ5tU5spxxVBOwECX3oUZc5+ED9Vu6cOP/FRgs6FI24/d603P6iSz0vuuA==} + '@codama/cli@1.3.1': + resolution: {integrity: sha512-3m84aErp6W0cFIArYh9Ymzp2QFFHL+zFx/QS8R8piBjkA/WbSTdslZnierBBqgXkoSM6uIqvm008DSvo3gj1LA==} + hasBin: true '@codama/errors@1.2.11': resolution: {integrity: sha512-npkIj4bqLMENt2HPtxzLitaduwtl/kaQkW1lFJJdJR7Fu1rD0R4jQkiysqvzMggviOFMnR2/ANutXxKy3NaqQA==} hasBin: true + '@codama/errors@1.3.3': + resolution: {integrity: sha512-iyo5qEW/rgNTTtcZnGqahcnUtMHRRTlTzeTZo6SLpuNistbEn2itOssnklNZVClhXR/4Td0riHwGedP3AjwgJA==} + hasBin: true + '@codama/node-types@1.2.11': resolution: {integrity: sha512-4yUA2uYwC/VmtyiRZe+89mWJ3BiN9D6mckiYgvpyOHTNtQ0y35CQpPloJzb0hiRcWIuVaOmV+AWqZrZn5wbzkg==} - '@codama/nodes-from-anchor@1.1.11': - resolution: {integrity: sha512-OpBGlmZnHhbOhHfJ8uKcUP5/ZESjVGV/xyxB5XDRHyBFzUOuxGheAm1/fC9M7K5pNtxEaOk8Ouq9U72cvAK0Xw==} + '@codama/node-types@1.3.3': + resolution: {integrity: sha512-41GdFy/OPRemXTAmptDSi/wDXHPimy40mx9v0z2EdIMNYEyKAYZDcvr2jzSei8meeCV9j4PgKF5snwBQK7HaSg==} '@codama/nodes@1.2.11': resolution: {integrity: sha512-+cJrFHYcNMwjgfChgY3ujbUNu8dmsokcbq5UGzuS5CCSJ8g7t3SIc07tTj/VJwZnKrClCSiKl12chP7Q0Vc2Rw==} + '@codama/nodes@1.3.3': + resolution: {integrity: sha512-CgxGfH6ndcZpvf+RfVwSyIOyq8cNejbqY9TRr4SqVMIEbE1Wpqx+GPrEGRKtwHgB8KqsWCz7Pve8BCGhsPkr2g==} + '@codama/renderers-core@1.0.13': resolution: {integrity: sha512-1/IDgYlsKi1CZCJ6imyiIk/BJDYNKzUnwfD0m/HwLOhzyKZwn0OAbMMQuKkBgcclmzD/izxmHxYHJvAJZSBl+w==} - '@codama/renderers-js-umi@1.1.12': - resolution: {integrity: sha512-Ne3hdMBPDdfXgXTjFoxeSSoOLP44ecCryG/H0t2okNau3IB6NO3DN13xn4xtC/l3JO6bdjxggyPg8QZEw8lc5g==} + '@codama/renderers-core@1.0.19': + resolution: {integrity: sha512-ARvgw8ObOMiIbeahcKBpWKl2N4lYaywDOAsbYDjr/zV8jpPll39TVidgQt0lP4JjdGz7xZTBCmQmtxW5hqr9pA==} - '@codama/renderers-js@1.2.10': - resolution: {integrity: sha512-rGlrmP5Rs90taX2IDKjHskDXhfVFMajfnCq1RFNg4/2XoEtWeXPkhQTWVUgn0q9tBAcvQCWyea2IfjGjjk5XMA==} + '@codama/renderers-js@1.3.4': + resolution: {integrity: sha512-srcHHCc7l2FXTlUEoPOolw0bmxBkdyqpzOGtBNc7eeF9sOCE3mlR84qXzxoqCKx4T26wl+QHihI0wby0bMlfrA==} '@codama/renderers-rust@1.0.19': resolution: {integrity: sha512-ur2oQsMZ0P/g0DXY4tcw6Hznsq8ax1n968lfUNnxMHNBYr3zdhfJRBvzsF7RtcYkEvengOafQn1N5AlsNv1GBA==} - '@codama/renderers@1.0.19': - resolution: {integrity: sha512-gzc+dOVyzIkPjEEZiEcQLAHS+7hJL9hU4x5ZiMJfemLLapk/wIg7fH1s5alw3oDh6HosZouVtnAYp1OOukH88A==} - - '@codama/validators@1.2.11': - resolution: {integrity: sha512-67j+GEIZqq1Qh8eZe63Dnh21zzeVoJQbj56uek8VYLevgt9qfO8hdI9D/XGg7xM+o2fKa9g3NlwO5jOSG+1oLQ==} + '@codama/validators@1.3.3': + resolution: {integrity: sha512-dj3vlwMlxU57l6cRLxb76ZwlrEGv+dq7llDtH0aqc1z3OW5SOryREUuzeqL7T/2hY8FiY+pxjH4CQx+A08hULQ==} '@codama/visitors-core@1.2.11': resolution: {integrity: sha512-+hf5NT7DzxxVus+z3mVVrE53hW60E83ao64Ya3zyVFa+vLCUnAcYgrpL8I6UU391QymgDa0NfYJXedgjqWkfGw==} - '@codama/visitors@1.2.11': - resolution: {integrity: sha512-UxqVUcXFJFdCdpkKXiEmHRaLhIJIyAQijmt1hMb1LoWnPe2yavkuVdo5cPuJqZ/lImu4+LDVZz7Tk7l3iZG8uw==} + '@codama/visitors-core@1.3.3': + resolution: {integrity: sha512-Kuz2we5iDhq0Y9bPwEjEGGSueBPJkLxoDkJ+Z3NuHlqo/k2aHvDNl9NaoOOUPwNzPVbntfpJW9Ga3pP9oc/PQQ==} + + '@codama/visitors@1.3.3': + resolution: {integrity: sha512-ReZoo0kItffkhpvl9qRjy3HV1nZXv/k8p4wZ10NveUTDtRghk72YkY0kpK2lt/p+2SlWrhQ9IkO4Q+EQoqABrA==} '@iarna/toml@2.2.5': resolution: {integrity: sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==} - '@noble/hashes@1.7.1': - resolution: {integrity: sha512-B8XBPsn4vT/KJAGqDzbwztd+6Yte3P4V7iafm24bxgDe/mlRuK6xmWPuCNrKt2vDafZ8MfJLlchDG/vYafQEjQ==} - engines: {node: ^14.21.3 || >=16} - '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -94,17 +98,11 @@ packages: peerDependencies: typescript: '>=5' - '@solana/codecs-core@2.1.0': - resolution: {integrity: sha512-SR7pKtmJBg2mhmkel2NeHA1pz06QeQXdMv8WJoIR9m8F/hw80K/612uaYbwTt2nkK0jg/Qn/rNSd7EcJ4SBGjw==} + '@solana/codecs-core@2.3.0': + resolution: {integrity: sha512-oG+VZzN6YhBHIoSKgS5ESM9VIGzhWjEHEGNPSibiDTxFhsFWxNaz8LbMDPjBUE69r9wmdGLkrQ+wVPbnJcZPvw==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' - - '@solana/codecs-data-structures@2.1.0': - resolution: {integrity: sha512-oDF5ek54kirqJ09q8k/qEpobBiWOhd3CkkGOTyfjsmTF/IGIigNbdYIakxV3+vudBeaNBw08y0XdBYI4JL/nqA==} - engines: {node: '>=20.18.0'} - peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' '@solana/codecs-numbers@2.0.0-rc.4': resolution: {integrity: sha512-ZJR7TaUO65+3Hzo3YOOUCS0wlzh17IW+j0MZC2LCk1R0woaypRpHKj4iSMYeQOZkMxsd9QT3WNvjFrPC2qA6Sw==} @@ -112,11 +110,11 @@ packages: peerDependencies: typescript: '>=5' - '@solana/codecs-numbers@2.1.0': - resolution: {integrity: sha512-XMu4yw5iCgQnMKsxSWPPOrGgtaohmupN3eyAtYv3K3C/MJEc5V90h74k5B1GUCiHvcrdUDO9RclNjD9lgbjFag==} + '@solana/codecs-numbers@2.3.0': + resolution: {integrity: sha512-jFvvwKJKffvG7Iz9dmN51OGB7JBcy2CJ6Xf3NqD/VP90xak66m/Lg48T01u5IQ/hc15mChVHiBm+HHuOFDUrQg==} engines: {node: '>=20.18.0'} peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' '@solana/codecs-strings@2.0.0-rc.4': resolution: {integrity: sha512-LGfK2RL0BKjYYUfzu2FG/gTgCsYOMz9FKVs2ntji6WneZygPxJTV5W98K3J8Rl0JewpCSCFQH3xjLSHBJUS0fA==} @@ -125,18 +123,12 @@ packages: fastestsmallesttextencoderdecoder: ^1.0.22 typescript: '>=5' - '@solana/codecs-strings@2.1.0': - resolution: {integrity: sha512-O/eJFLzFrHomcCR1Y5QbIqoPo7iaJaWNnIeskB4mVhVjLyjlJS4WtBP2NBRzM9uJXaXyOxxKroqqO9zFsHOpvQ==} + '@solana/codecs-strings@2.3.0': + resolution: {integrity: sha512-y5pSBYwzVziXu521hh+VxqUtp0hYGTl1eWGoc1W+8mdvBdC1kTqm/X7aYQw33J42hw03JjryvYOvmGgk3Qz/Ug==} engines: {node: '>=20.18.0'} peerDependencies: fastestsmallesttextencoderdecoder: ^1.0.22 - typescript: '>=5' - - '@solana/codecs@2.1.0': - resolution: {integrity: sha512-C0TnfrpbTg7zoIFYfM65ofeL2AWEz80OsD6mjVdcTKpb1Uj7XuBuNLss3dMnatPQaL7RagD9VLA5/WfYayyteQ==} - engines: {node: '>=20.18.0'} - peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' '@solana/errors@2.0.0-rc.4': resolution: {integrity: sha512-0PPaMyB81keEHG/1pnyEuiBVKctbXO641M2w3CIOrYT/wzjunfF0FTxsqq9wYJeYo0AyiefCKGgSPs6wiY2PpQ==} @@ -145,18 +137,12 @@ packages: peerDependencies: typescript: '>=5' - '@solana/errors@2.1.0': - resolution: {integrity: sha512-l+GxAv0Ar4d3c3PlZdA9G++wFYZREEbbRyAFP8+n8HSg0vudCuzogh/13io6hYuUhG/9Ve8ARZNamhV7UScKNw==} + '@solana/errors@2.3.0': + resolution: {integrity: sha512-66RI9MAbwYV0UtP7kGcTBVLxJgUxoZGm8Fbc0ah+lGiAw17Gugco6+9GrJCV83VyF2mDWyYnYM9qdI3yjgpnaQ==} engines: {node: '>=20.18.0'} hasBin: true peerDependencies: - typescript: '>=5' - - '@solana/options@2.1.0': - resolution: {integrity: sha512-T/vJCr8qnwK6HxriOPXCrx31IpA9ZYecxuOzQ3G74kIayED4spmpXp6PLtRYR/fo2LZ6UcgHN0qSgONnvwEweg==} - engines: {node: '>=20.18.0'} - peerDependencies: - typescript: '>=5' + typescript: '>=5.3.3' '@types/fs-extra@11.0.4': resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==} @@ -190,6 +176,10 @@ packages: resolution: {integrity: sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g==} engines: {node: '>= 0.4'} + call-bind-apply-helpers@1.0.2: + resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} + engines: {node: '>= 0.4'} + call-bind@1.0.8: resolution: {integrity: sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==} engines: {node: '>= 0.4'} @@ -198,12 +188,20 @@ packages: resolution: {integrity: sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==} engines: {node: '>= 0.4'} + call-bound@1.0.4: + resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==} + engines: {node: '>= 0.4'} + chalk@5.4.1: resolution: {integrity: sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==} engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} - codama@1.2.11: - resolution: {integrity: sha512-mb5KYgsc8tH8t+MKy0jQBmCrySgRRxt/eGDbmuidLsORck925f6qZihkM64czARQ47AjY8nJg1URwg0RGdCjsg==} + chalk@5.6.0: + resolution: {integrity: sha512-46QrSQFyVSEyYAgQ22hQ+zDa60YHA4fBstHmtSApj1Y5vKtG27fWowW03jCk5KcbXEWPZUIR894aARCA/G1kfQ==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + + codama@1.3.3: + resolution: {integrity: sha512-eCOflah25uWKHGyjvW2FPydRAwhDw4ZAjBuBFF9AVJIE3xknR+pcRMLdlxO5LO3ixlxkHKHdESXJY/aVXmzZtw==} hasBin: true commander@12.1.0: @@ -214,6 +212,10 @@ packages: resolution: {integrity: sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==} engines: {node: '>=18'} + commander@14.0.0: + resolution: {integrity: sha512-2uM9rYjPvyq39NwLRqaiLtWHyDC1FvryJDa2ATTVims5YAS4PupsEQsDvP14FqhFr0P49CYDugi59xaxJlTXRA==} + engines: {node: '>=20'} + commander@5.1.0: resolution: {integrity: sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==} engines: {node: '>= 6'} @@ -249,6 +251,10 @@ packages: resolution: {integrity: sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==} engines: {node: '>= 0.4'} + es-object-atoms@1.1.1: + resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==} + engines: {node: '>= 0.4'} + event-stream@3.3.4: resolution: {integrity: sha512-QHpkERcGsR0T7Qm3HNJSyXKEEj8AHNxkY3PK8TS2KJvQ7NiSHe3DDpwVKKtoYprL/AreyzFBeIkBIWChAqn60g==} @@ -292,6 +298,10 @@ packages: resolution: {integrity: sha512-VW6Pxhsrk0KAOqs3WEd0klDiF/+V7gQOpAvY1jVU/LHmaD/kQO4523aiJuikX/QAKYiW6x8Jh+RJej1almdtCA==} engines: {node: '>= 0.4'} + get-intrinsic@1.3.0: + resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==} + engines: {node: '>= 0.4'} + get-proto@1.0.1: resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} engines: {node: '>= 0.4'} @@ -348,6 +358,10 @@ packages: resolution: {integrity: sha512-Lp6HbbBgosLmJbjx0pBLbgvx68FaFU1sdkmBuckmhhJ88kL13OA51CDtR2yJB50eCNMH9wRqtQNNiAqQH4YXnA==} engines: {node: '>= 0.4'} + json-stable-stringify@1.3.0: + resolution: {integrity: sha512-qtYiSSFlwot9XHtF9bD9c7rwKjr+RecWT//ZnPvSmEjpV5mmPOCN4j8UjY5hbjNkOwZ/jQv3J6R1/pL7RwgMsg==} + engines: {node: '>= 0.4'} + jsonfile@6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} @@ -412,8 +426,8 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} - prettier@3.5.3: - resolution: {integrity: sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==} + prettier@3.6.2: + resolution: {integrity: sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==} engines: {node: '>=14'} hasBin: true @@ -497,23 +511,14 @@ packages: snapshots: - '@codama/cli@1.0.10(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@codama/cli@1.3.1': dependencies: - '@codama/nodes': 1.2.11 - '@codama/nodes-from-anchor': 1.1.11(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@codama/renderers': 1.0.19(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@codama/renderers-js': 1.2.10(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@codama/renderers-js-umi': 1.1.12(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@codama/renderers-rust': 1.0.19(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@codama/visitors': 1.2.11 - '@codama/visitors-core': 1.2.11 - commander: 13.1.0 + '@codama/nodes': 1.3.3 + '@codama/visitors': 1.3.3 + '@codama/visitors-core': 1.3.3 + commander: 14.0.0 picocolors: 1.1.1 prompts: 2.4.2 - transitivePeerDependencies: - - chokidar - - fastestsmallesttextencoderdecoder - - typescript '@codama/errors@1.2.11': dependencies: @@ -521,55 +526,47 @@ snapshots: chalk: 5.4.1 commander: 13.1.0 + '@codama/errors@1.3.3': + dependencies: + '@codama/node-types': 1.3.3 + chalk: 5.6.0 + commander: 14.0.0 + '@codama/node-types@1.2.11': {} - '@codama/nodes-from-anchor@1.1.11(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': - dependencies: - '@codama/errors': 1.2.11 - '@codama/nodes': 1.2.11 - '@codama/visitors': 1.2.11 - '@noble/hashes': 1.7.1 - '@solana/codecs': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - transitivePeerDependencies: - - fastestsmallesttextencoderdecoder - - typescript + '@codama/node-types@1.3.3': {} '@codama/nodes@1.2.11': dependencies: '@codama/errors': 1.2.11 '@codama/node-types': 1.2.11 + '@codama/nodes@1.3.3': + dependencies: + '@codama/errors': 1.3.3 + '@codama/node-types': 1.3.3 + '@codama/renderers-core@1.0.13': dependencies: '@codama/errors': 1.2.11 '@codama/nodes': 1.2.11 '@codama/visitors-core': 1.2.11 - '@codama/renderers-js-umi@1.1.12(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@codama/renderers-core@1.0.19': dependencies: - '@codama/errors': 1.2.11 - '@codama/nodes': 1.2.11 - '@codama/renderers-core': 1.0.13 - '@codama/validators': 1.2.11 - '@codama/visitors-core': 1.2.11 - '@solana/codecs-strings': 2.0.0-rc.4(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - nunjucks: 3.2.4 - prettier: 3.5.3 - transitivePeerDependencies: - - chokidar - - fastestsmallesttextencoderdecoder - - typescript + '@codama/errors': 1.3.3 + '@codama/nodes': 1.3.3 + '@codama/visitors-core': 1.3.3 - '@codama/renderers-js@1.2.10(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@codama/renderers-js@1.3.4(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': dependencies: - '@codama/errors': 1.2.11 - '@codama/nodes': 1.2.11 - '@codama/nodes-from-anchor': 1.1.11(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@codama/renderers-core': 1.0.13 - '@codama/visitors-core': 1.2.11 - '@solana/codecs-strings': 2.0.0-rc.4(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@codama/errors': 1.3.3 + '@codama/nodes': 1.3.3 + '@codama/renderers-core': 1.0.19 + '@codama/visitors-core': 1.3.3 + '@solana/codecs-strings': 2.3.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) nunjucks: 3.2.4 - prettier: 3.5.3 + prettier: 3.6.2 transitivePeerDependencies: - chokidar - fastestsmallesttextencoderdecoder @@ -588,21 +585,11 @@ snapshots: - fastestsmallesttextencoderdecoder - typescript - '@codama/renderers@1.0.19(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@codama/validators@1.3.3': dependencies: - '@codama/renderers-js': 1.2.10(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@codama/renderers-js-umi': 1.1.12(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@codama/renderers-rust': 1.0.19(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - transitivePeerDependencies: - - chokidar - - fastestsmallesttextencoderdecoder - - typescript - - '@codama/validators@1.2.11': - dependencies: - '@codama/errors': 1.2.11 - '@codama/nodes': 1.2.11 - '@codama/visitors-core': 1.2.11 + '@codama/errors': 1.3.3 + '@codama/nodes': 1.3.3 + '@codama/visitors-core': 1.3.3 '@codama/visitors-core@1.2.11': dependencies: @@ -610,15 +597,19 @@ snapshots: '@codama/nodes': 1.2.11 json-stable-stringify: 1.2.1 - '@codama/visitors@1.2.11': + '@codama/visitors-core@1.3.3': dependencies: - '@codama/errors': 1.2.11 - '@codama/nodes': 1.2.11 - '@codama/visitors-core': 1.2.11 + '@codama/errors': 1.3.3 + '@codama/nodes': 1.3.3 + json-stable-stringify: 1.3.0 - '@iarna/toml@2.2.5': {} + '@codama/visitors@1.3.3': + dependencies: + '@codama/errors': 1.3.3 + '@codama/nodes': 1.3.3 + '@codama/visitors-core': 1.3.3 - '@noble/hashes@1.7.1': {} + '@iarna/toml@2.2.5': {} '@nodelib/fs.scandir@2.1.5': dependencies: @@ -637,16 +628,9 @@ snapshots: '@solana/errors': 2.0.0-rc.4(typescript@5.7.3) typescript: 5.7.3 - '@solana/codecs-core@2.1.0(typescript@5.7.3)': + '@solana/codecs-core@2.3.0(typescript@5.7.3)': dependencies: - '@solana/errors': 2.1.0(typescript@5.7.3) - typescript: 5.7.3 - - '@solana/codecs-data-structures@2.1.0(typescript@5.7.3)': - dependencies: - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/codecs-numbers': 2.1.0(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) + '@solana/errors': 2.3.0(typescript@5.7.3) typescript: 5.7.3 '@solana/codecs-numbers@2.0.0-rc.4(typescript@5.7.3)': @@ -655,10 +639,10 @@ snapshots: '@solana/errors': 2.0.0-rc.4(typescript@5.7.3) typescript: 5.7.3 - '@solana/codecs-numbers@2.1.0(typescript@5.7.3)': + '@solana/codecs-numbers@2.3.0(typescript@5.7.3)': dependencies: - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) + '@solana/codecs-core': 2.3.0(typescript@5.7.3) + '@solana/errors': 2.3.0(typescript@5.7.3) typescript: 5.7.3 '@solana/codecs-strings@2.0.0-rc.4(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': @@ -669,47 +653,25 @@ snapshots: fastestsmallesttextencoderdecoder: 1.0.22 typescript: 5.7.3 - '@solana/codecs-strings@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@solana/codecs-strings@2.3.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': dependencies: - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/codecs-numbers': 2.1.0(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) + '@solana/codecs-core': 2.3.0(typescript@5.7.3) + '@solana/codecs-numbers': 2.3.0(typescript@5.7.3) + '@solana/errors': 2.3.0(typescript@5.7.3) fastestsmallesttextencoderdecoder: 1.0.22 typescript: 5.7.3 - '@solana/codecs@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': - dependencies: - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/codecs-data-structures': 2.1.0(typescript@5.7.3) - '@solana/codecs-numbers': 2.1.0(typescript@5.7.3) - '@solana/codecs-strings': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/options': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - typescript: 5.7.3 - transitivePeerDependencies: - - fastestsmallesttextencoderdecoder - '@solana/errors@2.0.0-rc.4(typescript@5.7.3)': dependencies: chalk: 5.4.1 commander: 12.1.0 typescript: 5.7.3 - '@solana/errors@2.1.0(typescript@5.7.3)': + '@solana/errors@2.3.0(typescript@5.7.3)': dependencies: chalk: 5.4.1 - commander: 13.1.0 - typescript: 5.7.3 - - '@solana/options@2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': - dependencies: - '@solana/codecs-core': 2.1.0(typescript@5.7.3) - '@solana/codecs-data-structures': 2.1.0(typescript@5.7.3) - '@solana/codecs-numbers': 2.1.0(typescript@5.7.3) - '@solana/codecs-strings': 2.1.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@solana/errors': 2.1.0(typescript@5.7.3) + commander: 14.0.0 typescript: 5.7.3 - transitivePeerDependencies: - - fastestsmallesttextencoderdecoder '@types/fs-extra@11.0.4': dependencies: @@ -743,6 +705,11 @@ snapshots: es-errors: 1.3.0 function-bind: 1.1.2 + call-bind-apply-helpers@1.0.2: + dependencies: + es-errors: 1.3.0 + function-bind: 1.1.2 + call-bind@1.0.8: dependencies: call-bind-apply-helpers: 1.0.1 @@ -755,24 +722,29 @@ snapshots: call-bind-apply-helpers: 1.0.1 get-intrinsic: 1.2.7 + call-bound@1.0.4: + dependencies: + call-bind-apply-helpers: 1.0.2 + get-intrinsic: 1.3.0 + chalk@5.4.1: {} - codama@1.2.11(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3): + chalk@5.6.0: {} + + codama@1.3.3: dependencies: - '@codama/cli': 1.0.10(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) - '@codama/errors': 1.2.11 - '@codama/nodes': 1.2.11 - '@codama/validators': 1.2.11 - '@codama/visitors': 1.2.11 - transitivePeerDependencies: - - chokidar - - fastestsmallesttextencoderdecoder - - typescript + '@codama/cli': 1.3.1 + '@codama/errors': 1.3.3 + '@codama/nodes': 1.3.3 + '@codama/validators': 1.3.3 + '@codama/visitors': 1.3.3 commander@12.1.0: {} commander@13.1.0: {} + commander@14.0.0: {} + commander@5.1.0: {} data-uri-to-buffer@4.0.1: {} @@ -789,7 +761,7 @@ snapshots: dunder-proto@1.0.1: dependencies: - call-bind-apply-helpers: 1.0.1 + call-bind-apply-helpers: 1.0.2 es-errors: 1.3.0 gopd: 1.2.0 @@ -803,6 +775,10 @@ snapshots: dependencies: es-errors: 1.3.0 + es-object-atoms@1.1.1: + dependencies: + es-errors: 1.3.0 + event-stream@3.3.4: dependencies: duplexer: 0.1.2 @@ -865,10 +841,23 @@ snapshots: hasown: 2.0.2 math-intrinsics: 1.1.0 + get-intrinsic@1.3.0: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-define-property: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.1.1 + function-bind: 1.1.2 + get-proto: 1.0.1 + gopd: 1.2.0 + has-symbols: 1.1.0 + hasown: 2.0.2 + math-intrinsics: 1.1.0 + get-proto@1.0.1: dependencies: dunder-proto: 1.0.1 - es-object-atoms: 1.0.0 + es-object-atoms: 1.1.1 glob-parent@5.1.2: dependencies: @@ -918,6 +907,14 @@ snapshots: jsonify: 0.0.1 object-keys: 1.1.1 + json-stable-stringify@1.3.0: + dependencies: + call-bind: 1.0.8 + call-bound: 1.0.4 + isarray: 2.0.5 + jsonify: 0.0.1 + object-keys: 1.1.1 + jsonfile@6.1.0: dependencies: universalify: 2.0.1 @@ -967,7 +964,7 @@ snapshots: picomatch@2.3.1: {} - prettier@3.5.3: {} + prettier@3.6.2: {} prompts@2.4.2: dependencies: From 576fe2c33aaec8234b2eb6ba05fb7169c497b8fe Mon Sep 17 00:00:00 2001 From: Loris Leiva Date: Tue, 2 Sep 2025 16:36:49 +0100 Subject: [PATCH 2/2] Upgrade Codama --- clients/js/src/cli/utils.ts | 21 +++- .../js/src/generated/instructions/allocate.ts | 12 +- package.json | 2 +- pnpm-lock.yaml | 104 ++++++++++++------ 4 files changed, 94 insertions(+), 45 deletions(-) diff --git a/clients/js/src/cli/utils.ts b/clients/js/src/cli/utils.ts index 4b69c83..8424c03 100644 --- a/clients/js/src/cli/utils.ts +++ b/clients/js/src/cli/utils.ts @@ -55,6 +55,11 @@ import { RpcOption, WriteOptions, } from './options'; +import { + COMPUTE_BUDGET_PROGRAM_ADDRESS, + ComputeBudgetInstruction, + identifyComputeBudgetInstruction, +} from '@solana-program/compute-budget'; const LOCALHOST_URL = 'http://127.0.0.1:8899'; const DATA_SOURCE_OPTIONS = @@ -86,11 +91,11 @@ export async function getClient(options: GlobalOptions): Promise { readonlyClient.configs ); const { planner, executor } = createDefaultTransactionPlannerAndExecutor({ - computeUnitPrice: options.priorityFees, + priorityFees: options.priorityFees, payer, rpc: readonlyClient.rpc, rpcSubscriptions: readonlyClient.rpcSubscriptions, - parallelChunkSize: 5, + concurrency: 5, }); const planAndExecute = async (instructionPlan: InstructionPlan) => { const transactionPlan = await planner(instructionPlan); @@ -152,6 +157,18 @@ function removeComputeUnitLimitInstruction< }; } +export function getSetComputeUnitLimitInstructionIndex( + transactionMessage: BaseTransactionMessage +) { + return transactionMessage.instructions.findIndex((ix) => { + return ( + ix.programAddress === COMPUTE_BUDGET_PROGRAM_ADDRESS && + identifyComputeBudgetInstruction(ix.data as Uint8Array) === + ComputeBudgetInstruction.SetComputeUnitLimit + ); + }); +} + async function executeTransactionPlan( transactionPlan: TransactionPlan, executor: TransactionPlanExecutor diff --git a/clients/js/src/generated/instructions/allocate.ts b/clients/js/src/generated/instructions/allocate.ts index 9e13b99..84d334e 100644 --- a/clients/js/src/generated/instructions/allocate.ts +++ b/clients/js/src/generated/instructions/allocate.ts @@ -19,9 +19,9 @@ import { type AccountMeta, type AccountSignerMeta, type Address, - type FixedSizeCodec, - type FixedSizeDecoder, - type FixedSizeEncoder, + type Codec, + type Decoder, + type Encoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, @@ -93,7 +93,7 @@ export type AllocateInstructionDataArgs = { seed?: OptionOrNullable; }; -export function getAllocateInstructionDataEncoder(): FixedSizeEncoder { +export function getAllocateInstructionDataEncoder(): Encoder { return transformEncoder( getStructEncoder([ ['discriminator', getU8Encoder()], @@ -107,14 +107,14 @@ export function getAllocateInstructionDataEncoder(): FixedSizeEncoder { +export function getAllocateInstructionDataDecoder(): Decoder { return getStructDecoder([ ['discriminator', getU8Decoder()], ['seed', getOptionDecoder(getSeedDecoder(), { prefix: null })], ]); } -export function getAllocateInstructionDataCodec(): FixedSizeCodec< +export function getAllocateInstructionDataCodec(): Codec< AllocateInstructionDataArgs, AllocateInstructionData > { diff --git a/package.json b/package.json index 3ae3fcb..a779c5f 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "rust:semver": "cargo semver-checks" }, "devDependencies": { - "@codama/renderers-js": "^1.3", + "@codama/renderers-js": "^1.3.5", "@codama/renderers-rust": "~1.0", "@iarna/toml": "^2.2.5", "codama": "^1.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9c2a5e5..09ab5c4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: devDependencies: '@codama/renderers-js': - specifier: ^1.3 - version: 1.3.4(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + specifier: ^1.3.5 + version: 1.3.5(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) '@codama/renderers-rust': specifier: ~1.0 version: 1.0.19(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) @@ -41,26 +41,36 @@ packages: resolution: {integrity: sha512-iyo5qEW/rgNTTtcZnGqahcnUtMHRRTlTzeTZo6SLpuNistbEn2itOssnklNZVClhXR/4Td0riHwGedP3AjwgJA==} hasBin: true + '@codama/errors@1.3.4': + resolution: {integrity: sha512-gEbfWkf5J1klGlLbrg5zIMYTncYO6SCsLRxKbDRrE1TmxRqt3cUovQyPhccGcNh/e/GisauIGjbsZTJaFNgXuw==} + hasBin: true + '@codama/node-types@1.2.11': resolution: {integrity: sha512-4yUA2uYwC/VmtyiRZe+89mWJ3BiN9D6mckiYgvpyOHTNtQ0y35CQpPloJzb0hiRcWIuVaOmV+AWqZrZn5wbzkg==} '@codama/node-types@1.3.3': resolution: {integrity: sha512-41GdFy/OPRemXTAmptDSi/wDXHPimy40mx9v0z2EdIMNYEyKAYZDcvr2jzSei8meeCV9j4PgKF5snwBQK7HaSg==} + '@codama/node-types@1.3.4': + resolution: {integrity: sha512-WOKU9v019gfX58y+I+hadokckvYLEZKvcsXpf578S+B+sV9YBCOhIjlzDDONcfe9iGUw49M6VpyWkp+EenasLg==} + '@codama/nodes@1.2.11': resolution: {integrity: sha512-+cJrFHYcNMwjgfChgY3ujbUNu8dmsokcbq5UGzuS5CCSJ8g7t3SIc07tTj/VJwZnKrClCSiKl12chP7Q0Vc2Rw==} '@codama/nodes@1.3.3': resolution: {integrity: sha512-CgxGfH6ndcZpvf+RfVwSyIOyq8cNejbqY9TRr4SqVMIEbE1Wpqx+GPrEGRKtwHgB8KqsWCz7Pve8BCGhsPkr2g==} + '@codama/nodes@1.3.4': + resolution: {integrity: sha512-Q3eS/kMqiozZzlpY/otVfQQ9M3pRdCS0D1dlB3TyuHWBAJiAGPfjRT21KQ4M8xub6eTWJY7PwT7sykPqS/fQPg==} + '@codama/renderers-core@1.0.13': resolution: {integrity: sha512-1/IDgYlsKi1CZCJ6imyiIk/BJDYNKzUnwfD0m/HwLOhzyKZwn0OAbMMQuKkBgcclmzD/izxmHxYHJvAJZSBl+w==} - '@codama/renderers-core@1.0.19': - resolution: {integrity: sha512-ARvgw8ObOMiIbeahcKBpWKl2N4lYaywDOAsbYDjr/zV8jpPll39TVidgQt0lP4JjdGz7xZTBCmQmtxW5hqr9pA==} + '@codama/renderers-core@1.1.0': + resolution: {integrity: sha512-OscEiIv4nXiiqb2I9PWDI0Aw8bM6Qdtb9oqbuFb0XXt8hJTeLoNk+AN8ZZFtJMtiy+SizJjUsbX2KFE2HsVhdg==} - '@codama/renderers-js@1.3.4': - resolution: {integrity: sha512-srcHHCc7l2FXTlUEoPOolw0bmxBkdyqpzOGtBNc7eeF9sOCE3mlR84qXzxoqCKx4T26wl+QHihI0wby0bMlfrA==} + '@codama/renderers-js@1.3.5': + resolution: {integrity: sha512-c23KBVOqmNd02pzxSTGxBUKVnC6LOZOK2KPeYCb3EsmD5E4YSEFAMt2bI66BsbzuisKxLya9dop7UG5wRGfIIg==} '@codama/renderers-rust@1.0.19': resolution: {integrity: sha512-ur2oQsMZ0P/g0DXY4tcw6Hznsq8ax1n968lfUNnxMHNBYr3zdhfJRBvzsF7RtcYkEvengOafQn1N5AlsNv1GBA==} @@ -74,6 +84,9 @@ packages: '@codama/visitors-core@1.3.3': resolution: {integrity: sha512-Kuz2we5iDhq0Y9bPwEjEGGSueBPJkLxoDkJ+Z3NuHlqo/k2aHvDNl9NaoOOUPwNzPVbntfpJW9Ga3pP9oc/PQQ==} + '@codama/visitors-core@1.3.4': + resolution: {integrity: sha512-TCP1ncA0ErBvv5q8BKCRvv98qHh9on8MOiPhdToJ/w50aNm0y5Y2mHbUWqk5vle8k3V9fuo7uf1aAOaqA6G4Vg==} + '@codama/visitors@1.3.3': resolution: {integrity: sha512-ReZoo0kItffkhpvl9qRjy3HV1nZXv/k8p4wZ10NveUTDtRghk72YkY0kpK2lt/p+2SlWrhQ9IkO4Q+EQoqABrA==} @@ -98,8 +111,8 @@ packages: peerDependencies: typescript: '>=5' - '@solana/codecs-core@2.3.0': - resolution: {integrity: sha512-oG+VZzN6YhBHIoSKgS5ESM9VIGzhWjEHEGNPSibiDTxFhsFWxNaz8LbMDPjBUE69r9wmdGLkrQ+wVPbnJcZPvw==} + '@solana/codecs-core@3.0.1': + resolution: {integrity: sha512-7U12QJX6VZeq03r0l0SZnGPk+YHbyU9lDjEZpjiSHdWbixy8inoYTsqV523Soy41SnGwvVsfiJf7SUB5kvgGaQ==} engines: {node: '>=20.18.0'} peerDependencies: typescript: '>=5.3.3' @@ -110,8 +123,8 @@ packages: peerDependencies: typescript: '>=5' - '@solana/codecs-numbers@2.3.0': - resolution: {integrity: sha512-jFvvwKJKffvG7Iz9dmN51OGB7JBcy2CJ6Xf3NqD/VP90xak66m/Lg48T01u5IQ/hc15mChVHiBm+HHuOFDUrQg==} + '@solana/codecs-numbers@3.0.1': + resolution: {integrity: sha512-HdXioWMVc0Ih9N7vuEF11pMwQWHqSF/TQrCDKljr981QQ5q/pBleUZB3hM43zP/ndnTasIxqAuLXIypricAGqg==} engines: {node: '>=20.18.0'} peerDependencies: typescript: '>=5.3.3' @@ -123,8 +136,8 @@ packages: fastestsmallesttextencoderdecoder: ^1.0.22 typescript: '>=5' - '@solana/codecs-strings@2.3.0': - resolution: {integrity: sha512-y5pSBYwzVziXu521hh+VxqUtp0hYGTl1eWGoc1W+8mdvBdC1kTqm/X7aYQw33J42hw03JjryvYOvmGgk3Qz/Ug==} + '@solana/codecs-strings@3.0.1': + resolution: {integrity: sha512-UxaD1Xdxe35Y2B0HnSHe48ok8ew+tyrVI1w65eHj0NzGb9FxLx/KuuEg/b/qXQRUB75JQjDo8IBh5rWZ7rl5qQ==} engines: {node: '>=20.18.0'} peerDependencies: fastestsmallesttextencoderdecoder: ^1.0.22 @@ -137,8 +150,8 @@ packages: peerDependencies: typescript: '>=5' - '@solana/errors@2.3.0': - resolution: {integrity: sha512-66RI9MAbwYV0UtP7kGcTBVLxJgUxoZGm8Fbc0ah+lGiAw17Gugco6+9GrJCV83VyF2mDWyYnYM9qdI3yjgpnaQ==} + '@solana/errors@3.0.1': + resolution: {integrity: sha512-/EhRoJLrO03wj+3/miA6YkBnGjAS12mvilWkQ4LBv/hVqhUF9V8JXpSMnD40hoaMraE23V9IaHNHcfoJmldjwA==} engines: {node: '>=20.18.0'} hasBin: true peerDependencies: @@ -532,10 +545,18 @@ snapshots: chalk: 5.6.0 commander: 14.0.0 + '@codama/errors@1.3.4': + dependencies: + '@codama/node-types': 1.3.4 + chalk: 5.6.0 + commander: 14.0.0 + '@codama/node-types@1.2.11': {} '@codama/node-types@1.3.3': {} + '@codama/node-types@1.3.4': {} + '@codama/nodes@1.2.11': dependencies: '@codama/errors': 1.2.11 @@ -546,25 +567,30 @@ snapshots: '@codama/errors': 1.3.3 '@codama/node-types': 1.3.3 + '@codama/nodes@1.3.4': + dependencies: + '@codama/errors': 1.3.4 + '@codama/node-types': 1.3.4 + '@codama/renderers-core@1.0.13': dependencies: '@codama/errors': 1.2.11 '@codama/nodes': 1.2.11 '@codama/visitors-core': 1.2.11 - '@codama/renderers-core@1.0.19': + '@codama/renderers-core@1.1.0': dependencies: - '@codama/errors': 1.3.3 - '@codama/nodes': 1.3.3 - '@codama/visitors-core': 1.3.3 + '@codama/errors': 1.3.4 + '@codama/nodes': 1.3.4 + '@codama/visitors-core': 1.3.4 - '@codama/renderers-js@1.3.4(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@codama/renderers-js@1.3.5(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': dependencies: - '@codama/errors': 1.3.3 - '@codama/nodes': 1.3.3 - '@codama/renderers-core': 1.0.19 - '@codama/visitors-core': 1.3.3 - '@solana/codecs-strings': 2.3.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) + '@codama/errors': 1.3.4 + '@codama/nodes': 1.3.4 + '@codama/renderers-core': 1.1.0 + '@codama/visitors-core': 1.3.4 + '@solana/codecs-strings': 3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3) nunjucks: 3.2.4 prettier: 3.6.2 transitivePeerDependencies: @@ -603,6 +629,12 @@ snapshots: '@codama/nodes': 1.3.3 json-stable-stringify: 1.3.0 + '@codama/visitors-core@1.3.4': + dependencies: + '@codama/errors': 1.3.4 + '@codama/nodes': 1.3.4 + json-stable-stringify: 1.3.0 + '@codama/visitors@1.3.3': dependencies: '@codama/errors': 1.3.3 @@ -628,9 +660,9 @@ snapshots: '@solana/errors': 2.0.0-rc.4(typescript@5.7.3) typescript: 5.7.3 - '@solana/codecs-core@2.3.0(typescript@5.7.3)': + '@solana/codecs-core@3.0.1(typescript@5.7.3)': dependencies: - '@solana/errors': 2.3.0(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) typescript: 5.7.3 '@solana/codecs-numbers@2.0.0-rc.4(typescript@5.7.3)': @@ -639,10 +671,10 @@ snapshots: '@solana/errors': 2.0.0-rc.4(typescript@5.7.3) typescript: 5.7.3 - '@solana/codecs-numbers@2.3.0(typescript@5.7.3)': + '@solana/codecs-numbers@3.0.1(typescript@5.7.3)': dependencies: - '@solana/codecs-core': 2.3.0(typescript@5.7.3) - '@solana/errors': 2.3.0(typescript@5.7.3) + '@solana/codecs-core': 3.0.1(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) typescript: 5.7.3 '@solana/codecs-strings@2.0.0-rc.4(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': @@ -653,23 +685,23 @@ snapshots: fastestsmallesttextencoderdecoder: 1.0.22 typescript: 5.7.3 - '@solana/codecs-strings@2.3.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': + '@solana/codecs-strings@3.0.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.3)': dependencies: - '@solana/codecs-core': 2.3.0(typescript@5.7.3) - '@solana/codecs-numbers': 2.3.0(typescript@5.7.3) - '@solana/errors': 2.3.0(typescript@5.7.3) + '@solana/codecs-core': 3.0.1(typescript@5.7.3) + '@solana/codecs-numbers': 3.0.1(typescript@5.7.3) + '@solana/errors': 3.0.1(typescript@5.7.3) fastestsmallesttextencoderdecoder: 1.0.22 typescript: 5.7.3 '@solana/errors@2.0.0-rc.4(typescript@5.7.3)': dependencies: - chalk: 5.4.1 + chalk: 5.6.0 commander: 12.1.0 typescript: 5.7.3 - '@solana/errors@2.3.0(typescript@5.7.3)': + '@solana/errors@3.0.1(typescript@5.7.3)': dependencies: - chalk: 5.4.1 + chalk: 5.6.0 commander: 14.0.0 typescript: 5.7.3