diff --git a/Cargo.lock b/Cargo.lock index c643f19..2234b58 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,6 +18,14 @@ dependencies = [ "anchor-spl", ] +[[package]] +name = "adapter-jupiter" +version = "0.1.0" +dependencies = [ + "anchor-lang", + "anchor-spl", +] + [[package]] name = "adapter-katana" version = "0.1.0" @@ -88,18 +96,42 @@ version = "0.1.0" dependencies = [ "anchor-lang", "anchor-spl", - "arrayref", - "hex", - "itertools", - "num-derive", - "num-traits", - "spl-associated-token-account", - "static-pubkey", - "thiserror", - "tulip-arrform", - "tulip-derivative", - "type-layout", - "uint", +] + +[[package]] +name = "aead" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" +dependencies = [ + "generic-array", +] + +[[package]] +name = "aes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +dependencies = [ + "cfg-if", + "cipher 0.3.0", + "cpufeatures", + "opaque-debug", +] + +[[package]] +name = "aes-gcm-siv" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589c637f0e68c877bbd59a4599bbe849cac8e5f3e4b5a3ebae8f528cd218dcdc" +dependencies = [ + "aead", + "aes", + "cipher 0.3.0", + "ctr", + "polyval", + "subtle", + "zeroize", ] [[package]] @@ -124,9 +156,9 @@ dependencies = [ [[package]] name = "anchor-attribute-access-control" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b75d05b6b4ac9d95bb6e3b786b27d3a708c4c5a87c92ffaa25bbe9ae4c5d91" +checksum = "cf7d535e1381be3de2c0716c0a1c1e32ad9df1042cddcf7bc18d743569e53319" dependencies = [ "anchor-syn", "anyhow", @@ -138,9 +170,9 @@ dependencies = [ [[package]] name = "anchor-attribute-account" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "485351a6d8157750d10d88c8e256f1bf8339262b2220ae9125aed3471309b5de" +checksum = "c3bcd731f21048a032be27c7791701120e44f3f6371358fc4261a7f716283d29" dependencies = [ "anchor-syn", "anyhow", @@ -153,9 +185,9 @@ dependencies = [ [[package]] name = "anchor-attribute-constant" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc632c540913dd051a78b00587cc47f57013d303163ddfaf4fa18717f7ccc1e0" +checksum = "e1be64a48e395fe00b8217287f226078be2cf32dae42fdf8a885b997945c3d28" dependencies = [ "anchor-syn", "proc-macro2", @@ -164,9 +196,9 @@ dependencies = [ [[package]] name = "anchor-attribute-error" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b5bd1dcfa7f3bc22dacef233d70a9e0bee269c4ac484510662f257cba2353a1" +checksum = "38ea6713d1938c0da03656ff8a693b17dc0396da66d1ba320557f07e86eca0d4" dependencies = [ "anchor-syn", "proc-macro2", @@ -176,9 +208,9 @@ dependencies = [ [[package]] name = "anchor-attribute-event" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c6f9e6ce551ac9a177a45c99a65699a860c9e95fac68675138af1246e2591b0" +checksum = "d401f11efb3644285685f8339829a9786d43ed7490bb1699f33c478d04d5a582" dependencies = [ "anchor-syn", "anyhow", @@ -189,9 +221,9 @@ dependencies = [ [[package]] name = "anchor-attribute-interface" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d104aa17418cb329ed7418b227e083d5f326a27f26ce98f5d92e33da62a5f459" +checksum = "c6700a6f5c888a9c33fe8afc0c64fd8575fa28d05446037306d0f96102ae4480" dependencies = [ "anchor-syn", "anyhow", @@ -203,9 +235,9 @@ dependencies = [ [[package]] name = "anchor-attribute-program" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6831b920b173c004ddf7ae1167d1d25e9f002ffcb1773bbc5c7ce532a4441e1" +checksum = "6ad769993b5266714e8939e47fbdede90e5c030333c7522d99a4d4748cf26712" dependencies = [ "anchor-syn", "anyhow", @@ -216,9 +248,9 @@ dependencies = [ [[package]] name = "anchor-attribute-state" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde147b10c71d95dc679785db0b5f3abac0091f789167aa62ac0135e2f54e8b9" +checksum = "4e677fae4a016a554acdd0e3b7f178d3acafaa7e7ffac6b8690cf4e171f1c116" dependencies = [ "anchor-syn", "anyhow", @@ -229,9 +261,9 @@ dependencies = [ [[package]] name = "anchor-derive-accounts" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cde98a0e1a56046b040ff591dfda391f88917af2b6487d02b45093c05be3514" +checksum = "340beef6809d1c3fcc7ae219153d981e95a8a277ff31985bd7050e32645dc9a8" dependencies = [ "anchor-syn", "anyhow", @@ -242,9 +274,9 @@ dependencies = [ [[package]] name = "anchor-lang" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a85dd2c5e29e20c7f4701a43724d6cd5406d0ee5694705522e43da0f26542a84" +checksum = "662ceafe667448ee4199a4be2ee83b6bb76da28566eee5cea05f96ab38255af8" dependencies = [ "anchor-attribute-access-control", "anchor-attribute-account", @@ -266,9 +298,9 @@ dependencies = [ [[package]] name = "anchor-spl" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0188c33b4a3c124c4e593f2b440415aaea70a7650fac6ba0772395385d71c003" +checksum = "f32390ce8356f54c0f0245ea156f8190717e37285b8bf4f406a613dc4b954cde" dependencies = [ "anchor-lang", "solana-program", @@ -278,9 +310,9 @@ dependencies = [ [[package]] name = "anchor-syn" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03549dc2eae0b20beba6333b14520e511822a6321cdb1760f841064a69347316" +checksum = "0418bcb5daac3b8cb1b60d8fdb1d468ca36f5509f31fb51179326fae1028fdcc" dependencies = [ "anyhow", "bs58 0.3.1", @@ -290,7 +322,7 @@ dependencies = [ "quote", "serde", "serde_json", - "sha2", + "sha2 0.9.9", "syn", "thiserror", ] @@ -313,13 +345,19 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +[[package]] +name = "assert_matches" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" + [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -357,6 +395,15 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitmaps" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +dependencies = [ + "typenum", +] + [[package]] name = "blake3" version = "1.3.1" @@ -403,7 +450,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" dependencies = [ "borsh-derive", - "hashbrown", + "hashbrown 0.11.2", ] [[package]] @@ -500,6 +547,9 @@ name = "cc" version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +dependencies = [ + "jobserver", +] [[package]] name = "cfg-if" @@ -507,6 +557,35 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "cipher" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +dependencies = [ + "generic-array", +] + +[[package]] +name = "cipher" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "console_error_panic_hook" version = "0.1.7" @@ -542,6 +621,49 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-channel" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset 0.7.1", + "scopeguard", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +dependencies = [ + "cfg-if", +] + [[package]] name = "crunchy" version = "0.2.2" @@ -568,6 +690,15 @@ dependencies = [ "subtle", ] +[[package]] +name = "ctr" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +dependencies = [ + "cipher 0.3.0", +] + [[package]] name = "curve25519-dalek" version = "3.2.1" @@ -576,11 +707,18 @@ checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" dependencies = [ "byteorder", "digest 0.9.0", - "rand_core", + "rand_core 0.5.1", + "serde", "subtle", "zeroize", ] +[[package]] +name = "derivation-path" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e5c37193a1db1d8ed868c03ec7b152175f26160a5b740e5e484143877e0adf0" + [[package]] name = "digest" version = "0.9.0" @@ -601,6 +739,41 @@ dependencies = [ "subtle", ] +[[package]] +name = "ed25519" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" +dependencies = [ + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand", + "serde", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "ed25519-dalek-bip32" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d2be62a4061b872c8c0873ee4fc6f101ce7b889d039f019c5fa2af471a59908" +dependencies = [ + "derivation-path", + "ed25519-dalek", + "hmac 0.12.1", + "sha2 0.10.6", +] + [[package]] name = "either" version = "1.8.0" @@ -626,6 +799,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "generic-array" version = "0.14.6" @@ -657,8 +836,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -670,6 +851,15 @@ dependencies = [ "ahash", ] +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] + [[package]] name = "heck" version = "0.3.3" @@ -689,10 +879,13 @@ dependencies = [ ] [[package]] -name = "hex" -version = "0.4.3" +name = "hermit-abi" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] [[package]] name = "hmac" @@ -704,6 +897,15 @@ dependencies = [ "digest 0.9.0", ] +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.5", +] + [[package]] name = "hmac-drbg" version = "0.3.0" @@ -712,7 +914,7 @@ checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" dependencies = [ "digest 0.9.0", "generic-array", - "hmac", + "hmac 0.8.1", ] [[package]] @@ -722,12 +924,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] -name = "instant" -version = "0.1.12" +name = "im" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" dependencies = [ - "cfg-if", + "bitmaps", + "rand_core 0.6.4", + "rand_xoshiro", + "rayon", + "serde", + "sized-chunks", + "typenum", + "version_check", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", ] [[package]] @@ -745,6 +963,15 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +[[package]] +name = "jobserver" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.60" @@ -787,7 +1014,7 @@ dependencies = [ "libsecp256k1-gen-genmult", "rand", "serde", - "sha2", + "sha2 0.9.9", "typenum", ] @@ -856,13 +1083,34 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.5.6" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memoffset" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" dependencies = [ "autocfg", ] +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak", + "rand_core 0.6.4", + "zeroize", +] + [[package]] name = "num-derive" version = "0.3.3" @@ -874,6 +1122,16 @@ dependencies = [ "syn", ] +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.15" @@ -883,6 +1141,16 @@ dependencies = [ "autocfg", ] +[[package]] +name = "num_cpus" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +dependencies = [ + "hermit-abi 0.2.6", + "libc", +] + [[package]] name = "num_enum" version = "0.5.7" @@ -918,27 +1186,61 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "parking_lot" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ - "instant", "lock_api", "parking_lot_core", ] [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" dependencies = [ "cfg-if", - "instant", "libc", "redox_syscall", "smallvec", - "winapi", + "windows-sys", +] + +[[package]] +name = "pbkdf2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" +dependencies = [ + "crypto-mac", +] + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.5", +] + +[[package]] +name = "percent-encoding" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" + +[[package]] +name = "polyval" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug", + "universal-hash", ] [[package]] @@ -989,6 +1291,15 @@ dependencies = [ "yansi", ] +[[package]] +name = "qstring" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d464fae65fff2680baf48019211ce37aaec0c78e9264c84a3e484717f965104e" +dependencies = [ + "percent-encoding", +] + [[package]] name = "quote" version = "1.0.21" @@ -1007,7 +1318,7 @@ dependencies = [ "getrandom 0.1.16", "libc", "rand_chacha", - "rand_core", + "rand_core 0.5.1", "rand_hc", ] @@ -1018,7 +1329,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.5.1", ] [[package]] @@ -1030,13 +1341,53 @@ dependencies = [ "getrandom 0.1.16", ] +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.7", +] + [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "num_cpus", ] [[package]] @@ -1066,10 +1417,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] -name = "rustc-hex" -version = "2.1.0" +name = "rustc-hash" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc_version" @@ -1157,6 +1508,17 @@ dependencies = [ "opaque-debug", ] +[[package]] +name = "sha2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.5", +] + [[package]] name = "sha3" version = "0.9.1" @@ -1169,6 +1531,32 @@ dependencies = [ "opaque-debug", ] +[[package]] +name = "sha3" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" +dependencies = [ + "digest 0.10.5", + "keccak", +] + +[[package]] +name = "signature" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" + +[[package]] +name = "sized-chunks" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +dependencies = [ + "bitmaps", + "typenum", +] + [[package]] name = "smallvec" version = "1.10.0" @@ -1177,29 +1565,43 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "solana-frozen-abi" -version = "1.9.29" +version = "1.14.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d4fcb89eb3d0f30bd4b4a31ad1825c9d95cd638509acead00969d7601713288" +checksum = "1c39813ee5b249cb8ccb325d3639323eb3616e7bb9a2b1502936d7ea20530097" dependencies = [ + "ahash", + "blake3", + "block-buffer 0.9.0", "bs58 0.4.0", "bv", + "byteorder", + "cc", + "either", "generic-array", + "getrandom 0.1.16", + "hashbrown 0.12.3", + "im", + "lazy_static", "log", "memmap2", + "once_cell", + "rand_core 0.6.4", "rustc_version", "serde", + "serde_bytes", "serde_derive", - "sha2", + "serde_json", + "sha2 0.10.6", "solana-frozen-abi-macro", - "solana-logger", + "subtle", "thiserror", ] [[package]] name = "solana-frozen-abi-macro" -version = "1.9.29" +version = "1.14.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d63ab101db88ecccd8da34065b9097b88367e0744fdfd05cb7de87b4ede3717f" +checksum = "dad43ac27c4b8d7a3ce0e2cb8642a7e3b8ea5e3c29ecea38045a8518519adccf" dependencies = [ "proc-macro2", "quote", @@ -1209,9 +1611,9 @@ dependencies = [ [[package]] name = "solana-logger" -version = "1.9.29" +version = "1.14.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1805d52fc8277a84c4803c7850c8f41471b57fb0dec7750338955ad6e43e2" +checksum = "13a18f8d7490f712a4340998fca2b0d35afcdef671320a0e51f40b537363d592" dependencies = [ "env_logger", "lazy_static", @@ -1220,9 +1622,9 @@ dependencies = [ [[package]] name = "solana-program" -version = "1.9.29" +version = "1.14.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5deafc4902425d40197f74166640300dd20b078e4ffd518c1bb56ceb7e01680" +checksum = "0dafff676128fe508ab83147b6fb19534fc33f43ec14789da1f1867e9ea06887" dependencies = [ "base64 0.13.0", "bincode", @@ -1233,39 +1635,96 @@ dependencies = [ "bs58 0.4.0", "bv", "bytemuck", + "cc", "console_error_panic_hook", "console_log", "curve25519-dalek", - "getrandom 0.1.16", + "getrandom 0.2.7", "itertools", "js-sys", "lazy_static", + "libc", "libsecp256k1", "log", + "memoffset 0.6.5", "num-derive", "num-traits", "parking_lot", "rand", + "rand_chacha", "rustc_version", "rustversion", "serde", "serde_bytes", "serde_derive", - "sha2", - "sha3", + "serde_json", + "sha2 0.10.6", + "sha3 0.10.6", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-sdk-macro", + "thiserror", + "tiny-bip39", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "solana-sdk" +version = "1.14.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c702cc57432bc16eab54ad7b5668c2a3cdc72b0f820175972b4857e26ac4f49" +dependencies = [ + "assert_matches", + "base64 0.13.0", + "bincode", + "bitflags", + "borsh", + "bs58 0.4.0", + "bytemuck", + "byteorder", + "chrono", + "derivation-path", + "digest 0.10.5", + "ed25519-dalek", + "ed25519-dalek-bip32", + "generic-array", + "hmac 0.12.1", + "itertools", + "js-sys", + "lazy_static", + "libsecp256k1", + "log", + "memmap2", + "num-derive", + "num-traits", + "pbkdf2 0.11.0", + "qstring", + "rand", + "rand_chacha", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "serde_json", + "sha2 0.10.6", + "sha3 0.10.6", "solana-frozen-abi", "solana-frozen-abi-macro", "solana-logger", + "solana-program", "solana-sdk-macro", "thiserror", + "uriparse", "wasm-bindgen", ] [[package]] name = "solana-sdk-macro" -version = "1.9.29" +version = "1.14.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db4c93bd43c91290ad54fe6ff86179a859954f196507c4789a4876d38a62f17" +checksum = "f89a14a8f1e7708fe19ee3140125e9d8279945ead74cb09e65c94dd5cf0640c3" dependencies = [ "bs58 0.4.0", "proc-macro2", @@ -1274,24 +1733,70 @@ dependencies = [ "syn", ] +[[package]] +name = "solana-zk-token-sdk" +version = "1.14.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32395c4561673f7b4aa1f3a5b5a654eaa363041f67d92f5d680de72293ef7d1b" +dependencies = [ + "aes-gcm-siv", + "arrayref", + "base64 0.13.0", + "bincode", + "bytemuck", + "byteorder", + "cipher 0.4.3", + "curve25519-dalek", + "getrandom 0.1.16", + "itertools", + "lazy_static", + "merlin", + "num-derive", + "num-traits", + "rand", + "serde", + "serde_json", + "sha3 0.9.1", + "solana-program", + "solana-sdk", + "subtle", + "thiserror", + "zeroize", +] + [[package]] name = "spl-associated-token-account" -version = "1.0.5" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b013067447a1396303ddfc294f36e3d260a32f8a16c501c295bcdc7de39b490" +checksum = "fbc000f0fdf1f12f99d77d398137c1751345b18c88258ce0f99b7872cf6c9bd6" dependencies = [ + "assert_matches", "borsh", + "num-derive", + "num-traits", "solana-program", "spl-token", + "spl-token-2022", + "thiserror", +] + +[[package]] +name = "spl-memo" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0dc6f70db6bacea7ff25870b016a65ba1d1b6013536f08e4fd79a8f9005325" +dependencies = [ + "solana-program", ] [[package]] name = "spl-token" -version = "3.3.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc67166ef99d10c18cb5e9c208901e6d8255c6513bb1f877977eba48e6cc4fb" +checksum = "8e85e168a785e82564160dcb87b2a8e04cee9bfd1f4d488c729d53d6a4bd300d" dependencies = [ "arrayref", + "bytemuck", "num-derive", "num-traits", "num_enum", @@ -1300,23 +1805,23 @@ dependencies = [ ] [[package]] -name = "static-pubkey" -version = "1.0.3" +name = "spl-token-2022" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0547d5945c93f55e1b18bf2a67d1a3d0548561f2687645b22c1c1d4fbb9a8e90" +checksum = "0edb869dbe159b018f17fb9bfa67118c30f232d7f54a73742bc96794dff77ed8" dependencies = [ - "bs58 0.4.0", - "proc-macro2", - "quote", - "syn", + "arrayref", + "bytemuck", + "num-derive", + "num-traits", + "num_enum", + "solana-program", + "solana-zk-token-sdk", + "spl-memo", + "spl-token", + "thiserror", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "subtle" version = "2.4.1" @@ -1334,6 +1839,18 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + [[package]] name = "termcolor" version = "1.1.3" @@ -1364,50 +1881,46 @@ dependencies = [ ] [[package]] -name = "toml" -version = "0.5.9" +name = "tiny-bip39" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" dependencies = [ - "serde", + "anyhow", + "hmac 0.8.1", + "once_cell", + "pbkdf2 0.4.0", + "rand", + "rustc-hash", + "sha2 0.9.9", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", ] [[package]] -name = "tulip-arrform" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26e9bc79d09160eae39c81027639b268e2bc60a9cb05e772f788ff7a2b6265d0" - -[[package]] -name = "tulip-derivative" -version = "2.2.1" +name = "tinyvec" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75d6eabea9d108df2d23d7f1201de4f7d2bceebe0dda5fa05bcef95a5ff4deaf" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ - "proc-macro2", - "quote", - "syn", + "tinyvec_macros", ] [[package]] -name = "type-layout" -version = "0.2.0" +name = "tinyvec_macros" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "074069282ba5be5078f1bdb34112b963516d50f262bf4c1082fee1f6ada11d74" -dependencies = [ - "memoffset", - "type-layout-derive", -] +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] -name = "type-layout-derive" -version = "0.2.0" +name = "toml" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4a1cf66ce820973c4b31c5ef47a8e930a53ffbcec191212c33f5a3ad75c6cd" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" dependencies = [ - "proc-macro2", - "quote", - "syn", + "serde", ] [[package]] @@ -1416,30 +1929,53 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" -[[package]] -name = "uint" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9db035e67dfaf7edd9aebfe8676afcd63eed53c8a4044fed514c8cccf1835177" -dependencies = [ - "byteorder", - "crunchy", - "rustc-hex", - "static_assertions", -] - [[package]] name = "unicode-ident" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-segmentation" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "universal-hash" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "uriparse" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0200d0fc04d809396c2ad43f3c95da3582a2556eba8d453c1087f4120ee352ff" +dependencies = [ + "fnv", + "lazy_static", +] + [[package]] name = "version_check" version = "0.9.4" @@ -1553,6 +2089,63 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + [[package]] name = "yansi" version = "0.5.1" @@ -1564,3 +2157,18 @@ name = "zeroize" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] diff --git a/programs/adapter-francium/Cargo.toml b/programs/adapter-francium/Cargo.toml index ab39e46..bb9dce7 100644 --- a/programs/adapter-francium/Cargo.toml +++ b/programs/adapter-francium/Cargo.toml @@ -15,5 +15,5 @@ no-log-ix-name = [] cpi = ["no-entrypoint"] [dependencies] -anchor-lang = "0.24.2" -anchor-spl = "0.24.2" +anchor-lang = "0.26.0" +anchor-spl = "0.26.0" diff --git a/programs/adapter-friktion/Cargo.toml b/programs/adapter-friktion/Cargo.toml index 62cf60e..76aa7ec 100644 --- a/programs/adapter-friktion/Cargo.toml +++ b/programs/adapter-friktion/Cargo.toml @@ -16,5 +16,5 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = "0.24.2" -anchor-spl = "0.24.2" +anchor-lang = "0.26.0" +anchor-spl = "0.26.0" diff --git a/programs/adapter-jupiter/Cargo.toml b/programs/adapter-jupiter/Cargo.toml new file mode 100644 index 0000000..1d555e2 --- /dev/null +++ b/programs/adapter-jupiter/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "adapter-jupiter" +version = "0.1.0" +description = "Created with Anchor" +edition = "2021" + +[lib] +crate-type = ["cdylib", "lib"] +name = "adapter_jupiter" + +[features] +no-entrypoint = [] +no-idl = [] +no-log-ix-name = [] +cpi = ["no-entrypoint"] +default = [] + +[profile.release] +overflow-checks = true + +[dependencies] +anchor-lang = "0.26.0" +anchor-spl = "0.26.0" diff --git a/programs/adapter-jupiter/Xargo.toml b/programs/adapter-jupiter/Xargo.toml new file mode 100644 index 0000000..475fb71 --- /dev/null +++ b/programs/adapter-jupiter/Xargo.toml @@ -0,0 +1,2 @@ +[target.bpfel-unknown-unknown.dependencies.std] +features = [] diff --git a/programs/adapter-jupiter/src/lib.rs b/programs/adapter-jupiter/src/lib.rs new file mode 100644 index 0000000..2b16610 --- /dev/null +++ b/programs/adapter-jupiter/src/lib.rs @@ -0,0 +1,191 @@ +use anchor_lang::prelude::*; +use anchor_lang::solana_program::{ + hash::hash, + instruction::{AccountMeta, Instruction}, + program::invoke, + pubkey::Pubkey, +}; +use anchor_spl::token::TokenAccount; + +declare_id!("ADPT8iF4A7BSUWQ8AsVwmcod2suFzA4bpYpJj7kUWK3E"); + +const SWAP_CONFIG_SIZE: usize = 30; + +#[program] +pub mod adapter_jupiter { + use super::*; + + const PLATFORM_FEE: u8 = 0; + + pub fn swap(ctx: Context, input: Vec) -> Result<()> { + let discriminator: [u8; 8] = sighash("global", "route"); + + // Use remaining accounts + let mut dest_token_account_and_balance = + load_token_account_and_balance(ctx.remaining_accounts, 2); + + // Get Input + let mut input_bytes: &[u8] = &input[..]; + let input_struct = SwapInputWrapper::deserialize(&mut input_bytes)?; + msg!("Input: {:?}", input_struct); + + let mut last_index: usize = SWAP_CONFIG_SIZE - 1; + let mut start_index: usize = 1; + if input_struct.swap_config[0] > 0 && input_struct.swap_config[0] < SWAP_CONFIG_SIZE as u8 { + last_index = input_struct.swap_config[0] as usize; + } else if input_struct.swap_config[0] == 0 { + start_index = 0; + }; + + let swap_accounts = load_remaining_accounts(ctx.remaining_accounts, None); + + let mut swap_data = vec![]; + swap_data.append(&mut discriminator.try_to_vec()?); + swap_data.extend( + &mut input_struct.swap_config[start_index..=last_index] + .iter() + .cloned(), + ); + swap_data.append(&mut input_struct.in_amount.try_to_vec()?); + swap_data.append(&mut input_struct.out_amount.try_to_vec()?); + swap_data.append(&mut input_struct.slippage_bps.try_to_vec()?); + swap_data.append(&mut PLATFORM_FEE.try_to_vec()?); + msg!("swap_data: {:?}", swap_data); + + let ix = Instruction { + program_id: ctx.accounts.base_program_id.key(), + accounts: swap_accounts, + data: swap_data, + }; + + invoke(&ix, ctx.remaining_accounts)?; + + // Wrap Output + let output_struct = SwapOutputWrapper { + swap_out_amount: dest_token_account_and_balance.get_balance_change(), + ..Default::default() + }; + let mut output: Vec = Vec::new(); + output_struct.serialize(&mut output).unwrap(); + + anchor_lang::solana_program::program::set_return_data(&output); + msg!("Output: {:?}", output_struct); + + Ok(()) + } +} + +#[derive(Accounts)] +pub struct Action<'info> { + // TODO: Add constraints + pub gateway_authority: Signer<'info>, + /// CHECK: Safe + pub base_program_id: AccountInfo<'info>, +} + +#[derive(AnchorSerialize, AnchorDeserialize, Clone, Debug, Default)] +pub struct SwapInputWrapper { + pub in_amount: u64, + pub out_amount: u64, + pub slippage_bps: u16, + pub swap_config: [u8; SWAP_CONFIG_SIZE], +} + +// OutputWrapper needs to take up all the space of 32 bytes +#[derive(AnchorSerialize, AnchorDeserialize, Clone, Debug, Default)] +pub struct SwapOutputWrapper { + pub swap_out_amount: u64, + pub dummy_2: u64, + pub dummy_3: u64, + pub dummy_4: u64, +} + +pub type SwapOutputTuple = (u64, u64, u64, u64); + +impl From for SwapOutputTuple { + fn from(result: SwapOutputWrapper) -> SwapOutputTuple { + let SwapOutputWrapper { + swap_out_amount, + dummy_2, + dummy_3, + dummy_4, + } = result; + (swap_out_amount, dummy_2, dummy_3, dummy_4) + } +} + +pub fn sighash(namespace: &str, name: &str) -> [u8; 8] { + let preimage = format!("{}:{}", namespace, name); + let mut sighash = [0u8; 8]; + + sighash.copy_from_slice(&hash(preimage.as_bytes()).to_bytes()[..8]); + sighash +} + +pub fn load_token_account_and_balance<'info>( + remaining_accounts: &[AccountInfo<'info>], + account_index: usize, +) -> TokenAccountAndBalance<'info> { + let token_account_info = &remaining_accounts[account_index]; + let token_account = Account::::try_from(token_account_info).unwrap(); + let balance_before = token_account.amount.clone(); + return TokenAccountAndBalance { + token_accout: token_account, + balance_before: balance_before, + }; +} + +pub struct TokenAccountAndBalance<'info> { + token_accout: Account<'info, TokenAccount>, + balance_before: u64, +} + +impl<'info> TokenAccountAndBalance<'info> { + pub fn get_balance_change(&mut self) -> u64 { + self.token_accout.reload().unwrap(); + let balance_before = self.balance_before; + let balance_after = self.token_accout.amount; + if balance_after > balance_before { + balance_after.checked_sub(balance_before).unwrap() + } else if balance_after == balance_before { + 0_u64 + } else { + balance_before.checked_sub(balance_after).unwrap() + } + } +} + +pub fn load_remaining_accounts<'info>( + remaining_accounts: &[AccountInfo<'info>], + index_array: Option>, +) -> Vec { + let mut accounts: Vec = vec![]; + match index_array { + Some(index_array) => { + for index in index_array.iter() { + if remaining_accounts[*index].is_writable { + accounts.push(AccountMeta::new( + remaining_accounts[*index].key(), + remaining_accounts[*index].is_signer, + )) + } else { + accounts.push(AccountMeta::new_readonly( + remaining_accounts[*index].key(), + remaining_accounts[*index].is_signer, + )) + } + } + } + None => { + for account in remaining_accounts.iter() { + if account.is_writable { + accounts.push(AccountMeta::new(account.key(), account.is_signer)) + } else { + accounts.push(AccountMeta::new_readonly(account.key(), account.is_signer)) + } + } + } + } + + return accounts; +} diff --git a/programs/adapter-katana/Cargo.toml b/programs/adapter-katana/Cargo.toml index 450435f..a5be268 100644 --- a/programs/adapter-katana/Cargo.toml +++ b/programs/adapter-katana/Cargo.toml @@ -15,5 +15,5 @@ no-log-ix-name = [] cpi = ["no-entrypoint"] [dependencies] -anchor-lang = "0.24.2" -anchor-spl = "0.24.2" +anchor-lang = "0.26.0" +anchor-spl = "0.26.0" diff --git a/programs/adapter-larix/Cargo.toml b/programs/adapter-larix/Cargo.toml index 8a92bb4..3150c2c 100644 --- a/programs/adapter-larix/Cargo.toml +++ b/programs/adapter-larix/Cargo.toml @@ -15,5 +15,5 @@ no-log-ix-name = [] cpi = ["no-entrypoint"] [dependencies] -anchor-lang = "0.24.2" -anchor-spl = "0.24.2" +anchor-lang = "0.26.0" +anchor-spl = "0.26.0" diff --git a/programs/adapter-lifinity/Cargo.toml b/programs/adapter-lifinity/Cargo.toml index e8d449b..88b5d56 100644 --- a/programs/adapter-lifinity/Cargo.toml +++ b/programs/adapter-lifinity/Cargo.toml @@ -15,5 +15,5 @@ no-log-ix-name = [] cpi = ["no-entrypoint"] [dependencies] -anchor-lang = "0.24.2" -anchor-spl = "0.24.2" +anchor-lang = "0.26.0" +anchor-spl = "0.26.0" diff --git a/programs/adapter-nft-finance/Cargo.toml b/programs/adapter-nft-finance/Cargo.toml index 532c210..dc9df94 100644 --- a/programs/adapter-nft-finance/Cargo.toml +++ b/programs/adapter-nft-finance/Cargo.toml @@ -19,5 +19,5 @@ default = [] overflow-checks = true [dependencies] -anchor-lang = "0.24.2" -anchor-spl = "0.24.2" +anchor-lang = "0.26.0" +anchor-spl = "0.26.0" diff --git a/programs/adapter-orca/Cargo.toml b/programs/adapter-orca/Cargo.toml index f643c17..4486914 100644 --- a/programs/adapter-orca/Cargo.toml +++ b/programs/adapter-orca/Cargo.toml @@ -15,5 +15,5 @@ no-log-ix-name = [] cpi = ["no-entrypoint"] [dependencies] -anchor-lang = "0.24.2" -anchor-spl = "0.24.2" +anchor-lang = "0.26.0" +anchor-spl = "0.26.0" diff --git a/programs/adapter-raydium/Cargo.toml b/programs/adapter-raydium/Cargo.toml index be97593..34d81af 100644 --- a/programs/adapter-raydium/Cargo.toml +++ b/programs/adapter-raydium/Cargo.toml @@ -16,5 +16,5 @@ cpi = ["no-entrypoint"] default = [] [dependencies] -anchor-lang = "0.24.2" -anchor-spl = "0.24.2" +anchor-lang = "0.26.0" +anchor-spl = "0.26.0" diff --git a/programs/adapter-saber/Cargo.toml b/programs/adapter-saber/Cargo.toml index 117cfb2..90f8b01 100644 --- a/programs/adapter-saber/Cargo.toml +++ b/programs/adapter-saber/Cargo.toml @@ -15,5 +15,5 @@ no-log-ix-name = [] cpi = ["no-entrypoint"] [dependencies] -anchor-lang = "0.24.2" -anchor-spl = "0.24.2" +anchor-lang = "0.26.0" +anchor-spl = "0.26.0" diff --git a/programs/adapter-solend/Cargo.toml b/programs/adapter-solend/Cargo.toml index 1c19b09..af2d49a 100644 --- a/programs/adapter-solend/Cargo.toml +++ b/programs/adapter-solend/Cargo.toml @@ -15,5 +15,5 @@ no-log-ix-name = [] cpi = ["no-entrypoint"] [dependencies] -anchor-lang = "0.24.2" -anchor-spl = "0.24.2" +anchor-lang = "0.26.0" +anchor-spl = "0.26.0" diff --git a/programs/adapter-tulip/Cargo.toml b/programs/adapter-tulip/Cargo.toml index 7f77707..cbf35bc 100644 --- a/programs/adapter-tulip/Cargo.toml +++ b/programs/adapter-tulip/Cargo.toml @@ -15,17 +15,5 @@ no-log-ix-name = [] cpi = ["no-entrypoint"] [dependencies] -anchor-lang = "0.24.2" -anchor-spl = "0.24.2" -spl-associated-token-account = "1.0.3" -hex = "0.4.3" -tulip-arrform = "0.1.2" -tulip-derivative = "2.2.1" -static-pubkey = "1.0.2" -arrayref="0.3.6" -uint = "0.8.5" -num-derive = "0.3" -num-traits = "0.2" -thiserror = "1.0" -type-layout = "0.2.0" -itertools = "0.10.3" +anchor-lang = "0.26.0" +anchor-spl = "0.26.0" diff --git a/target/idl/adapter_jupiter.json b/target/idl/adapter_jupiter.json new file mode 100644 index 0000000..268ea2d --- /dev/null +++ b/target/idl/adapter_jupiter.json @@ -0,0 +1,82 @@ +{ + "version": "0.1.0", + "name": "adapter_jupiter", + "instructions": [ + { + "name": "swap", + "accounts": [ + { + "name": "gatewayAuthority", + "isMut": false, + "isSigner": true + }, + { + "name": "baseProgramId", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "input", + "type": "bytes" + } + ] + } + ], + "types": [ + { + "name": "SwapInputWrapper", + "type": { + "kind": "struct", + "fields": [ + { + "name": "inAmount", + "type": "u64" + }, + { + "name": "outAmount", + "type": "u64" + }, + { + "name": "slippageBps", + "type": "u16" + }, + { + "name": "swapConfig", + "type": { + "array": [ + "u8", + 30 + ] + } + } + ] + } + }, + { + "name": "SwapOutputWrapper", + "type": { + "kind": "struct", + "fields": [ + { + "name": "swapOutAmount", + "type": "u64" + }, + { + "name": "dummy2", + "type": "u64" + }, + { + "name": "dummy3", + "type": "u64" + }, + { + "name": "dummy4", + "type": "u64" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/target/types/adapter_jupiter.ts b/target/types/adapter_jupiter.ts new file mode 100644 index 0000000..69ca87e --- /dev/null +++ b/target/types/adapter_jupiter.ts @@ -0,0 +1,165 @@ +export type AdapterJupiter = { + "version": "0.1.0", + "name": "adapter_jupiter", + "instructions": [ + { + "name": "swap", + "accounts": [ + { + "name": "gatewayAuthority", + "isMut": false, + "isSigner": true + }, + { + "name": "baseProgramId", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "input", + "type": "bytes" + } + ] + } + ], + "types": [ + { + "name": "SwapInputWrapper", + "type": { + "kind": "struct", + "fields": [ + { + "name": "inAmount", + "type": "u64" + }, + { + "name": "outAmount", + "type": "u64" + }, + { + "name": "slippageBps", + "type": "u16" + }, + { + "name": "swapConfig", + "type": { + "array": [ + "u8", + 30 + ] + } + } + ] + } + }, + { + "name": "SwapOutputWrapper", + "type": { + "kind": "struct", + "fields": [ + { + "name": "swapOutAmount", + "type": "u64" + }, + { + "name": "dummy2", + "type": "u64" + }, + { + "name": "dummy3", + "type": "u64" + }, + { + "name": "dummy4", + "type": "u64" + } + ] + } + } + ] +}; + +export const IDL: AdapterJupiter = { + "version": "0.1.0", + "name": "adapter_jupiter", + "instructions": [ + { + "name": "swap", + "accounts": [ + { + "name": "gatewayAuthority", + "isMut": false, + "isSigner": true + }, + { + "name": "baseProgramId", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "input", + "type": "bytes" + } + ] + } + ], + "types": [ + { + "name": "SwapInputWrapper", + "type": { + "kind": "struct", + "fields": [ + { + "name": "inAmount", + "type": "u64" + }, + { + "name": "outAmount", + "type": "u64" + }, + { + "name": "slippageBps", + "type": "u16" + }, + { + "name": "swapConfig", + "type": { + "array": [ + "u8", + 30 + ] + } + } + ] + } + }, + { + "name": "SwapOutputWrapper", + "type": { + "kind": "struct", + "fields": [ + { + "name": "swapOutAmount", + "type": "u64" + }, + { + "name": "dummy2", + "type": "u64" + }, + { + "name": "dummy3", + "type": "u64" + }, + { + "name": "dummy4", + "type": "u64" + } + ] + } + } + ] +};