Code Monkey home page Code Monkey logo

skip-go's Introduction

# skip-go

A util for signing and sending bundles through the Skip relayer.

# Usage

skipjs exposes a single default export, `SkipBundleClient`.
`SkipBundleClient` has two functions:
`signBundle` and `sendBundle`.

```
func SignBundle(bundle [][]byte, privateKeyBytes []byte) ([]string, []byte)

func SendBundle(b64EncodedSignedBundle []string, bundleSignature []byte, publicKey string, rpcURL string, desiredHeight string, sync bool) (*http.Response, error)
```

## SignBundle
`SignBundle` is used to sign a bundle of transactions. It must be provided with an array of `[]byte`, and a sepc256k1 private key (as `[]byte`), used to sign the bundle.
The transactions argument should be an array of base64-encoded transaction strings. The encoded bytes can be either Cosmos SDK `TxRaw`s or Ethereum native transactions (such as those produced from `ethers`, for Ethermint EVM chains. See the examples for more details.
`SignBundle` returns a (`SignedBundle`, `bundleSignature`), which can then both be passed to `SendBundle` to send the bundle to the relayer.

## SendBundle

`SendBundle` sends a `b64EncodedSignedBundle` to the Sentinel for inclusion in the auction.

A `b64EncodedSignedBundle` is the first output of `SignBundle` that can be reused here.

A `bundleSignature` is the second output of `SignBundle` that can be reused here.

The `publickey` is the address, as a `string`, that was used to sign the bundle.

`desiredHeight` is the desired height for the bundle to be included on-chain. Submitted bundles will only be considered in the auction for this height. Passing `0` as `desiredHeight` will cause the Skip Sentinel to consider the bundle for the immediate next height.

`sync` specifies whether to use the async or sync RPC endpoint. If set to `true`, the promise will not resolve until the bundle has been simulated. If set to `false`, the promise resolves on bundle submission, prior to its simulation. Our recommendation is to set this to `true` by default in order to debug responses (it will not affect how fast your bundle is submitted).

The `rpcURL` endpoint is an `ip:port` string that depends on the chain you're using. Skip relayer endpoints for each chain can be found [here](https://www.notion.so/skip-protocol/Skip-Configurations-By-Chain-a6076cfa743f4ab38194096403e62f3c).

skip-go's People

Contributors

maghnusm avatar notjeremyliu avatar

Stargazers

 avatar

Watchers

 avatar

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.