Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
a638240
Governance sdk get token owners (#482)
SebastianBor Jan 14, 2022
a3c4c01
Use connection for all api calls (#484)
SebastianBor Jan 14, 2022
718f3ed
Governance: use getProgramAccounts instead of fetch (#485)
SebastianBor Jan 14, 2022
75402e9
Governace sdk tests (#486)
SebastianBor Jan 14, 2022
91f0109
Governnace sdk tests (#487)
SebastianBor Jan 14, 2022
44dfff5
Governance: sdk tests (#488)
SebastianBor Jan 14, 2022
dd8044b
Governance SDK: Remove moment (#490)
johnrees Jan 15, 2022
281aeb3
Voter weight plugin config (#481)
abrzezinski94 Jan 18, 2022
c5f7cd1
Governance SDK: Create proposal test (#492)
SebastianBor Jan 20, 2022
84c4f1e
Governance: remove unused npm dependencies (#495)
johnrees Jan 21, 2022
a7ffaf8
Governance SDK: Increase default testTimeout for jest (#494)
johnrees Jan 21, 2022
e99fc57
chore(governance-sdk): governance errors code tweaks (#493)
johnrees Jan 21, 2022
d7ec7b3
Governance Chat Sdk: v2 (#498)
SebastianBor Jan 22, 2022
870e7ff
Governance: fix BN import (#500)
SebastianBor Jan 24, 2022
cb02ac9
Governance: update withSetRealmAuthority to v2 (#501)
SebastianBor Jan 24, 2022
1abd4bc
Governance: Fix instruction option index (#503)
SebastianBor Jan 27, 2022
ac27cea
Governance: Make mint configurable and support >1 mints (#504)
SebastianBor Jan 27, 2022
2f2ceef
Governance Sdk: Update api to v2 (#506)
SebastianBor Feb 1, 2022
ecd6acd
chore: update governance-sdk version to 0.0.20
SebastianBor Feb 1, 2022
0546d83
Do not use parallel calls for fetching multiple account types (#507)
SebastianBor Feb 1, 2022
b0c77e9
chore: rename withExecuteInstruction to withExecuteTransaction
SebastianBor Feb 1, 2022
200983f
fix: chat message serialisation
SebastianBor Feb 2, 2022
6d01e18
Governance: Fix proposal coments (#508)
SebastianBor Feb 2, 2022
abb1c9a
Await for finalise (#509)
SebastianBor Feb 3, 2022
e588ced
Governance: Use correct index for next instruction (#510)
SebastianBor Feb 3, 2022
a436574
Add mint grant authority and index to form (#512)
SebastianBor Feb 4, 2022
5480bd0
Governance: Add query apis for proposals, governances and token owner…
SebastianBor Feb 4, 2022
b602859
Governance: Ignore simulation errors to detect spl-gov version (#515)
SebastianBor Feb 7, 2022
e0b26b4
Default grant authority to the proposal governance (#516)
SebastianBor Feb 8, 2022
4a246f1
Governance: Add proposal tipping point (#517)
SebastianBor Feb 9, 2022
c8d1298
Governance: Add set realm authority instruction (#518)
SebastianBor Feb 9, 2022
d59e345
Governance: Simulate multiple a whole proposal at once (#520)
mschneider Feb 18, 2022
a446b0e
Governance: Rename vsr set-registrar instruction to create-registrar …
ckamm Feb 21, 2022
1897259
disallow crawling - reduce traffic
justinschuldt Mar 4, 2022
1e87455
Merge pull request #523 from justinschuldt/patch-1
Mar 4, 2022
eca8ea4
Payer must be writable in instructions which create Accounts (#524)
emdoyle Mar 9, 2022
f2061fd
chore: bump @solana/spl-governance version
SebastianBor Mar 9, 2022
c0e78c8
feat: add tryGetRealmConfig (#529)
SebastianBor Mar 14, 2022
53b7b29
Governance SDK: Implement withSetGovernanceDelegate (#532)
SebastianBor Mar 21, 2022
7f090a5
chore: bump spl-gov-sdk version to 0.0.32
SebastianBor Mar 21, 2022
4090e39
Governance SDK: MaxVoterWeightRecord account and api (#533)
SebastianBor Mar 21, 2022
90a0eb2
Governance SDK: Add VoterWeightRecord account and api (#534)
SebastianBor Mar 22, 2022
cf8001c
Governance: Support councilVoteThreshold (spl-gov v3) (#542)
SebastianBor May 6, 2022
306d7a3
Governance spl gov v3 api (#548)
SebastianBor Aug 18, 2022
de304dd
chore: Fix GovernananceTokenKind name (#549)
SebastianBor Aug 18, 2022
daac6c5
Governance: Rename GovernanceTokenKind (#550)
SebastianBor Aug 19, 2022
b4d4903
fix: Rollback default version to V1 (#551)
SebastianBor Aug 19, 2022
854f49c
fix: Make vetoVoteWeight conditional to version >= V2
SebastianBor Aug 19, 2022
865df9a
Governance: Fix Proposal serialisation
SebastianBor Aug 19, 2022
2e5fc9e
Governance: Publish npm 0.3.6
SebastianBor Aug 19, 2022
c239366
chore: Add vote example
SebastianBor Aug 20, 2022
7ca73d6
Governance: Do not throw errors in tryGetRealmConfig
SebastianBor Aug 22, 2022
4177a79
feat: Update sdk to latest spl-gov V3 0.3.9 (#552)
SebastianBor Aug 23, 2022
b7ba289
fix: Realms-explorer spl-gov v3 defaults
SebastianBor Aug 23, 2022
f247150
Governance: Fix V1 Governance account creation (#553)
SebastianBor Aug 23, 2022
a58b959
Governance: Fix GovernanceConfig serialisation for V2 args
SebastianBor Aug 25, 2022
c44fc3b
Governance: Split instruction and account schemas (#554)
SebastianBor Aug 25, 2022
ab8be6d
Governance: Fix setupRealm test
SebastianBor Aug 25, 2022
19cf21e
feat: Support Absolute max voter weight source (#558)
SebastianBor Sep 21, 2022
dfe0a8c
fix: move reserved[3] to GovernanceConfig
SebastianBor Oct 6, 2022
1baaa1c
chore: Update version to 0.3.15
SebastianBor Oct 6, 2022
3bbb3cc
FIX: payer accounts not writable (#559)
sayantank Oct 19, 2022
11def6c
batch realm request + fix recentblockhash (#562)
abrzezinski94 Oct 30, 2022
2a53d6d
test infra fix (#563)
abrzezinski94 Oct 31, 2022
9f269c9
Governance: sdk v3 1 (#567)
SebastianBor Dec 12, 2022
b874111
Governance: Add ProposalDeposit api (#569)
SebastianBor Jan 2, 2023
2f054db
chore: Update spl-governance-sdk to 0.3.19
SebastianBor Jan 2, 2023
122d238
Governance: Add createRevokeGoverningTokens (#572)
SebastianBor Jan 16, 2023
e573b36
chore: Bump spl-gov-sdk version to 0.3.20
SebastianBor Jan 16, 2023
a17e122
Governance: Add withRefundProposalDeposit (#573)
SebastianBor Jan 30, 2023
5bf3c49
chore: bump spl-gov sdk version to 0.3.21
SebastianBor Jan 30, 2023
bddf486
Governance: Add governingTokenOwnerIsSigner (#574)
SebastianBor Jan 30, 2023
b596c58
chore: bump spl-gov sdk version to 0.3.22
SebastianBor Jan 30, 2023
5fd1bcf
Governance: simplify withDepositGoverningTokens (#575)
SebastianBor Jan 30, 2023
5698d36
chore: bump spl-gov sdk version to 0.3.23
SebastianBor Jan 30, 2023
7885a6c
Update withDepositGoverningTokens.ts (#576)
asktree Feb 1, 2023
fdd8728
chore: bump spl-gov sdk version to 0.3.24
SebastianBor Feb 1, 2023
6a698a0
feat: Add governingTokenOwnerIsSigner param (#577)
SebastianBor Feb 1, 2023
cb5b4e6
chore: bump spl-gov sdk version to 0.3.25
SebastianBor Feb 1, 2023
7144ac0
Governance: Add getGovernanceProgramVersion test (#580)
SebastianBor Mar 14, 2023
4cabfe6
Governance: Rename maxVotingTime to baseVotingTime (#581)
SebastianBor Mar 28, 2023
a4f4ddf
chore: bump spl-gov sdk verion to 0.3.26 (#582)
SebastianBor Mar 28, 2023
0560e7b
throw an error if writing governance config and baseVotingTime < 1hr …
asktree Apr 17, 2023
040b7c8
chore: Update spl-gov sdk version to 0.3.27 (#584)
SebastianBor Apr 17, 2023
16957c9
Governance: Fix VoteType enum (#590)
0xShuk Jul 19, 2023
6a23631
chore: bump version to 0.3.28 (#591)
SebastianBor Jul 19, 2023
c168fed
Update simulate function (#598)
0xShuk Aug 22, 2024
82fbb39
chore: bump version to 0.3.29
SebastianBor Aug 26, 2024
6505a16
Update README.md
SebastianBor Feb 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ yarn-debug.log*
yarn-error.log*
*.css
*.css.map

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"cSpell.words": [
"Addin",
"Blockhash",
"blockworks",
"Lamport",
"lamports",
"localnet",
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# oyster

This repo still exists in archived form, but the maintained version of `governance-sdk` package has now relocated to: https://github.com/Mythic-Project/oyster/tree/main/packages/governance-sdk

## Setup

Be sure to be running Node v12.16.2 and yarn version 1.22.10.
Expand Down
9 changes: 5 additions & 4 deletions packages/arweave-push/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@
"test": "mocha test/*.test.js --timeout=60000"
},
"devDependencies": {
"jest": "^27.4.7",
"mocha": "^8.0.0",
"proxyquire": "^2.1.0",
"sinon": "^10.0.0"
},
"dependencies": {
"@google-cloud/storage": "^5.0.0",
"@solana/web3.js": "^1.22.0",
"arweave": "1.10.13",
"busboy": "^0.3.0",
"coingecko-api": "1.0.10",
"escape-html": "^1.0.3",
"arweave": "1.10.13",
"@solana/web3.js": "^1.22.0",
"mime-types": "2.1.30",
"node-fetch": "2.6.1",
"coingecko-api": "1.0.10"
"node-fetch": "2.6.1"
}
}
5 changes: 3 additions & 2 deletions packages/bridge-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"@babel/preset-typescript": "^7.13.0",
"@oyster/common": "0.0.2",
"@solana/spl-token": "0.0.13",
"@solana/spl-token": "0.1.3",
"@solana/spl-token-swap": "0.1.0",
"@solana/web3.js": "^1.22.0",
"bignumber.js": "^9.0.1",
Expand Down Expand Up @@ -77,6 +77,7 @@
"@types/node": "^12.12.62",
"arweave-deploy": "^1.9.1",
"gh-pages": "^3.1.0",
"jest": "^27.4.7",
"prettier": "^2.1.2"
}
}
}
7 changes: 4 additions & 3 deletions packages/bridge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"@oyster/common": "0.0.2",
"@project-serum/serum": "^0.13.11",
"@react-three/drei": "^3.8.0",
"@solana/spl-token": "0.0.13",
"@solana/bridge-sdk": "0.0.1",
"@solana/spl-token": "0.1.3",
"@solana/spl-token-registry": "^0.2.0",
"@solana/spl-token-swap": "0.1.0",
"@solana/bridge-sdk": "0.0.1",
"@solana/web3.js": "^1.22.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
Expand Down Expand Up @@ -103,6 +103,7 @@
"@types/node": "^12.12.62",
"arweave-deploy": "^1.9.1",
"gh-pages": "^3.1.0",
"jest": "^27.4.7",
"npm-link-shared": "0.5.6",
"prettier": "^2.1.2",
"typechain": "^4.0.3"
Expand All @@ -115,4 +116,4 @@
"react": "16.13.1",
"react-dom": "16.13.1"
}
}
}
2 changes: 1 addition & 1 deletion packages/bridge/public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
Disallow: *
5 changes: 3 additions & 2 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"dependencies": {
"@project-serum/serum": "^0.13.11",
"@solana/spl-token": "0.0.13",
"@solana/spl-token": "0.1.3",
"@solana/spl-token-swap": "0.1.0",
"@solana/wallet-adapter-base": "^0.6.0",
"@solana/wallet-adapter-react": "^0.12.6",
Expand Down Expand Up @@ -61,6 +61,7 @@
"@types/node": "^12.12.62",
"arweave-deploy": "^1.9.1",
"gh-pages": "^3.1.0",
"jest": "^27.4.7",
"less": "4.1.1",
"less-watch-compiler": "v1.14.6",
"prettier": "^2.1.2"
Expand All @@ -76,4 +77,4 @@
"react": "16.13.1",
"react-dom": "16.13.1"
}
}
}
1 change: 1 addition & 0 deletions packages/common/src/contexts/accounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ function wrapNativeAccount(
pubkey: pubkey,
account,
info: {
address: pubkey,
mint: WRAPPED_SOL_MINT,
owner: pubkey,
amount: new u64(account.lamports),
Expand Down
25 changes: 12 additions & 13 deletions packages/common/src/contexts/connection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ interface ConnectionConfig {

const ConnectionContext = React.createContext<ConnectionConfig>({
endpoint: DEFAULT,
setEndpoint: () => {},
setEndpoint: () => { },
slippage: DEFAULT_SLIPPAGE,
setSlippage: (val: number) => {},
setSlippage: (val: number) => { },
connection: new Connection(DEFAULT, 'recent'),
sendConnection: new Connection(DEFAULT, 'recent'),
env: ENDPOINTS[0].name,
Expand Down Expand Up @@ -120,7 +120,7 @@ export function ConnectionProvider({ children = undefined as any }) {
.excludeByTag('nft')
.filterByChainId(
ENDPOINTS.find(end => end.endpoint === endpoint)?.ChainId ||
ChainId.MainnetBeta,
ChainId.MainnetBeta,
)
.getList();

Expand Down Expand Up @@ -153,7 +153,7 @@ export function ConnectionProvider({ children = undefined as any }) {
// is empty after opening its first time, preventing subsequent subscriptions from receiving responses.
// This is a hack to prevent the list from every getting empty
useEffect(() => {
const id = connection.onAccountChange(new Account().publicKey, () => {});
const id = connection.onAccountChange(new Account().publicKey, () => { });
return () => {
connection.removeAccountChangeListener(id);
};
Expand All @@ -169,7 +169,7 @@ export function ConnectionProvider({ children = undefined as any }) {
useEffect(() => {
const id = sendConnection.onAccountChange(
new Account().publicKey,
() => {},
() => { },
);
return () => {
sendConnection.removeAccountChangeListener(id);
Expand Down Expand Up @@ -270,7 +270,7 @@ export const sendTransactions = async (
signersSet: Account[][],
sequenceType: SequenceType = SequenceType.Parallel,
commitment: Commitment = 'singleGossip',
successCallback: (txid: string, ind: number) => void = (txid, ind) => {},
successCallback: (txid: string, ind: number) => void = (txid, ind) => { },
failCallback: (reason: string, ind: number) => boolean = (txid, ind) => false,
block?: BlockhashAndFeeCalculator,
): Promise<number> => {
Expand Down Expand Up @@ -382,7 +382,7 @@ export const sendTransaction = async (
try {
transaction = await wallet.signTransaction(transaction);
} catch (ex) {
throw new SignTransactionError(ex);
throw new SignTransactionError(JSON.stringify(ex));
}
}

Expand Down Expand Up @@ -415,11 +415,10 @@ export const sendTransaction = async (
console.error('getErrorForTransaction() error', ex);
}

if ('timeout' in confirmationStatus.err) {
if ('timeout' in (confirmationStatus.err as any)) {
notify({
message: `Transaction hasn't been confirmed within ${
DEFAULT_TIMEOUT / 1000
}s. Please check on Solana Explorer`,
message: `Transaction hasn't been confirmed within ${DEFAULT_TIMEOUT / 1000
}s. Please check on Solana Explorer`,
description: (
<>
<ExplorerLink
Expand Down Expand Up @@ -566,15 +565,15 @@ export async function sendSignedTransaction({

slot = confirmation?.slot || 0;
} catch (err) {
if (err.timeout) {
if ((err as any).timeout) {
throw new Error('Timed out awaiting confirmation on transaction');
}
let simulateResult: SimulatedTransactionResponse | null = null;
try {
simulateResult = (
await simulateTransaction(connection, signedTransaction, 'single')
).value;
} catch (e) {}
} catch (e) { }
if (simulateResult && simulateResult.err) {
if (simulateResult.logs) {
for (let i = simulateResult.logs.length - 1; i >= 0; --i) {
Expand Down
78 changes: 43 additions & 35 deletions packages/common/src/contexts/wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@solana/wallet-adapter-base';
import {
useWallet as useWalletBase,
WalletProvider as BaseWalletProvider
WalletProvider as BaseWalletProvider,
} from '@solana/wallet-adapter-react';
import {
getLedgerWallet,
Expand All @@ -22,10 +22,19 @@ import {
Wallet,
WalletName,
} from '@solana/wallet-adapter-wallets';
import { Button, Modal } from "antd";
import React, { createContext, FC, ReactNode, useCallback, useContext, useEffect, useMemo, useState } from 'react';
import { notify } from "../utils";
import { useConnectionConfig } from "./connection";
import { Button, Modal } from 'antd';
import React, {
createContext,
FC,
ReactNode,
useCallback,
useContext,
useEffect,
useMemo,
useState,
} from 'react';
import { notify } from '../utils';
import { useConnectionConfig } from './connection';

export interface WalletContextState extends WalletAdapterProps {
wallets: Wallet[];
Expand All @@ -43,20 +52,25 @@ export interface WalletContextState extends WalletAdapterProps {
signMessage: MessageSignerWalletAdapterProps['signMessage'] | undefined;
}

export function useWallet (): WalletContextState {
export function useWallet(): WalletContextState {
return useWalletBase() as WalletContextState;
}

export { SignerWalletAdapter, WalletNotConnectedError };

export type WalletSigner = Pick<SignerWalletAdapter, 'publicKey' | 'signTransaction' | 'signAllTransactions'>;
export type WalletSigner = Pick<
SignerWalletAdapter,
'publicKey' | 'signTransaction' | 'signAllTransactions'
>;

export interface WalletModalContextState {
visible: boolean;
setVisible: (open: boolean) => void;
}

export const WalletModalContext = createContext<WalletModalContextState>({} as WalletModalContextState);
export const WalletModalContext = createContext<WalletModalContextState>(
{} as WalletModalContextState,
);

export function useWalletModal(): WalletModalContextState {
return useContext(WalletModalContext);
Expand All @@ -76,20 +90,23 @@ export const WalletModal = () => {
onCancel={close}
width={400}
>
{wallets.map((wallet) => {
{wallets.map(wallet => {
return (
<Button
key={wallet.name}
size="large"
type={wallet === selected ? 'primary' : 'ghost'}
onClick={() => { select(wallet.name); close(); }}
onClick={() => {
select(wallet.name);
close();
}}
icon={
<img
alt={`${wallet.name}`}
width={20}
height={20}
src={wallet.icon}
style={{marginRight: 8}}
style={{ marginRight: 8 }}
/>
}
style={{
Expand Down Expand Up @@ -117,13 +134,10 @@ export const WalletModalProvider = ({ children }: { children: ReactNode }) => {
const base58 = publicKey.toBase58();
const keyToDisplay =
base58.length > 20
? `${base58.substring(
0,
7,
)}.....${base58.substring(
base58.length - 7,
base58.length,
)}`
? `${base58.substring(0, 7)}.....${base58.substring(
base58.length - 7,
base58.length,
)}`
: base58;

notify({
Expand Down Expand Up @@ -151,22 +165,22 @@ export const WalletModalProvider = ({ children }: { children: ReactNode }) => {
}}
>
{children}
<WalletModal/>
<WalletModal />
</WalletModalContext.Provider>
);
};

export const WalletProvider = ({ children }: {children: ReactNode }) => {
export const WalletProvider = ({ children }: { children: ReactNode }) => {
const { env } = useConnectionConfig();

const network = useMemo(() => {
switch (env) {
case "mainnet-beta":
case 'mainnet-beta':
return WalletAdapterNetwork.Mainnet;
case "testnet":
case 'testnet':
return WalletAdapterNetwork.Testnet;
case "devnet":
case "localnet":
case 'devnet':
case 'localnet':
default:
return WalletAdapterNetwork.Devnet;
}
Expand All @@ -178,13 +192,13 @@ export const WalletProvider = ({ children }: {children: ReactNode }) => {
getSlopeWallet(),
getSolflareWallet(),
getTorusWallet({
options: { clientId: 'Get a client ID @ https://developer.tor.us' }
options: { clientId: 'Get a client ID @ https://developer.tor.us' },
}),
getLedgerWallet(),
getSolletWallet({ network }),
getSolletExtensionWallet({ network }),
],
[]
[],
);

const onError = useCallback((error: WalletError) => {
Expand All @@ -196,14 +210,8 @@ export const WalletProvider = ({ children }: {children: ReactNode }) => {
}, []);

return (
<BaseWalletProvider
wallets={wallets}
onError={onError}
autoConnect
>
<WalletModalProvider>
{children}
</WalletModalProvider>
<BaseWalletProvider wallets={wallets} onError={onError} autoConnect>
<WalletModalProvider>{children}</WalletModalProvider>
</BaseWalletProvider>
);
}
};
Loading