2022-02-23 02:09:17 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2022-04-02 01:09:21 -07:00
|
|
|
set -e pipefail
|
2022-02-23 02:09:17 -08:00
|
|
|
|
2022-03-31 12:03:45 -07:00
|
|
|
WALLET_WITH_FUNDS=~/.config/solana/mango-devnet.json
|
|
|
|
PROGRAM_ID=m43thNJ58XCjL798ZSq6JGAG1BnWskhdq5or6kcnfsD
|
|
|
|
|
|
|
|
# TODO fix need for --skip-lint
|
|
|
|
# build program,
|
2022-07-26 23:52:41 -07:00
|
|
|
cargo run -p anchor-cli -- build --skip-lint
|
2022-03-31 12:03:45 -07:00
|
|
|
|
|
|
|
# patch types, which we want in rust, but anchor client doesn't support
|
2022-03-31 04:30:05 -07:00
|
|
|
./idl-fixup.sh
|
2022-03-23 07:39:11 -07:00
|
|
|
|
|
|
|
# update types in ts client package
|
2022-04-12 23:48:35 -07:00
|
|
|
cp -v ./target/types/mango_v4.ts ./ts/client/src/mango_v4.ts
|
2022-03-23 07:39:11 -07:00
|
|
|
|
2022-07-06 00:56:14 -07:00
|
|
|
(cd ./ts/client && yarn tsc)
|
2022-05-18 08:16:14 -07:00
|
|
|
|
2022-04-01 23:59:07 -07:00
|
|
|
if [[ -z "${NO_DEPLOY}" ]]; then
|
|
|
|
# publish program
|
|
|
|
solana --url https://mango.devnet.rpcpool.com program deploy --program-id $PROGRAM_ID \
|
2022-07-05 10:31:47 -07:00
|
|
|
-k $WALLET_WITH_FUNDS target/deploy/mango_v4.so --skip-fee-check
|
2022-04-01 23:59:07 -07:00
|
|
|
|
2022-06-23 07:41:24 -07:00
|
|
|
# # publish idl
|
2022-07-26 23:52:41 -07:00
|
|
|
cargo run -p anchor-cli -- idl upgrade --provider.cluster https://mango.devnet.rpcpool.com --provider.wallet $WALLET_WITH_FUNDS \
|
2022-07-25 07:07:53 -07:00
|
|
|
--filepath target/idl/mango_v4.json $PROGRAM_ID
|
2022-04-01 23:59:07 -07:00
|
|
|
else
|
|
|
|
echo "Skipping deployment..."
|
|
|
|
fi
|
2022-03-23 07:39:11 -07:00
|
|
|
|
|
|
|
|
2022-07-25 07:07:53 -07:00
|
|
|
# build npm package
|
|
|
|
(cd ./ts/client && tsc)
|