Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions packages/create-sei/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"extends": ["../../biome.json"],
"files": {
"ignoreUnknown": false,
"ignore": ["templates/**"]
}
}
17 changes: 9 additions & 8 deletions packages/create-sei/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env node
import inquirer from 'inquirer';
import boxen from 'boxen';
import inquirer from 'inquirer';

import path from 'path';
import fs from 'fs';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
import fs from 'node:fs';
import path from 'node:path';
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { Command } from 'commander';

const __filename = fileURLToPath(import.meta.url);
Expand Down Expand Up @@ -86,7 +86,7 @@ const promptEVMLibrary = async () => {
};

function isValidDirectoryName(dirName) {
const illegalRe = /[<>:"/\\|?*\x00-\x1F]/g;
const illegalRe = /[<>:"/\\|?*]/g;
const windowsReservedRe = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i;
const trailingRe = /[. ]+$/;
const validNpmPackageRe = /^(?:@[a-z0-9-*~][a-z0-9-*._~]*)?[a-z0-9-~][a-z0-9-._~]*$/;
Expand All @@ -95,6 +95,7 @@ function isValidDirectoryName(dirName) {
return false;
}

// Check for illegal characters, Windows reserved names, trailing spaces/dots
if (illegalRe.test(dirName) || windowsReservedRe.test(dirName) || trailingRe.test(dirName) || !validNpmPackageRe.test(dirName)) {
return false;
}
Expand Down Expand Up @@ -166,7 +167,7 @@ async function runWizard(options: WizardOptions): Promise<void> {

const appFramework = options.framework || (await promptFramework());
let appConnectionType = options.ecosystem || (await promptRpcIntegrations());
if (appConnectionType == RPCIntegrationType.EVM) {
if (appConnectionType === RPCIntegrationType.EVM) {
appConnectionType = options.library || (await promptEVMLibrary());
}

Expand All @@ -182,7 +183,7 @@ async function runWizard(options: WizardOptions): Promise<void> {
program
.command('app')
.description('Create a new SEI dApp')
.option('-n, --name <name>', `Specify the name of your dApp. Name must be a valid package name.`)
.option('-n, --name <name>', 'Specify the name of your dApp. Name must be a valid package name.')
.option('-f, --framework <framework>', `Specify the app framework to use: [${Object.values(FrontendScaffolding).join(', ')}]`)
.option('-e, --ecosystem <ecosystem>', `Specify the ecosystem to use: [${Object.values(RPCIntegrationType).join(', ')}]`)
.option('-l, --library <library>', `Specify the EVM library to use: [${Object.values(EVMLibrary).join(', ')}]. Only used if ecosystem chosen is 'EVM'`)
Expand Down
11 changes: 2 additions & 9 deletions packages/ledger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
"module": "./dist/esm/src/index.js",
"types": "./dist/types/src/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"files": ["dist"],
"scripts": {
"build": "rimraf dist && yarn build:cjs && yarn build:esm && yarn build:types",
"build:cjs": "tsc --outDir dist/cjs --module commonjs",
Expand All @@ -18,12 +16,7 @@
"test": "jest"
},
"homepage": "https://github.com/sei-protocol/sei-js#readme",
"keywords": [
"sei",
"javascript",
"typescript",
"ledger"
],
"keywords": ["sei", "javascript", "typescript", "ledger"],
"repository": "git@github.com:sei-protocol/sei-js.git",
"license": "MIT",
"publishConfig": {
Expand Down
8 changes: 4 additions & 4 deletions packages/ledger/src/cosmos/seiLedgerOfflineAminoSigner.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AminoSignResponse, encodeSecp256k1Signature, OfflineAminoSigner, serializeSignDoc, StdSignDoc } from '@cosmjs/amino';
import { fromHex } from '@cosmjs/encoding';
import { AccountData } from '@cosmjs/proto-signing';
import { type AminoSignResponse, type OfflineAminoSigner, type StdSignDoc, encodeSecp256k1Signature, serializeSignDoc } from '@cosmjs/amino';
import { Secp256k1Signature } from '@cosmjs/crypto';
import { SeiApp } from '@zondax/ledger-sei';
import { fromHex } from '@cosmjs/encoding';
import type { AccountData } from '@cosmjs/proto-signing';
import type { SeiApp } from '@zondax/ledger-sei';

/**
* A signer implementation that uses a Ledger device to sign transactions
Expand Down
8 changes: 1 addition & 7 deletions packages/precompiles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@
"test": "jest --passWithNoTests"
},
"homepage": "https://github.com/sei-protocol/sei-js#readme",
"keywords": [
"sei",
"javascript",
"typescript",
"node",
"evm"
],
"keywords": ["sei", "javascript", "typescript", "node", "evm"],
"repository": "git@github.com:sei-protocol/sei-js.git",
"license": "MIT",
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/precompiles/src/ethers/addressPrecompile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type ContractRunner, Contract, type InterfaceAbi } from 'ethers';
import { Contract, type ContractRunner, type InterfaceAbi } from 'ethers';
import { ADDRESS_PRECOMPILE_ABI, ADDRESS_PRECOMPILE_ADDRESS } from '../precompiles';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/precompiles/src/ethers/distributionPrecompile.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Contract, type ContractRunner, type InterfaceAbi } from 'ethers';
import { DISTRIBUTION_PRECOMPILE_ADDRESS, DISTRIBUTION_PRECOMPILE_ABI } from '../precompiles';
import { DISTRIBUTION_PRECOMPILE_ABI, DISTRIBUTION_PRECOMPILE_ADDRESS } from '../precompiles';

/**
* The ABI for the Distribution precompile contract, used to create an Ethers contract.
Expand Down
11 changes: 2 additions & 9 deletions packages/registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
"module": "./dist/esm/src/index.js",
"types": "./dist/types/src/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"files": ["dist"],
"scripts": {
"build": "rimraf dist && yarn build:cjs && yarn build:esm && yarn build:types",
"build:cjs": "tsc --outDir dist/cjs --module commonjs",
Expand All @@ -18,12 +16,7 @@
"test": "jest"
},
"homepage": "https://github.com/sei-protocol/sei-js#readme",
"keywords": [
"sei",
"javascript",
"typescript",
"registry"
],
"keywords": ["sei", "javascript", "typescript", "registry"],
"repository": "git@github.com:sei-protocol/sei-js.git",
"license": "MIT",
"publishConfig": {
Expand Down
12 changes: 6 additions & 6 deletions packages/registry/src/gas/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { ModuleAdjustments, GAS_INFO, ChainGasInfo } from '../index';
import { Network } from '../../index';
import type { Network } from '../../index';
import { type ChainGasInfo, GAS_INFO, type ModuleAdjustments } from '../index';

describe('GasInfo Tests', () => {
// Check if GasInfo contains all expected networks
it('contains all required networks', () => {
const expectedNetworks: Network[] = ['pacific-1', 'atlantic-2', 'arctic-1'];
expectedNetworks.forEach((network) => {
for (const network of expectedNetworks) {
expect(GAS_INFO).toHaveProperty(network);
});
}
});

// Validate the structure of GasInfo for each network
it('validates structure for each network', () => {
Object.values(GAS_INFO).forEach((info: ChainGasInfo) => {
for (const info of Object.values(GAS_INFO)) {
expect(typeof info.denom).toBe('string');
expect(typeof info.min_gas_price).toBe('number');
expect(info).toHaveProperty('module_adjustments');
Expand All @@ -22,7 +22,7 @@ describe('GasInfo Tests', () => {
expect(typeof dex.sudo_gas_price).toBe('number');
expect(typeof dex.order_placement).toBe('number');
expect(typeof dex.order_cancellation).toBe('number');
});
}
});

// Example: Check specific values for a network (e.g., 'pacific-1')
Expand Down
2 changes: 1 addition & 1 deletion packages/registry/src/gas/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import GasInfoJSON from '../../chain-registry/gas.json';
import { Network } from '../index';
import type { Network } from '../index';

/**
* Defines the gas price adjustments for specific modules within the Sei blockchain,
Expand Down
14 changes: 7 additions & 7 deletions packages/registry/src/ibc/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import type { Network } from '../../index';
import { IBC_INFO } from '../index';
import { Network } from '../../index';

describe('IBCInfo Tests', () => {
// Check if IBCInfo contains all expected networks
it('contains all required networks', () => {
const expectedNetworks: Network[] = ['pacific-1', 'atlantic-2', 'arctic-1'];
expectedNetworks.forEach((network) => {
for (const network of expectedNetworks) {
expect(IBC_INFO).toHaveProperty(network);
});
}
});

// Validate the structure of IBCInfo for each network
it('validates structure for each network', () => {
Object.values(IBC_INFO).forEach((channels) => {
channels.forEach((channel) => {
for (const channels of Object.values(IBC_INFO)) {
for (const channel of channels) {
expect(typeof channel.counterparty_chain_name).toBe('string');
expect(typeof channel.dst_channel).toBe('string');
expect(typeof channel.src_channel).toBe('string');
expect(typeof channel.port_id).toBe('string');
expect(typeof channel.client_id).toBe('string');
});
});
}
}
});

// Example: Check specific content for a given network
Expand Down
2 changes: 1 addition & 1 deletion packages/registry/src/ibc/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import IBCInfoJSON from '../../chain-registry/ibc_info.json';
import { Network } from '../index';
import type { Network } from '../index';

/**
* Represents information about an IBC channel, facilitating communication
Expand Down
12 changes: 6 additions & 6 deletions packages/registry/src/networks/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ describe('Networks configuration', () => {
it('should contain configurations for all expected Sei networks', () => {
const expectedNetworkIds = ['pacific-1', 'atlantic-2', 'arctic-1'];

expectedNetworkIds.forEach((id) => {
for (const id of expectedNetworkIds) {
expect(NETWORKS).toHaveProperty(id);
const networkConfig = NETWORKS[id];
expect(networkConfig).toBeDefined();
expect(networkConfig.chainId).toBe(id);
});
}
});

it('should contain valid RPC endpoints for each network', () => {
Object.values(NETWORKS).forEach((networkConfig) => {
for (const networkConfig of Object.values(NETWORKS)) {
expect(networkConfig.rpc).toBeDefined();
expect(Array.isArray(networkConfig.rpc)).toBeTruthy();
networkConfig.rpc.forEach((endpoint) => {
for (const endpoint of networkConfig.rpc) {
expect(endpoint).toHaveProperty('provider');
expect(typeof endpoint.provider).toBe('string');
expect(endpoint).toHaveProperty('url');
expect(typeof endpoint.url).toBe('string');
});
});
}
}
});
});
2 changes: 1 addition & 1 deletion packages/registry/src/networks/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import NetworksJSON from '../../chain-registry/chains.json';
import { Network } from '../index';
import type { Network } from '../index';

/**
* Describes an endpoint with a provider name and its associated URL.
Expand Down
22 changes: 11 additions & 11 deletions packages/registry/src/tokens/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
import { TOKEN_LIST } from '../index';
import { Network } from '../../index';
import type { Network } from '../../index';
import { type DenomUnit, TOKEN_LIST } from '../index';

describe('AssetList Tests', () => {
it('should have the correct structure for each network', () => {
const networks: Network[] = ['pacific-1', 'atlantic-2', 'arctic-1'];
networks.forEach((network) => {
for (const network of networks) {
expect(Array.isArray(TOKEN_LIST[network])).toBeTruthy();
TOKEN_LIST[network].forEach((asset) => {
for (const asset of TOKEN_LIST[network]) {
expect(asset).toHaveProperty('name');
expect(asset).toHaveProperty('description');
expect(asset).toHaveProperty('symbol');
expect(asset).toHaveProperty('base');
expect(asset).toHaveProperty('display');
expect(asset).toHaveProperty('denom_units');
expect(Array.isArray(asset.denom_units)).toBeTruthy();
asset.denom_units.forEach((denomUnit: any) => {
for (const denomUnit of asset.denom_units) {
expect(denomUnit).toHaveProperty('denom');
expect(denomUnit).toHaveProperty('exponent');
expect(typeof denomUnit.denom).toBe('string');
expect(typeof denomUnit.exponent).toBe('number');
});
}
if (asset.images) {
if (asset.images.png) expect(typeof asset.images.png).toBe('string');
if (asset.images.svg) expect(typeof asset.images.svg).toBe('string');
}
if (asset.coingecko_id) expect(typeof asset.coingecko_id).toBe('string');
if (asset.type_token) expect(typeof asset.type_token).toBe('string');
});
});
}
}
});
});

it('should contain the "sei" asset with correct properties in each network', () => {
Object.keys(TOKEN_LIST).forEach((network) => {
for (const network of Object.keys(TOKEN_LIST)) {
const seiAsset = TOKEN_LIST[network as Network].find((asset) => asset.symbol === 'SEI');
expect(seiAsset).toBeDefined();
expect(seiAsset?.name).toBe('Sei');
expect(seiAsset?.description).toBe('The native token of Sei');
expect(seiAsset?.base).toBe('usei');
expect(seiAsset?.denom_units.some((unit) => unit.denom === 'sei' && unit.exponent === 6)).toBeTruthy();
expect(seiAsset?.denom_units.some((unit: DenomUnit) => unit.denom === 'sei' && unit.exponent === 6)).toBeTruthy();
if (seiAsset?.images) {
expect(seiAsset.images.png).toMatch(/^https?:\/\/.+/);
}
});
}
});
2 changes: 1 addition & 1 deletion packages/registry/src/tokens/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import TokenListJSON from '../../community-assetlist/assetlist.json';
import { Network } from '../index';
import type { Network } from '../index';

/**
* DenomUnit represents a struct that describes a given
Expand Down
10 changes: 5 additions & 5 deletions packages/registry/src/wallets/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { Wallet, WALLETS } from '../index';
import { WALLETS, type Wallet } from '../index';

describe('Wallet Extensions Configuration Tests', () => {
it('contains an array of wallet extensions', () => {
expect(Array.isArray(WALLETS)).toBeTruthy();
WALLETS.forEach((extension: Wallet) => {
for (const extension of WALLETS) {
expect(typeof extension.name).toBe('string');
expect(typeof extension.identifier).toBe('string');
expect(typeof extension.icon).toBe('string');
expect(typeof extension.url).toBe('string');
expect(Array.isArray(extension.capabilities)).toBeTruthy();
extension.capabilities.forEach((capability) => {
for (const capability of extension.capabilities) {
expect(['native', 'evm']).toContain(capability);
});
});
}
}
});

it('contains specific wallet extension by identifier', () => {
Expand Down
8 changes: 2 additions & 6 deletions packages/sei-global-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,8 @@
},
"typesVersions": {
"*": {
"eip6963": [
"./dist/types/eip6963.d.ts"
],
"solana-standard": [
"./dist/types/solana-standard.d.ts"
]
"eip6963": ["./dist/types/eip6963.d.ts"],
"solana-standard": ["./dist/types/solana-standard.d.ts"]
}
},
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/sei-global-wallet/src/lib/wallet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createGlobalWalletClient, GlobalWalletClient } from '@dynamic-labs/global-wallet-client';
import { type GlobalWalletClient, createGlobalWalletClient } from '@dynamic-labs/global-wallet-client';
import { config } from './config';

const Wallet: GlobalWalletClient = createGlobalWalletClient({
Expand Down