From 403e4fc26fe34aa9843110524aaf26da5527f6ba Mon Sep 17 00:00:00 2001 From: ritikbhatt20 Date: Sat, 26 Oct 2024 00:52:54 +0530 Subject: [PATCH 1/4] added tokens/transfer-tokens/poseidon --- .../transfer-tokens-program/.gitignore | 7 + .../transfer-tokens-program/.prettierignore | 7 + .../transfer-tokens-program/Anchor.toml | 18 + .../transfer-tokens-program/Cargo.toml | 14 + .../migrations/deploy.ts | 12 + .../transfer-tokens-program/package.json | 22 + .../transfer-tokens-program/pnpm-lock.yaml | 1655 +++++++++++++++++ .../transfer-tokens-program/Cargo.toml | 21 + .../transfer-tokens-program/Xargo.toml | 2 + .../transfer-tokens-program/src/lib.rs | 53 + .../tests/bankrun.test.ts | 151 ++ .../tests/transfer-tokens-program.ts | 78 + .../ts-programs/package.json | 15 + .../ts-programs/pnpm-lock.yaml | 22 + .../ts-programs/src/transferTokensProgram.ts | 19 + .../transfer-tokens-program/tsconfig.json | 10 + 16 files changed, 2106 insertions(+) create mode 100644 tokens/transfer-tokens/poseidon/transfer-tokens-program/.gitignore create mode 100644 tokens/transfer-tokens/poseidon/transfer-tokens-program/.prettierignore create mode 100644 tokens/transfer-tokens/poseidon/transfer-tokens-program/Anchor.toml create mode 100644 tokens/transfer-tokens/poseidon/transfer-tokens-program/Cargo.toml create mode 100644 tokens/transfer-tokens/poseidon/transfer-tokens-program/migrations/deploy.ts create mode 100644 tokens/transfer-tokens/poseidon/transfer-tokens-program/package.json create mode 100644 tokens/transfer-tokens/poseidon/transfer-tokens-program/pnpm-lock.yaml create mode 100644 tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/Cargo.toml create mode 100644 tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/Xargo.toml create mode 100644 tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/src/lib.rs create mode 100644 tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/bankrun.test.ts create mode 100644 tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/transfer-tokens-program.ts create mode 100644 tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/package.json create mode 100644 tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/pnpm-lock.yaml create mode 100644 tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/src/transferTokensProgram.ts create mode 100644 tokens/transfer-tokens/poseidon/transfer-tokens-program/tsconfig.json diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/.gitignore b/tokens/transfer-tokens/poseidon/transfer-tokens-program/.gitignore new file mode 100644 index 000000000..2e0446b07 --- /dev/null +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/.gitignore @@ -0,0 +1,7 @@ +.anchor +.DS_Store +target +**/*.rs.bk +node_modules +test-ledger +.yarn diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/.prettierignore b/tokens/transfer-tokens/poseidon/transfer-tokens-program/.prettierignore new file mode 100644 index 000000000..414258343 --- /dev/null +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/.prettierignore @@ -0,0 +1,7 @@ +.anchor +.DS_Store +target +node_modules +dist +build +test-ledger diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/Anchor.toml b/tokens/transfer-tokens/poseidon/transfer-tokens-program/Anchor.toml new file mode 100644 index 000000000..b7cd91584 --- /dev/null +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/Anchor.toml @@ -0,0 +1,18 @@ +[toolchain] + +[features] +resolution = true +skip-lint = false + +[programs.localnet] +transfer_tokens_program = "BSHN8q3tEDsSiHBEHKKgxevQoSvXpKciZ7W3kcWSuEfC" + +[registry] +url = "https://api.apr.dev" + +[provider] +cluster = "Localnet" +wallet = "~/.config/solana/id.json" + +[scripts] +test = "pnpm ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts" diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/Cargo.toml b/tokens/transfer-tokens/poseidon/transfer-tokens-program/Cargo.toml new file mode 100644 index 000000000..f39770481 --- /dev/null +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/Cargo.toml @@ -0,0 +1,14 @@ +[workspace] +members = [ + "programs/*" +] +resolver = "2" + +[profile.release] +overflow-checks = true +lto = "fat" +codegen-units = 1 +[profile.release.build-override] +opt-level = 3 +incremental = false +codegen-units = 1 diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/migrations/deploy.ts b/tokens/transfer-tokens/poseidon/transfer-tokens-program/migrations/deploy.ts new file mode 100644 index 000000000..64a1c3599 --- /dev/null +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/migrations/deploy.ts @@ -0,0 +1,12 @@ +// Migrations are an early feature. Currently, they're nothing more than this +// single deploy script that's invoked from the CLI, injecting a provider +// configured from the workspace's Anchor.toml. + +const anchor = require('@coral-xyz/anchor'); + +module.exports = async (provider) => { + // Configure client to use the provider. + anchor.setProvider(provider); + + // Add your deploy script here. +}; diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/package.json b/tokens/transfer-tokens/poseidon/transfer-tokens-program/package.json new file mode 100644 index 000000000..8bb8327e6 --- /dev/null +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/package.json @@ -0,0 +1,22 @@ +{ + "dependencies": { + "@coral-xyz/anchor": "^0.30.0", + "@solana/spl-token": "^0.3.8", + "anchor-bankrun": "^0.5.0", + "solana-bankrun": "^0.4.0" + }, + "scripts": { + "lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w", + "lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check" + }, + "devDependencies": { + "@types/bn.js": "^5.1.0", + "@types/chai": "^4.3.0", + "@types/mocha": "^9.0.0", + "chai": "^4.3.4", + "mocha": "^9.0.3", + "ts-mocha": "^10.0.0", + "typescript": "^4.3.5", + "zx": "^8.1.4" + } +} diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/pnpm-lock.yaml b/tokens/transfer-tokens/poseidon/transfer-tokens-program/pnpm-lock.yaml new file mode 100644 index 000000000..45ae2aac4 --- /dev/null +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/pnpm-lock.yaml @@ -0,0 +1,1655 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + '@coral-xyz/anchor': + specifier: ^0.30.0 + version: 0.30.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@solana/spl-token': + specifier: ^0.3.8 + version: 0.3.11(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)(utf-8-validate@5.0.10) + anchor-bankrun: + specifier: ^0.5.0 + version: 0.5.0(@coral-xyz/anchor@0.30.1(bufferutil@4.0.8)(utf-8-validate@5.0.10))(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(solana-bankrun@0.4.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)) + solana-bankrun: + specifier: ^0.4.0 + version: 0.4.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + devDependencies: + '@types/bn.js': + specifier: ^5.1.0 + version: 5.1.6 + '@types/chai': + specifier: ^4.3.0 + version: 4.3.20 + '@types/mocha': + specifier: ^9.0.0 + version: 9.1.1 + chai: + specifier: ^4.3.4 + version: 4.5.0 + mocha: + specifier: ^9.0.3 + version: 9.2.2 + ts-mocha: + specifier: ^10.0.0 + version: 10.0.0(mocha@9.2.2) + typescript: + specifier: ^4.3.5 + version: 4.9.5 + zx: + specifier: ^8.1.4 + version: 8.1.9 + +packages: + + '@babel/runtime@7.25.9': + resolution: {integrity: sha512-4zpTHZ9Cm6L9L+uIqghQX8ZXg8HKFcjYO3qHoO8zTmRm6HQUJ8SSJ+KRvbMBZn0EGVlT4DRYeQ/6hjlyXBh+Kg==} + engines: {node: '>=6.9.0'} + + '@coral-xyz/anchor-errors@0.30.1': + resolution: {integrity: sha512-9Mkradf5yS5xiLWrl9WrpjqOrAV+/W2RQHDlbnAZBivoGpOs1ECjoDCkVk4aRG8ZdiFiB8zQEVlxf+8fKkmSfQ==} + engines: {node: '>=10'} + + '@coral-xyz/anchor@0.30.1': + resolution: {integrity: sha512-gDXFoF5oHgpriXAaLpxyWBHdCs8Awgf/gLHIo6crv7Aqm937CNdY+x+6hoj7QR5vaJV7MxWSQ0NGFzL3kPbWEQ==} + engines: {node: '>=11'} + + '@coral-xyz/borsh@0.30.1': + resolution: {integrity: sha512-aaxswpPrCFKl8vZTbxLssA2RvwX2zmKLlRCIktJOwW+VpVwYtXRtlWiIP+c2pPRKneiTiWCN2GEMSH9j1zTlWQ==} + engines: {node: '>=10'} + peerDependencies: + '@solana/web3.js': ^1.68.0 + + '@noble/curves@1.6.0': + resolution: {integrity: sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==} + engines: {node: ^14.21.3 || >=16} + + '@noble/hashes@1.5.0': + resolution: {integrity: sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==} + engines: {node: ^14.21.3 || >=16} + + '@solana/buffer-layout-utils@0.2.0': + resolution: {integrity: sha512-szG4sxgJGktbuZYDg2FfNmkMi0DYQoVjN2h7ta1W1hPrwzarcFLBq9UpX1UjNXsNpT9dn+chgprtWGioUAr4/g==} + engines: {node: '>= 10'} + + '@solana/buffer-layout@4.0.1': + resolution: {integrity: sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==} + engines: {node: '>=5.10'} + + '@solana/codecs-core@2.0.0-rc.1': + resolution: {integrity: sha512-bauxqMfSs8EHD0JKESaNmNuNvkvHSuN3bbWAF5RjOfDu2PugxHrvRebmYauvSumZ3cTfQ4HJJX6PG5rN852qyQ==} + peerDependencies: + typescript: '>=5' + + '@solana/codecs-data-structures@2.0.0-rc.1': + resolution: {integrity: sha512-rinCv0RrAVJ9rE/rmaibWJQxMwC5lSaORSZuwjopSUE6T0nb/MVg6Z1siNCXhh/HFTOg0l8bNvZHgBcN/yvXog==} + peerDependencies: + typescript: '>=5' + + '@solana/codecs-numbers@2.0.0-rc.1': + resolution: {integrity: sha512-J5i5mOkvukXn8E3Z7sGIPxsThRCgSdgTWJDQeZvucQ9PT6Y3HiVXJ0pcWiOWAoQ3RX8e/f4I3IC+wE6pZiJzDQ==} + peerDependencies: + typescript: '>=5' + + '@solana/codecs-strings@2.0.0-rc.1': + resolution: {integrity: sha512-9/wPhw8TbGRTt6mHC4Zz1RqOnuPTqq1Nb4EyuvpZ39GW6O2t2Q7Q0XxiB3+BdoEjwA2XgPw6e2iRfvYgqty44g==} + peerDependencies: + fastestsmallesttextencoderdecoder: ^1.0.22 + typescript: '>=5' + + '@solana/codecs@2.0.0-rc.1': + resolution: {integrity: sha512-qxoR7VybNJixV51L0G1RD2boZTcxmwUWnKCaJJExQ5qNKwbpSyDdWfFJfM5JhGyKe9DnPVOZB+JHWXnpbZBqrQ==} + peerDependencies: + typescript: '>=5' + + '@solana/errors@2.0.0-rc.1': + resolution: {integrity: sha512-ejNvQ2oJ7+bcFAYWj225lyRkHnixuAeb7RQCixm+5mH4n1IA4Qya/9Bmfy5RAAHQzxK43clu3kZmL5eF9VGtYQ==} + hasBin: true + peerDependencies: + typescript: '>=5' + + '@solana/options@2.0.0-rc.1': + resolution: {integrity: sha512-mLUcR9mZ3qfHlmMnREdIFPf9dpMc/Bl66tLSOOWxw4ml5xMT2ohFn7WGqoKcu/UHkT9CrC6+amEdqCNvUqI7AA==} + peerDependencies: + typescript: '>=5' + + '@solana/spl-token-metadata@0.1.6': + resolution: {integrity: sha512-7sMt1rsm/zQOQcUWllQX9mD2O6KhSAtY1hFR2hfFwgqfFWzSY9E9GDvFVNYUI1F0iQKcm6HmePU9QbKRXTEBiA==} + engines: {node: '>=16'} + peerDependencies: + '@solana/web3.js': ^1.95.3 + + '@solana/spl-token@0.3.11': + resolution: {integrity: sha512-bvohO3rIMSVL24Pb+I4EYTJ6cL82eFpInEXD/I8K8upOGjpqHsKUoAempR/RnUlI1qSFNyFlWJfu6MNUgfbCQQ==} + engines: {node: '>=16'} + peerDependencies: + '@solana/web3.js': ^1.88.0 + + '@solana/web3.js@1.95.4': + resolution: {integrity: sha512-sdewnNEA42ZSMxqkzdwEWi6fDgzwtJHaQa5ndUGEJYtoOnM6X5cvPmjoTUp7/k7bRrVAxfBgDnvQQHD6yhlLYw==} + + '@swc/helpers@0.5.13': + resolution: {integrity: sha512-UoKGxQ3r5kYI9dALKJapMmuK+1zWM/H17Z1+iwnNmzcJRnfFuevZs375TA5rW31pu4BS4NoSy1fRsexDXfWn5w==} + + '@types/bn.js@5.1.6': + resolution: {integrity: sha512-Xh8vSwUeMKeYYrj3cX4lGQgFSF/N03r+tv4AiLl1SucqV+uTQpxRcnM8AkXKHwYP9ZPXOYXRr2KPXpVlIvqh9w==} + + '@types/chai@4.3.20': + resolution: {integrity: sha512-/pC9HAB5I/xMlc5FP77qjCnI16ChlJfW0tGa0IUcFn38VJrTV6DeZ60NU5KZBtaOZqjdpwTWohz5HU1RrhiYxQ==} + + '@types/connect@3.4.38': + resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} + + '@types/fs-extra@11.0.4': + resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==} + + '@types/json5@0.0.29': + resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} + + '@types/jsonfile@6.1.4': + resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==} + + '@types/mocha@9.1.1': + resolution: {integrity: sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==} + + '@types/node@12.20.55': + resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} + + '@types/node@22.7.9': + resolution: {integrity: sha512-jrTfRC7FM6nChvU7X2KqcrgquofrWLFDeYC1hKfwNWomVvrn7JIksqf344WN2X/y8xrgqBd2dJATZV4GbatBfg==} + + '@types/uuid@8.3.4': + resolution: {integrity: sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==} + + '@types/ws@7.4.7': + resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==} + + '@types/ws@8.5.12': + resolution: {integrity: sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==} + + '@ungap/promise-all-settled@1.1.2': + resolution: {integrity: sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==} + + JSONStream@1.3.5: + resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==} + hasBin: true + + agentkeepalive@4.5.0: + resolution: {integrity: sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==} + engines: {node: '>= 8.0.0'} + + anchor-bankrun@0.5.0: + resolution: {integrity: sha512-cNTRv7pN9dy+kiyJ3UlNVTg9hAXhY2HtNVNXJbP/2BkS9nOdLV0qKWhgW8UR9Go0gYuEOLKuPzrGL4HFAZPsVw==} + engines: {node: '>= 10'} + peerDependencies: + '@coral-xyz/anchor': ^0.30.0 + '@solana/web3.js': '>1.92.0' + solana-bankrun: '>=0.2.0 <0.5.0' + + ansi-colors@4.1.1: + resolution: {integrity: sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==} + engines: {node: '>=6'} + + ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + + ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + + anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + + argparse@2.0.1: + resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + + arrify@1.0.1: + resolution: {integrity: sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==} + engines: {node: '>=0.10.0'} + + assertion-error@1.1.0: + resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} + + balanced-match@1.0.2: + resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + + base-x@3.0.10: + resolution: {integrity: sha512-7d0s06rR9rYaIWHkpfLIFICM/tkSVdoPC9qYAQRpxn9DdKNWNsKC0uk++akckyLq16Tx2WIinnZ6WRriAt6njQ==} + + base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + + bigint-buffer@1.1.5: + resolution: {integrity: sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA==} + engines: {node: '>= 10.0.0'} + + bignumber.js@9.1.2: + resolution: {integrity: sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==} + + binary-extensions@2.3.0: + resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} + engines: {node: '>=8'} + + bindings@1.5.0: + resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==} + + bn.js@5.2.1: + resolution: {integrity: sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==} + + borsh@0.7.0: + resolution: {integrity: sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==} + + brace-expansion@1.1.11: + resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} + + braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} + + browser-stdout@1.3.1: + resolution: {integrity: sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==} + + bs58@4.0.1: + resolution: {integrity: sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==} + + buffer-from@1.1.2: + resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + + buffer-layout@1.2.2: + resolution: {integrity: sha512-kWSuLN694+KTk8SrYvCqwP2WcgQjoRCiF5b4QDvkkz8EmgD+aWAIceGFKMIAdmF/pH+vpgNV3d3kAKorcdAmWA==} + engines: {node: '>=4.5'} + + buffer@6.0.3: + resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} + + bufferutil@4.0.8: + resolution: {integrity: sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==} + engines: {node: '>=6.14.2'} + + camelcase@6.3.0: + resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} + engines: {node: '>=10'} + + chai@4.5.0: + resolution: {integrity: sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==} + engines: {node: '>=4'} + + chalk@4.1.2: + resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} + engines: {node: '>=10'} + + chalk@5.3.0: + resolution: {integrity: sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + + check-error@1.0.3: + resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} + + chokidar@3.5.3: + resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} + engines: {node: '>= 8.10.0'} + + cliui@7.0.4: + resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} + + color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} + + color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + + commander@12.1.0: + resolution: {integrity: sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==} + engines: {node: '>=18'} + + commander@2.20.3: + resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + + concat-map@0.0.1: + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + + cross-fetch@3.1.8: + resolution: {integrity: sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==} + + crypto-hash@1.3.0: + resolution: {integrity: sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg==} + engines: {node: '>=8'} + + debug@4.3.3: + resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + decamelize@4.0.0: + resolution: {integrity: sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==} + engines: {node: '>=10'} + + deep-eql@4.1.4: + resolution: {integrity: sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==} + engines: {node: '>=6'} + + delay@5.0.0: + resolution: {integrity: sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==} + engines: {node: '>=10'} + + diff@3.5.0: + resolution: {integrity: sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==} + engines: {node: '>=0.3.1'} + + diff@5.0.0: + resolution: {integrity: sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==} + engines: {node: '>=0.3.1'} + + dot-case@3.0.4: + resolution: {integrity: sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==} + + emoji-regex@8.0.0: + resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + + es6-promise@4.2.8: + resolution: {integrity: sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==} + + es6-promisify@5.0.0: + resolution: {integrity: sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==} + + escalade@3.2.0: + resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} + engines: {node: '>=6'} + + escape-string-regexp@4.0.0: + resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} + engines: {node: '>=10'} + + eventemitter3@4.0.7: + resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==} + + eventemitter3@5.0.1: + resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} + + eyes@0.1.8: + resolution: {integrity: sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==} + engines: {node: '> 0.1.90'} + + fast-stable-stringify@1.0.0: + resolution: {integrity: sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==} + + fastestsmallesttextencoderdecoder@1.0.22: + resolution: {integrity: sha512-Pb8d48e+oIuY4MaM64Cd7OW1gt4nxCHs7/ddPPZ/Ic3sg8yVGM7O9wDvZ7us6ScaUupzM+pfBolwtYhN1IxBIw==} + + file-uri-to-path@1.0.0: + resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==} + + fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} + + find-up@5.0.0: + resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} + engines: {node: '>=10'} + + flat@5.0.2: + resolution: {integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==} + hasBin: true + + fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + get-caller-file@2.0.5: + resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} + engines: {node: 6.* || 8.* || >= 10.*} + + get-func-name@2.0.2: + resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==} + + glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + + glob@7.2.0: + resolution: {integrity: sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==} + deprecated: Glob versions prior to v9 are no longer supported + + growl@1.10.5: + resolution: {integrity: sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==} + engines: {node: '>=4.x'} + + has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + + he@1.2.0: + resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} + hasBin: true + + humanize-ms@1.2.1: + resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==} + + ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + + inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. + + inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + + is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + + is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + + is-fullwidth-code-point@3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} + + is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + + is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + + is-plain-obj@2.1.0: + resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} + engines: {node: '>=8'} + + is-unicode-supported@0.1.0: + resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} + engines: {node: '>=10'} + + isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + + isomorphic-ws@4.0.1: + resolution: {integrity: sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==} + peerDependencies: + ws: '*' + + jayson@4.1.2: + resolution: {integrity: sha512-5nzMWDHy6f+koZOuYsArh2AXs73NfWYVlFyJJuCedr93GpY+Ku8qq10ropSXVfHK+H0T6paA88ww+/dV+1fBNA==} + engines: {node: '>=8'} + hasBin: true + + js-yaml@4.1.0: + resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} + hasBin: true + + json-stringify-safe@5.0.1: + resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==} + + json5@1.0.2: + resolution: {integrity: sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==} + hasBin: true + + jsonparse@1.3.1: + resolution: {integrity: sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==} + engines: {'0': node >= 0.2.0} + + locate-path@6.0.0: + resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} + engines: {node: '>=10'} + + log-symbols@4.1.0: + resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} + engines: {node: '>=10'} + + loupe@2.3.7: + resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} + + lower-case@2.0.2: + resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==} + + make-error@1.3.6: + resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + + minimatch@3.1.2: + resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + + minimatch@4.2.1: + resolution: {integrity: sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==} + engines: {node: '>=10'} + + minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + + mkdirp@0.5.6: + resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==} + hasBin: true + + mocha@9.2.2: + resolution: {integrity: sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g==} + engines: {node: '>= 12.0.0'} + hasBin: true + + ms@2.1.2: + resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + + nanoid@3.3.1: + resolution: {integrity: sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + + no-case@3.0.4: + resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} + + node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + + node-gyp-build@4.8.2: + resolution: {integrity: sha512-IRUxE4BVsHWXkV/SFOut4qTlagw2aM8T5/vnTsmrHJvVoKueJHRc/JaFND7QDDc61kLYUJ6qlZM3sqTSyx2dTw==} + hasBin: true + + normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + + p-limit@3.1.0: + resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} + engines: {node: '>=10'} + + p-locate@5.0.0: + resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} + engines: {node: '>=10'} + + pako@2.1.0: + resolution: {integrity: sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==} + + path-exists@4.0.0: + resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} + engines: {node: '>=8'} + + path-is-absolute@1.0.1: + resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} + engines: {node: '>=0.10.0'} + + pathval@1.1.1: + resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} + + picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + + randombytes@2.1.0: + resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} + + readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + + regenerator-runtime@0.14.1: + resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} + + require-directory@2.1.1: + resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} + engines: {node: '>=0.10.0'} + + rpc-websockets@9.0.4: + resolution: {integrity: sha512-yWZWN0M+bivtoNLnaDbtny4XchdAIF5Q4g/ZsC5UC61Ckbp0QczwO8fg44rV3uYmY4WHd+EZQbn90W1d8ojzqQ==} + + safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + + serialize-javascript@6.0.0: + resolution: {integrity: sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==} + + snake-case@3.0.4: + resolution: {integrity: sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==} + + solana-bankrun-darwin-arm64@0.4.0: + resolution: {integrity: sha512-6dz78Teoz7ez/3lpRLDjktYLJb79FcmJk2me4/YaB8WiO6W43OdExU4h+d2FyuAryO2DgBPXaBoBNY/8J1HJmw==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [darwin] + + solana-bankrun-darwin-universal@0.4.0: + resolution: {integrity: sha512-zSSw/Jx3KNU42pPMmrEWABd0nOwGJfsj7nm9chVZ3ae7WQg3Uty0hHAkn5NSDCj3OOiN0py9Dr1l9vmRJpOOxg==} + engines: {node: '>= 10'} + os: [darwin] + + solana-bankrun-darwin-x64@0.4.0: + resolution: {integrity: sha512-LWjs5fsgHFtyr7YdJR6r0Ho5zrtzI6CY4wvwPXr8H2m3b4pZe6RLIZjQtabCav4cguc14G0K8yQB2PTMuGub8w==} + engines: {node: '>= 10'} + cpu: [x64] + os: [darwin] + + solana-bankrun-linux-x64-gnu@0.4.0: + resolution: {integrity: sha512-SrlVrb82UIxt21Zr/XZFHVV/h9zd2/nP25PMpLJVLD7Pgl2yhkhfi82xj3OjxoQqWe+zkBJ+uszA0EEKr67yNw==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + + solana-bankrun-linux-x64-musl@0.4.0: + resolution: {integrity: sha512-Nv328ZanmURdYfcLL+jwB1oMzX4ZzK57NwIcuJjGlf0XSNLq96EoaO5buEiUTo4Ls7MqqMyLbClHcrPE7/aKyA==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + + solana-bankrun@0.4.0: + resolution: {integrity: sha512-NMmXUipPBkt8NgnyNO3SCnPERP6xT/AMNMBooljGA3+rG6NN8lmXJsKeLqQTiFsDeWD74U++QM/DgcueSWvrIg==} + engines: {node: '>= 10'} + + source-map-support@0.5.21: + resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} + + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + + string-width@4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} + + strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + + strip-bom@3.0.0: + resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} + engines: {node: '>=4'} + + strip-json-comments@3.1.1: + resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} + engines: {node: '>=8'} + + superstruct@0.15.5: + resolution: {integrity: sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ==} + + superstruct@2.0.2: + resolution: {integrity: sha512-uV+TFRZdXsqXTL2pRvujROjdZQ4RAlBUS5BTh9IGm+jTqQntYThciG/qu57Gs69yjnVUSqdxF9YLmSnpupBW9A==} + engines: {node: '>=14.0.0'} + + supports-color@7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} + + supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} + + text-encoding-utf-8@1.0.2: + resolution: {integrity: sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==} + + through@2.3.8: + resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} + + to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + + toml@3.0.0: + resolution: {integrity: sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==} + + tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + + ts-mocha@10.0.0: + resolution: {integrity: sha512-VRfgDO+iiuJFlNB18tzOfypJ21xn2xbuZyDvJvqpTbWgkAgD17ONGr8t+Tl8rcBtOBdjXp5e/Rk+d39f7XBHRw==} + engines: {node: '>= 6.X.X'} + hasBin: true + peerDependencies: + mocha: ^3.X.X || ^4.X.X || ^5.X.X || ^6.X.X || ^7.X.X || ^8.X.X || ^9.X.X || ^10.X.X + + ts-node@7.0.1: + resolution: {integrity: sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw==} + engines: {node: '>=4.2.0'} + hasBin: true + + tsconfig-paths@3.15.0: + resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} + + tslib@2.8.0: + resolution: {integrity: sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==} + + type-detect@4.1.0: + resolution: {integrity: sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==} + engines: {node: '>=4'} + + typescript@4.9.5: + resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} + engines: {node: '>=4.2.0'} + hasBin: true + + undici-types@6.19.8: + resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} + + utf-8-validate@5.0.10: + resolution: {integrity: sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==} + engines: {node: '>=6.14.2'} + + uuid@8.3.2: + resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} + hasBin: true + + webidl-conversions@3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + + whatwg-url@5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + + workerpool@6.2.0: + resolution: {integrity: sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==} + + wrap-ansi@7.0.0: + resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} + engines: {node: '>=10'} + + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + + ws@7.5.10: + resolution: {integrity: sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==} + engines: {node: '>=8.3.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + + ws@8.18.0: + resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + + y18n@5.0.8: + resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} + engines: {node: '>=10'} + + yargs-parser@20.2.4: + resolution: {integrity: sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==} + engines: {node: '>=10'} + + yargs-unparser@2.0.0: + resolution: {integrity: sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==} + engines: {node: '>=10'} + + yargs@16.2.0: + resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==} + engines: {node: '>=10'} + + yn@2.0.0: + resolution: {integrity: sha512-uTv8J/wiWTgUTg+9vLTi//leUl5vDQS6uii/emeTb2ssY7vl6QWf2fFbIIGjnhjvbdKlU0ed7QPgY1htTC86jQ==} + engines: {node: '>=4'} + + yocto-queue@0.1.0: + resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} + engines: {node: '>=10'} + + zx@8.1.9: + resolution: {integrity: sha512-UHuLHphHmsBYKkAchkSrEN4nzDyagafqC9HUxtc1J7eopaScW6H9dsLJ1lmkAntnLtDTGoM8fa+jrJrXiIfKFA==} + engines: {node: '>= 12.17.0'} + hasBin: true + +snapshots: + + '@babel/runtime@7.25.9': + dependencies: + regenerator-runtime: 0.14.1 + + '@coral-xyz/anchor-errors@0.30.1': {} + + '@coral-xyz/anchor@0.30.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + dependencies: + '@coral-xyz/anchor-errors': 0.30.1 + '@coral-xyz/borsh': 0.30.1(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10)) + '@noble/hashes': 1.5.0 + '@solana/web3.js': 1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10) + bn.js: 5.2.1 + bs58: 4.0.1 + buffer-layout: 1.2.2 + camelcase: 6.3.0 + cross-fetch: 3.1.8 + crypto-hash: 1.3.0 + eventemitter3: 4.0.7 + pako: 2.1.0 + snake-case: 3.0.4 + superstruct: 0.15.5 + toml: 3.0.0 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + + '@coral-xyz/borsh@0.30.1(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))': + dependencies: + '@solana/web3.js': 1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10) + bn.js: 5.2.1 + buffer-layout: 1.2.2 + + '@noble/curves@1.6.0': + dependencies: + '@noble/hashes': 1.5.0 + + '@noble/hashes@1.5.0': {} + + '@solana/buffer-layout-utils@0.2.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + dependencies: + '@solana/buffer-layout': 4.0.1 + '@solana/web3.js': 1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10) + bigint-buffer: 1.1.5 + bignumber.js: 9.1.2 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + + '@solana/buffer-layout@4.0.1': + dependencies: + buffer: 6.0.3 + + '@solana/codecs-core@2.0.0-rc.1(typescript@4.9.5)': + dependencies: + '@solana/errors': 2.0.0-rc.1(typescript@4.9.5) + typescript: 4.9.5 + + '@solana/codecs-data-structures@2.0.0-rc.1(typescript@4.9.5)': + dependencies: + '@solana/codecs-core': 2.0.0-rc.1(typescript@4.9.5) + '@solana/codecs-numbers': 2.0.0-rc.1(typescript@4.9.5) + '@solana/errors': 2.0.0-rc.1(typescript@4.9.5) + typescript: 4.9.5 + + '@solana/codecs-numbers@2.0.0-rc.1(typescript@4.9.5)': + dependencies: + '@solana/codecs-core': 2.0.0-rc.1(typescript@4.9.5) + '@solana/errors': 2.0.0-rc.1(typescript@4.9.5) + typescript: 4.9.5 + + '@solana/codecs-strings@2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)': + dependencies: + '@solana/codecs-core': 2.0.0-rc.1(typescript@4.9.5) + '@solana/codecs-numbers': 2.0.0-rc.1(typescript@4.9.5) + '@solana/errors': 2.0.0-rc.1(typescript@4.9.5) + fastestsmallesttextencoderdecoder: 1.0.22 + typescript: 4.9.5 + + '@solana/codecs@2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)': + dependencies: + '@solana/codecs-core': 2.0.0-rc.1(typescript@4.9.5) + '@solana/codecs-data-structures': 2.0.0-rc.1(typescript@4.9.5) + '@solana/codecs-numbers': 2.0.0-rc.1(typescript@4.9.5) + '@solana/codecs-strings': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5) + '@solana/options': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5) + typescript: 4.9.5 + transitivePeerDependencies: + - fastestsmallesttextencoderdecoder + + '@solana/errors@2.0.0-rc.1(typescript@4.9.5)': + dependencies: + chalk: 5.3.0 + commander: 12.1.0 + typescript: 4.9.5 + + '@solana/options@2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)': + dependencies: + '@solana/codecs-core': 2.0.0-rc.1(typescript@4.9.5) + '@solana/codecs-data-structures': 2.0.0-rc.1(typescript@4.9.5) + '@solana/codecs-numbers': 2.0.0-rc.1(typescript@4.9.5) + '@solana/codecs-strings': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5) + '@solana/errors': 2.0.0-rc.1(typescript@4.9.5) + typescript: 4.9.5 + transitivePeerDependencies: + - fastestsmallesttextencoderdecoder + + '@solana/spl-token-metadata@0.1.6(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)': + dependencies: + '@solana/codecs': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5) + '@solana/web3.js': 1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10) + transitivePeerDependencies: + - fastestsmallesttextencoderdecoder + - typescript + + '@solana/spl-token@0.3.11(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)(utf-8-validate@5.0.10)': + dependencies: + '@solana/buffer-layout': 4.0.1 + '@solana/buffer-layout-utils': 0.2.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@solana/spl-token-metadata': 0.1.6(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5) + '@solana/web3.js': 1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10) + buffer: 6.0.3 + transitivePeerDependencies: + - bufferutil + - encoding + - fastestsmallesttextencoderdecoder + - typescript + - utf-8-validate + + '@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + dependencies: + '@babel/runtime': 7.25.9 + '@noble/curves': 1.6.0 + '@noble/hashes': 1.5.0 + '@solana/buffer-layout': 4.0.1 + agentkeepalive: 4.5.0 + bigint-buffer: 1.1.5 + bn.js: 5.2.1 + borsh: 0.7.0 + bs58: 4.0.1 + buffer: 6.0.3 + fast-stable-stringify: 1.0.0 + jayson: 4.1.2(bufferutil@4.0.8)(utf-8-validate@5.0.10) + node-fetch: 2.7.0 + rpc-websockets: 9.0.4 + superstruct: 2.0.2 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + + '@swc/helpers@0.5.13': + dependencies: + tslib: 2.8.0 + + '@types/bn.js@5.1.6': + dependencies: + '@types/node': 22.7.9 + + '@types/chai@4.3.20': {} + + '@types/connect@3.4.38': + dependencies: + '@types/node': 22.7.9 + + '@types/fs-extra@11.0.4': + dependencies: + '@types/jsonfile': 6.1.4 + '@types/node': 22.7.9 + optional: true + + '@types/json5@0.0.29': + optional: true + + '@types/jsonfile@6.1.4': + dependencies: + '@types/node': 22.7.9 + optional: true + + '@types/mocha@9.1.1': {} + + '@types/node@12.20.55': {} + + '@types/node@22.7.9': + dependencies: + undici-types: 6.19.8 + + '@types/uuid@8.3.4': {} + + '@types/ws@7.4.7': + dependencies: + '@types/node': 22.7.9 + + '@types/ws@8.5.12': + dependencies: + '@types/node': 22.7.9 + + '@ungap/promise-all-settled@1.1.2': {} + + JSONStream@1.3.5: + dependencies: + jsonparse: 1.3.1 + through: 2.3.8 + + agentkeepalive@4.5.0: + dependencies: + humanize-ms: 1.2.1 + + anchor-bankrun@0.5.0(@coral-xyz/anchor@0.30.1(bufferutil@4.0.8)(utf-8-validate@5.0.10))(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(solana-bankrun@0.4.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)): + dependencies: + '@coral-xyz/anchor': 0.30.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@solana/web3.js': 1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10) + solana-bankrun: 0.4.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + + ansi-colors@4.1.1: {} + + ansi-regex@5.0.1: {} + + ansi-styles@4.3.0: + dependencies: + color-convert: 2.0.1 + + anymatch@3.1.3: + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.1 + + argparse@2.0.1: {} + + arrify@1.0.1: {} + + assertion-error@1.1.0: {} + + balanced-match@1.0.2: {} + + base-x@3.0.10: + dependencies: + safe-buffer: 5.2.1 + + base64-js@1.5.1: {} + + bigint-buffer@1.1.5: + dependencies: + bindings: 1.5.0 + + bignumber.js@9.1.2: {} + + binary-extensions@2.3.0: {} + + bindings@1.5.0: + dependencies: + file-uri-to-path: 1.0.0 + + bn.js@5.2.1: {} + + borsh@0.7.0: + dependencies: + bn.js: 5.2.1 + bs58: 4.0.1 + text-encoding-utf-8: 1.0.2 + + brace-expansion@1.1.11: + dependencies: + balanced-match: 1.0.2 + concat-map: 0.0.1 + + braces@3.0.3: + dependencies: + fill-range: 7.1.1 + + browser-stdout@1.3.1: {} + + bs58@4.0.1: + dependencies: + base-x: 3.0.10 + + buffer-from@1.1.2: {} + + buffer-layout@1.2.2: {} + + buffer@6.0.3: + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + + bufferutil@4.0.8: + dependencies: + node-gyp-build: 4.8.2 + optional: true + + camelcase@6.3.0: {} + + chai@4.5.0: + dependencies: + assertion-error: 1.1.0 + check-error: 1.0.3 + deep-eql: 4.1.4 + get-func-name: 2.0.2 + loupe: 2.3.7 + pathval: 1.1.1 + type-detect: 4.1.0 + + chalk@4.1.2: + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + + chalk@5.3.0: {} + + check-error@1.0.3: + dependencies: + get-func-name: 2.0.2 + + chokidar@3.5.3: + dependencies: + anymatch: 3.1.3 + braces: 3.0.3 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.3 + + cliui@7.0.4: + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + + color-convert@2.0.1: + dependencies: + color-name: 1.1.4 + + color-name@1.1.4: {} + + commander@12.1.0: {} + + commander@2.20.3: {} + + concat-map@0.0.1: {} + + cross-fetch@3.1.8: + dependencies: + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + + crypto-hash@1.3.0: {} + + debug@4.3.3(supports-color@8.1.1): + dependencies: + ms: 2.1.2 + optionalDependencies: + supports-color: 8.1.1 + + decamelize@4.0.0: {} + + deep-eql@4.1.4: + dependencies: + type-detect: 4.1.0 + + delay@5.0.0: {} + + diff@3.5.0: {} + + diff@5.0.0: {} + + dot-case@3.0.4: + dependencies: + no-case: 3.0.4 + tslib: 2.8.0 + + emoji-regex@8.0.0: {} + + es6-promise@4.2.8: {} + + es6-promisify@5.0.0: + dependencies: + es6-promise: 4.2.8 + + escalade@3.2.0: {} + + escape-string-regexp@4.0.0: {} + + eventemitter3@4.0.7: {} + + eventemitter3@5.0.1: {} + + eyes@0.1.8: {} + + fast-stable-stringify@1.0.0: {} + + fastestsmallesttextencoderdecoder@1.0.22: {} + + file-uri-to-path@1.0.0: {} + + fill-range@7.1.1: + dependencies: + to-regex-range: 5.0.1 + + find-up@5.0.0: + dependencies: + locate-path: 6.0.0 + path-exists: 4.0.0 + + flat@5.0.2: {} + + fs.realpath@1.0.0: {} + + fsevents@2.3.3: + optional: true + + get-caller-file@2.0.5: {} + + get-func-name@2.0.2: {} + + glob-parent@5.1.2: + dependencies: + is-glob: 4.0.3 + + glob@7.2.0: + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.1.2 + once: 1.4.0 + path-is-absolute: 1.0.1 + + growl@1.10.5: {} + + has-flag@4.0.0: {} + + he@1.2.0: {} + + humanize-ms@1.2.1: + dependencies: + ms: 2.1.3 + + ieee754@1.2.1: {} + + inflight@1.0.6: + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + + inherits@2.0.4: {} + + is-binary-path@2.1.0: + dependencies: + binary-extensions: 2.3.0 + + is-extglob@2.1.1: {} + + is-fullwidth-code-point@3.0.0: {} + + is-glob@4.0.3: + dependencies: + is-extglob: 2.1.1 + + is-number@7.0.0: {} + + is-plain-obj@2.1.0: {} + + is-unicode-supported@0.1.0: {} + + isexe@2.0.0: {} + + isomorphic-ws@4.0.1(ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10)): + dependencies: + ws: 7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10) + + jayson@4.1.2(bufferutil@4.0.8)(utf-8-validate@5.0.10): + dependencies: + '@types/connect': 3.4.38 + '@types/node': 12.20.55 + '@types/ws': 7.4.7 + JSONStream: 1.3.5 + commander: 2.20.3 + delay: 5.0.0 + es6-promisify: 5.0.0 + eyes: 0.1.8 + isomorphic-ws: 4.0.1(ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10)) + json-stringify-safe: 5.0.1 + uuid: 8.3.2 + ws: 7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10) + transitivePeerDependencies: + - bufferutil + - utf-8-validate + + js-yaml@4.1.0: + dependencies: + argparse: 2.0.1 + + json-stringify-safe@5.0.1: {} + + json5@1.0.2: + dependencies: + minimist: 1.2.8 + optional: true + + jsonparse@1.3.1: {} + + locate-path@6.0.0: + dependencies: + p-locate: 5.0.0 + + log-symbols@4.1.0: + dependencies: + chalk: 4.1.2 + is-unicode-supported: 0.1.0 + + loupe@2.3.7: + dependencies: + get-func-name: 2.0.2 + + lower-case@2.0.2: + dependencies: + tslib: 2.8.0 + + make-error@1.3.6: {} + + minimatch@3.1.2: + dependencies: + brace-expansion: 1.1.11 + + minimatch@4.2.1: + dependencies: + brace-expansion: 1.1.11 + + minimist@1.2.8: {} + + mkdirp@0.5.6: + dependencies: + minimist: 1.2.8 + + mocha@9.2.2: + dependencies: + '@ungap/promise-all-settled': 1.1.2 + ansi-colors: 4.1.1 + browser-stdout: 1.3.1 + chokidar: 3.5.3 + debug: 4.3.3(supports-color@8.1.1) + diff: 5.0.0 + escape-string-regexp: 4.0.0 + find-up: 5.0.0 + glob: 7.2.0 + growl: 1.10.5 + he: 1.2.0 + js-yaml: 4.1.0 + log-symbols: 4.1.0 + minimatch: 4.2.1 + ms: 2.1.3 + nanoid: 3.3.1 + serialize-javascript: 6.0.0 + strip-json-comments: 3.1.1 + supports-color: 8.1.1 + which: 2.0.2 + workerpool: 6.2.0 + yargs: 16.2.0 + yargs-parser: 20.2.4 + yargs-unparser: 2.0.0 + + ms@2.1.2: {} + + ms@2.1.3: {} + + nanoid@3.3.1: {} + + no-case@3.0.4: + dependencies: + lower-case: 2.0.2 + tslib: 2.8.0 + + node-fetch@2.7.0: + dependencies: + whatwg-url: 5.0.0 + + node-gyp-build@4.8.2: + optional: true + + normalize-path@3.0.0: {} + + once@1.4.0: + dependencies: + wrappy: 1.0.2 + + p-limit@3.1.0: + dependencies: + yocto-queue: 0.1.0 + + p-locate@5.0.0: + dependencies: + p-limit: 3.1.0 + + pako@2.1.0: {} + + path-exists@4.0.0: {} + + path-is-absolute@1.0.1: {} + + pathval@1.1.1: {} + + picomatch@2.3.1: {} + + randombytes@2.1.0: + dependencies: + safe-buffer: 5.2.1 + + readdirp@3.6.0: + dependencies: + picomatch: 2.3.1 + + regenerator-runtime@0.14.1: {} + + require-directory@2.1.1: {} + + rpc-websockets@9.0.4: + dependencies: + '@swc/helpers': 0.5.13 + '@types/uuid': 8.3.4 + '@types/ws': 8.5.12 + buffer: 6.0.3 + eventemitter3: 5.0.1 + uuid: 8.3.2 + ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + optionalDependencies: + bufferutil: 4.0.8 + utf-8-validate: 5.0.10 + + safe-buffer@5.2.1: {} + + serialize-javascript@6.0.0: + dependencies: + randombytes: 2.1.0 + + snake-case@3.0.4: + dependencies: + dot-case: 3.0.4 + tslib: 2.8.0 + + solana-bankrun-darwin-arm64@0.4.0: + optional: true + + solana-bankrun-darwin-universal@0.4.0: + optional: true + + solana-bankrun-darwin-x64@0.4.0: + optional: true + + solana-bankrun-linux-x64-gnu@0.4.0: + optional: true + + solana-bankrun-linux-x64-musl@0.4.0: + optional: true + + solana-bankrun@0.4.0(bufferutil@4.0.8)(utf-8-validate@5.0.10): + dependencies: + '@solana/web3.js': 1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10) + bs58: 4.0.1 + optionalDependencies: + solana-bankrun-darwin-arm64: 0.4.0 + solana-bankrun-darwin-universal: 0.4.0 + solana-bankrun-darwin-x64: 0.4.0 + solana-bankrun-linux-x64-gnu: 0.4.0 + solana-bankrun-linux-x64-musl: 0.4.0 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + + source-map-support@0.5.21: + dependencies: + buffer-from: 1.1.2 + source-map: 0.6.1 + + source-map@0.6.1: {} + + string-width@4.2.3: + dependencies: + emoji-regex: 8.0.0 + is-fullwidth-code-point: 3.0.0 + strip-ansi: 6.0.1 + + strip-ansi@6.0.1: + dependencies: + ansi-regex: 5.0.1 + + strip-bom@3.0.0: + optional: true + + strip-json-comments@3.1.1: {} + + superstruct@0.15.5: {} + + superstruct@2.0.2: {} + + supports-color@7.2.0: + dependencies: + has-flag: 4.0.0 + + supports-color@8.1.1: + dependencies: + has-flag: 4.0.0 + + text-encoding-utf-8@1.0.2: {} + + through@2.3.8: {} + + to-regex-range@5.0.1: + dependencies: + is-number: 7.0.0 + + toml@3.0.0: {} + + tr46@0.0.3: {} + + ts-mocha@10.0.0(mocha@9.2.2): + dependencies: + mocha: 9.2.2 + ts-node: 7.0.1 + optionalDependencies: + tsconfig-paths: 3.15.0 + + ts-node@7.0.1: + dependencies: + arrify: 1.0.1 + buffer-from: 1.1.2 + diff: 3.5.0 + make-error: 1.3.6 + minimist: 1.2.8 + mkdirp: 0.5.6 + source-map-support: 0.5.21 + yn: 2.0.0 + + tsconfig-paths@3.15.0: + dependencies: + '@types/json5': 0.0.29 + json5: 1.0.2 + minimist: 1.2.8 + strip-bom: 3.0.0 + optional: true + + tslib@2.8.0: {} + + type-detect@4.1.0: {} + + typescript@4.9.5: {} + + undici-types@6.19.8: {} + + utf-8-validate@5.0.10: + dependencies: + node-gyp-build: 4.8.2 + optional: true + + uuid@8.3.2: {} + + webidl-conversions@3.0.1: {} + + whatwg-url@5.0.0: + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + + which@2.0.2: + dependencies: + isexe: 2.0.0 + + workerpool@6.2.0: {} + + wrap-ansi@7.0.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + + wrappy@1.0.2: {} + + ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10): + optionalDependencies: + bufferutil: 4.0.8 + utf-8-validate: 5.0.10 + + ws@8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10): + optionalDependencies: + bufferutil: 4.0.8 + utf-8-validate: 5.0.10 + + y18n@5.0.8: {} + + yargs-parser@20.2.4: {} + + yargs-unparser@2.0.0: + dependencies: + camelcase: 6.3.0 + decamelize: 4.0.0 + flat: 5.0.2 + is-plain-obj: 2.1.0 + + yargs@16.2.0: + dependencies: + cliui: 7.0.4 + escalade: 3.2.0 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 20.2.4 + + yn@2.0.0: {} + + yocto-queue@0.1.0: {} + + zx@8.1.9: + optionalDependencies: + '@types/fs-extra': 11.0.4 + '@types/node': 22.7.9 diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/Cargo.toml b/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/Cargo.toml new file mode 100644 index 000000000..bced8a79d --- /dev/null +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "transfer-tokens-program" +version = "0.1.0" +description = "Created with Anchor" +edition = "2021" + +[lib] +crate-type = ["cdylib", "lib"] +name = "transfer_tokens_program" + +[features] +default = [] +cpi = ["no-entrypoint"] +no-entrypoint = [] +no-idl = [] +no-log-ix-name = [] +idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"] + +[dependencies] +anchor-lang = { version = "0.30.1", features = ["init-if-needed"] } +anchor-spl = "0.30.1" diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/Xargo.toml b/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/Xargo.toml new file mode 100644 index 000000000..475fb71ed --- /dev/null +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/Xargo.toml @@ -0,0 +1,2 @@ +[target.bpfel-unknown-unknown.dependencies.std] +features = [] diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/src/lib.rs b/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/src/lib.rs new file mode 100644 index 000000000..3fe0cae97 --- /dev/null +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/src/lib.rs @@ -0,0 +1,53 @@ +use anchor_lang::prelude::*; +use anchor_spl::{ + associated_token::AssociatedToken, + token::{Transfer as TransferSPL, Mint, transfer as transfer_spl, TokenAccount, Token}, +}; +declare_id!("BSHN8q3tEDsSiHBEHKKgxevQoSvXpKciZ7W3kcWSuEfC"); +#[program] +pub mod transfer_tokens_program { + use super::*; + pub fn transfer_tokens( + ctx: Context, + transfer_amount: u64, + ) -> Result<()> { + let cpi_accounts = TransferSPL { + from: ctx.accounts.source_ata.to_account_info(), + to: ctx.accounts.destination_ata.to_account_info(), + authority: ctx.accounts.owner.to_account_info(), + }; + let cpi_ctx = CpiContext::new( + ctx.accounts.token_program.to_account_info(), + cpi_accounts, + ); + transfer_spl(cpi_ctx, transfer_amount)?; + Ok(()) + } +} +#[derive(Accounts)] +pub struct TransferTokensContext<'info> { + #[account(mut)] + pub owner: Signer<'info>, + #[account( + init_if_needed, + payer = owner, + associated_token::mint = mint, + associated_token::authority = destination, + )] + pub destination_ata: Account<'info, TokenAccount>, + #[account()] + pub mint: Account<'info, Mint>, + #[account( + init_if_needed, + payer = owner, + associated_token::mint = mint, + associated_token::authority = owner, + )] + pub source_ata: Account<'info, TokenAccount>, + /// CHECK: Not necessary to enforce authority verification here + #[account(mut)] + pub destination: UncheckedAccount<'info>, + pub associated_token_program: Program<'info, AssociatedToken>, + pub token_program: Program<'info, Token>, + pub system_program: Program<'info, System>, +} diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/bankrun.test.ts b/tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/bankrun.test.ts new file mode 100644 index 000000000..f4109757e --- /dev/null +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/bankrun.test.ts @@ -0,0 +1,151 @@ +// import { describe, it, before } from 'node:test'; +// import * as anchor from '@coral-xyz/anchor'; +// import { PublicKey, Keypair } from '@solana/web3.js'; +// import { BankrunProvider } from 'anchor-bankrun'; +// import { assert } from 'chai'; +// import { startAnchor } from 'solana-bankrun'; +// import { +// getAssociatedTokenAddressSync, +// createMint, +// mintTo, +// getOrCreateAssociatedTokenAccount, +// } from '@solana/spl-token'; +// import { TransferTokensProgram } from '../target/types/transfer_tokens_program'; + +// // Load the program ID and IDL from the target folder +// const IDL = require('../target/idl/transfer_tokens_program.json'); +// const PROGRAM_ID = new PublicKey(IDL.address); + +// describe('token_transfer_program', async () => { +// // Initialize Bankrun context +// const context = await startAnchor( +// "", +// [ +// { name: "transfer_tokens_program", programId: PROGRAM_ID }, +// ], +// [] +// ); +// const provider = new BankrunProvider(context); +// const program = new anchor.Program(IDL, provider); +// const connection = provider.connection; +// const payer = provider.wallet as anchor.Wallet; + +// // Keypair for mint and recipient +// const mintKeypair = Keypair.generate(); +// const recipientKeypair = Keypair.generate(); + +// let mintAccount: PublicKey; +// let senderTokenAccount: PublicKey; +// let recipientTokenAccount: PublicKey; + +// const confirm = async (signature: string): Promise => { +// const block = await provider.connection.getLatestBlockhash(); +// await provider.connection.confirmTransaction({ +// signature, +// ...block, +// }); +// return signature; +// }; + +// it('Test Preparation', async () => { +// console.log('Starting test preparation...'); + +// // Create an SPL token mint +// console.log('Creating mint account...'); +// mintAccount = await createMint( +// connection, +// payer.payer, +// provider.publicKey, +// null, +// 9 // Decimals +// ); +// console.log('Mint account created:', mintAccount.toBase58()); + +// // Get or create associated token accounts for sender and recipient +// senderTokenAccount = getAssociatedTokenAddressSync( +// mintAccount, +// payer.publicKey +// ); +// recipientTokenAccount = getAssociatedTokenAddressSync( +// mintAccount, +// recipientKeypair.publicKey +// ); + +// console.log('Sender Token Account PublicKey:', senderTokenAccount.toBase58()); +// console.log('Recipient Token Account PublicKey:', recipientTokenAccount.toBase58()); + +// // Create associated token accounts for the sender and recipient +// console.log('Creating associated token accounts...'); +// await getOrCreateAssociatedTokenAccount( +// connection, +// payer.payer, +// mintAccount, +// payer.publicKey +// ); +// console.log('Sender associated token account created.'); + +// await getOrCreateAssociatedTokenAccount( +// connection, +// payer.payer, +// mintAccount, +// recipientKeypair.publicKey +// ); +// console.log('Recipient associated token account created.'); + +// // Mint some tokens to the sender's associated token account +// console.log('Minting tokens to sender\'s associated token account...'); +// await mintTo( +// connection, +// payer.payer, +// mintAccount, +// senderTokenAccount, +// payer.payer, +// 100 * 10 ** 9 // 100 tokens +// ); +// console.log('Minting complete. 100 tokens minted to:', senderTokenAccount.toBase58()); +// }); + +// it('Transfers tokens between accounts using Bankrun', async () => { +// console.log('Starting token transfer test...'); + +// const transferAmount = new anchor.BN(50 * 10 ** 9); +// console.log('Initiating token transfer of:', transferAmount.toString()); + +// // Call the transfer_tokens function of the program +// const txSignature = await program.methods +// .transferTokens(transferAmount) +// .accounts({ +// owner: payer.publicKey, +// mint: mintAccount, +// destination: recipientTokenAccount, +// }) +// .rpc(); + +// console.log('Transfer transaction signature:', txSignature); + +// // Fetch the balances of the associated token accounts +// const senderAccountInfo = await connection.getTokenAccountBalance( +// senderTokenAccount +// ); +// const recipientAccountInfo = await connection.getTokenAccountBalance( +// recipientTokenAccount +// ); + +// console.log('Sender account balance after transfer:', senderAccountInfo.value.uiAmount); +// console.log('Recipient account balance after transfer:', recipientAccountInfo.value.uiAmount); + +// // Verify that the transfer occurred correctly +// assert.equal( +// senderAccountInfo.value.uiAmount, +// 50, +// 'Sender should have 50 tokens left' +// ); +// assert.equal( +// recipientAccountInfo.value.uiAmount, +// 50, +// 'Recipient should have received 50 tokens' +// ); + +// console.log('Token transfer test completed successfully.'); +// }); +// }); diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/transfer-tokens-program.ts b/tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/transfer-tokens-program.ts new file mode 100644 index 000000000..1589319b6 --- /dev/null +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/transfer-tokens-program.ts @@ -0,0 +1,78 @@ +import * as anchor from '@coral-xyz/anchor'; +import { Program } from '@coral-xyz/anchor'; +import { ASSOCIATED_TOKEN_PROGRAM_ID, createMint, getAssociatedTokenAddressSync, getOrCreateAssociatedTokenAccount, mintTo } from '@solana/spl-token'; +import { Keypair, PublicKey } from '@solana/web3.js'; +import { assert } from 'chai'; +import { TransferTokensProgram } from '../target/types/transfer_tokens_program'; + +describe('transfer_tokens_program', () => { + // Configure the client to use the local cluster. + const provider = anchor.AnchorProvider.env(); + anchor.setProvider(provider); + const program = anchor.workspace.TransferTokensProgram as Program; + + const payer = provider.wallet as anchor.Wallet; + + // Keypair for mint and recipient + const mintKeypair = Keypair.generate(); + const recipientKeypair = Keypair.generate(); + + let mintAccount: PublicKey; + let senderTokenAccount: PublicKey; + let recipientTokenAccount: PublicKey; + + before(async () => { + // Create an SPL token mint. + mintAccount = await createMint( + provider.connection, + payer.payer, + payer.publicKey, + null, + 9, // Decimals + ); + + // Get or create associated token accounts for sender and recipient. + senderTokenAccount = getAssociatedTokenAddressSync(mintAccount, payer.publicKey); + recipientTokenAccount = getAssociatedTokenAddressSync(mintAccount, recipientKeypair.publicKey); + + // Create the associated token account for the sender and recipient. + await getOrCreateAssociatedTokenAccount(provider.connection, payer.payer, mintAccount, payer.publicKey); + await getOrCreateAssociatedTokenAccount(provider.connection, payer.payer, mintAccount, recipientKeypair.publicKey); + + // Mint some tokens to the sender's associated token account. + await mintTo( + provider.connection, + payer.payer, + mintAccount, + senderTokenAccount, + payer.payer, + 100 * 10 ** 9, // 100 tokens + ); + }); + + it('Transfers tokens between accounts', async () => { + const transferAmount = new anchor.BN(50 * 10 ** 9); + + // Call the transfer_tokens function of the program. + const txSignature = await program.methods + .transferTokens(transferAmount) + .accounts({ + owner: payer.publicKey, + mint: mintAccount, + destination: recipientKeypair.publicKey, + }) + .rpc(); + + console.log('Transfer transaction signature:', txSignature); + + // Fetch the balances of the associated token accounts. + const senderAccountInfo = await provider.connection.getTokenAccountBalance(senderTokenAccount); + const recipientAccountInfo = await provider.connection.getTokenAccountBalance(recipientTokenAccount); + + console.log('Sender account info:', senderAccountInfo.value.uiAmount); + + // Verify that the transfer occurred correctly. + assert.equal(senderAccountInfo.value.uiAmount, 50, 'Sender should have 50 tokens left'); + assert.equal(recipientAccountInfo.value.uiAmount, 50, 'Recipient should have received 50 tokens'); + }); +}); diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/package.json b/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/package.json new file mode 100644 index 000000000..e9afdb860 --- /dev/null +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/package.json @@ -0,0 +1,15 @@ +{ + "name": "ts-programs", + "version": "1.0.0", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "description": "", + "dependencies": { + "@solanaturbine/poseidon": "^0.0.4" + } +} diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/pnpm-lock.yaml b/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/pnpm-lock.yaml new file mode 100644 index 000000000..0d5092821 --- /dev/null +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/pnpm-lock.yaml @@ -0,0 +1,22 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + '@solanaturbine/poseidon': + specifier: ^0.0.4 + version: 0.0.4 + +packages: + + '@solanaturbine/poseidon@0.0.4': + resolution: {integrity: sha512-VNQRtqobzBT+Wkh8fdPb0WVt12aIlgRJuGDxptclkphXi5w+VHUfMPcBshWSFPZg1nheXYgJABwvffYcyirw1g==} + +snapshots: + + '@solanaturbine/poseidon@0.0.4': {} diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/src/transferTokensProgram.ts b/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/src/transferTokensProgram.ts new file mode 100644 index 000000000..e26ad55e0 --- /dev/null +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/src/transferTokensProgram.ts @@ -0,0 +1,19 @@ +import { AssociatedTokenAccount, Mint, Pubkey, Signer, TokenProgram, u64 } from '@solanaturbine/poseidon'; + +export default class TokenTransferProgram { + static PROGRAM_ID = new Pubkey('BSHN8q3tEDsSiHBEHKKgxevQoSvXpKciZ7W3kcWSuEfC'); + + transferTokens( + owner: Signer, + sourceAta: AssociatedTokenAccount, + destination: Pubkey, + destinationAta: AssociatedTokenAccount, + mint: Mint, + transferAmount: u64, + ) { + sourceAta.derive(mint, owner.key).initIfNeeded(); + destinationAta.derive(mint, destination).initIfNeeded(); + + TokenProgram.transfer(sourceAta, destinationAta, owner, transferAmount); + } +} diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/tsconfig.json b/tokens/transfer-tokens/poseidon/transfer-tokens-program/tsconfig.json new file mode 100644 index 000000000..cd5d2e3d0 --- /dev/null +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "types": ["mocha", "chai"], + "typeRoots": ["./node_modules/@types"], + "lib": ["es2015"], + "module": "commonjs", + "target": "es6", + "esModuleInterop": true + } +} From a8b71b069d4f9e82159dce0c220d03b45b32aa7e Mon Sep 17 00:00:00 2001 From: ritikbhatt20 Date: Sat, 26 Oct 2024 18:25:05 +0530 Subject: [PATCH 2/4] feat: added bankrun test code --- .../tests/bankrun.test.ts | 263 ++++++++---------- 1 file changed, 112 insertions(+), 151 deletions(-) diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/bankrun.test.ts b/tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/bankrun.test.ts index f4109757e..be7ed5592 100644 --- a/tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/bankrun.test.ts +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/bankrun.test.ts @@ -1,151 +1,112 @@ -// import { describe, it, before } from 'node:test'; -// import * as anchor from '@coral-xyz/anchor'; -// import { PublicKey, Keypair } from '@solana/web3.js'; -// import { BankrunProvider } from 'anchor-bankrun'; -// import { assert } from 'chai'; -// import { startAnchor } from 'solana-bankrun'; -// import { -// getAssociatedTokenAddressSync, -// createMint, -// mintTo, -// getOrCreateAssociatedTokenAccount, -// } from '@solana/spl-token'; -// import { TransferTokensProgram } from '../target/types/transfer_tokens_program'; - -// // Load the program ID and IDL from the target folder -// const IDL = require('../target/idl/transfer_tokens_program.json'); -// const PROGRAM_ID = new PublicKey(IDL.address); - -// describe('token_transfer_program', async () => { -// // Initialize Bankrun context -// const context = await startAnchor( -// "", -// [ -// { name: "transfer_tokens_program", programId: PROGRAM_ID }, -// ], -// [] -// ); -// const provider = new BankrunProvider(context); -// const program = new anchor.Program(IDL, provider); -// const connection = provider.connection; -// const payer = provider.wallet as anchor.Wallet; - -// // Keypair for mint and recipient -// const mintKeypair = Keypair.generate(); -// const recipientKeypair = Keypair.generate(); - -// let mintAccount: PublicKey; -// let senderTokenAccount: PublicKey; -// let recipientTokenAccount: PublicKey; - -// const confirm = async (signature: string): Promise => { -// const block = await provider.connection.getLatestBlockhash(); -// await provider.connection.confirmTransaction({ -// signature, -// ...block, -// }); -// return signature; -// }; - -// it('Test Preparation', async () => { -// console.log('Starting test preparation...'); - -// // Create an SPL token mint -// console.log('Creating mint account...'); -// mintAccount = await createMint( -// connection, -// payer.payer, -// provider.publicKey, -// null, -// 9 // Decimals -// ); -// console.log('Mint account created:', mintAccount.toBase58()); - -// // Get or create associated token accounts for sender and recipient -// senderTokenAccount = getAssociatedTokenAddressSync( -// mintAccount, -// payer.publicKey -// ); -// recipientTokenAccount = getAssociatedTokenAddressSync( -// mintAccount, -// recipientKeypair.publicKey -// ); - -// console.log('Sender Token Account PublicKey:', senderTokenAccount.toBase58()); -// console.log('Recipient Token Account PublicKey:', recipientTokenAccount.toBase58()); - -// // Create associated token accounts for the sender and recipient -// console.log('Creating associated token accounts...'); -// await getOrCreateAssociatedTokenAccount( -// connection, -// payer.payer, -// mintAccount, -// payer.publicKey -// ); -// console.log('Sender associated token account created.'); - -// await getOrCreateAssociatedTokenAccount( -// connection, -// payer.payer, -// mintAccount, -// recipientKeypair.publicKey -// ); -// console.log('Recipient associated token account created.'); - -// // Mint some tokens to the sender's associated token account -// console.log('Minting tokens to sender\'s associated token account...'); -// await mintTo( -// connection, -// payer.payer, -// mintAccount, -// senderTokenAccount, -// payer.payer, -// 100 * 10 ** 9 // 100 tokens -// ); -// console.log('Minting complete. 100 tokens minted to:', senderTokenAccount.toBase58()); -// }); - -// it('Transfers tokens between accounts using Bankrun', async () => { -// console.log('Starting token transfer test...'); - -// const transferAmount = new anchor.BN(50 * 10 ** 9); -// console.log('Initiating token transfer of:', transferAmount.toString()); - -// // Call the transfer_tokens function of the program -// const txSignature = await program.methods -// .transferTokens(transferAmount) -// .accounts({ -// owner: payer.publicKey, -// mint: mintAccount, -// destination: recipientTokenAccount, -// }) -// .rpc(); - -// console.log('Transfer transaction signature:', txSignature); - -// // Fetch the balances of the associated token accounts -// const senderAccountInfo = await connection.getTokenAccountBalance( -// senderTokenAccount -// ); -// const recipientAccountInfo = await connection.getTokenAccountBalance( -// recipientTokenAccount -// ); - -// console.log('Sender account balance after transfer:', senderAccountInfo.value.uiAmount); -// console.log('Recipient account balance after transfer:', recipientAccountInfo.value.uiAmount); - -// // Verify that the transfer occurred correctly -// assert.equal( -// senderAccountInfo.value.uiAmount, -// 50, -// 'Sender should have 50 tokens left' -// ); -// assert.equal( -// recipientAccountInfo.value.uiAmount, -// 50, -// 'Recipient should have received 50 tokens' -// ); - -// console.log('Token transfer test completed successfully.'); -// }); -// }); +import { before, describe, it } from 'node:test'; +import * as anchor from '@coral-xyz/anchor'; +import { createMint, getAssociatedTokenAddressSync, getOrCreateAssociatedTokenAccount, mintTo } from '@solana/spl-token'; +import { Keypair, PublicKey } from '@solana/web3.js'; +import { BankrunProvider } from 'anchor-bankrun'; +import { assert } from 'chai'; +import { startAnchor } from 'solana-bankrun'; +import { TransferTokensProgram } from '../target/types/transfer_tokens_program'; + +// Load the program ID and IDL from the target folder +const IDL = require('../target/idl/transfer_tokens_program.json'); +const PROGRAM_ID = new PublicKey(IDL.address); + +describe('token_transfer_program', async () => { + // Initialize Bankrun context + const context = await startAnchor('', [{ name: 'transfer_tokens_program', programId: PROGRAM_ID }], []); + const provider = new BankrunProvider(context); + const program = new anchor.Program(IDL, provider); + const connection = provider.connection; + const payer = provider.wallet as anchor.Wallet; + + // Keypair for mint and recipient + const mintKeypair = Keypair.generate(); + const recipientKeypair = Keypair.generate(); + + let mintAccount: PublicKey; + let senderTokenAccount: PublicKey; + let recipientTokenAccount: PublicKey; + + const confirm = async (signature: string): Promise => { + const block = await provider.connection.getLatestBlockhash(); + await provider.connection.confirmTransaction({ + signature, + ...block, + }); + return signature; + }; + + it('Test Preparation', async () => { + console.log('Starting test preparation...'); + + // Create an SPL token mint + console.log('Creating mint account...'); + mintAccount = await createMint( + connection, + payer.payer, + provider.publicKey, + null, + 9, // Decimals + ); + console.log('Mint account created:', mintAccount.toBase58()); + + // Get or create associated token accounts for sender and recipient + senderTokenAccount = getAssociatedTokenAddressSync(mintAccount, payer.publicKey); + recipientTokenAccount = getAssociatedTokenAddressSync(mintAccount, recipientKeypair.publicKey); + + console.log('Sender Token Account PublicKey:', senderTokenAccount.toBase58()); + console.log('Recipient Token Account PublicKey:', recipientTokenAccount.toBase58()); + + // Create associated token accounts for the sender and recipient + console.log('Creating associated token accounts...'); + await getOrCreateAssociatedTokenAccount(connection, payer.payer, mintAccount, payer.publicKey); + console.log('Sender associated token account created.'); + + await getOrCreateAssociatedTokenAccount(connection, payer.payer, mintAccount, recipientKeypair.publicKey); + console.log('Recipient associated token account created.'); + + // Mint some tokens to the sender's associated token account + console.log("Minting tokens to sender's associated token account..."); + await mintTo( + connection, + payer.payer, + mintAccount, + senderTokenAccount, + payer.payer, + 100 * 10 ** 9, // 100 tokens + ); + console.log('Minting complete. 100 tokens minted to:', senderTokenAccount.toBase58()); + }); + + it('Transfers tokens between accounts using Bankrun', async () => { + console.log('Starting token transfer test...'); + + const transferAmount = new anchor.BN(50 * 10 ** 9); + console.log('Initiating token transfer of:', transferAmount.toString()); + + // Call the transfer_tokens function of the program + const txSignature = await program.methods + .transferTokens(transferAmount) + .accounts({ + owner: payer.publicKey, + mint: mintAccount, + destination: recipientTokenAccount, + }) + .rpc(); + + console.log('Transfer transaction signature:', txSignature); + + // Fetch the balances of the associated token accounts + const senderAccountInfo = await connection.getTokenAccountBalance(senderTokenAccount); + const recipientAccountInfo = await connection.getTokenAccountBalance(recipientTokenAccount); + + console.log('Sender account balance after transfer:', senderAccountInfo.value.uiAmount); + console.log('Recipient account balance after transfer:', recipientAccountInfo.value.uiAmount); + + // Verify that the transfer occurred correctly + assert.equal(senderAccountInfo.value.uiAmount, 50, 'Sender should have 50 tokens left'); + assert.equal(recipientAccountInfo.value.uiAmount, 50, 'Recipient should have received 50 tokens'); + + console.log('Token transfer test completed successfully.'); + }); +}); From a92917ed9d44e1cc3d2b5083d8238b414df2ad9a Mon Sep 17 00:00:00 2001 From: ritikbhatt20 Date: Thu, 31 Oct 2024 18:38:17 +0000 Subject: [PATCH 3/4] updated code for compatibility with Poseidon updates following exact Anchor program structure --- .../transfer-tokens-program/Anchor.toml | 2 +- .../transfer-tokens-program/package.json | 20 ++- .../transfer-tokens-program/pnpm-lock.yaml | 164 +++++++++--------- .../transfer-tokens-program/Cargo.toml | 1 + .../transfer-tokens-program/src/lib.rs | 111 +++++++++--- .../tests/bankrun.test.ts | 135 ++++++-------- .../tests/transfer-tokens-program.ts | 92 +++++----- .../ts-programs/package.json | 2 +- .../ts-programs/pnpm-lock.yaml | 10 +- .../ts-programs/src/transferTokensProgram.ts | 50 ++++-- 10 files changed, 327 insertions(+), 260 deletions(-) diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/Anchor.toml b/tokens/transfer-tokens/poseidon/transfer-tokens-program/Anchor.toml index b7cd91584..a787a24e3 100644 --- a/tokens/transfer-tokens/poseidon/transfer-tokens-program/Anchor.toml +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/Anchor.toml @@ -5,7 +5,7 @@ resolution = true skip-lint = false [programs.localnet] -transfer_tokens_program = "BSHN8q3tEDsSiHBEHKKgxevQoSvXpKciZ7W3kcWSuEfC" +transfer_tokens_program = "CSqtsYXnt2UfXttszwG6rGFFY7EedJ5kmn4xEyas4LeE" [registry] url = "https://api.apr.dev" diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/package.json b/tokens/transfer-tokens/poseidon/transfer-tokens-program/package.json index 8bb8327e6..bcfec1f6e 100644 --- a/tokens/transfer-tokens/poseidon/transfer-tokens-program/package.json +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/package.json @@ -1,22 +1,24 @@ { - "dependencies": { - "@coral-xyz/anchor": "^0.30.0", - "@solana/spl-token": "^0.3.8", - "anchor-bankrun": "^0.5.0", - "solana-bankrun": "^0.4.0" - }, + "license": "ISC", "scripts": { "lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w", "lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check" }, + "dependencies": { + "@coral-xyz/anchor": "^0.30.0", + "@solana/spl-token": "^0.4.9", + "@solana/web3.js": "^1.95.2" + }, "devDependencies": { "@types/bn.js": "^5.1.0", "@types/chai": "^4.3.0", "@types/mocha": "^9.0.0", - "chai": "^4.3.4", + "anchor-bankrun": "^0.4.0", + "chai": "^4.4.1", "mocha": "^9.0.3", + "prettier": "^2.6.2", + "solana-bankrun": "^0.3.0", "ts-mocha": "^10.0.0", - "typescript": "^4.3.5", - "zx": "^8.1.4" + "typescript": "^4.3.5" } } diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/pnpm-lock.yaml b/tokens/transfer-tokens/poseidon/transfer-tokens-program/pnpm-lock.yaml index 45ae2aac4..2c5186b5b 100644 --- a/tokens/transfer-tokens/poseidon/transfer-tokens-program/pnpm-lock.yaml +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/pnpm-lock.yaml @@ -12,14 +12,11 @@ importers: specifier: ^0.30.0 version: 0.30.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) '@solana/spl-token': - specifier: ^0.3.8 - version: 0.3.11(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)(utf-8-validate@5.0.10) - anchor-bankrun: - specifier: ^0.5.0 - version: 0.5.0(@coral-xyz/anchor@0.30.1(bufferutil@4.0.8)(utf-8-validate@5.0.10))(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(solana-bankrun@0.4.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - solana-bankrun: - specifier: ^0.4.0 - version: 0.4.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + specifier: ^0.4.9 + version: 0.4.9(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)(utf-8-validate@5.0.10) + '@solana/web3.js': + specifier: ^1.95.2 + version: 1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10) devDependencies: '@types/bn.js': specifier: ^5.1.0 @@ -30,26 +27,32 @@ importers: '@types/mocha': specifier: ^9.0.0 version: 9.1.1 + anchor-bankrun: + specifier: ^0.4.0 + version: 0.4.1(@coral-xyz/anchor@0.30.1(bufferutil@4.0.8)(utf-8-validate@5.0.10))(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(solana-bankrun@0.3.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)) chai: - specifier: ^4.3.4 + specifier: ^4.4.1 version: 4.5.0 mocha: specifier: ^9.0.3 version: 9.2.2 + prettier: + specifier: ^2.6.2 + version: 2.8.8 + solana-bankrun: + specifier: ^0.3.0 + version: 0.3.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) ts-mocha: specifier: ^10.0.0 version: 10.0.0(mocha@9.2.2) typescript: specifier: ^4.3.5 version: 4.9.5 - zx: - specifier: ^8.1.4 - version: 8.1.9 packages: - '@babel/runtime@7.25.9': - resolution: {integrity: sha512-4zpTHZ9Cm6L9L+uIqghQX8ZXg8HKFcjYO3qHoO8zTmRm6HQUJ8SSJ+KRvbMBZn0EGVlT4DRYeQ/6hjlyXBh+Kg==} + '@babel/runtime@7.26.0': + resolution: {integrity: sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==} engines: {node: '>=6.9.0'} '@coral-xyz/anchor-errors@0.30.1': @@ -119,17 +122,23 @@ packages: peerDependencies: typescript: '>=5' + '@solana/spl-token-group@0.0.7': + resolution: {integrity: sha512-V1N/iX7Cr7H0uazWUT2uk27TMqlqedpXHRqqAbVO2gvmJyT0E0ummMEAVQeXZ05ZhQ/xF39DLSdBp90XebWEug==} + engines: {node: '>=16'} + peerDependencies: + '@solana/web3.js': ^1.95.3 + '@solana/spl-token-metadata@0.1.6': resolution: {integrity: sha512-7sMt1rsm/zQOQcUWllQX9mD2O6KhSAtY1hFR2hfFwgqfFWzSY9E9GDvFVNYUI1F0iQKcm6HmePU9QbKRXTEBiA==} engines: {node: '>=16'} peerDependencies: '@solana/web3.js': ^1.95.3 - '@solana/spl-token@0.3.11': - resolution: {integrity: sha512-bvohO3rIMSVL24Pb+I4EYTJ6cL82eFpInEXD/I8K8upOGjpqHsKUoAempR/RnUlI1qSFNyFlWJfu6MNUgfbCQQ==} + '@solana/spl-token@0.4.9': + resolution: {integrity: sha512-g3wbj4F4gq82YQlwqhPB0gHFXfgsC6UmyGMxtSLf/BozT/oKd59465DbnlUK8L8EcimKMavxsVAMoLcEdeCicg==} engines: {node: '>=16'} peerDependencies: - '@solana/web3.js': ^1.88.0 + '@solana/web3.js': ^1.95.3 '@solana/web3.js@1.95.4': resolution: {integrity: sha512-sdewnNEA42ZSMxqkzdwEWi6fDgzwtJHaQa5ndUGEJYtoOnM6X5cvPmjoTUp7/k7bRrVAxfBgDnvQQHD6yhlLYw==} @@ -146,23 +155,17 @@ packages: '@types/connect@3.4.38': resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} - '@types/fs-extra@11.0.4': - resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==} - '@types/json5@0.0.29': resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} - '@types/jsonfile@6.1.4': - resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==} - '@types/mocha@9.1.1': resolution: {integrity: sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==} '@types/node@12.20.55': resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} - '@types/node@22.7.9': - resolution: {integrity: sha512-jrTfRC7FM6nChvU7X2KqcrgquofrWLFDeYC1hKfwNWomVvrn7JIksqf344WN2X/y8xrgqBd2dJATZV4GbatBfg==} + '@types/node@22.8.5': + resolution: {integrity: sha512-5iYk6AMPtsMbkZqCO1UGF9W5L38twq11S2pYWkybGHH2ogPUvXWNlQqJBzuEZWKj/WRH+QTeiv6ySWqJtvIEgA==} '@types/uuid@8.3.4': resolution: {integrity: sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==} @@ -184,13 +187,13 @@ packages: resolution: {integrity: sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==} engines: {node: '>= 8.0.0'} - anchor-bankrun@0.5.0: - resolution: {integrity: sha512-cNTRv7pN9dy+kiyJ3UlNVTg9hAXhY2HtNVNXJbP/2BkS9nOdLV0qKWhgW8UR9Go0gYuEOLKuPzrGL4HFAZPsVw==} + anchor-bankrun@0.4.1: + resolution: {integrity: sha512-ryCT84tw+lP4AqRpBsZJbt/KTRoVVKufkxFGd77gnx9iHkbwA5G/9cALk/eqLQm4xeUWTrJSJdEVyg2e74iP9A==} engines: {node: '>= 10'} peerDependencies: '@coral-xyz/anchor': ^0.30.0 - '@solana/web3.js': '>1.92.0' - solana-bankrun: '>=0.2.0 <0.5.0' + '@solana/web3.js': '>=1.78.4 <1.92.0' + solana-bankrun: ^0.2.0 ansi-colors@4.1.1: resolution: {integrity: sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==} @@ -604,6 +607,11 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + prettier@2.8.8: + resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} + engines: {node: '>=10.13.0'} + hasBin: true + randombytes@2.1.0: resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} @@ -630,37 +638,37 @@ packages: snake-case@3.0.4: resolution: {integrity: sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==} - solana-bankrun-darwin-arm64@0.4.0: - resolution: {integrity: sha512-6dz78Teoz7ez/3lpRLDjktYLJb79FcmJk2me4/YaB8WiO6W43OdExU4h+d2FyuAryO2DgBPXaBoBNY/8J1HJmw==} + solana-bankrun-darwin-arm64@0.3.1: + resolution: {integrity: sha512-9LWtH/3/WR9fs8Ve/srdo41mpSqVHmRqDoo69Dv1Cupi+o1zMU6HiEPUHEvH2Tn/6TDbPEDf18MYNfReLUqE6A==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] - solana-bankrun-darwin-universal@0.4.0: - resolution: {integrity: sha512-zSSw/Jx3KNU42pPMmrEWABd0nOwGJfsj7nm9chVZ3ae7WQg3Uty0hHAkn5NSDCj3OOiN0py9Dr1l9vmRJpOOxg==} + solana-bankrun-darwin-universal@0.3.1: + resolution: {integrity: sha512-muGHpVYWT7xCd8ZxEjs/bmsbMp8XBqroYGbE4lQPMDUuLvsJEIrjGqs3MbxEFr71sa58VpyvgywWd5ifI7sGIg==} engines: {node: '>= 10'} os: [darwin] - solana-bankrun-darwin-x64@0.4.0: - resolution: {integrity: sha512-LWjs5fsgHFtyr7YdJR6r0Ho5zrtzI6CY4wvwPXr8H2m3b4pZe6RLIZjQtabCav4cguc14G0K8yQB2PTMuGub8w==} + solana-bankrun-darwin-x64@0.3.1: + resolution: {integrity: sha512-oCaxfHyt7RC3ZMldrh5AbKfy4EH3YRMl8h6fSlMZpxvjQx7nK7PxlRwMeflMnVdkKKp7U8WIDak1lilIPd3/lg==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] - solana-bankrun-linux-x64-gnu@0.4.0: - resolution: {integrity: sha512-SrlVrb82UIxt21Zr/XZFHVV/h9zd2/nP25PMpLJVLD7Pgl2yhkhfi82xj3OjxoQqWe+zkBJ+uszA0EEKr67yNw==} + solana-bankrun-linux-x64-gnu@0.3.1: + resolution: {integrity: sha512-PfRFhr7igGFNt2Ecfdzh3li9eFPB3Xhmk0Eib17EFIB62YgNUg3ItRnQQFaf0spazFjjJLnglY1TRKTuYlgSVA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - solana-bankrun-linux-x64-musl@0.4.0: - resolution: {integrity: sha512-Nv328ZanmURdYfcLL+jwB1oMzX4ZzK57NwIcuJjGlf0XSNLq96EoaO5buEiUTo4Ls7MqqMyLbClHcrPE7/aKyA==} + solana-bankrun-linux-x64-musl@0.3.1: + resolution: {integrity: sha512-6r8i0NuXg3CGURql8ISMIUqhE7Hx/O7MlIworK4oN08jYrP0CXdLeB/hywNn7Z8d1NXrox/NpYUgvRm2yIzAsQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - solana-bankrun@0.4.0: - resolution: {integrity: sha512-NMmXUipPBkt8NgnyNO3SCnPERP6xT/AMNMBooljGA3+rG6NN8lmXJsKeLqQTiFsDeWD74U++QM/DgcueSWvrIg==} + solana-bankrun@0.3.1: + resolution: {integrity: sha512-inRwON7fBU5lPC36HdEqPeDg15FXJYcf77+o0iz9amvkUMJepcwnRwEfTNyMVpVYdgjTOBW5vg+596/3fi1kGA==} engines: {node: '>= 10'} source-map-support@0.5.21: @@ -824,14 +832,9 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} - zx@8.1.9: - resolution: {integrity: sha512-UHuLHphHmsBYKkAchkSrEN4nzDyagafqC9HUxtc1J7eopaScW6H9dsLJ1lmkAntnLtDTGoM8fa+jrJrXiIfKFA==} - engines: {node: '>= 12.17.0'} - hasBin: true - snapshots: - '@babel/runtime@7.25.9': + '@babel/runtime@7.26.0': dependencies: regenerator-runtime: 0.14.1 @@ -940,6 +943,14 @@ snapshots: transitivePeerDependencies: - fastestsmallesttextencoderdecoder + '@solana/spl-token-group@0.0.7(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)': + dependencies: + '@solana/codecs': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5) + '@solana/web3.js': 1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10) + transitivePeerDependencies: + - fastestsmallesttextencoderdecoder + - typescript + '@solana/spl-token-metadata@0.1.6(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)': dependencies: '@solana/codecs': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5) @@ -948,10 +959,11 @@ snapshots: - fastestsmallesttextencoderdecoder - typescript - '@solana/spl-token@0.3.11(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)(utf-8-validate@5.0.10)': + '@solana/spl-token@0.4.9(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)(utf-8-validate@5.0.10)': dependencies: '@solana/buffer-layout': 4.0.1 '@solana/buffer-layout-utils': 0.2.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@solana/spl-token-group': 0.0.7(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5) '@solana/spl-token-metadata': 0.1.6(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5) '@solana/web3.js': 1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10) buffer: 6.0.3 @@ -964,7 +976,7 @@ snapshots: '@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10)': dependencies: - '@babel/runtime': 7.25.9 + '@babel/runtime': 7.26.0 '@noble/curves': 1.6.0 '@noble/hashes': 1.5.0 '@solana/buffer-layout': 4.0.1 @@ -990,33 +1002,22 @@ snapshots: '@types/bn.js@5.1.6': dependencies: - '@types/node': 22.7.9 + '@types/node': 22.8.5 '@types/chai@4.3.20': {} '@types/connect@3.4.38': dependencies: - '@types/node': 22.7.9 - - '@types/fs-extra@11.0.4': - dependencies: - '@types/jsonfile': 6.1.4 - '@types/node': 22.7.9 - optional: true + '@types/node': 22.8.5 '@types/json5@0.0.29': optional: true - '@types/jsonfile@6.1.4': - dependencies: - '@types/node': 22.7.9 - optional: true - '@types/mocha@9.1.1': {} '@types/node@12.20.55': {} - '@types/node@22.7.9': + '@types/node@22.8.5': dependencies: undici-types: 6.19.8 @@ -1024,11 +1025,11 @@ snapshots: '@types/ws@7.4.7': dependencies: - '@types/node': 22.7.9 + '@types/node': 22.8.5 '@types/ws@8.5.12': dependencies: - '@types/node': 22.7.9 + '@types/node': 22.8.5 '@ungap/promise-all-settled@1.1.2': {} @@ -1041,11 +1042,11 @@ snapshots: dependencies: humanize-ms: 1.2.1 - anchor-bankrun@0.5.0(@coral-xyz/anchor@0.30.1(bufferutil@4.0.8)(utf-8-validate@5.0.10))(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(solana-bankrun@0.4.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)): + anchor-bankrun@0.4.1(@coral-xyz/anchor@0.30.1(bufferutil@4.0.8)(utf-8-validate@5.0.10))(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(solana-bankrun@0.3.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)): dependencies: '@coral-xyz/anchor': 0.30.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) '@solana/web3.js': 1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10) - solana-bankrun: 0.4.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + solana-bankrun: 0.3.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) ansi-colors@4.1.1: {} @@ -1440,6 +1441,8 @@ snapshots: picomatch@2.3.1: {} + prettier@2.8.8: {} + randombytes@2.1.0: dependencies: safe-buffer: 5.2.1 @@ -1476,31 +1479,31 @@ snapshots: dot-case: 3.0.4 tslib: 2.8.0 - solana-bankrun-darwin-arm64@0.4.0: + solana-bankrun-darwin-arm64@0.3.1: optional: true - solana-bankrun-darwin-universal@0.4.0: + solana-bankrun-darwin-universal@0.3.1: optional: true - solana-bankrun-darwin-x64@0.4.0: + solana-bankrun-darwin-x64@0.3.1: optional: true - solana-bankrun-linux-x64-gnu@0.4.0: + solana-bankrun-linux-x64-gnu@0.3.1: optional: true - solana-bankrun-linux-x64-musl@0.4.0: + solana-bankrun-linux-x64-musl@0.3.1: optional: true - solana-bankrun@0.4.0(bufferutil@4.0.8)(utf-8-validate@5.0.10): + solana-bankrun@0.3.1(bufferutil@4.0.8)(utf-8-validate@5.0.10): dependencies: '@solana/web3.js': 1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10) bs58: 4.0.1 optionalDependencies: - solana-bankrun-darwin-arm64: 0.4.0 - solana-bankrun-darwin-universal: 0.4.0 - solana-bankrun-darwin-x64: 0.4.0 - solana-bankrun-linux-x64-gnu: 0.4.0 - solana-bankrun-linux-x64-musl: 0.4.0 + solana-bankrun-darwin-arm64: 0.3.1 + solana-bankrun-darwin-universal: 0.3.1 + solana-bankrun-darwin-x64: 0.3.1 + solana-bankrun-linux-x64-gnu: 0.3.1 + solana-bankrun-linux-x64-musl: 0.3.1 transitivePeerDependencies: - bufferutil - encoding @@ -1648,8 +1651,3 @@ snapshots: yn@2.0.0: {} yocto-queue@0.1.0: {} - - zx@8.1.9: - optionalDependencies: - '@types/fs-extra': 11.0.4 - '@types/node': 22.7.9 diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/Cargo.toml b/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/Cargo.toml index bced8a79d..4daed713c 100644 --- a/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/Cargo.toml +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/Cargo.toml @@ -19,3 +19,4 @@ idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"] [dependencies] anchor-lang = { version = "0.30.1", features = ["init-if-needed"] } anchor-spl = "0.30.1" + diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/src/lib.rs b/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/src/lib.rs index 3fe0cae97..983b9f0dc 100644 --- a/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/src/lib.rs +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/src/lib.rs @@ -1,52 +1,111 @@ use anchor_lang::prelude::*; use anchor_spl::{ associated_token::AssociatedToken, - token::{Transfer as TransferSPL, Mint, transfer as transfer_spl, TokenAccount, Token}, + token::{ + mint_to, transfer as transfer_spl, Mint, MintTo, Token, TokenAccount, + Transfer as TransferSPL, + }, }; -declare_id!("BSHN8q3tEDsSiHBEHKKgxevQoSvXpKciZ7W3kcWSuEfC"); +declare_id!("CSqtsYXnt2UfXttszwG6rGFFY7EedJ5kmn4xEyas4LeE"); #[program] pub mod transfer_tokens_program { use super::*; - pub fn transfer_tokens( - ctx: Context, - transfer_amount: u64, + pub fn create_token( + ctx: Context, + decimals: u8, + freeze_authority: Pubkey, ) -> Result<()> { - let cpi_accounts = TransferSPL { - from: ctx.accounts.source_ata.to_account_info(), - to: ctx.accounts.destination_ata.to_account_info(), - authority: ctx.accounts.owner.to_account_info(), - }; + // Note: Initialization for mint handled manually + // As Poseidon's transpiler does not support initializeMint yet. + + Ok(()) + } + pub fn mint(ctx: Context, amount: u64) -> Result<()> { let cpi_ctx = CpiContext::new( ctx.accounts.token_program.to_account_info(), - cpi_accounts, + MintTo { + mint: ctx.accounts.mint_account.to_account_info(), + to: ctx.accounts.associated_token_account.to_account_info(), + authority: ctx.accounts.mint_authority.to_account_info(), + }, ); - transfer_spl(cpi_ctx, transfer_amount)?; + mint_to(cpi_ctx, amount)?; + Ok(()) + } + pub fn transfer_tokens(ctx: Context, amount: u64) -> Result<()> { + let cpi_accounts = TransferSPL { + from: ctx.accounts.sender_token_account.to_account_info(), + to: ctx.accounts.recipient_token_account.to_account_info(), + authority: ctx.accounts.sender.to_account_info(), + }; + let cpi_ctx = CpiContext::new(ctx.accounts.token_program.to_account_info(), cpi_accounts); + transfer_spl(cpi_ctx, amount)?; Ok(()) } } #[derive(Accounts)] -pub struct TransferTokensContext<'info> { +#[instruction(decimals: u8)] +pub struct CreateTokenContext<'info> { + // Note: Poseidon's transpiler does not support initializeMint yet, + // so this code is done manually using Anchor's InitializeMint. + // init, + // payer = mint_authority, + // mint::decimals = decimals, + // mint::authority = mint_authority.key(), this code is added manually + #[account( + init, + payer = payer, + mint::decimals = decimals, + mint::authority = payer.key(), + )] + pub mint_account: Account<'info, Mint>, #[account(mut)] - pub owner: Signer<'info>, + pub payer: Signer<'info>, + // Token Program and System Program is added manually as Poseidon does not support it yet using initializeMint + pub token_program: Program<'info, Token>, + pub system_program: Program<'info, System>, +} +#[derive(Accounts)] +pub struct MintContext<'info> { + #[account(mut)] + pub recipient: SystemAccount<'info>, #[account( init_if_needed, - payer = owner, - associated_token::mint = mint, - associated_token::authority = destination, + payer = mint_authority, + associated_token::mint = mint_account, + associated_token::authority = recipient, )] - pub destination_ata: Account<'info, TokenAccount>, - #[account()] - pub mint: Account<'info, Mint>, + pub associated_token_account: Account<'info, TokenAccount>, + #[account(mut)] + pub mint_account: Account<'info, Mint>, + #[account(mut)] + pub mint_authority: Signer<'info>, + pub associated_token_program: Program<'info, AssociatedToken>, + pub token_program: Program<'info, Token>, + pub system_program: Program<'info, System>, +} +#[derive(Accounts)] +pub struct TransferTokensContext<'info> { + #[account(mut)] + pub sender: Signer<'info>, + #[account(mut)] + pub mint_account: Account<'info, Mint>, #[account( init_if_needed, - payer = owner, - associated_token::mint = mint, - associated_token::authority = owner, + payer = sender, + associated_token::mint = mint_account, + associated_token::authority = sender, )] - pub source_ata: Account<'info, TokenAccount>, - /// CHECK: Not necessary to enforce authority verification here + pub sender_token_account: Account<'info, TokenAccount>, #[account(mut)] - pub destination: UncheckedAccount<'info>, + pub recipient: SystemAccount<'info>, + #[account( + init_if_needed, + payer = sender, + associated_token::mint = mint_account, + associated_token::authority = recipient, + )] + pub recipient_token_account: Account<'info, TokenAccount>, pub associated_token_program: Program<'info, AssociatedToken>, pub token_program: Program<'info, Token>, pub system_program: Program<'info, System>, diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/bankrun.test.ts b/tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/bankrun.test.ts index be7ed5592..d8075f539 100644 --- a/tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/bankrun.test.ts +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/bankrun.test.ts @@ -1,112 +1,91 @@ import { before, describe, it } from 'node:test'; import * as anchor from '@coral-xyz/anchor'; -import { createMint, getAssociatedTokenAddressSync, getOrCreateAssociatedTokenAccount, mintTo } from '@solana/spl-token'; +import { Program } from '@coral-xyz/anchor'; +import { getAssociatedTokenAddressSync, getMint } from '@solana/spl-token'; import { Keypair, PublicKey } from '@solana/web3.js'; import { BankrunProvider } from 'anchor-bankrun'; import { assert } from 'chai'; import { startAnchor } from 'solana-bankrun'; -import { TransferTokensProgram } from '../target/types/transfer_tokens_program'; +import type { TransferTokensProgram } from '../target/types/transfer_tokens_program'; -// Load the program ID and IDL from the target folder const IDL = require('../target/idl/transfer_tokens_program.json'); const PROGRAM_ID = new PublicKey(IDL.address); -describe('token_transfer_program', async () => { - // Initialize Bankrun context +describe('Bankrun - Transfer Tokens Program', async () => { + // Start the Bankrun context const context = await startAnchor('', [{ name: 'transfer_tokens_program', programId: PROGRAM_ID }], []); const provider = new BankrunProvider(context); + anchor.setProvider(provider); + const program = new anchor.Program(IDL, provider); - const connection = provider.connection; - const payer = provider.wallet as anchor.Wallet; - // Keypair for mint and recipient + const payer = provider.wallet as anchor.Wallet; const mintKeypair = Keypair.generate(); const recipientKeypair = Keypair.generate(); - let mintAccount: PublicKey; + const DECIMALS = 9; let senderTokenAccount: PublicKey; let recipientTokenAccount: PublicKey; - const confirm = async (signature: string): Promise => { - const block = await provider.connection.getLatestBlockhash(); - await provider.connection.confirmTransaction({ - signature, - ...block, - }); - return signature; - }; - - it('Test Preparation', async () => { - console.log('Starting test preparation...'); - - // Create an SPL token mint - console.log('Creating mint account...'); - mintAccount = await createMint( - connection, - payer.payer, - provider.publicKey, - null, - 9, // Decimals - ); - console.log('Mint account created:', mintAccount.toBase58()); - - // Get or create associated token accounts for sender and recipient - senderTokenAccount = getAssociatedTokenAddressSync(mintAccount, payer.publicKey); - recipientTokenAccount = getAssociatedTokenAddressSync(mintAccount, recipientKeypair.publicKey); - - console.log('Sender Token Account PublicKey:', senderTokenAccount.toBase58()); - console.log('Recipient Token Account PublicKey:', recipientTokenAccount.toBase58()); - - // Create associated token accounts for the sender and recipient - console.log('Creating associated token accounts...'); - await getOrCreateAssociatedTokenAccount(connection, payer.payer, mintAccount, payer.publicKey); - console.log('Sender associated token account created.'); - - await getOrCreateAssociatedTokenAccount(connection, payer.payer, mintAccount, recipientKeypair.publicKey); - console.log('Recipient associated token account created.'); - - // Mint some tokens to the sender's associated token account - console.log("Minting tokens to sender's associated token account..."); - await mintTo( - connection, - payer.payer, - mintAccount, - senderTokenAccount, - payer.payer, - 100 * 10 ** 9, // 100 tokens - ); - console.log('Minting complete. 100 tokens minted to:', senderTokenAccount.toBase58()); + before(async () => { + // Derive associated token account addresses + senderTokenAccount = getAssociatedTokenAddressSync(mintKeypair.publicKey, payer.publicKey); + recipientTokenAccount = getAssociatedTokenAddressSync(mintKeypair.publicKey, recipientKeypair.publicKey); }); - it('Transfers tokens between accounts using Bankrun', async () => { - console.log('Starting token transfer test...'); + it('Creates a new SPL Token', async () => { + const txSig = await program.methods + .createToken(DECIMALS, payer.publicKey) + .accounts({ + payer: payer.publicKey, + mintAccount: mintKeypair.publicKey, + }) + .signers([payer.payer, mintKeypair]) + .rpc(); + + console.log(`Transaction Signature: ${txSig}`); + const mintInfo = await getMint(provider.connection, mintKeypair.publicKey); - const transferAmount = new anchor.BN(50 * 10 ** 9); - console.log('Initiating token transfer of:', transferAmount.toString()); + assert.equal(mintInfo.decimals, DECIMALS, 'Mint decimals should match the specified value'); + assert.equal(mintInfo.mintAuthority?.toBase58(), payer.publicKey.toBase58(), 'Mint authority should be the payer'); - // Call the transfer_tokens function of the program - const txSignature = await program.methods - .transferTokens(transferAmount) + console.log('Mint created successfully:', mintKeypair.publicKey.toBase58()); + }); + + it("Mints tokens to sender's account", async () => { + const mintAmount = new anchor.BN(1_000_000_000); // Mint 1 token with 9 decimals + + const txSig = await program.methods + .mint(mintAmount) .accounts({ - owner: payer.publicKey, - mint: mintAccount, - destination: recipientTokenAccount, + mintAccount: mintKeypair.publicKey, + mintAuthority: payer.publicKey, + recipient: payer.publicKey, }) + .signers([payer.payer]) .rpc(); - console.log('Transfer transaction signature:', txSignature); + const mintInfo = await getMint(provider.connection, mintKeypair.publicKey); - // Fetch the balances of the associated token accounts - const senderAccountInfo = await connection.getTokenAccountBalance(senderTokenAccount); - const recipientAccountInfo = await connection.getTokenAccountBalance(recipientTokenAccount); + assert.equal(mintInfo.supply.toString(), mintAmount.toString(), 'Minted amount should match the specified value'); + console.log(`Minted ${mintAmount.toString()} tokens to ${senderTokenAccount}`); + console.log(`Transaction Signature: ${txSig}`); + }); - console.log('Sender account balance after transfer:', senderAccountInfo.value.uiAmount); - console.log('Recipient account balance after transfer:', recipientAccountInfo.value.uiAmount); + it('Transfers tokens from sender to recipient', async () => { + const transferAmount = new anchor.BN(500_000_000); // Transfer 0.5 tokens - // Verify that the transfer occurred correctly - assert.equal(senderAccountInfo.value.uiAmount, 50, 'Sender should have 50 tokens left'); - assert.equal(recipientAccountInfo.value.uiAmount, 50, 'Recipient should have received 50 tokens'); + const txSig = await program.methods + .transferTokens(transferAmount) + .accounts({ + sender: payer.publicKey, + mintAccount: mintKeypair.publicKey, + recipient: recipientKeypair.publicKey, + }) + .signers([payer.payer]) + .rpc(); - console.log('Token transfer test completed successfully.'); + console.log(`Transferred ${transferAmount.toString()} tokens to ${recipientTokenAccount}`); + console.log(`Transaction Signature: ${txSig}`); }); }); diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/transfer-tokens-program.ts b/tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/transfer-tokens-program.ts index 1589319b6..fe64f4f12 100644 --- a/tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/transfer-tokens-program.ts +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/tests/transfer-tokens-program.ts @@ -1,78 +1,80 @@ import * as anchor from '@coral-xyz/anchor'; import { Program } from '@coral-xyz/anchor'; -import { ASSOCIATED_TOKEN_PROGRAM_ID, createMint, getAssociatedTokenAddressSync, getOrCreateAssociatedTokenAccount, mintTo } from '@solana/spl-token'; +import { TOKEN_PROGRAM_ID, createMint, getAssociatedTokenAddressSync, getMint } from '@solana/spl-token'; import { Keypair, PublicKey } from '@solana/web3.js'; import { assert } from 'chai'; import { TransferTokensProgram } from '../target/types/transfer_tokens_program'; -describe('transfer_tokens_program', () => { - // Configure the client to use the local cluster. +describe('Transfer Tokens Program', () => { const provider = anchor.AnchorProvider.env(); anchor.setProvider(provider); const program = anchor.workspace.TransferTokensProgram as Program; const payer = provider.wallet as anchor.Wallet; - - // Keypair for mint and recipient const mintKeypair = Keypair.generate(); const recipientKeypair = Keypair.generate(); - let mintAccount: PublicKey; + const DECIMALS = 9; + let senderTokenAccount: PublicKey; let recipientTokenAccount: PublicKey; before(async () => { - // Create an SPL token mint. - mintAccount = await createMint( - provider.connection, - payer.payer, - payer.publicKey, - null, - 9, // Decimals - ); + // Derive associated token account addresses + senderTokenAccount = getAssociatedTokenAddressSync(mintKeypair.publicKey, payer.publicKey); + recipientTokenAccount = getAssociatedTokenAddressSync(mintKeypair.publicKey, recipientKeypair.publicKey); + }); + + it('Creates a new SPL Token', async () => { + const txSig = await program.methods + .createToken(DECIMALS, payer.publicKey) + .accounts({ + payer: payer.publicKey, + mintAccount: mintKeypair.publicKey, + }) + .signers([payer.payer, mintKeypair]) + .rpc(); - // Get or create associated token accounts for sender and recipient. - senderTokenAccount = getAssociatedTokenAddressSync(mintAccount, payer.publicKey); - recipientTokenAccount = getAssociatedTokenAddressSync(mintAccount, recipientKeypair.publicKey); + console.log(`Transaction Signature: ${txSig}`); + const mintInfo = await getMint(provider.connection, mintKeypair.publicKey); - // Create the associated token account for the sender and recipient. - await getOrCreateAssociatedTokenAccount(provider.connection, payer.payer, mintAccount, payer.publicKey); - await getOrCreateAssociatedTokenAccount(provider.connection, payer.payer, mintAccount, recipientKeypair.publicKey); + assert.equal(mintInfo.decimals, DECIMALS, 'Mint decimals should match the specified value'); + assert.equal(mintInfo.mintAuthority?.toBase58(), payer.publicKey.toBase58(), 'Mint authority should be the payer'); - // Mint some tokens to the sender's associated token account. - await mintTo( - provider.connection, - payer.payer, - mintAccount, - senderTokenAccount, - payer.payer, - 100 * 10 ** 9, // 100 tokens - ); + console.log('Mint created successfully:', mintKeypair.publicKey.toBase58()); }); - it('Transfers tokens between accounts', async () => { - const transferAmount = new anchor.BN(50 * 10 ** 9); + it("Mints tokens to sender's account", async () => { + const mintAmount = new anchor.BN(1_000_000_000); // Mint 1 token with 9 decimals - // Call the transfer_tokens function of the program. - const txSignature = await program.methods - .transferTokens(transferAmount) + const txSig = await program.methods + .mint(mintAmount) .accounts({ - owner: payer.publicKey, - mint: mintAccount, - destination: recipientKeypair.publicKey, + mintAccount: mintKeypair.publicKey, + mintAuthority: payer.publicKey, + recipient: payer.publicKey, }) + .signers([payer.payer]) .rpc(); - console.log('Transfer transaction signature:', txSignature); + console.log(`Minted ${mintAmount.toString()} tokens to ${senderTokenAccount}`); + console.log(`Transaction Signature: ${txSig}`); + }); - // Fetch the balances of the associated token accounts. - const senderAccountInfo = await provider.connection.getTokenAccountBalance(senderTokenAccount); - const recipientAccountInfo = await provider.connection.getTokenAccountBalance(recipientTokenAccount); + it('Transfers tokens from sender to recipient', async () => { + const transferAmount = new anchor.BN(500_000_000); // Transfer 0.5 tokens - console.log('Sender account info:', senderAccountInfo.value.uiAmount); + const txSig = await program.methods + .transferTokens(transferAmount) + .accounts({ + sender: payer.publicKey, + mintAccount: mintKeypair.publicKey, + recipient: recipientKeypair.publicKey, + }) + .signers([payer.payer]) + .rpc(); - // Verify that the transfer occurred correctly. - assert.equal(senderAccountInfo.value.uiAmount, 50, 'Sender should have 50 tokens left'); - assert.equal(recipientAccountInfo.value.uiAmount, 50, 'Recipient should have received 50 tokens'); + console.log(`Transferred ${transferAmount.toString()} tokens to ${recipientTokenAccount}`); + console.log(`Transaction Signature: ${txSig}`); }); }); diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/package.json b/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/package.json index e9afdb860..8e55452d9 100644 --- a/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/package.json +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/package.json @@ -10,6 +10,6 @@ "license": "ISC", "description": "", "dependencies": { - "@solanaturbine/poseidon": "^0.0.4" + "@solanaturbine/poseidon": "^0.0.10" } } diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/pnpm-lock.yaml b/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/pnpm-lock.yaml index 0d5092821..64f3eedd2 100644 --- a/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/pnpm-lock.yaml +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/pnpm-lock.yaml @@ -9,14 +9,14 @@ importers: .: dependencies: '@solanaturbine/poseidon': - specifier: ^0.0.4 - version: 0.0.4 + specifier: ^0.0.10 + version: 0.0.10 packages: - '@solanaturbine/poseidon@0.0.4': - resolution: {integrity: sha512-VNQRtqobzBT+Wkh8fdPb0WVt12aIlgRJuGDxptclkphXi5w+VHUfMPcBshWSFPZg1nheXYgJABwvffYcyirw1g==} + '@solanaturbine/poseidon@0.0.10': + resolution: {integrity: sha512-4C8niySNUp+qArCrtZ9WZszfwntynSzJUq8go7QSh63xUv2s5ACHfwLs73ajaH95NGmEcgpl6raENv0u0GeCqg==} snapshots: - '@solanaturbine/poseidon@0.0.4': {} + '@solanaturbine/poseidon@0.0.10': {} diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/src/transferTokensProgram.ts b/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/src/transferTokensProgram.ts index e26ad55e0..40d2c1ac1 100644 --- a/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/src/transferTokensProgram.ts +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/ts-programs/src/transferTokensProgram.ts @@ -1,19 +1,45 @@ -import { AssociatedTokenAccount, Mint, Pubkey, Signer, TokenProgram, u64 } from '@solanaturbine/poseidon'; +import { + AssociatedTokenAccount, + Mint, + Pubkey, + Result, + Signer, + SystemAccount, + TokenProgram, + UncheckedAccount, + u8, + u64, +} from '@solanaturbine/poseidon'; -export default class TokenTransferProgram { - static PROGRAM_ID = new Pubkey('BSHN8q3tEDsSiHBEHKKgxevQoSvXpKciZ7W3kcWSuEfC'); +export default class TransferTokensProgram { + static PROGRAM_ID = new Pubkey('CSqtsYXnt2UfXttszwG6rGFFY7EedJ5kmn4xEyas4LeE'); + + createToken(payer: Signer, mintAccount: Mint, decimals: u8, freezeAuthority?: Pubkey): Result { + // Initialize the mint account with specified decimals + TokenProgram.initializeMint( + mintAccount, + payer, // authority + decimals, + freezeAuthority, // freeze authority + ); + } + + mint(mintAuthority: Signer, mintAccount: Mint, recipient: SystemAccount, associatedTokenAccount: AssociatedTokenAccount, amount: u64): Result { + associatedTokenAccount.derive(mintAccount, recipient.key).initIfNeeded(mintAuthority); + TokenProgram.mintTo(mintAccount, associatedTokenAccount, mintAuthority, amount); + } transferTokens( - owner: Signer, - sourceAta: AssociatedTokenAccount, - destination: Pubkey, - destinationAta: AssociatedTokenAccount, - mint: Mint, - transferAmount: u64, + sender: Signer, + senderTokenAccount: AssociatedTokenAccount, + recipient: SystemAccount, + recipientTokenAccount: AssociatedTokenAccount, + mintAccount: Mint, + amount: u64, ) { - sourceAta.derive(mint, owner.key).initIfNeeded(); - destinationAta.derive(mint, destination).initIfNeeded(); + senderTokenAccount.derive(mintAccount, sender.key).initIfNeeded(sender); + recipientTokenAccount.derive(mintAccount, recipient.key).initIfNeeded(sender); - TokenProgram.transfer(sourceAta, destinationAta, owner, transferAmount); + TokenProgram.transfer(senderTokenAccount, recipientTokenAccount, sender, amount); } } From 4678f2d7bb4c8f5a08ee0434e959e0126b53deed Mon Sep 17 00:00:00 2001 From: ritikbhatt20 Date: Mon, 25 Nov 2024 15:26:54 +0000 Subject: [PATCH 4/4] verified technical requirements and resolved warnings --- .../programs/transfer-tokens-program/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/src/lib.rs b/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/src/lib.rs index 983b9f0dc..aa59d41ec 100644 --- a/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/src/lib.rs +++ b/tokens/transfer-tokens/poseidon/transfer-tokens-program/programs/transfer-tokens-program/src/lib.rs @@ -11,9 +11,9 @@ declare_id!("CSqtsYXnt2UfXttszwG6rGFFY7EedJ5kmn4xEyas4LeE"); pub mod transfer_tokens_program { use super::*; pub fn create_token( - ctx: Context, - decimals: u8, - freeze_authority: Pubkey, + _ctx: Context, + _decimals: u8, + _freeze_authority: Pubkey, ) -> Result<()> { // Note: Initialization for mint handled manually // As Poseidon's transpiler does not support initializeMint yet.