diff --git a/.cargo/config.toml b/.cargo/config.toml index 90410e2..c0c3a45 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,7 +1,7 @@ # paths = ["/path/to/override"] # path dependency overrides [alias] # command aliases -install_soroban = "install --git https://github.com/stellar/soroban-tools --rev cb3c44f9d8080917a7cb019d6be25019f6cf78c3 --root ./target soroban-cli --debug" +install_soroban = "install --git https://github.com/AhaLabs/soroban-tools --rev dc2a543993a293155516df52e79cc120cbd3dfe0 --root ./target soroban-cli --debug" b = "build --target wasm32-unknown-unknown --release" # c = "check" # t = "test" diff --git a/.gitignore b/.gitignore index 47d5260..5c6985f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. /.soroban-example-dapp /.soroban +/shared/config.json # dependencies /node_modules /.pnp diff --git a/Cargo.lock b/Cargo.lock index 9094998..c765933 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -94,15 +94,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - [[package]] name = "block-buffer" version = "0.10.4" @@ -118,12 +109,6 @@ version = "3.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8" -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - [[package]] name = "bytes-lit" version = "0.0.5" @@ -237,17 +222,32 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "3.2.0" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +checksum = "622178105f911d937a42cdb140730ba4a3ed2becd8ae6ce39c7d28b5d75d4588" dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "platforms", + "rustc_version", "subtle", "zeroize", ] +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.15", +] + [[package]] name = "cxx" version = "1.0.94" @@ -348,22 +348,13 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - [[package]] name = "digest" version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer 0.10.4", + "block-buffer", "const-oid", "crypto-common", "subtle", @@ -382,33 +373,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" dependencies = [ "der", - "digest 0.10.7", + "digest", "elliptic-curve", "rfc6979", - "signature 2.1.0", + "signature", "spki", ] [[package]] name = "ed25519" -version = "1.5.3" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +checksum = "60f6d271ca33075c88028be6f04d502853d63a5ece419d269c15315d4fc1cf1d" dependencies = [ - "signature 1.6.4", + "pkcs8", + "signature", ] [[package]] name = "ed25519-dalek" -version = "1.0.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ "curve25519-dalek", "ed25519", - "rand", + "rand_core 0.6.4", "serde", - "sha2 0.9.9", + "sha2", "zeroize", ] @@ -426,7 +418,7 @@ checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" dependencies = [ "base16ct", "crypto-bigint", - "digest 0.10.7", + "digest", "ff", "generic-array", "group", @@ -453,6 +445,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "fiat-crypto" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0870c84016d4b481be5c9f323c24f65e31e901ae618f0e80f4308fb00de1d2d" + [[package]] name = "fnv" version = "1.0.7" @@ -532,7 +530,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.7", + "digest", ] [[package]] @@ -582,12 +580,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" -[[package]] -name = "intx" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f38a50a899dc47a6d0ed5508e7f601a2e34c3a85303514b5d137f3c10a0c75" - [[package]] name = "itertools" version = "0.10.5" @@ -622,8 +614,8 @@ dependencies = [ "ecdsa", "elliptic-curve", "once_cell", - "sha2 0.10.7", - "signature 2.1.0", + "sha2", + "signature", ] [[package]] @@ -693,13 +685,13 @@ dependencies = [ [[package]] name = "num-derive" -version = "0.3.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +checksum = "9e6a0fd4f737c707bd9086cc16c925f294943eb62eb71499e9fd4cf71f8b9f4e" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] @@ -736,12 +728,6 @@ version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - [[package]] name = "paste" version = "1.0.13" @@ -758,6 +744,12 @@ dependencies = [ "spki", ] +[[package]] +name = "platforms" +version = "3.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4503fa043bf02cee09a9582e9554b4c6403b2ef55e4612e96561d294419429f8" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -800,11 +792,22 @@ checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ "getrandom 0.1.16", "libc", - "rand_chacha", + "rand_chacha 0.2.2", "rand_core 0.5.1", "rand_hc", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + [[package]] name = "rand_chacha" version = "0.2.2" @@ -815,6 +818,16 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + [[package]] name = "rand_core" version = "0.5.1" @@ -958,19 +971,6 @@ dependencies = [ "syn 2.0.15", ] -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - [[package]] name = "sha2" version = "0.10.7" @@ -979,7 +979,7 @@ checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.7", + "digest", ] [[package]] @@ -988,23 +988,17 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "digest 0.10.7", + "digest", "keccak", ] -[[package]] -name = "signature" -version = "1.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" - [[package]] name = "signature" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" dependencies = [ - "digest 0.10.7", + "digest", "rand_core 0.6.4", ] @@ -1018,21 +1012,20 @@ checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" name = "soroban-crowdfund-contract" version = "0.0.0" dependencies = [ - "rand", + "rand 0.7.3", "soroban-sdk", ] [[package]] name = "soroban-env-common" -version = "0.0.17" +version = "20.0.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e28d297d1172c2a020660728ac24ca3af7118de85ad547d071f96221111dfb" +checksum = "c2508a41765935d3bef43b2264667c4603725cf7ddd851321f1dc2b3bca8bb88" dependencies = [ "arbitrary", "crate-git-revision", "ethnum", "num-derive", - "num-integer", "num-traits", "serde", "soroban-env-macros", @@ -1043,9 +1036,9 @@ dependencies = [ [[package]] name = "soroban-env-guest" -version = "0.0.17" +version = "20.0.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fbccdce4f74778cfe79e6ca8b6df2d094237d0bedf4aa167a73bfdaa7388fed" +checksum = "b41f1b3ebb747487ff9920822112a5816030e053734ed63c05f1a7db476f2768" dependencies = [ "soroban-env-common", "static_assertions", @@ -1053,23 +1046,20 @@ dependencies = [ [[package]] name = "soroban-env-host" -version = "0.0.17" +version = "20.0.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35eef83232686c48fc8c8bfc560ee2e065bdd18ac31da8cb570e93f3fd78fea0" +checksum = "347fc729270de2fc8e312ba1872ef90fdc8dfcd0dacdd07a3bb7a038c41ea6d6" dependencies = [ "backtrace", - "curve25519-dalek", "ed25519-dalek", "getrandom 0.2.10", - "hex", "k256", - "log", "num-derive", "num-integer", "num-traits", - "rand", - "rand_chacha", - "sha2 0.9.9", + "rand 0.8.5", + "rand_chacha 0.3.1", + "sha2", "sha3", "soroban-env-common", "soroban-native-sdk-macros", @@ -1080,9 +1070,9 @@ dependencies = [ [[package]] name = "soroban-env-macros" -version = "0.0.17" +version = "20.0.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fcab4ca9be166587dd84939576634f2f7bccf213fe9f6aced9561ab4238be1" +checksum = "f16b7a75d77ae47143a07f92a35661c21e965f63bb4362d8491188a993687745" dependencies = [ "itertools", "proc-macro2", @@ -1091,14 +1081,13 @@ dependencies = [ "serde_json", "stellar-xdr", "syn 2.0.15", - "thiserror", ] [[package]] name = "soroban-ledger-snapshot" -version = "0.9.2" +version = "20.0.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c379a73e5d14b0b9ba41157161c5362427a2ca75c936d1b737d41bca91ef252f" +checksum = "d202c5870aeec1cb97bfd06a94b8fe691c513ba6da8638deb07d8660e90056ba" dependencies = [ "serde", "serde_json", @@ -1109,9 +1098,9 @@ dependencies = [ [[package]] name = "soroban-native-sdk-macros" -version = "0.0.17" +version = "20.0.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d891b456b0f6897ccbb8b67388ed7ce921fd47d19ff3ae8d8b1edca08339639" +checksum = "fe8cf96e5c9308347bc6fa0735d0591475a20b43ed00f96ad2df623bbe9c1e88" dependencies = [ "itertools", "proc-macro2", @@ -1121,15 +1110,15 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "0.9.2" +version = "20.0.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1cf449f8c53d905ac41d4c264442f26aa559d4a0ef451569a7739bd4d747595" +checksum = "7d771d43a66ba0df14ff28ac1b37a6568da00afa12f28273a67fe92853ab28f8" dependencies = [ "arbitrary", "bytes-lit", "ctor", "ed25519-dalek", - "rand", + "rand 0.8.5", "soroban-env-guest", "soroban-env-host", "soroban-ledger-snapshot", @@ -1139,9 +1128,9 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "0.9.2" +version = "20.0.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ab0a02c265c41a44311e3e6271e0fccd518bda0c8383c7ff8aee478541d3b" +checksum = "bf5a6dd2e08217fdd75f3f849256dda2614badda9095df233a47c7c8f9783493" dependencies = [ "crate-git-revision", "darling", @@ -1149,7 +1138,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "sha2 0.9.9", + "sha2", "soroban-env-common", "soroban-spec", "soroban-spec-rust", @@ -1159,9 +1148,9 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "0.9.2" +version = "20.0.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfd732ef1613e5ec919410fddd842d8cb804effb63c43acbf5ec6d77e6d0633" +checksum = "7e2a55aab81d7cd1df66f85de3d815fb08fc5fa412270dc374e031e27528c711" dependencies = [ "base64 0.13.1", "stellar-xdr", @@ -1171,14 +1160,14 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "0.9.2" +version = "20.0.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fde0592863f1f34c1eff8bdbe35a6557adb6abadfc57804217fe035bec7421ef" +checksum = "1bcfa549d3362e6eafa3a51ad29d571f3dbae2cb9fe33d9f94c00a9f742f71df" dependencies = [ "prettyplease", "proc-macro2", "quote", - "sha2 0.9.9", + "sha2", "soroban-spec", "stellar-xdr", "syn 2.0.15", @@ -1187,20 +1176,19 @@ dependencies = [ [[package]] name = "soroban-token-sdk" -version = "0.9.2" +version = "20.0.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38fabcf7f14b0a9b471d1663d3b29e32ca374a86dc8da6fe6536b5d3842def45" +checksum = "7294182d2197ac4da58163ca8f9c2e4df2045e5b81752928d82da9289ef366ee" dependencies = [ "soroban-sdk", ] [[package]] name = "soroban-wasmi" -version = "0.30.0-soroban" +version = "0.31.0-soroban1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c193640a103c4fc81163feca877bbea234dc20150015428ecc4e010f025f82bf" +checksum = "1b6e3e79c1f227ec98ea1e8fbf43d0267b9ca748616c9c8c0162fa2a8ca4d5d2" dependencies = [ - "intx", "smallvec", "spin", "wasmi_arena", @@ -1242,9 +1230,9 @@ dependencies = [ [[package]] name = "stellar-xdr" -version = "0.0.17" +version = "20.0.0-rc1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae197b4edde8835ab0ba018f1b5cdab0c47d0f28848f3f75d2951a1c9c7cdb48" +checksum = "e09a3734914a7427dbcd4f06b6dcd2b1cf38e934202f6abe4d73658f718b6113" dependencies = [ "arbitrary", "base64 0.13.1", @@ -1442,9 +1430,9 @@ checksum = "401c1f35e413fac1846d4843745589d9ec678977ab35a384db8ae7830525d468" [[package]] name = "wasmi_core" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624e6333e861ef49095d2d678b76ebf30b06bf37effca845be7e5b87c90071b7" +checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a" dependencies = [ "downcast-rs", "libm", @@ -1572,17 +1560,3 @@ name = "zeroize" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] diff --git a/Cargo.toml b/Cargo.toml index 3106b42..2579de3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,5 +16,5 @@ codegen-units = 1 lto = true [workspace.dependencies] -soroban-sdk = "0.9.2" -soroban-token-sdk = "0.9.2" +soroban-sdk = "20.0.0-rc2" +soroban-token-sdk = "20.0.0-rc2" diff --git a/components/molecules/deposits/index.tsx b/components/molecules/deposits/index.tsx index a42fb63..bfd01b2 100644 --- a/components/molecules/deposits/index.tsx +++ b/components/molecules/deposits/index.tsx @@ -2,21 +2,20 @@ import React from 'react' import styles from './style.module.css' import { Utils } from '../../../shared/utils' import { Spacer } from '../../atoms/spacer' -import { balance as getBalance } from 'crowdfund-contract' +import { crowdfund } from '../../../shared/contracts' export interface IDepositsProps { address: string decimals: number name?: string symbol?: string - idCrowdfund: string } export function Deposits(props: IDepositsProps) { const [balance, setBalance] = React.useState(BigInt(0)) React.useEffect(() => { - getBalance({ user: props.address }).then(setBalance) + crowdfund.balance({ user: props.address }).then(setBalance) }, [props.address]) diff --git a/components/molecules/form-pledge/index.tsx b/components/molecules/form-pledge/index.tsx index d38b368..6f39413 100644 --- a/components/molecules/form-pledge/index.tsx +++ b/components/molecules/form-pledge/index.tsx @@ -4,8 +4,7 @@ import { TransactionModal } from '../../molecules/transaction-modal' import { Utils } from '../../../shared/utils' import styles from './style.module.css' import { Spacer } from '../../atoms/spacer' -import { deposit } from 'crowdfund-contract' -import * as abundance from 'abundance-token' +import { abundance, crowdfund } from '../../../shared/contracts' export interface IFormPledgeProps { account: string @@ -78,7 +77,7 @@ const FormPledge: FunctionComponent = props => { setSubmitting(true) try { - await deposit({ + await crowdfund.deposit({ user: props.account, amount: BigInt(amount * 10 ** decimals), }) diff --git a/components/organisms/pledge/index.tsx b/components/organisms/pledge/index.tsx index 18f5a34..58681fe 100644 --- a/components/organisms/pledge/index.tsx +++ b/components/organisms/pledge/index.tsx @@ -7,8 +7,10 @@ import { useAccount, useSubscription, } from '../../../hooks' -import * as crowdfundContract from 'crowdfund-contract' -import * as abundanceContract from 'abundance-token' +import { + crowdfund as crowdfundContract, + abundance as abundanceContract, +} from '../../../shared/contracts' import * as SorobanClient from 'soroban-client' import { Deposits, FormPledge } from '../../molecules' @@ -32,7 +34,7 @@ const Pledge: FunctionComponent = () => { React.useEffect(() => { Promise.all([ - abundanceContract.balance({ id: crowdfundContract.CONTRACT_ID }), + abundanceContract.balance({ id: crowdfundContract.options.contractId }), abundanceContract.decimals(), abundanceContract.name(), abundanceContract.symbol(), @@ -56,14 +58,22 @@ const Pledge: FunctionComponent = () => { const [targetReached, setTargetReached] = useState(false) - useSubscription(crowdfundContract, 'pledged_amount_changed', React.useMemo(() => event => { - let eventTokenBalance = xdr.ScVal.fromXDR(event.value.xdr, 'base64') - setAbundance({ ...abundance!, balance: SorobanClient.scValToNative(eventTokenBalance) }) - }, [abundance])) + useSubscription( + crowdfundContract.options.contractId, + 'pledged_amount_changed', + React.useMemo(() => event => { + let eventTokenBalance = xdr.ScVal.fromXDR(event.value.xdr, 'base64') + setAbundance({ ...abundance!, balance: SorobanClient.scValToNative(eventTokenBalance) }) + }, [abundance]) + ) - useSubscription(crowdfundContract, 'target_reached', React.useMemo(() => () => { - setTargetReached(true) - }, [])) + useSubscription( + crowdfundContract.options.contractId, + 'target_reached', + React.useMemo(() => () => { + setTargetReached(true) + }, []) + ) return ( @@ -116,7 +126,6 @@ const Pledge: FunctionComponent = () => { decimals={abundance.decimals || 7} name={abundance.name} symbol={abundance.symbol} - idCrowdfund={crowdfundContract.CONTRACT_ID} /> )} diff --git a/contracts/abundance/src/allowance.rs b/contracts/abundance/src/allowance.rs index 86d21cd..550665e 100644 --- a/contracts/abundance/src/allowance.rs +++ b/contracts/abundance/src/allowance.rs @@ -40,12 +40,11 @@ pub fn write_allowance( e.storage().temporary().set(&key.clone(), &allowance); if amount > 0 { - e.storage().temporary().bump( - &key, - expiration_ledger - .checked_sub(e.ledger().sequence()) - .unwrap(), - ) + let live_for = expiration_ledger + .checked_sub(e.ledger().sequence()) + .unwrap(); + + e.storage().temporary().bump(&key, live_for, live_for) } } diff --git a/contracts/abundance/src/balance.rs b/contracts/abundance/src/balance.rs index 06b17d6..40a7304 100644 --- a/contracts/abundance/src/balance.rs +++ b/contracts/abundance/src/balance.rs @@ -1,10 +1,12 @@ -use crate::storage_types::{DataKey, BALANCE_BUMP_AMOUNT}; +use crate::storage_types::{DataKey, BALANCE_BUMP_AMOUNT, BALANCE_LIFETIME_THRESHOLD}; use soroban_sdk::{Address, Env}; pub fn read_balance(e: &Env, addr: Address) -> i128 { let key = DataKey::Balance(addr); if let Some(balance) = e.storage().persistent().get::(&key) { - e.storage().persistent().bump(&key, BALANCE_BUMP_AMOUNT); + e.storage() + .persistent() + .bump(&key, BALANCE_LIFETIME_THRESHOLD, BALANCE_BUMP_AMOUNT); balance } else { 0 @@ -14,38 +16,20 @@ pub fn read_balance(e: &Env, addr: Address) -> i128 { fn write_balance(e: &Env, addr: Address, amount: i128) { let key = DataKey::Balance(addr); e.storage().persistent().set(&key, &amount); - e.storage().persistent().bump(&key, BALANCE_BUMP_AMOUNT); + e.storage() + .persistent() + .bump(&key, BALANCE_LIFETIME_THRESHOLD, BALANCE_BUMP_AMOUNT); } pub fn receive_balance(e: &Env, addr: Address, amount: i128) { let balance = read_balance(e, addr.clone()); - if !is_authorized(e, addr.clone()) { - panic!("can't receive when deauthorized"); - } write_balance(e, addr, balance + amount); } pub fn spend_balance(e: &Env, addr: Address, amount: i128) { let balance = read_balance(e, addr.clone()); - if !is_authorized(e, addr.clone()) { - panic!("can't spend when deauthorized"); - } if balance < amount { panic!("insufficient balance"); } write_balance(e, addr, balance - amount); } - -pub fn is_authorized(e: &Env, addr: Address) -> bool { - let key = DataKey::State(addr); - if let Some(state) = e.storage().persistent().get::(&key) { - state - } else { - true - } -} - -pub fn write_authorization(e: &Env, addr: Address, is_authorized: bool) { - let key = DataKey::State(addr); - e.storage().persistent().set(&key, &is_authorized); -} diff --git a/contracts/abundance/src/contract.rs b/contracts/abundance/src/contract.rs index 408ab57..ea1219b 100644 --- a/contracts/abundance/src/contract.rs +++ b/contracts/abundance/src/contract.rs @@ -2,49 +2,13 @@ //! interface. use crate::admin::{has_administrator, read_administrator, write_administrator}; use crate::allowance::{read_allowance, spend_allowance, write_allowance}; -use crate::balance::{is_authorized, write_authorization}; use crate::balance::{read_balance, receive_balance, spend_balance}; -use crate::event; use crate::metadata::{read_decimal, read_name, read_symbol, write_metadata}; -use crate::storage_types::INSTANCE_BUMP_AMOUNT; +use crate::storage_types::{INSTANCE_BUMP_AMOUNT, INSTANCE_LIFETIME_THRESHOLD}; +use soroban_sdk::token::{self, Interface as _}; use soroban_sdk::{contract, contractimpl, Address, Env, String}; -use soroban_token_sdk::TokenMetadata; - -pub trait TokenTrait { - fn initialize(e: Env, admin: Address, decimal: u32, name: String, symbol: String); - - fn allowance(e: Env, from: Address, spender: Address) -> i128; - - fn approve(e: Env, from: Address, spender: Address, amount: i128, expiration_ledger: u32); - - fn balance(e: Env, id: Address) -> i128; - - fn spendable_balance(e: Env, id: Address) -> i128; - - fn authorized(e: Env, id: Address) -> bool; - - fn transfer(e: Env, from: Address, to: Address, amount: i128); - - fn transfer_from(e: Env, spender: Address, from: Address, to: Address, amount: i128); - - fn burn(e: Env, from: Address, amount: i128); - - fn burn_from(e: Env, spender: Address, from: Address, amount: i128); - - fn clawback(e: Env, from: Address, amount: i128); - - fn set_authorized(e: Env, id: Address, authorize: bool); - - fn mint(e: Env, to: Address, amount: i128); - - fn set_admin(e: Env, new_admin: Address); - - fn decimals(e: Env) -> u32; - - fn name(e: Env) -> String; - - fn symbol(e: Env) -> String; -} +use soroban_token_sdk::metadata::TokenMetadata; +use soroban_token_sdk::TokenUtils; fn check_nonnegative_amount(amount: i128) { if amount < 0 { @@ -56,8 +20,8 @@ fn check_nonnegative_amount(amount: i128) { pub struct Token; #[contractimpl] -impl TokenTrait for Token { - fn initialize(e: Env, admin: Address, decimal: u32, name: String, symbol: String) { +impl Token { + pub fn initialize(e: Env, admin: Address, decimal: u32, name: String, symbol: String) { if has_administrator(&e) { panic!("already initialized") } @@ -76,8 +40,44 @@ impl TokenTrait for Token { ) } + /// Mint yourself some tokens! + /// + /// # Arguments + /// + /// * `to` - The account to mint tokens to; the transaction must also be signed by this + /// account + /// * `amount` - The amount of tokens to mint (remember to multiply by `decimals`!) + pub fn mint(e: Env, to: Address, amount: i128) { + check_nonnegative_amount(amount); + to.require_auth(); + + e.storage() + .instance() + .bump(INSTANCE_LIFETIME_THRESHOLD, INSTANCE_BUMP_AMOUNT); + + receive_balance(&e, to.clone(), amount); + TokenUtils::new(&e).events().mint(to.clone(), to, amount); + } + + pub fn set_admin(e: Env, new_admin: Address) { + let admin = read_administrator(&e); + admin.require_auth(); + + e.storage() + .instance() + .bump(INSTANCE_LIFETIME_THRESHOLD, INSTANCE_BUMP_AMOUNT); + + write_administrator(&e, &new_admin); + TokenUtils::new(&e).events().set_admin(admin, new_admin); + } +} + +#[contractimpl] +impl token::Interface for Token { fn allowance(e: Env, from: Address, spender: Address) -> i128 { - e.storage().instance().bump(INSTANCE_BUMP_AMOUNT); + e.storage() + .instance() + .bump(INSTANCE_LIFETIME_THRESHOLD, INSTANCE_BUMP_AMOUNT); read_allowance(&e, from, spender).amount } @@ -86,37 +86,42 @@ impl TokenTrait for Token { check_nonnegative_amount(amount); - e.storage().instance().bump(INSTANCE_BUMP_AMOUNT); + e.storage() + .instance() + .bump(INSTANCE_LIFETIME_THRESHOLD, INSTANCE_BUMP_AMOUNT); write_allowance(&e, from.clone(), spender.clone(), amount, expiration_ledger); - event::approve(&e, from, spender, amount, expiration_ledger); + TokenUtils::new(&e) + .events() + .approve(from, spender, amount, expiration_ledger); } fn balance(e: Env, id: Address) -> i128 { - e.storage().instance().bump(INSTANCE_BUMP_AMOUNT); + e.storage() + .instance() + .bump(INSTANCE_LIFETIME_THRESHOLD, INSTANCE_BUMP_AMOUNT); read_balance(&e, id) } fn spendable_balance(e: Env, id: Address) -> i128 { - e.storage().instance().bump(INSTANCE_BUMP_AMOUNT); + e.storage() + .instance() + .bump(INSTANCE_LIFETIME_THRESHOLD, INSTANCE_BUMP_AMOUNT); read_balance(&e, id) } - fn authorized(e: Env, id: Address) -> bool { - e.storage().instance().bump(INSTANCE_BUMP_AMOUNT); - is_authorized(&e, id) - } - fn transfer(e: Env, from: Address, to: Address, amount: i128) { from.require_auth(); check_nonnegative_amount(amount); - e.storage().instance().bump(INSTANCE_BUMP_AMOUNT); + e.storage() + .instance() + .bump(INSTANCE_LIFETIME_THRESHOLD, INSTANCE_BUMP_AMOUNT); spend_balance(&e, from.clone(), amount); receive_balance(&e, to.clone(), amount); - event::transfer(&e, from, to, amount); + TokenUtils::new(&e).events().transfer(from, to, amount); } fn transfer_from(e: Env, spender: Address, from: Address, to: Address, amount: i128) { @@ -124,12 +129,14 @@ impl TokenTrait for Token { check_nonnegative_amount(amount); - e.storage().instance().bump(INSTANCE_BUMP_AMOUNT); + e.storage() + .instance() + .bump(INSTANCE_LIFETIME_THRESHOLD, INSTANCE_BUMP_AMOUNT); spend_allowance(&e, from.clone(), spender, amount); spend_balance(&e, from.clone(), amount); receive_balance(&e, to.clone(), amount); - event::transfer(&e, from, to, amount) + TokenUtils::new(&e).events().transfer(from, to, amount) } fn burn(e: Env, from: Address, amount: i128) { @@ -137,10 +144,12 @@ impl TokenTrait for Token { check_nonnegative_amount(amount); - e.storage().instance().bump(INSTANCE_BUMP_AMOUNT); + e.storage() + .instance() + .bump(INSTANCE_LIFETIME_THRESHOLD, INSTANCE_BUMP_AMOUNT); spend_balance(&e, from.clone(), amount); - event::burn(&e, from, amount); + TokenUtils::new(&e).events().burn(from, amount); } fn burn_from(e: Env, spender: Address, from: Address, amount: i128) { @@ -148,59 +157,13 @@ impl TokenTrait for Token { check_nonnegative_amount(amount); - e.storage().instance().bump(INSTANCE_BUMP_AMOUNT); + e.storage() + .instance() + .bump(INSTANCE_LIFETIME_THRESHOLD, INSTANCE_BUMP_AMOUNT); spend_allowance(&e, from.clone(), spender, amount); spend_balance(&e, from.clone(), amount); - event::burn(&e, from, amount) - } - - fn clawback(e: Env, from: Address, amount: i128) { - check_nonnegative_amount(amount); - let admin = read_administrator(&e); - admin.require_auth(); - - e.storage().instance().bump(INSTANCE_BUMP_AMOUNT); - - spend_balance(&e, from.clone(), amount); - event::clawback(&e, admin, from, amount); - } - - fn set_authorized(e: Env, id: Address, authorize: bool) { - let admin = read_administrator(&e); - admin.require_auth(); - - e.storage().instance().bump(INSTANCE_BUMP_AMOUNT); - - write_authorization(&e, id.clone(), authorize); - event::set_authorized(&e, admin, id, authorize); - } - - /// Mint yourself some tokens! - /// - /// # Arguments - /// - /// * `to` - The account to mint tokens to; the transaction must also be signed by this - /// account - /// * `amount` - The amount of tokens to mint (remember to multiply by `decimals`!) - fn mint(e: Env, to: Address, amount: i128) { - check_nonnegative_amount(amount); - to.require_auth(); - - e.storage().instance().bump(INSTANCE_BUMP_AMOUNT); - - receive_balance(&e, to.clone(), amount); - event::mint(&e, to.clone(), to, amount); - } - - fn set_admin(e: Env, new_admin: Address) { - let admin = read_administrator(&e); - admin.require_auth(); - - e.storage().instance().bump(INSTANCE_BUMP_AMOUNT); - - write_administrator(&e, &new_admin); - event::set_admin(&e, admin, new_admin); + TokenUtils::new(&e).events().burn(from, amount) } fn decimals(e: Env) -> u32 { diff --git a/contracts/abundance/src/event.rs b/contracts/abundance/src/event.rs deleted file mode 100644 index b897bb4..0000000 --- a/contracts/abundance/src/event.rs +++ /dev/null @@ -1,36 +0,0 @@ -use soroban_sdk::{symbol_short, Address, Env, Symbol}; - -pub(crate) fn approve(e: &Env, from: Address, to: Address, amount: i128, expiration_ledger: u32) { - let topics = (Symbol::new(e, "approve"), from, to); - e.events().publish(topics, (amount, expiration_ledger)); -} - -pub(crate) fn transfer(e: &Env, from: Address, to: Address, amount: i128) { - let topics = (symbol_short!("transfer"), from, to); - e.events().publish(topics, amount); -} - -pub(crate) fn mint(e: &Env, admin: Address, to: Address, amount: i128) { - let topics = (symbol_short!("mint"), admin, to); - e.events().publish(topics, amount); -} - -pub(crate) fn clawback(e: &Env, admin: Address, from: Address, amount: i128) { - let topics = (symbol_short!("clawback"), admin, from); - e.events().publish(topics, amount); -} - -pub(crate) fn set_authorized(e: &Env, admin: Address, id: Address, authorize: bool) { - let topics = (Symbol::new(e, "set_authorized"), admin, id); - e.events().publish(topics, authorize); -} - -pub(crate) fn set_admin(e: &Env, admin: Address, new_admin: Address) { - let topics = (symbol_short!("set_admin"), admin); - e.events().publish(topics, new_admin); -} - -pub(crate) fn burn(e: &Env, from: Address, amount: i128) { - let topics = (symbol_short!("burn"), from); - e.events().publish(topics, amount); -} diff --git a/contracts/abundance/src/lib.rs b/contracts/abundance/src/lib.rs index 0531bb8..b5f04e4 100644 --- a/contracts/abundance/src/lib.rs +++ b/contracts/abundance/src/lib.rs @@ -4,7 +4,6 @@ mod admin; mod allowance; mod balance; mod contract; -mod event; mod metadata; mod storage_types; mod test; diff --git a/contracts/abundance/src/metadata.rs b/contracts/abundance/src/metadata.rs index f09ac1d..715feee 100644 --- a/contracts/abundance/src/metadata.rs +++ b/contracts/abundance/src/metadata.rs @@ -1,22 +1,22 @@ use soroban_sdk::{Env, String}; -use soroban_token_sdk::{TokenMetadata, TokenUtils}; +use soroban_token_sdk::{metadata::TokenMetadata, TokenUtils}; pub fn read_decimal(e: &Env) -> u32 { let util = TokenUtils::new(e); - util.get_metadata().decimal + util.metadata().get_metadata().decimal } pub fn read_name(e: &Env) -> String { let util = TokenUtils::new(e); - util.get_metadata().name + util.metadata().get_metadata().name } pub fn read_symbol(e: &Env) -> String { let util = TokenUtils::new(e); - util.get_metadata().symbol + util.metadata().get_metadata().symbol } pub fn write_metadata(e: &Env, metadata: TokenMetadata) { let util = TokenUtils::new(e); - util.set_metadata(&metadata); + util.metadata().set_metadata(&metadata); } diff --git a/contracts/abundance/src/storage_types.rs b/contracts/abundance/src/storage_types.rs index 707f44d..5710c05 100644 --- a/contracts/abundance/src/storage_types.rs +++ b/contracts/abundance/src/storage_types.rs @@ -1,7 +1,11 @@ use soroban_sdk::{contracttype, Address}; -pub(crate) const INSTANCE_BUMP_AMOUNT: u32 = 34560; // 2 days -pub(crate) const BALANCE_BUMP_AMOUNT: u32 = 518400; // 30 days +pub(crate) const DAY_IN_LEDGERS: u32 = 17280; +pub(crate) const INSTANCE_BUMP_AMOUNT: u32 = 7 * DAY_IN_LEDGERS; +pub(crate) const INSTANCE_LIFETIME_THRESHOLD: u32 = INSTANCE_BUMP_AMOUNT - DAY_IN_LEDGERS; + +pub(crate) const BALANCE_BUMP_AMOUNT: u32 = 30 * DAY_IN_LEDGERS; +pub(crate) const BALANCE_LIFETIME_THRESHOLD: u32 = BALANCE_BUMP_AMOUNT - DAY_IN_LEDGERS; #[derive(Clone)] #[contracttype] diff --git a/contracts/abundance/src/test.rs b/contracts/abundance/src/test.rs index 0d0a0b0..513ae5d 100644 --- a/contracts/abundance/src/test.rs +++ b/contracts/abundance/src/test.rs @@ -116,43 +116,6 @@ fn test() { )] ); - token.set_authorized(&user2, &false); - assert_eq!( - e.auths(), - std::vec![( - admin2.clone(), - AuthorizedInvocation { - function: AuthorizedFunction::Contract(( - token.address.clone(), - Symbol::new(&e, "set_authorized"), - (&user2, false).into_val(&e), - )), - sub_invocations: std::vec![] - } - )] - ); - assert_eq!(token.authorized(&user2), false); - - token.set_authorized(&user3, &true); - assert_eq!(token.authorized(&user3), true); - - token.clawback(&user3, &100); - assert_eq!( - e.auths(), - std::vec![( - admin2.clone(), - AuthorizedInvocation { - function: AuthorizedFunction::Contract(( - token.address.clone(), - symbol_short!("clawback"), - (&user3, 100_i128).into_val(&e), - )), - sub_invocations: std::vec![] - } - )] - ); - assert_eq!(token.balance(&user3), 200); - // Increase to 500 token.approve(&user2, &user3, &500, &200); assert_eq!(token.allowance(&user2, &user3), 500); @@ -247,42 +210,6 @@ fn transfer_insufficient_balance() { token.transfer(&user1, &user2, &1001); } -#[test] -#[should_panic(expected = "can't receive when deauthorized")] -fn transfer_receive_deauthorized() { - let e = Env::default(); - e.mock_all_auths(); - - let admin = Address::random(&e); - let user1 = Address::random(&e); - let user2 = Address::random(&e); - let token = create_token(&e, &admin); - - token.mint(&user1, &1000); - assert_eq!(token.balance(&user1), 1000); - - token.set_authorized(&user2, &false); - token.transfer(&user1, &user2, &1); -} - -#[test] -#[should_panic(expected = "can't spend when deauthorized")] -fn transfer_spend_deauthorized() { - let e = Env::default(); - e.mock_all_auths(); - - let admin = Address::random(&e); - let user1 = Address::random(&e); - let user2 = Address::random(&e); - let token = create_token(&e, &admin); - - token.mint(&user1, &1000); - assert_eq!(token.balance(&user1), 1000); - - token.set_authorized(&user1, &false); - token.transfer(&user1, &user2, &1); -} - #[test] #[should_panic(expected = "insufficient allowance")] fn transfer_from_insufficient_allowance() { diff --git a/contracts/crowdfund/src/test.rs b/contracts/crowdfund/src/test.rs index 6a48e6c..1234da4 100644 --- a/contracts/crowdfund/src/test.rs +++ b/contracts/crowdfund/src/test.rs @@ -40,11 +40,11 @@ struct Setup<'a> { fn create_token_contract<'a>( e: &Env, admin: &Address, -) -> (token::Client<'a>, token::AdminClient<'a>) { +) -> (token::Client<'a>, token::StellarAssetClient<'a>) { let contract_address = e.register_stellar_asset_contract(admin.clone()); ( token::Client::new(e, &contract_address), - token::AdminClient::new(e, &contract_address), + token::StellarAssetClient::new(e, &contract_address), ) } diff --git a/hooks/useSubscription.ts b/hooks/useSubscription.ts index 457515b..67d563d 100644 --- a/hooks/useSubscription.ts +++ b/hooks/useSubscription.ts @@ -1,19 +1,10 @@ import * as React from 'react' +import { server } from '../shared/contracts' import * as SorobanClient from 'soroban-client' let xdr = SorobanClient.xdr -interface GeneratedLibrary { - Server: SorobanClient.Server - CONTRACT_ID_HEX: string -} - -// TODO: update js-soroban-client to include latestLedger -interface GetEventsWithLatestLedger extends SorobanClient.SorobanRpc.GetEventsResponse { - latestLedger?: string; -} - /** - * Concatenated `${CONTRACT_ID_HEX}:${topic}` + * Concatenated `${contractId}:${topic}` */ type PagingKey = string @@ -33,12 +24,12 @@ const paging: Record void, pollInterval = 5000 ) { - const id = `${library.CONTRACT_ID_HEX}:${topic}` + const id = `${contractId}:${topic}` paging[id] = paging[id] || {} React.useEffect(() => { @@ -48,18 +39,18 @@ export function useSubscription( async function pollEvents(): Promise { try { if (!paging[id].lastLedgerStart) { - let latestLedgerState = await library.Server.getLatestLedger(); + let latestLedgerState = await server.getLatestLedger(); paging[id].lastLedgerStart = latestLedgerState.sequence } - let response = await library.Server.getEvents({ + let response = await server.getEvents({ startLedger: !paging[id].pagingToken ? paging[id].lastLedgerStart : undefined, cursor: paging[id].pagingToken, filters: [ { - contractIds: [library.CONTRACT_ID_HEX], + contractIds: [contractId], topics: [[ xdr.ScVal.scvSymbol(topic).toXDR("base64") ]], @@ -67,7 +58,7 @@ export function useSubscription( } ], limit: 10 - }) as GetEventsWithLatestLedger; + }); paging[id].pagingToken = undefined; if (response.latestLedger) { @@ -97,5 +88,5 @@ export function useSubscription( if (timeoutId != null) clearTimeout(timeoutId) stop = true } - }, [library, topic, onEvent, id, pollInterval]) + }, [contractId, topic, onEvent, id, pollInterval]) } diff --git a/initialize.sh b/initialize.sh index a2536d4..a81529c 100755 --- a/initialize.sh +++ b/initialize.sh @@ -67,6 +67,7 @@ mkdir -p .soroban-example-dapp echo $NETWORK > ./.soroban-example-dapp/network echo $SOROBAN_RPC_URL > ./.soroban-example-dapp/rpc-url echo "$SOROBAN_NETWORK_PASSPHRASE" > ./.soroban-example-dapp/passphrase +echo "{ \"network\": \"$NETWORK\", \"rpcUrl\": \"$SOROBAN_RPC_URL\", \"networkPassphrase\": \"$SOROBAN_NETWORK_PASSPHRASE\" }" > ./shared/config.json if !(soroban config identity ls | grep token-admin 2>&1 >/dev/null); then echo Create the token-admin identity diff --git a/package-lock.json b/package-lock.json index abab1d2..ed1ea14 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,16 +11,16 @@ "dependencies": { "@radix-ui/react-dialog": "1.0.2", "@stellar/freighter-api": "^1.5.1", - "abundance-token": "file:./.soroban-example-dapp/abundance-client/abundance-token", + "abundance-token": "file:./.soroban-example-dapp/abundance-token", "axios": "^0.27.2", "bigint-conversion": "^2.4.1", - "crowdfund-contract": "file:./.soroban-example-dapp/crowdfund-client/crowdfund-contract", + "crowdfund-contract": "file:./.soroban-example-dapp/crowdfund-contract", "humanize-duration": "^3.27.3", "moment": "^2.29.4", "next": "^13.4.4", "react": "^18.2.0", "react-dom": "^18.2.0", - "soroban-client": "0.9.2" + "soroban-client": "1.0.0-beta.2" }, "devDependencies": { "@types/humanize-duration": "^3.27.1", @@ -39,6 +39,7 @@ ".soroban-example-dapp/abundance-client": { "name": "abundance-token", "version": "0.0.0", + "extraneous": true, "dependencies": { "@stellar/freighter-api": "1.5.0", "bigint-conversion": "2.4.1", @@ -51,6 +52,7 @@ }, ".soroban-example-dapp/abundance-client/abundance-token": { "version": "0.0.0", + "extraneous": true, "dependencies": { "@stellar/freighter-api": "1.5.1", "buffer": "6.0.3", @@ -60,53 +62,23 @@ "typescript": "5.1.6" } }, - ".soroban-example-dapp/abundance-client/abundance-token/node_modules/@stellar/freighter-api": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@stellar/freighter-api/-/freighter-api-1.5.1.tgz", - "integrity": "sha512-WEnKEqd+xVLnOq6bJv+fLXod8JQyPjzpOKTpH4g7tG9MM1fmXzD3y2SXJlpCIw8kVqtiC4ynWOlSWX+TKO7KiQ==" - }, - ".soroban-example-dapp/abundance-client/abundance-token/node_modules/js-xdr": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/js-xdr/-/js-xdr-3.0.0.tgz", - "integrity": "sha512-tSt6UKJ2L7t+yaQURGkHo9kop9qnVbChTlCu62zNiDbDZQoZb/YjUj2iFJ3lgelhfg9p5bhO2o/QX+g36TPsSQ==" - }, - ".soroban-example-dapp/abundance-client/abundance-token/node_modules/soroban-client": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/soroban-client/-/soroban-client-0.9.2.tgz", - "integrity": "sha512-PPQLvAQTF/y56ev9V9wdMze/K49u1Cj6F9rkiUlRy++wCpSAVjiRYG+duolYvjkzUFPon56xlgAc7tuP4EolWA==", - "dependencies": { - "axios": "^1.4.0", - "bignumber.js": "^9.1.1", - "buffer": "^6.0.3", - "detect-node": "^2.0.4", - "es6-promise": "^4.2.4", - "eventsource": "^2.0.2", - "lodash": "^4.17.21", - "randombytes": "^2.1.0", - "stellar-base": "10.0.0-soroban.4", - "toml": "^3.0.0", - "urijs": "^1.19.1" - } - }, - ".soroban-example-dapp/abundance-client/abundance-token/node_modules/stellar-base": { - "version": "10.0.0-soroban.4", - "resolved": "https://registry.npmjs.org/stellar-base/-/stellar-base-10.0.0-soroban.4.tgz", - "integrity": "sha512-Afl2Mlh+aXokIHhy2x67Df5ofbss83oAOHV7pHLI0fsPlxAgs7YtbClzkNxvpnXyxQI77PMIWFJbT17Y3dR/+A==", + ".soroban-example-dapp/abundance-token": { + "version": "0.0.0", "dependencies": { - "base32.js": "^0.1.0", - "bignumber.js": "^9.1.1", - "buffer": "^6.0.3", - "crc": "^4.3.2", - "crypto-browserify": "^3.12.0", - "js-xdr": "^3.0.0", - "sha.js": "^2.3.6", - "tweetnacl": "^1.0.3" + "@stellar/freighter-api": "1.5.1", + "buffer": "6.0.3", + "soroban-client": "1.0.0-beta.2" }, - "optionalDependencies": { - "sodium-native": "^4.0.1" + "devDependencies": { + "typescript": "5.1.6" } }, - ".soroban-example-dapp/abundance-client/abundance-token/node_modules/typescript": { + ".soroban-example-dapp/abundance-token/node_modules/@stellar/freighter-api": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@stellar/freighter-api/-/freighter-api-1.5.1.tgz", + "integrity": "sha512-WEnKEqd+xVLnOq6bJv+fLXod8JQyPjzpOKTpH4g7tG9MM1fmXzD3y2SXJlpCIw8kVqtiC4ynWOlSWX+TKO7KiQ==" + }, + ".soroban-example-dapp/abundance-token/node_modules/typescript": { "version": "5.1.6", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", @@ -119,19 +91,10 @@ "node": ">=14.17" } }, - ".soroban-example-dapp/abundance-client/node_modules/axios": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz", - "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==", - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, ".soroban-example-dapp/crowdfund-client": { "name": "crowdfund-contract", "version": "0.0.0", + "extraneous": true, "dependencies": { "@stellar/freighter-api": "1.5.0", "bigint-conversion": "2.4.1", @@ -144,6 +107,7 @@ }, ".soroban-example-dapp/crowdfund-client/crowdfund-contract": { "version": "0.0.0", + "extraneous": true, "dependencies": { "@stellar/freighter-api": "1.5.1", "buffer": "6.0.3", @@ -153,53 +117,23 @@ "typescript": "5.1.6" } }, - ".soroban-example-dapp/crowdfund-client/crowdfund-contract/node_modules/@stellar/freighter-api": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@stellar/freighter-api/-/freighter-api-1.5.1.tgz", - "integrity": "sha512-WEnKEqd+xVLnOq6bJv+fLXod8JQyPjzpOKTpH4g7tG9MM1fmXzD3y2SXJlpCIw8kVqtiC4ynWOlSWX+TKO7KiQ==" - }, - ".soroban-example-dapp/crowdfund-client/crowdfund-contract/node_modules/js-xdr": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/js-xdr/-/js-xdr-3.0.0.tgz", - "integrity": "sha512-tSt6UKJ2L7t+yaQURGkHo9kop9qnVbChTlCu62zNiDbDZQoZb/YjUj2iFJ3lgelhfg9p5bhO2o/QX+g36TPsSQ==" - }, - ".soroban-example-dapp/crowdfund-client/crowdfund-contract/node_modules/soroban-client": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/soroban-client/-/soroban-client-0.9.2.tgz", - "integrity": "sha512-PPQLvAQTF/y56ev9V9wdMze/K49u1Cj6F9rkiUlRy++wCpSAVjiRYG+duolYvjkzUFPon56xlgAc7tuP4EolWA==", - "dependencies": { - "axios": "^1.4.0", - "bignumber.js": "^9.1.1", - "buffer": "^6.0.3", - "detect-node": "^2.0.4", - "es6-promise": "^4.2.4", - "eventsource": "^2.0.2", - "lodash": "^4.17.21", - "randombytes": "^2.1.0", - "stellar-base": "10.0.0-soroban.4", - "toml": "^3.0.0", - "urijs": "^1.19.1" - } - }, - ".soroban-example-dapp/crowdfund-client/crowdfund-contract/node_modules/stellar-base": { - "version": "10.0.0-soroban.4", - "resolved": "https://registry.npmjs.org/stellar-base/-/stellar-base-10.0.0-soroban.4.tgz", - "integrity": "sha512-Afl2Mlh+aXokIHhy2x67Df5ofbss83oAOHV7pHLI0fsPlxAgs7YtbClzkNxvpnXyxQI77PMIWFJbT17Y3dR/+A==", + ".soroban-example-dapp/crowdfund-contract": { + "version": "0.0.0", "dependencies": { - "base32.js": "^0.1.0", - "bignumber.js": "^9.1.1", - "buffer": "^6.0.3", - "crc": "^4.3.2", - "crypto-browserify": "^3.12.0", - "js-xdr": "^3.0.0", - "sha.js": "^2.3.6", - "tweetnacl": "^1.0.3" + "@stellar/freighter-api": "1.5.1", + "buffer": "6.0.3", + "soroban-client": "1.0.0-beta.2" }, - "optionalDependencies": { - "sodium-native": "^4.0.1" + "devDependencies": { + "typescript": "5.1.6" } }, - ".soroban-example-dapp/crowdfund-client/crowdfund-contract/node_modules/typescript": { + ".soroban-example-dapp/crowdfund-contract/node_modules/@stellar/freighter-api": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@stellar/freighter-api/-/freighter-api-1.5.1.tgz", + "integrity": "sha512-WEnKEqd+xVLnOq6bJv+fLXod8JQyPjzpOKTpH4g7tG9MM1fmXzD3y2SXJlpCIw8kVqtiC4ynWOlSWX+TKO7KiQ==" + }, + ".soroban-example-dapp/crowdfund-contract/node_modules/typescript": { "version": "5.1.6", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", @@ -212,16 +146,6 @@ "node": ">=14.17" } }, - ".soroban-example-dapp/crowdfund-client/node_modules/axios": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz", - "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==", - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, "node_modules/@aashutoshrathi/word-wrap": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", @@ -921,7 +845,7 @@ } }, "node_modules/abundance-token": { - "resolved": ".soroban-example-dapp/abundance-client/abundance-token", + "resolved": ".soroban-example-dapp/abundance-token", "link": true }, "node_modules/acorn": { @@ -1140,22 +1064,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/asn1.js": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", - "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", - "dependencies": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "safer-buffer": "^2.1.0" - } - }, - "node_modules/asn1.js/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, "node_modules/ast-types-flow": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz", @@ -1257,18 +1165,13 @@ } }, "node_modules/bignumber.js": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", - "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==", + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", + "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", "engines": { "node": "*" } }, - "node_modules/bn.js": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", - "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" - }, "node_modules/bplist-parser": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", @@ -1303,70 +1206,6 @@ "node": ">=8" } }, - "node_modules/brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" - }, - "node_modules/browserify-aes": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", - "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", - "dependencies": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/browserify-cipher": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", - "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", - "dependencies": { - "browserify-aes": "^1.0.4", - "browserify-des": "^1.0.0", - "evp_bytestokey": "^1.0.0" - } - }, - "node_modules/browserify-des": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", - "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", - "dependencies": { - "cipher-base": "^1.0.1", - "des.js": "^1.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "node_modules/browserify-rsa": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz", - "integrity": "sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==", - "dependencies": { - "bn.js": "^5.0.0", - "randombytes": "^2.0.1" - } - }, - "node_modules/browserify-sign": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", - "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", - "dependencies": { - "bn.js": "^5.1.1", - "browserify-rsa": "^4.0.1", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "elliptic": "^6.5.3", - "inherits": "^2.0.4", - "parse-asn1": "^5.1.5", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - } - }, "node_modules/buffer": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", @@ -1390,11 +1229,6 @@ "ieee754": "^1.2.1" } }, - "node_modules/buffer-xor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==" - }, "node_modules/bundle-name": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz", @@ -1478,15 +1312,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, "node_modules/client-only": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", @@ -1527,61 +1352,6 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, - "node_modules/crc": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/crc/-/crc-4.3.2.tgz", - "integrity": "sha512-uGDHf4KLLh2zsHa8D8hIQ1H/HtFQhyHrc0uhHBcoKGol/Xnb+MPYfUMw7cvON6ze/GUESTudKayDcJC5HnJv1A==", - "engines": { - "node": ">=12" - }, - "peerDependencies": { - "buffer": ">=6.0.3" - }, - "peerDependenciesMeta": { - "buffer": { - "optional": true - } - } - }, - "node_modules/create-ecdh": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", - "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", - "dependencies": { - "bn.js": "^4.1.0", - "elliptic": "^6.5.3" - } - }, - "node_modules/create-ecdh/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, - "node_modules/create-hash": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", - "dependencies": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" - } - }, - "node_modules/create-hmac": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "dependencies": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -1597,30 +1367,9 @@ } }, "node_modules/crowdfund-contract": { - "resolved": ".soroban-example-dapp/crowdfund-client/crowdfund-contract", + "resolved": ".soroban-example-dapp/crowdfund-contract", "link": true }, - "node_modules/crypto-browserify": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", - "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", - "dependencies": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" - }, - "engines": { - "node": "*" - } - }, "node_modules/csstype": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", @@ -1735,40 +1484,11 @@ "node": ">=6" } }, - "node_modules/des.js": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.1.0.tgz", - "integrity": "sha512-r17GxjhUCjSRy8aiJpr8/UadFIzMzJGexI3Nmz4ADi9LYSFx4gTBp80+NaX/YsXWWLhpZ7v/v/ubEc/bCNfKwg==", - "dependencies": { - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "node_modules/detect-node": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", - "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==" - }, "node_modules/detect-node-es": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz", "integrity": "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==" }, - "node_modules/diffie-hellman": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", - "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", - "dependencies": { - "bn.js": "^4.1.0", - "miller-rabin": "^4.0.0", - "randombytes": "^2.0.0" - } - }, - "node_modules/diffie-hellman/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -1793,25 +1513,6 @@ "node": ">=6.0.0" } }, - "node_modules/elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "dependencies": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "node_modules/elliptic/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, "node_modules/emoji-regex": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", @@ -1924,11 +1625,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" - }, "node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -2391,23 +2087,6 @@ "node": ">=0.10.0" } }, - "node_modules/eventsource": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", - "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", - "dependencies": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" - } - }, "node_modules/execa": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", @@ -2879,38 +2558,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/hash-base": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", - "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", - "dependencies": { - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "dependencies": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "node_modules/hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", - "dependencies": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, "node_modules/human-signals": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", @@ -3435,11 +3082,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -3469,16 +3111,6 @@ "node": ">=10" } }, - "node_modules/md5.js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", - "dependencies": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -3507,23 +3139,6 @@ "node": ">=8.6" } }, - "node_modules/miller-rabin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", - "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", - "dependencies": { - "bn.js": "^4.0.0", - "brorand": "^1.0.1" - }, - "bin": { - "miller-rabin": "bin/miller-rabin" - } - }, - "node_modules/miller-rabin/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -3555,16 +3170,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "node_modules/minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" - }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -3670,9 +3275,9 @@ } }, "node_modules/node-gyp-build": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", - "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.1.tgz", + "integrity": "sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ==", "optional": true, "bin": { "node-gyp-build": "bin.js", @@ -3926,18 +3531,6 @@ "node": ">=6" } }, - "node_modules/parse-asn1": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", - "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", - "dependencies": { - "asn1.js": "^5.2.0", - "browserify-aes": "^1.0.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3", - "safe-buffer": "^5.1.1" - } - }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -3980,21 +3573,6 @@ "node": ">=8" } }, - "node_modules/pbkdf2": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", - "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", - "dependencies": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - }, - "engines": { - "node": ">=0.12" - } - }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -4060,24 +3638,6 @@ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, - "node_modules/public-encrypt": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", - "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", - "dependencies": { - "bn.js": "^4.1.0", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "node_modules/public-encrypt/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, "node_modules/punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", @@ -4107,23 +3667,6 @@ } ] }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, - "node_modules/randomfill": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", - "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", - "dependencies": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" - } - }, "node_modules/react": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", @@ -4220,19 +3763,6 @@ } } }, - "node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/regenerator-runtime": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz", @@ -4315,15 +3845,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "dependencies": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, "node_modules/run-applescript": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz", @@ -4502,11 +4023,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, "node_modules/scheduler": { "version": "0.23.0", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", @@ -4603,20 +4119,14 @@ } }, "node_modules/soroban-client": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/soroban-client/-/soroban-client-0.9.2.tgz", - "integrity": "sha512-PPQLvAQTF/y56ev9V9wdMze/K49u1Cj6F9rkiUlRy++wCpSAVjiRYG+duolYvjkzUFPon56xlgAc7tuP4EolWA==", + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/soroban-client/-/soroban-client-1.0.0-beta.2.tgz", + "integrity": "sha512-v5h3yvef7HkUD3H26w33NUEgRXcPiOSDWEsVzMloaxsprs3N002tXJHvFF+Uw1eYt50Uk6bvqBgvkLwX10VENw==", "dependencies": { "axios": "^1.4.0", "bignumber.js": "^9.1.1", "buffer": "^6.0.3", - "detect-node": "^2.0.4", - "es6-promise": "^4.2.4", - "eventsource": "^2.0.2", - "lodash": "^4.17.21", - "randombytes": "^2.1.0", - "stellar-base": "10.0.0-soroban.4", - "toml": "^3.0.0", + "stellar-base": "v10.0.0-beta.1", "urijs": "^1.19.1" } }, @@ -4630,24 +4140,14 @@ "proxy-from-env": "^1.1.0" } }, - "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/stellar-base": { - "version": "10.0.0-soroban.4", - "resolved": "https://registry.npmjs.org/stellar-base/-/stellar-base-10.0.0-soroban.4.tgz", - "integrity": "sha512-Afl2Mlh+aXokIHhy2x67Df5ofbss83oAOHV7pHLI0fsPlxAgs7YtbClzkNxvpnXyxQI77PMIWFJbT17Y3dR/+A==", + "node_modules/soroban-client/node_modules/stellar-base": { + "version": "10.0.0-beta.1", + "resolved": "https://registry.npmjs.org/stellar-base/-/stellar-base-10.0.0-beta.1.tgz", + "integrity": "sha512-zXC5AsbUsLi57JruyeIMv23s3iUxq/P2ZFrSJ+FerLIZjSAjY8EDs4zwY4LCuu7swUu46Lm8GK6sqxUZCPekHw==", "dependencies": { "base32.js": "^0.1.0", - "bignumber.js": "^9.1.1", + "bignumber.js": "^9.1.2", "buffer": "^6.0.3", - "crc": "^4.3.2", - "crypto-browserify": "^3.12.0", "js-xdr": "^3.0.0", "sha.js": "^2.3.6", "tweetnacl": "^1.0.3" @@ -4656,6 +4156,14 @@ "sodium-native": "^4.0.1" } }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/streamsearch": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", @@ -4664,14 +4172,6 @@ "node": ">=10.0.0" } }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, "node_modules/string.prototype.matchall": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.8.tgz", @@ -4882,11 +4382,6 @@ "node": ">=8.0" } }, - "node_modules/toml": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz", - "integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==" - }, "node_modules/ts-api-utils": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.1.tgz", @@ -5102,11 +4597,6 @@ } } }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" - }, "node_modules/watchpack": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", diff --git a/package.json b/package.json index 2c061ab..dfa51fb 100644 --- a/package.json +++ b/package.json @@ -10,21 +10,25 @@ "setup": "./initialize.sh ${NETWORK:-futurenet} && npm install", "clean": "rm -rf .next .soroban .soroban-example-dapp", "reset": "npm run clean && npm run setup", - "preinstall": "cargo build --target wasm32-unknown-unknown --release && ./target/bin/soroban contract bindings typescript --wasm ./target/wasm32-unknown-unknown/release/soroban_crowdfund_contract.wasm --id $(cat ./.soroban-example-dapp/crowdfund_id) --output-dir ./.soroban-example-dapp/crowdfund-client --network $(cat ./.soroban-example-dapp/network) --contract-name crowdfund-contract && ./target/bin/soroban contract bindings typescript --wasm ./target/wasm32-unknown-unknown/release/abundance_token.wasm --id $(cat ./.soroban-example-dapp/abundance_token_id) --output-dir ./.soroban-example-dapp/abundance-client --network $(cat ./.soroban-example-dapp/network) --contract-name abundance-token" + "build:contracts": "./target/bin/soroban contract build", + "bindings:crowdfund": "./target/bin/soroban contract bindings typescript --wasm ./target/wasm32-unknown-unknown/release/soroban_crowdfund_contract.wasm --id $(cat ./.soroban-example-dapp/crowdfund_id) --output-dir ./.soroban-example-dapp/crowdfund-contract --network $(cat ./.soroban-example-dapp/network) --overwrite", + "bindings:abundance": "./target/bin/soroban contract bindings typescript --wasm ./target/wasm32-unknown-unknown/release/abundance_token.wasm --id $(cat ./.soroban-example-dapp/abundance_token_id) --output-dir ./.soroban-example-dapp/abundance-token --network $(cat ./.soroban-example-dapp/network) --overwrite", + "bindings": "npm run bindings:crowdfund && npm run bindings:abundance", + "preinstall": "npm run build:contracts && npm run bindings" }, "dependencies": { "@radix-ui/react-dialog": "1.0.2", "@stellar/freighter-api": "^1.5.1", - "abundance-token": "file:./.soroban-example-dapp/abundance-client/abundance-token", + "abundance-token": "file:./.soroban-example-dapp/abundance-token", "axios": "^0.27.2", "bigint-conversion": "^2.4.1", - "crowdfund-contract": "file:./.soroban-example-dapp/crowdfund-client/crowdfund-contract", + "crowdfund-contract": "file:./.soroban-example-dapp/crowdfund-contract", "humanize-duration": "^3.27.3", "moment": "^2.29.4", "next": "^13.4.4", "react": "^18.2.0", "react-dom": "^18.2.0", - "soroban-client": "0.9.2" + "soroban-client": "1.0.0-beta.2" }, "devDependencies": { "@types/humanize-duration": "^3.27.1", diff --git a/shared/contracts.ts b/shared/contracts.ts new file mode 100644 index 0000000..e225f4e --- /dev/null +++ b/shared/contracts.ts @@ -0,0 +1,17 @@ +import * as Abundance from 'abundance-token' +import * as Crowdfund from 'crowdfund-contract' +import { Server } from 'soroban-client' +import config from './config.json' +const { network, rpcUrl } = config + +export const abundance = new Abundance.Contract({ + rpcUrl, + ...Abundance.networks[network as keyof typeof Abundance.networks], +}) + +export const crowdfund = new Crowdfund.Contract({ + rpcUrl, + ...Crowdfund.networks[network as keyof typeof Crowdfund.networks], +}) + +export const server = new Server(rpcUrl) diff --git a/shared/utils.tsx b/shared/utils.ts similarity index 100% rename from shared/utils.tsx rename to shared/utils.ts