serum: Rename swap to spl-token-swap and add new swap package (#98)

This commit is contained in:
Armani Ferrante 2021-05-11 21:20:15 -07:00 committed by GitHub
parent 9702547be0
commit 93946077cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 3449 additions and 71 deletions

View File

@ -34,7 +34,8 @@
| [`@project-serum/common`](/packages/common) | [![npm](https://img.shields.io/npm/v/@project-serum/common.svg)](https://www.npmjs.com/package/@project-serum/common) | Common utilities |
| [`@project-serum/serum`](/packages/serum) | [![npm](https://img.shields.io/npm/v/@project-serum/serum.svg)](https://www.npmjs.com/package/@project-serum/serum) | Library for interacting with the Serum DEX |
| [`@project-serum/pool`](/packages/pool) | [![npm](https://img.shields.io/npm/v/@project-serum/pool.svg)](https://www.npmjs.com/package/@project-serum/pool) | Client for interacting with Pools |
| [`@project-serum/swap`](/packages/swap) | [![npm](https://img.shields.io/npm/v/@project-serum/swap.svg)](https://www.npmjs.com/package/@project-serum/swap) | Client for interacting with the Swap Program |
| [`@project-serum/spl-token-swap`](/packages/spl-token-swap) | [![npm](https://img.shields.io/npm/v/@project-serum/spl-token-swap.svg)](https://www.npmjs.com/package/@project-serum/spl-token-swap) | Client for interacting with the SPL Token Swap Program |
| [`@project-serum/swap`](/packages/swap) | [![npm](https://img.shields.io/npm/v/@project-serum/swap.svg)](https://www.npmjs.com/package/@project-serum/swap) | Client for swapping on the Serum DEX |
| [`@project-serum/tokens`](/packages/tokens) | [![npm](https://img.shields.io/npm/v/@project-serum/tokens.svg)](https://www.npmjs.com/package/@project-serum/tokens) | Solana token addresses |
## Contributing

View File

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.1.0]
### Breaking
- Renamed package from `@project-serum/swap` to `@project-serum/spl-token-swap`.
## [0.0.5]
### Added

1472
packages/spl-token-swap/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,49 @@
{
"name": "@project-serum/spl-token-swap",
"version": "0.1.0-alpha.1",
"description": "Serum Swap",
"main": "lib/index.js",
"types": "lib/src/index.d.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "tsc",
"test": "jest test",
"coverage": "jest --coverage test",
"prepublishOnly": "yarn build",
"shell": "tsc && node -e \"$(< shell)\" -i --experimental-repl-await"
},
"jest": {
"transform": {
".(ts)": "ts-jest"
},
"testEnvironment": "node",
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js"
]
},
"dependencies": {
"@project-serum/serum": "^0.13.21",
"@solana/spl-token": "^0.0.13",
"@solana/spl-token-swap": "0.1.0",
"bn.js": "^5.1.3",
"bs58": "^4.0.1",
"buffer-layout": "^1.2.0",
"dotenv": "^8.2.0"
},
"peerDependencies": {
"@solana/web3.js": "^0.90.0"
},
"devDependencies": {
"@tsconfig/node12": "^1.0.7",
"@types/bn.js": "^4.11.6",
"@types/bs58": "^4.0.1",
"@types/jest": "^24.9.1",
"@types/node": "^12.12.62"
}
}

View File

@ -0,0 +1,4 @@
export * from './pools';
export * from './instructions';
export * from './utils';
export * from './types';

View File

@ -0,0 +1,16 @@
import BN from 'bn.js';
export const timeMs = (): number => {
return new Date().getTime();
};
export function divideBnToNumber(numerator: BN, denominator: BN): number {
const quotient = numerator.div(denominator).toNumber();
const rem = numerator.umod(denominator);
const gcd = rem.gcd(denominator);
return quotient + rem.div(gcd).toNumber() / denominator.div(gcd).toNumber();
}
export function getTokenMultiplierFromDecimals(decimals: number): BN {
return new BN(10).pow(new BN(decimals));
}

View File

@ -0,0 +1,15 @@
{
"extends": "@tsconfig/node12/tsconfig.json",
"compilerOptions": {
"outDir": "./lib",
"allowJs": true,
"checkJs": true,
"declaration": true,
"declarationMap": true,
"noImplicitAny": false,
"resolveJsonModule": true,
"sourceMap": true
},
"include": ["./src/**/*"],
"exclude": ["./src/**/*.test.js", "node_modules", "**/node_modules"]
}

View File

@ -0,0 +1,5 @@
build/
dist/
node_modules/
.snapshots/
*.min.js

24
packages/swap/.eslintrc Normal file
View File

@ -0,0 +1,24 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint"
],
"env": {
"node": true,
"jest": true
},
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
},
"rules": {
"no-constant-condition": ["error", { "checkLoops": false }],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off"
}
}

28
packages/swap/README.md Normal file
View File

@ -0,0 +1,28 @@
# Serum Swap
[![Build Status](https://travis-ci.com/project-serum/serum-ts.svg?branch=master)](https://travis-ci.com/project-serum/serum-ts)
[![npm (scoped)](https://img.shields.io/npm/v/@project-serum/swap)](https://www.npmjs.com/package/@project-serum/swap)
[![Discord Chat](https://img.shields.io/discord/739225212658122886?color=blueviolet)](https://discord.com/channels/739225212658122886)
[![Documentation](https://img.shields.io/badge/typedoc-documentation-blue)](https://project-serum.github.io/serum-ts/swap/classes/swap.html)
[![License](https://img.shields.io/github/license/project-serum/serum-dex?color=blue)](https://opensource.org/licenses/Apache-2.0)
Client library for swapping directly on the serum orderbook.
The Solana program can be found [here](https://github.com/project-serum/swap).
## Installation
Using npm:
```
npm install @solana/web3.js @project-serum/swap
```
Using yarn:
```
yarn add @solana/web3.js @project-serum/swap
```
## API Reference
[API Reference](https://project-serum.github.io/serum-ts/swap/classes/swap.html).

View File

@ -0,0 +1,94 @@
const anchor = require('@project-serum/anchor');
const Provider = anchor.Provider;
const Wallet = anchor.Wallet;
const BN = anchor.BN;
const Connection = require('@solana/web3.js').Connection;
const PublicKey = require('@solana/web3.js').PublicKey;
const TokenListProvider = require('@solana/spl-token-registry')
.TokenListProvider;
const Swap = require('..').Swap;
// Mainnet beta addresses.
const SRM = new PublicKey('SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt');
const USDC = new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v');
const USDT = new PublicKey('Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB');
const WBTC = new PublicKey('9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E');
const DECIMALS = 6;
async function main() {
// Client for sending transactions to the swap program on mainnet.
const client = await swapClient();
// All tokens available for swapping.
const _tokens = client.tokens();
// All tokens available for swapping with SRM.
const _srmSwapPairs = client.pairs(SRM);
// Estimate the amount received by swapping from SRM -> USDC.
const estimatedUsdc = await client.estimate({
fromMint: SRM,
toMint: USDC,
amount: toNative(1),
});
const estimatedBtc = await client.estimate({
fromMint: SRM,
toMint: WBTC,
amount: toNative(1),
});
console.log('estimate', estimatedBtc.toNumber());
/*
// Swaps SRM -> USDC on the Serum orderbook. If the resulting USDC is
// has greater than a 1% error from the estimate, then fails.
const usdcSwapTx = await client.swap({
fromMint: SRM,
toMint: USDC,
amount: toNative(1),
minExpectedSwapAmount: estimatedUsdc.mul(new BN(99)).div(new BN(100)),
});
// Uses the default minExpectedSwapAmount calculation.
const usdcSwapTxDefault = await client.swap({
fromMint: SRM,
toMint: USDC,
amount: toNative(1),
});
// Transitive swap from SRM -> USDC -> BTC.
const btcSwapTx = await client.swap({
fromMint: SRM,
toMint: WBTC,
amount: toNative(1),
});
console.log('resp', fromNative(estimatedUsdc));
console.log('resp', fromNative(estimatedBtc));
console.log('resp', usdcSwapTx);
console.log('resp', usdcSwapTxDefault);
console.log('resp', btcSwapTx);
*/
}
async function swapClient() {
const provider = new Provider(
new Connection('https://api.mainnet-beta.solana.com', 'recent'),
Wallet.local(),
Provider.defaultOptions(),
);
const tokenList = await new TokenListProvider().resolve();
return new Swap(provider, tokenList);
}
// Converts the given number to native units (i.e. with decimals).
// The mints used in this example all have 6 decimals. One should dynamically
// fetch decimals for the tokens they are swapping in production.
function toNative(amount) {
return new BN(amount * 10 ** DECIMALS);
}
function fromNative(amount) {
return amount.toNumber() / 10 ** DECIMALS;
}
main().catch(console.error);

View File

@ -0,0 +1,4 @@
module.exports = {
preset: 'ts-jest/presets/js-with-ts',
testEnvironment: 'node',
};

View File

@ -1,49 +1,60 @@
{
"name": "@project-serum/swap",
"version": "0.0.16",
"description": "Serum Swap",
"version": "0.1.0-alpha.1",
"description": "Client for swapping on the Serum DEX",
"license": "MIT",
"repository": "project-serum/serum-ts",
"main": "lib/index.js",
"source": "src/index.js",
"types": "lib/index.d.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
"engines": {
"node": ">=10"
},
"scripts": {
"build": "tsc",
"test": "jest test",
"coverage": "jest --coverage test",
"prepublishOnly": "yarn build",
"shell": "tsc && node -e \"$(< shell)\" -i --experimental-repl-await"
},
"jest": {
"transform": {
".(ts)": "ts-jest"
},
"testEnvironment": "node",
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js"
]
},
"dependencies": {
"@project-serum/serum": "^0.13.21",
"@solana/spl-token": "^0.0.13",
"@solana/spl-token-swap": "0.1.0",
"bn.js": "^5.1.3",
"bs58": "^4.0.1",
"buffer-layout": "^1.2.0",
"dotenv": "^8.2.0"
},
"peerDependencies": {
"@solana/web3.js": "^0.90.0"
"start": "tsc --watch",
"clean": "rm -rf lib",
"docs": "typedoc --excludePrivate --out ../../docs/swap src/index.ts --includeVersion --readme none",
"prepare": "run-s clean build",
"shell": "node -e \"$(< shell)\" -i --experimental-repl-await"
},
"devDependencies": {
"@tsconfig/node12": "^1.0.7",
"@types/bn.js": "^4.11.6",
"@types/bs58": "^4.0.1",
"@types/jest": "^24.9.1",
"@types/node": "^12.12.62"
}
"@types/jest": "^26.0.9",
"@typescript-eslint/eslint-plugin": "^4.6.0",
"@typescript-eslint/parser": "^4.6.0",
"babel-eslint": "^10.0.3",
"cross-env": "^7.0.2",
"eslint": "^7.6.0",
"eslint-config-prettier": "^6.11.0",
"jest": "^26.4.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.5",
"ts-jest": "^26.2.0",
"typedoc": "^0.20.36",
"typescript": "^4.0.5"
},
"files": [
"lib"
],
"prettier": {
"singleQuote": true,
"trailingComma": "all"
},
"dependencies": {
"@project-serum/anchor": "^0.5.1-beta.2",
"@project-serum/serum": "^0.13.34",
"@solana/spl-token": "^0.1.3",
"@solana/spl-token-registry": "^0.2.68",
"@solana/web3.js": "^1.2.0",
"base64-js": "^1.5.1",
"bn.js": "^5.1.2"
},
"browserslist": [
">0.2%",
"not dead",
"not op_mini all",
"maintained node versions"
]
}

355
packages/swap/src/idl.ts Normal file
View File

@ -0,0 +1,355 @@
import { Idl } from '@project-serum/anchor';
// Idl for client generation.
export const IDL: Idl = {
version: '0.0.0',
name: 'swap',
instructions: [
{
name: 'swap',
accounts: [
{
name: 'market',
accounts: [
{
name: 'market',
isMut: true,
isSigner: false,
},
{
name: 'openOrders',
isMut: true,
isSigner: false,
},
{
name: 'requestQueue',
isMut: true,
isSigner: false,
},
{
name: 'eventQueue',
isMut: true,
isSigner: false,
},
{
name: 'bids',
isMut: true,
isSigner: false,
},
{
name: 'asks',
isMut: true,
isSigner: false,
},
{
name: 'orderPayerTokenAccount',
isMut: true,
isSigner: false,
},
{
name: 'coinVault',
isMut: true,
isSigner: false,
},
{
name: 'pcVault',
isMut: true,
isSigner: false,
},
{
name: 'vaultSigner',
isMut: false,
isSigner: false,
},
{
name: 'coinWallet',
isMut: true,
isSigner: false,
},
],
},
{
name: 'authority',
isMut: false,
isSigner: true,
},
{
name: 'pcWallet',
isMut: true,
isSigner: false,
},
{
name: 'dexProgram',
isMut: false,
isSigner: false,
},
{
name: 'tokenProgram',
isMut: false,
isSigner: false,
},
{
name: 'rent',
isMut: false,
isSigner: false,
},
],
args: [
{
name: 'side',
type: {
defined: 'Side',
},
},
{
name: 'amount',
type: 'u64',
},
{
name: 'minExpectedSwapAmount',
type: 'u64',
},
],
},
{
name: 'swapTransitive',
accounts: [
{
name: 'from',
accounts: [
{
name: 'market',
isMut: true,
isSigner: false,
},
{
name: 'openOrders',
isMut: true,
isSigner: false,
},
{
name: 'requestQueue',
isMut: true,
isSigner: false,
},
{
name: 'eventQueue',
isMut: true,
isSigner: false,
},
{
name: 'bids',
isMut: true,
isSigner: false,
},
{
name: 'asks',
isMut: true,
isSigner: false,
},
{
name: 'orderPayerTokenAccount',
isMut: true,
isSigner: false,
},
{
name: 'coinVault',
isMut: true,
isSigner: false,
},
{
name: 'pcVault',
isMut: true,
isSigner: false,
},
{
name: 'vaultSigner',
isMut: false,
isSigner: false,
},
{
name: 'coinWallet',
isMut: true,
isSigner: false,
},
],
},
{
name: 'to',
accounts: [
{
name: 'market',
isMut: true,
isSigner: false,
},
{
name: 'openOrders',
isMut: true,
isSigner: false,
},
{
name: 'requestQueue',
isMut: true,
isSigner: false,
},
{
name: 'eventQueue',
isMut: true,
isSigner: false,
},
{
name: 'bids',
isMut: true,
isSigner: false,
},
{
name: 'asks',
isMut: true,
isSigner: false,
},
{
name: 'orderPayerTokenAccount',
isMut: true,
isSigner: false,
},
{
name: 'coinVault',
isMut: true,
isSigner: false,
},
{
name: 'pcVault',
isMut: true,
isSigner: false,
},
{
name: 'vaultSigner',
isMut: false,
isSigner: false,
},
{
name: 'coinWallet',
isMut: true,
isSigner: false,
},
],
},
{
name: 'authority',
isMut: false,
isSigner: true,
},
{
name: 'pcWallet',
isMut: true,
isSigner: false,
},
{
name: 'dexProgram',
isMut: false,
isSigner: false,
},
{
name: 'tokenProgram',
isMut: false,
isSigner: false,
},
{
name: 'rent',
isMut: false,
isSigner: false,
},
],
args: [
{
name: 'amount',
type: 'u64',
},
{
name: 'minExpectedSwapAmount',
type: 'u64',
},
],
},
],
types: [
{
name: 'Side',
type: {
kind: 'enum',
variants: [
{
name: 'Bid',
},
{
name: 'Ask',
},
],
},
},
],
events: [
{
name: 'DidSwap',
fields: [
{
name: 'given_amount',
type: 'u64',
index: false,
},
{
name: 'min_expected_swap_amount',
type: 'u64',
index: false,
},
{
name: 'from_amount',
type: 'u64',
index: false,
},
{
name: 'to_amount',
type: 'u64',
index: false,
},
{
name: 'spill_amount',
type: 'u64',
index: false,
},
{
name: 'from_mint',
type: 'publicKey',
index: false,
},
{
name: 'to_mint',
type: 'publicKey',
index: false,
},
{
name: 'quote_mint',
type: 'publicKey',
index: false,
},
{
name: 'authority',
type: 'publicKey',
index: false,
},
],
},
],
errors: [
{
code: 100,
name: 'SwapTokensCannotMatch',
msg: 'The tokens being swapped must have different mints',
},
{
code: 101,
name: 'SlippageExceeded',
msg: 'Slippage tolerance exceeded',
},
],
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,124 @@
import { Provider } from '@project-serum/anchor';
import { OpenOrders } from '@project-serum/serum';
import { TokenListContainer } from '@solana/spl-token-registry';
import { PublicKey } from '@solana/web3.js';
import { DEX_PID, USDC_PUBKEY, USDT_PUBKEY } from './utils';
// Utility class to parse the token list for markets.
export default class SwapMarkets {
constructor(
private provider: Provider,
private tokenList: TokenListContainer,
) {}
public tokens(): PublicKey[] {
return this.tokenList
.getList()
.filter((t) => {
const isUsdxQuoted =
t.extensions?.serumV3Usdt || t.extensions?.serumV3Usdc;
return isUsdxQuoted;
})
.map((t) => new PublicKey(t.address));
}
public pairs(mint: PublicKey): PublicKey[] {
const tokenList = this.tokenList.getList();
const mintInfo = this.tokenList
.getList()
.filter((t) => t.address === mint.toString())[0];
if (mintInfo === undefined) {
return [];
}
const pairs = new Set<string>();
// Add all tokens that also have USDC quoted markets.
if (mintInfo.extensions?.serumV3Usdc) {
pairs.add(USDC_PUBKEY.toString());
let iter = tokenList
.filter(
(t) => t.address !== mintInfo.address && t.extensions?.serumV3Usdc,
)
.map((t) => t.address);
iter.forEach(pairs.add, pairs);
}
// Add all tokens that also have USDT quoted markets.
if (mintInfo.extensions?.serumV3Usdt) {
pairs.add(USDT_PUBKEY.toString());
tokenList
.filter(
(t) => t.address !== mintInfo.address && t.extensions?.serumV3Usdt,
)
.map((t) => t.address)
.forEach(pairs.add, pairs);
}
return [...pairs].map((t) => new PublicKey(t));
}
// Returns the `usdxMint` quoted market address *if* no open orders account
// already exists.
public async getMarketAddressIfNeeded(
usdxMint: PublicKey,
baseMint: PublicKey,
): Promise<PublicKey> {
const marketAddress = this.getMarketAddress(usdxMint, baseMint);
let accounts = await OpenOrders.findForMarketAndOwner(
this.provider.connection,
marketAddress,
this.provider.wallet.publicKey,
DEX_PID,
);
if (accounts[0] !== undefined) {
throw new Error('Open orders account already exists');
}
return marketAddress;
}
// Returns the `usdxMint` quoted market address.
public getMarketAddress(usdxMint: PublicKey, baseMint: PublicKey): PublicKey {
const market = this.tokenList
.getList()
.filter((t) => {
if (t.address !== baseMint?.toString()) {
return false;
}
if (usdxMint.equals(USDC_PUBKEY)) {
return t.extensions?.serumV3Usdc !== undefined;
} else if (usdxMint.equals(USDT_PUBKEY)) {
return t.extensions?.serumV3Usdt !== undefined;
} else {
return false;
}
})
.map((t) => {
if (usdxMint!.equals(USDC_PUBKEY)) {
return new PublicKey(t.extensions!.serumV3Usdc as string);
} else {
return new PublicKey(t.extensions!.serumV3Usdt as string);
}
})[0];
if (market === undefined) {
throw new Error(
`Usd(x) quoted market not found for ${baseMint.toString()}`,
);
}
return market;
}
// Returns true if there's a trade across two USDC quoted markets
// `fromMint` `toMint`.
public usdcPathExists(fromMint: PublicKey, toMint: PublicKey): boolean {
const fromMarket = this.tokenList
.getList()
.filter((t) => t.address === fromMint.toString())
.filter((t) => t.extensions?.serumV3Usdc !== undefined)[0];
const toMarket = this.tokenList
.getList()
.filter((t) => t.address === toMint.toString())
.filter((t) => t.extensions?.serumV3Usdc !== undefined)[0];
return fromMarket !== undefined && toMarket !== undefined;
}
}

View File

@ -1,16 +1,58 @@
import BN from 'bn.js';
import { PublicKey } from '@solana/web3.js';
export const timeMs = (): number => {
return new Date().getTime();
};
// Serum DEX program id on mainnet-beta.
export const DEX_PID = new PublicKey(
'9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin',
);
export function divideBnToNumber(numerator: BN, denominator: BN): number {
const quotient = numerator.div(denominator).toNumber();
const rem = numerator.umod(denominator);
const gcd = rem.gcd(denominator);
return quotient + rem.div(gcd).toNumber() / denominator.div(gcd).toNumber();
// Swap program id on mainnet-beta.
export const SWAP_PID = new PublicKey(
'22Y43yTVxuUkoRKdm9thyRhQ3SdgQS7c7kB6UNCiaczD',
);
// USDC mint on mainnet-beta.
export const USDC_PUBKEY = new PublicKey(
'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
);
// USDT mint on mainnet-beta.
export const USDT_PUBKEY = new PublicKey(
'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB',
);
// Return the program derived address used by the serum DEX to control token
// vaults.
export async function getVaultOwnerAndNonce(
marketPublicKey: PublicKey,
dexProgramId: PublicKey = DEX_PID,
) {
const nonce = new BN(0);
while (nonce.toNumber() < 255) {
try {
const vaultOwner = await PublicKey.createProgramAddress(
[marketPublicKey.toBuffer(), nonce.toArrayLike(Buffer, 'le', 8)],
dexProgramId,
);
return [vaultOwner, nonce];
} catch (e) {
nonce.iaddn(1);
}
}
throw new Error('Unable to find nonce');
}
export function getTokenMultiplierFromDecimals(decimals: number): BN {
return new BN(10).pow(new BN(decimals));
// Returns an associated token address for spl tokens.
export async function getAssociatedTokenAddress(
associatedProgramId: PublicKey,
programId: PublicKey,
mint: PublicKey,
owner: PublicKey,
): Promise<PublicKey> {
return (
await PublicKey.findProgramAddress(
[owner.toBuffer(), programId.toBuffer(), mint.toBuffer()],
associatedProgramId,
)
)[0];
}

159
yarn.lock
View File

@ -3387,6 +3387,29 @@
pako "^2.0.3"
snake-case "^3.0.4"
"@project-serum/anchor@^0.5.1-beta.2":
version "0.5.1-beta.2"
resolved "https://registry.yarnpkg.com/@project-serum/anchor/-/anchor-0.5.1-beta.2.tgz#358ca148c82df088346d9dbd12ed46f229aee7d6"
integrity sha512-FECLlXAPF2FwhJtZTItqXnClCNPZ0xJlFW4HgNrOUuPInGqwX7i9KwE/43Gjf7tQW2tzcspjtfIkZalThcqc5A==
dependencies:
"@project-serum/borsh" "^0.2.1"
"@solana/web3.js" "^1.2.0"
"@types/bn.js" "^4.11.6"
"@types/bs58" "^4.0.1"
"@types/crypto-hash" "^1.1.2"
"@types/pako" "^1.0.1"
base64-js "^1.5.1"
bn.js "^5.1.2"
bs58 "^4.0.1"
buffer-layout "^1.2.0"
camelcase "^5.3.1"
crypto-hash "^1.3.0"
eventemitter3 "^4.0.7"
find "^0.3.0"
js-sha256 "^0.9.0"
pako "^2.0.3"
snake-case "^3.0.4"
"@project-serum/borsh@^0.0.1-beta.0":
version "0.0.1-beta.0"
resolved "https://registry.yarnpkg.com/@project-serum/borsh/-/borsh-0.0.1-beta.0.tgz#8ab465ac23e0d840127c7922f8a1a500b50667d5"
@ -3395,10 +3418,10 @@
bn.js "^5.1.2"
buffer-layout "^1.2.0"
"@project-serum/borsh@^0.1.0":
version "0.1.1"
resolved "https://registry.yarnpkg.com/@project-serum/borsh/-/borsh-0.1.1.tgz#a810aad74e4b458fbd1ab63188f175bee765a8af"
integrity sha512-bzCea8KTyc7CNkcMn0V2HW/FdU9pnJUcVRrwLqvJkYeo+mhkXE4AxxWErN3q+UxhEm8ypGIX1OYTKJaTJvj5cQ==
"@project-serum/borsh@^0.2.1":
version "0.2.1"
resolved "https://registry.yarnpkg.com/@project-serum/borsh/-/borsh-0.2.1.tgz#1d0dc4ccf8be307ddd1e88fcfb6f94b9aa26f857"
integrity sha512-cE5z9iaYN5nC2L8ARslKdyA31EFV6hW2ROriLfNDBqwzbDCCx0uigUdNOBZ4FHEwE12B78vUEQGywVASWXzcKQ==
dependencies:
bn.js "^5.1.2"
buffer-layout "^1.2.0"
@ -3460,6 +3483,13 @@
dependencies:
cross-fetch "3.0.6"
"@solana/spl-token-registry@^0.2.68":
version "0.2.81"
resolved "https://registry.yarnpkg.com/@solana/spl-token-registry/-/spl-token-registry-0.2.81.tgz#579e9b73eac37cc959436408b4d6ad6e2cfab8c5"
integrity sha512-4cxV3tvrMjrcxodGN/aSGe947gNYyKC9sRsme5K1aUWl+g+KHNu5/nA9QFkjKjTa91QSGhUzvx2I08pCMoEiLA==
dependencies:
cross-fetch "3.0.6"
"@solana/spl-token-swap@0.1.0":
version "0.1.0"
resolved "https://registry.yarnpkg.com/@solana/spl-token-swap/-/spl-token-swap-0.1.0.tgz#a1bc2b0c96edae8b31bb2cc000ebacdc36e131c8"
@ -3485,7 +3515,19 @@
dotenv "8.2.0"
mkdirp "1.0.4"
"@solana/web3.js@0.90.0", "@solana/web3.js@^0.86.1", "@solana/web3.js@^0.90.0", "@solana/web3.js@^1.1.0":
"@solana/spl-token@^0.1.3":
version "0.1.4"
resolved "https://registry.yarnpkg.com/@solana/spl-token/-/spl-token-0.1.4.tgz#7fc6ba82a7fbb2b0907f7ffc87709488db83ed2a"
integrity sha512-W8uSC4ysWVjbKK7lvsIHFxdMIkOCEoOm9tYY9VVpBlUIp4+K5bpPxHXUlxMiHfkKPWAxab6IGUn71VVLg8uq5Q==
dependencies:
"@babel/runtime" "^7.10.5"
"@solana/web3.js" "^1.9.1"
bn.js "^5.1.0"
buffer "6.0.3"
buffer-layout "^1.2.0"
dotenv "8.2.0"
"@solana/web3.js@0.90.0", "@solana/web3.js@^0.86.1", "@solana/web3.js@^0.90.0", "@solana/web3.js@^1.1.0", "@solana/web3.js@^1.2.0", "@solana/web3.js@^1.9.1":
version "0.90.0"
resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-0.90.0.tgz#e7043af04426f1af6404ea1664b5715970a06ea2"
integrity sha512-bBWEBLbU26we/gcLMfAxg2V/r1Y1WiPAfVcWV8vJDd9EsRt56I9bt6fATUaHhKgfmQQtxBdxCiz9LCm3WrPQEQ==
@ -5236,6 +5278,11 @@ bn.js@^5.0.0, bn.js@^5.1.1, bn.js@^5.1.2, bn.js@^5.1.3:
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.1.3.tgz#beca005408f642ebebea80b042b4d18d2ac0ee6b"
integrity sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ==
bn.js@^5.1.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.0.tgz#358860674396c6997771a9d051fcc1b57d4ae002"
integrity sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==
body-parser@1.19.0:
version "1.19.0"
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a"
@ -5449,6 +5496,14 @@ buffer-xor@^1.0.3:
resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9"
integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=
buffer@6.0.3, buffer@^6.0.1:
version "6.0.3"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6"
integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==
dependencies:
base64-js "^1.3.1"
ieee754 "^1.2.1"
buffer@^4.3.0:
version "4.9.2"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.2.tgz#230ead344002988644841ab0244af8c44bbe3ef8"
@ -5458,14 +5513,6 @@ buffer@^4.3.0:
ieee754 "^1.1.4"
isarray "^1.0.0"
buffer@^6.0.1:
version "6.0.3"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6"
integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==
dependencies:
base64-js "^1.3.1"
ieee754 "^1.2.1"
bufferutil@^4.0.1:
version "4.0.2"
resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.2.tgz#79f68631910f6b993d870fc77dc0a2894eb96cd5"
@ -6009,10 +6056,10 @@ colorette@^1.2.1:
resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.1.tgz#4d0b921325c14faf92633086a536db6e89564b1b"
integrity sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw==
colorette@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.2.tgz#cbcc79d5e99caea2dbf10eb3a26fd8b3e6acfa94"
integrity sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==
colors@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78"
integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==
columnify@^1.5.4:
version "1.5.4"
@ -8385,6 +8432,16 @@ fs-extra@^9.0.1:
jsonfile "^6.0.1"
universalify "^1.0.0"
fs-extra@^9.1.0:
version "9.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==
dependencies:
at-least-node "^1.0.0"
graceful-fs "^4.2.0"
jsonfile "^6.0.1"
universalify "^2.0.0"
fs-minipass@^1.2.5:
version "1.2.7"
resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7"
@ -8769,6 +8826,18 @@ handlebars@^4.7.2, handlebars@^4.7.6:
optionalDependencies:
uglify-js "^3.1.4"
handlebars@^4.7.7:
version "4.7.7"
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1"
integrity sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==
dependencies:
minimist "^1.2.5"
neo-async "^2.6.0"
source-map "^0.6.1"
wordwrap "^1.0.0"
optionalDependencies:
uglify-js "^3.1.4"
har-schema@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92"
@ -11009,6 +11078,11 @@ lodash@4.17.15:
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
log-symbols@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.0.0.tgz#69b3cc46d20f448eccdb75ea1fa733d9e821c920"
@ -11074,7 +11148,7 @@ lru-cache@^6.0.0:
dependencies:
yallist "^4.0.0"
lunr@^2.3.8:
lunr@^2.3.8, lunr@^2.3.9:
version "2.3.9"
resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1"
integrity sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==
@ -11179,6 +11253,11 @@ marked@^0.8.0:
resolved "https://registry.yarnpkg.com/marked/-/marked-0.8.2.tgz#4faad28d26ede351a7a1aaa5fec67915c869e355"
integrity sha512-EGwzEeCcLniFX51DhTpmTom+dSA/MG/OBUDjnWtHbEnjAH180VzUeAw+oE4+Zv+CoYBWyRlYOTR0N8SO9R1PVw==
marked@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/marked/-/marked-2.0.3.tgz#3551c4958c4da36897bda2a16812ef1399c8d6b0"
integrity sha512-5otztIIcJfPc2qGTN8cVtOJEjNJZ0jwa46INMagrYfk0EvqtRuEHLsEe0LrFS0/q+ZRKT0+kXK7P2T1AN5lWRA==
md5.js@^1.3.4:
version "1.3.5"
resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f"
@ -12110,6 +12189,13 @@ onetime@^5.1.0:
dependencies:
mimic-fn "^2.1.0"
onigasm@^2.2.5:
version "2.2.5"
resolved "https://registry.yarnpkg.com/onigasm/-/onigasm-2.2.5.tgz#cc4d2a79a0fa0b64caec1f4c7ea367585a676892"
integrity sha512-F+th54mPc0l1lp1ZcFMyL/jTs2Tlq4SqIHKIXGZOR/VkHkF9A7Fr5rRr5+ZG/lWeRsyrClLYRq7s/yFQ/XhWCA==
dependencies:
lru-cache "^5.1.1"
open@^7.0.2:
version "7.3.0"
resolved "https://registry.yarnpkg.com/open/-/open-7.3.0.tgz#45461fdee46444f3645b6e14eb3ca94b82e1be69"
@ -14926,7 +15012,7 @@ shell-quote@1.7.2, shell-quote@^1.6.1:
resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2"
integrity sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg==
shelljs@^0.8.3:
shelljs@^0.8.3, shelljs@^0.8.4:
version "0.8.4"
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.4.tgz#de7684feeb767f8716b326078a8a00875890e3c2"
integrity sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==
@ -14940,6 +15026,14 @@ shellwords@^0.1.1:
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==
shiki@^0.9.3:
version "0.9.3"
resolved "https://registry.yarnpkg.com/shiki/-/shiki-0.9.3.tgz#7bf7bcf3ed50ca525ec89cc09254abce4264d5ca"
integrity sha512-NEjg1mVbAUrzRv2eIcUt3TG7X9svX7l3n3F5/3OdFq+/BxUdmBOeKGiH4icZJBLHy354Shnj6sfBTemea2e7XA==
dependencies:
onigasm "^2.2.5"
vscode-textmate "^5.2.0"
side-channel@^1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.3.tgz#cdc46b057550bbab63706210838df5d4c19519c3"
@ -16216,6 +16310,11 @@ typedoc-default-themes@0.8.0-0:
lunr "^2.3.8"
underscore "^1.9.1"
typedoc-default-themes@^0.12.10:
version "0.12.10"
resolved "https://registry.yarnpkg.com/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz#614c4222fe642657f37693ea62cad4dafeddf843"
integrity sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==
typedoc@0.17.0-3:
version "0.17.0-3"
resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.17.0-3.tgz#91996e77427ff3a208ab76595a927ee11b75e9e8"
@ -16232,6 +16331,23 @@ typedoc@0.17.0-3:
shelljs "^0.8.3"
typedoc-default-themes "0.8.0-0"
typedoc@^0.20.36:
version "0.20.36"
resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.20.36.tgz#ee5523c32f566ad8283fc732aa8ea322d1a45f6a"
integrity sha512-qFU+DWMV/hifQ9ZAlTjdFO9wbUIHuUBpNXzv68ZyURAP9pInjZiO4+jCPeAzHVcaBCHER9WL/+YzzTt6ZlN/Nw==
dependencies:
colors "^1.4.0"
fs-extra "^9.1.0"
handlebars "^4.7.7"
lodash "^4.17.21"
lunr "^2.3.9"
marked "^2.0.3"
minimatch "^3.0.0"
progress "^2.0.3"
shelljs "^0.8.4"
shiki "^0.9.3"
typedoc-default-themes "^0.12.10"
typescript@^4.0.3, typescript@^4.0.5:
version "4.0.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.5.tgz#ae9dddfd1069f1cb5beb3ef3b2170dd7c1332389"
@ -16550,6 +16666,11 @@ vm-browserify@^1.0.1:
resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0"
integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==
vscode-textmate@^5.2.0:
version "5.4.0"
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-5.4.0.tgz#4b25ffc1f14ac3a90faf9a388c67a01d24257cd7"
integrity sha512-c0Q4zYZkcLizeYJ3hNyaVUM2AA8KDhNCA3JvXY8CeZSJuBdAy3bAvSbv46RClC4P3dSO9BdwhnKEx2zOo6vP/w==
w3c-hr-time@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd"