Giter VIP home page Giter VIP logo

saber-common's People

Contributors

albert597 avatar andrewtian avatar arcticmatt avatar arrowana avatar awojciak avatar dependabot[bot] avatar ebramanti avatar enoughpower avatar epicfaace avatar github-actions[bot] avatar h0lme3 avatar ilmoi avatar jasonchitla avatar jeffhu1 avatar josheleonard avatar ldy0909061 avatar macalinao avatar michaelhly avatar munanadi avatar nickcruz avatar olistic avatar pjijin avatar richardwu avatar slopefinance avatar sunnymicrosystems avatar taycaldwell avatar visvirial avatar vpontis avatar vsakos avatar zhengyutay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

saber-common's Issues

Type 'PublicKey' is not assignable to type 'ContextAccounts<any>'

hi, any idea about this error?
program is a AnchorTypes from @saberhq/anchor-contrib.

 this.program.instruction.update(new anchor.BN(timestampNow), null, {
          accounts: {
            activityMaster: activityMasterKey,
            authority: authority.publicKey,
          },
        }),
Argument of type '[any, null, { accounts: { activityMaster: PublicKey; authority: PublicKey; }; }]' is not assignable to parameter of type '[...any[], Context<[{ name: "activityMaster"; isMut: true; isSigner: false; }, { name: "authority"; isMut: false; isSigner: true; }]>]'.
  Type at position 2 in source is not compatible with type at position 1 in target.
    Type '{ accounts: { activityMaster: PublicKey; authority: PublicKey; }; }' is not assignable to type 'Context<[{ name: "activityMaster"; isMut: true; isSigner: false; }, { name: "authority"; isMut: false; isSigner: true; }]>'.
      Type '{ accounts: { activityMaster: PublicKey; authority: PublicKey; }; }' is not assignable to type '{ accounts: ContextAccounts<[{ name: "activityMaster"; isMut: true; isSigner: false; }, { name: "authority"; isMut: false; isSigner: true; }]>; }'.
        The types of 'accounts.authority' are incompatible between these types.
          Type 'PublicKey' is not assignable to type 'ContextAccounts<any>'.

the idl is:

    {
      name: "update",
      accounts: [
        {
          name: "activityMaster",
          isMut: true,
          isSigner: false
        },
        {
          name: "authority",
          isMut: false,
          isSigner: true
        }
      ],
      args: [
        {
          name: "openRewardTimestamp",
          type: "i64"
        },
        {
          name: "url",
          type: {
            option: "string"
          }
        }
      ]
    },

Error at compiling solana-contrib

I'm getting the error below while trying to build a project that has anchor-contrib as a dependency. Any ideas?

node_modules/@saberhq/solana-contrib/dist/cjs/transaction/PendingTransaction.d.ts:7:49 - error TS2312: An interface can only extend an object type or intersection of object types with statically known members.

7 export interface TransactionWaitOptions extends OperationOptions {
                                                  ~~~~~~~~~~~~~~~~


Found 1 error in node_modules/@saberhq/solana-contrib/dist/cjs/transaction/PendingTransaction.d.ts:7

Add network to Provider

The Provider should know the network it is on, so explorer utils can properly compute the URLs

Walletconnect support

Hi Ian, do you know if it's possible to get walletconnect support? It seems like adapter was set up a month ago. I would be happy to create a PR but it seems that because it the adapter accepts nonstandard options such as a projectId field, it's slightly nontrivial to integrate (happy to take a stab). The use case I have is for fireblocks support.

`useParsedAccountData` does not refetch

I didn't try to root cause this one. But here's a way to reproduce:

Try to get the SOL balance for an account.

useAccountData() will give the proper lamports after a sail refetch

but

useParsedAccountData() will have the stale lamports

TypeError: fields must be array of Layout instances

I'm getting an issue using the stableswap-sdk.

import { loadExchangeInfoFromSwapAccount, SWAP_PROGRAM_ID } from "@saberhq/stableswap-sdk";

Simply importing anything that imports stableswap-sdk/src/instructions/layouts.ts fails with this error:

/Users/andrew/w/x/node_modules/@solana/buffer-layout/lib/Layout.js:999
            throw new TypeError('fields must be array of Layout instances');
            ^

TypeError: fields must be array of Layout instances
    at new Structure (/Users/andrew/w/x/node_modules/@solana/buffer-layout/lib/Layout.js:999:19)
    at Object.exports.struct (/Users/andrew/w/x/node_modules/@solana/buffer-layout/lib/Layout.js:2373:57)
    at Object.<anonymous> (/Users/andrew/w/x/node_modules/@saberhq/stableswap-sdk/dist/cjs/state/layout.js:10:35)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/andrew/w/x/node_modules/@saberhq/stableswap-sdk/dist/cjs/instructions/layouts.js:7:18)

solana-labs/solana-program-library#2683 suggests it's a package version issue.

I have

"@saberhq/stableswap-sdk": "^1.12.44",
"@solana/buffer-layout": "^4.0.0",
"@solana/spl-token": "^0.1.8",
"@solana/web3.js": "^1.34.0"

in my package.json.

Any idea what the issue is?

es6 support for stableswap-sdk

I noticed that token-utils have es6 module export in the package.json but not stableswap-sdk. Can we add it in? Seems to be a quick win for bundling.

WalletNotReadyError

@saber-hq/use-solana often tries to connect to a wallet too early, before it's ready, and ends up giving a WalletNotReadyError.

We may want to change this code to use retries instead of just waiting for 1 second, particularly if a WalletNotReadyError is thrown:

timeout = setTimeout(() => {
void wallet.connect(walletArgs).catch((e) => {
onError(new WalletAutomaticConnectionError(e, walletProviderInfo));
});
}, 1_000);

`createMintAndVault` not working

TypeError: Blob.encode[amount] requires (length 8) Buffer as src
      at Blob.encode (node_modules/buffer-layout/lib/Layout.js:2321:13)
      at Structure.encode (node_modules/buffer-layout/lib/Layout.js:1263:26)
      at Function.createMintToInstruction (node_modules/@solana/spl-token/client/token.js:1745:16)

Module parse failed: Unexpected token

when I use the Jupiter SDK this webpack error is occured. I added babel-loader at module but it's same.
My project is next.js and typescript.
Please help me
image

How do I get a list of `swapAccount`s?

The stableswap-sdk code describes the swapAccount parameter as "The public key identifying this instance of the Stable Swap."

Where can I find a mapping of pool pairs to swapAccount public keys? (i.e. how do I find what swapAccount to pass into methods like loadExchangeInfoFromSwapAccount?)

should I just call getProgramAccounts passing in the SWAP_PROGRAM_ID? e.g.

curl https://api.mainnet-beta.solana.com -X POST -H "Content-Type: application/json" -d '
  {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getProgramAccounts",
    "params": [
      "SSwpkEEcbUqx4vtoEByFjSkhKdCT862DNVb52nZg1UZ",
      {
        "encoding": "base64"
      }
    ]
  }
'

Add Solscan explorer link

Hi

solana-contrib is now just providing solana explorer link.
Can we add solscan link?

 generateSolanaExplorerLink(cluster: Cluster = "mainnet-beta"): string {
    return `https://explorer.solana.com/tx/${this.signature}?cluster=${cluster}`;
  }

Is Saber exchange API available for users to connect to exchange?

Hi, Saber Team,

I really like your work.

I am wondering whether saber exchange API is available. I want to use exchange API to pull some public data, such as available pools, TVL, etc. Also, I want to deposit / withdraw from the liquidity pools via API. Is this possible at the current stage?

looking forward to your response!

Thank you in advance!

TokenAmount.parse doesn't work for decimal inputs without a whole number part

export const parseAmountFromString = <Tk extends Token<Tk>>(
  token: Tk,
  uiAmount: string
): JSBI => {
  const parts = uiAmount.split(".");
  if (parts.length === 0) {
    throw new Error("empty number");
  }
  invariant(parts[0]);
  const whole = JSBI.BigInt(parts[0]);

I believe this is in the @ubeswap/token-math package. Instead of using split, it may make sense to to just do a simple indexOf on the .

Anchor Contrib Dependency Issues

node_modules/@saberhq/anchor-contrib/dist/cjs/utils/coder.d.ts:4:41 - error TS2307: Cannot find module '@project-serum/anchor/dist/cjs/coder/instruction' or its corresponding type declarations.

4 import type { InstructionDisplay } from "@project-serum/anchor/dist/cjs/coder/instruction";
                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error.

This is with anchor v0.21.0 and v1.12.43

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.