Skip to content

Commit

Permalink
fix(build): export dist to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
sambacha committed Oct 27, 2021
1 parent a9e53b5 commit 2e77c46
Show file tree
Hide file tree
Showing 14 changed files with 1,961 additions and 21 deletions.
60 changes: 55 additions & 5 deletions packages/sdk-connect/src/connector.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
/**
* @package OpenMevSocket
* @version 0.2.0
* @see docs.openmev.org
*/
import { io, Socket } from 'socket.io-client';
import { BigNumberish } from '@ethersproject/bignumber';
import { getDefaultProvider } from '@ethersproject/providers';
// import { hexDataLength, hexDataSlice, hexlify } from '@ethersproject/bytes'
// import { defaultAbiCoder } from '@ethersproject/abi';

/**
* @configure JSON_RPC_URL is default
* @configure RPC_URL for failover
*/
const defaultServerUrl = 'https://api.sushirelay.com/v1';
const JSONRPC_URL = 'https://api.staging.sushirelay.com/v1';
const JSON_RPC_URL = 'https://api.staging.sushirelay.com/v1';
const RPC_URL = process.env.RPC_URL
const tokenKey = `SESSION_TOKEN`;
export const provider = getDefaultProvider(JSONRPC_URL);

/**
* @exports provider
* @const getDefaultProvider
* @
*/
export const provider = getDefaultProvider(JSON_RPC_URL || RPC_URL );

export enum Event {
FEES_CHANGE = 'FEES_CHANGE',
Expand Down Expand Up @@ -58,14 +73,49 @@ export enum Debug {
ERROR_UNKNOWN = 'ERROR_UNKNOWN',
}

export interface OpenMEVsemver {
export type ConnectionInfo = {
url: string,
headers?: { [key: string]: string | number }

user?: string,
password?: string,

allowInsecureAuthentication?: boolean,
allowGzip?: boolean,

throttleLimit?: number,
throttleSlotInterval?: number;
throttleCallback?: (attempt: number, url: string) => Promise<boolean>,

timeout?: number,
};

export interface OnceBlockable {
once(eventName: "block", handler: () => void): void;
}

export interface OncePollable {
once(eventName: "poll", handler: () => void): void;
}

export type PollOptions = {
timeout?: number,
floor?: number,
ceiling?: number,
interval?: number,
retryLimit?: number,
onceBlock?: OnceBlockable
oncePoll?: OncePollable
};

export interface platformVersion {
api: number;
client: string;
}

export interface SocketSession {
token: string;
version: OpenMEVsemver | undefined;
version: platformVersion | any;
}

/**
Expand Down
8 changes: 6 additions & 2 deletions packages/sdk-connect/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
/**
* @package OpenMEV/SDK-Connector
* @version 0.1.0
* @version 0.2.0
* @license Apache-2.0
* @export connector
* @since v0.3.0
*/
export * from './connector';
import {
OpenMEVSocket
} from './connector'
export default OpenMEVSocket
//export * from './connector';
3 changes: 3 additions & 0 deletions packages/use-react-wallet/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
!dist
.DS_Store
node_modules
2 changes: 2 additions & 0 deletions packages/use-react-wallet/dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import * as useWallet from './lib';
export { useWallet };
8 changes: 8 additions & 0 deletions packages/use-react-wallet/dist/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

'use strict'

if (process.env.NODE_ENV === 'production') {
module.exports = require('./use-react-wallet.cjs.production.min.js')
} else {
module.exports = require('./use-react-wallet.cjs.development.js')
}
17 changes: 17 additions & 0 deletions packages/use-react-wallet/dist/lib.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Web3Modal, { ICoreOptions } from 'web3modal';
import { Network, Web3Provider } from '@ethersproject/providers';
declare type State = {
provider?: Web3Provider;
account?: Account;
network?: Network;
web3Modal?: Web3Modal;
};
declare type Account = string;
declare type ConnectWallet = (opts?: Partial<ICoreOptions>) => void;
declare type DisconnectWallet = () => void;
declare type UseWallet = () => State & {
connect: ConnectWallet;
disconnect: DisconnectWallet;
};
export declare const useWallet: UseWallet;
export {};
Loading

0 comments on commit 2e77c46

Please sign in to comment.