add ts basic example, cleanup release script, update idl

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-03-23 15:39:11 +01:00
parent 4459369c23
commit 4f7eb1b38f
3 changed files with 3164 additions and 308 deletions

View File

@ -2,30 +2,33 @@
set -euo pipefail
if [[ -z "${PROVIDER_WALLET}" ]]; then
echo "Please provide path to a provider wallet keypair."
exit -1
fi
# build program, TODO try removing --skip-lint
anchor build --skip-lint
if [[ -z "${VERSION_MANUALLY_BUMPED}" ]]; then
echo "Please bump versions in package.json and in cargo.toml."
exit -1
fi
# build program
anchor build
# update on chain program and IDL, atm used for testing/developing
anchor deploy --provider.cluster devnet --provider.wallet ${PROVIDER_WALLET}
anchor idl upgrade --provider.cluster devnet --provider.wallet ${PROVIDER_WALLET}\
--filepath target/idl/voter_stake_registry.json Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS
# update types in npm package and publish the npm package
cp cp ./target/types/mango_v4.ts ./ts/mango_v4.ts
# update types in ts client package
cp -v ./target/types/mango_v4.ts ./ts/mango_v4.ts
yarn clean && yarn build && cp package.json ./dist/
# yarn publish dist # TODO: should this package replace mango-v3-client?
echo
echo Remember to commit and push the version update as well as the changes
echo to ts/mango_v4.tx.
echo
# if [[ -z "${PROVIDER_WALLET}" ]]; then
# echo "Please provide path to a provider wallet keypair."
# exit -1
# fi
# if [[ -z "${VERSION_MANUALLY_BUMPED}" ]]; then
# echo "Please bump versions in package.json and in cargo.toml."
# exit -1
# fi
# # update on chain program and IDL, atm used for testing/developing
# anchor deploy --provider.cluster devnet --provider.wallet ${PROVIDER_WALLET}
# anchor idl upgrade --provider.cluster devnet --provider.wallet ${PROVIDER_WALLET}\
# --filepath target/idl/voter_stake_registry.json Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS
# # publish the npm package
# yarn publish dist
# echo
# echo Remember to commit and push the version update as well as the changes
# echo to ts/mango_v4.tx.
# echo

15
ts/example.ts Normal file
View File

@ -0,0 +1,15 @@
import { Provider, Wallet } from '@project-serum/anchor';
import { Connection, Keypair } from '@solana/web3.js';
import { MangoClient } from './client';
async function main() {
const options = Provider.defaultOptions();
const connection = new Connection('https://api.devnet.solana.com', options);
const wallet = new Wallet(Keypair.generate());
const provider = new Provider(connection, wallet, options);
const client = await MangoClient.connect(provider, true);
// client.program.rpc.createAccount ...
}
main();

File diff suppressed because it is too large Load Diff