Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eslint/prettier] Adds linting/prettier #90

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
74 changes: 74 additions & 0 deletions scripts/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

module.exports = {
plugins: ['unused-imports', 'prettier', 'header', 'require-extensions'],
extends: [
'react-app',
'eslint:recommended',
'prettier',
'plugin:prettier/recommended',
'plugin:import/typescript',
],
settings: {
'import/resolver': {
typescript: true,
},
},
env: {
es2020: true,
},
root: false,
ignorePatterns: [
'node_modules',
'build',
'dist',
'coverage',
'apps/icons/src',
'next-env.d.ts',
'doc/book',
'external-crates',
'storybook-static',
'.next',
],
rules: {
'no-case-declarations': 'off',
'no-implicit-coercion': [2, { number: true, string: true, boolean: false }],
'@typescript-eslint/no-redeclare': 'off',
'@typescript-eslint/ban-types': [
'error',
{
types: {
Buffer: 'Buffer usage increases bundle size and is not consistently implemented on web.',
},
extendDefaults: true,
},
],
'no-restricted-globals': [
'error',
{
name: 'Buffer',
message: 'Buffer usage increases bundle size and is not consistently implemented on web.',
},
],
'header/header': [
2,
'line',
[' Copyright (c) Mysten Labs, Inc.', ' SPDX-License-Identifier: Apache-2.0'],
],
'unused-imports/no-unused-imports': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
vars: 'all',
args: 'none',
ignoreRestSiblings: true,
},
],
},
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
};
15 changes: 15 additions & 0 deletions scripts/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# ignore generated files
/apps/icons/src
npm-debug.log*
package-lock.json
yarn-debug.log*
.next/
.swc/
build/
coverage/
dist/
out/
playwright-report/
storybook-static/
CHANGELOG.md

6 changes: 2 additions & 4 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@

This directory contains different scripts used to build transactions (for multi-sig operations).



## Setup SuiNS locally

To setup a local instance of SuiNS (or in any network of your choosing), all you need to do is call:

```
# choose from mainnet, testnet, devnet, localnet
export NETWORK=localnet
export NETWORK=localnet
pnpm ts-node init/init.ts
```

This will automatically publish all the packages in the correct order, collect all the variables in a `published.json`
file, as well as do a full on-chain setup (creation of the registry, addition of pricelist, authorization of all apps as well as
file, as well as do a full on-chain setup (creation of the registry, addition of pricelist, authorization of all apps as well as
calling their respective setup functions).

Then, you can use these published variables to the SDK and call different actions (e.g. registering names, subnames etc)
Expand Down
121 changes: 62 additions & 59 deletions scripts/config/constants.ts
Original file line number Diff line number Diff line change
@@ -1,65 +1,68 @@
import { normalizeSuiAddress } from "@mysten/sui.js/utils";
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
import { normalizeSuiAddress } from '@mysten/sui.js/utils';

export type Network = 'mainnet' | 'testnet'
export type Network = 'mainnet' | 'testnet';

export type Config = Record<'mainnet' | 'testnet', PackageInfo>
export type Config = Record<'mainnet' | 'testnet', PackageInfo>;

export type PackageInfo = {
packageId: string;
registrationPackageId: string;
upgradeCap?: string;
publisherId: string;
adminAddress: string;
adminCap: string;
suins: string;
displayObject?: string;
directSetupPackageId: string;
discountsPackage: {
packageId: string;
discountHouseId: string;
},
renewalsPackageId: string;
subNamesPackageId: string;
tempSubdomainsProxyPackageId: string;
}
packageId: string;
registrationPackageId: string;
upgradeCap?: string;
publisherId: string;
adminAddress: string;
adminCap: string;
suins: string;
displayObject?: string;
directSetupPackageId: string;
discountsPackage: {
packageId: string;
discountHouseId: string;
};
renewalsPackageId: string;
subNamesPackageId: string;
tempSubdomainsProxyPackageId: string;
};

export const mainPackage: Config = {
mainnet: {
packageId: '0xd22b24490e0bae52676651b4f56660a5ff8022a2576e0089f79b3c88d44e08f0',
registrationPackageId: '0x9d451fa0139fef8f7c1f0bd5d7e45b7fa9dbb84c2e63c2819c7abd0a7f7d749d',
upgradeCap: '0x9cda28244a0d0de294d2b271e772a9c33eb47d316c59913d7369b545b4af098c',
publisherId: '0x7339f23f06df3601167d67a31752781d307136fd18304c48c928778e752caae1',
adminAddress: normalizeSuiAddress('0xa81a2328b7bbf70ab196d6aca400b5b0721dec7615bf272d95e0b0df04517e72'),
adminCap: '0x3f8d702d90c572b60ac692fb5074f7a7ac350b80d9c59eab4f6b7692786cae0a',
suins: '0x6e0ddefc0ad98889c04bab9639e512c21766c5e6366f89e696956d9be6952871',
displayObject: '0x866fbd8e51b6637c25f0e811ece9a85eb417f3987ecdfefb80f15d1192d72b4c',
discountsPackage: {
packageId: '0x6a6ea140e095ddd82f7c745905054b3203129dd04a09d0375416c31161932d2d',
discountHouseId: '0x7fdd883c0b7427f18cdb498c4c87a4a79d6bec4783cb3f21aa3816bbc64ce8ef',
},
directSetupPackageId: '0xdac22652eb400beb1f5e2126459cae8eedc116b73b8ad60b71e3e8d7fdb317e2',
renewalsPackageId: '0xd5e5f74126e7934e35991643b0111c3361827fc0564c83fa810668837c6f0b0f',
subNamesPackageId: 'TODO: Fill this in...',
tempSubdomainsProxyPackageId: 'TODO: Fill this in...'
},
testnet: {
packageId: '0x22fa05f21b1ad71442491220bb9338f7b7095fe35000ef88d5400d28523bdd93',
registrationPackageId: '0x4255184a0143c0ce4394a3f16a6f5aa5d64507269e54e51ea396d569fe8f1ba5',
publisherId: '0x62d9690d7e6234bfd57170a89c9c8ec54604ea31cefaa3869e8be4912ee1a4ab',
adminAddress: '0xfe09cf0b3d77678b99250572624bf74fe3b12af915c5db95f0ed5d755612eb68',
adminCap: normalizeSuiAddress('0x5def5bd9dc94b7d418d081a91c533ec619fb4350e6c4e4602aea96fd49331b15'),
suins: '0x300369e8909b9a6464da265b9a5a9ab6fe2158a040e84e808628cde7a07ee5a3',
directSetupPackageId: '0x6ed81fd808a23eae2da488052334d50478b36527474fc99707c1aed0e43104b1',
discountsPackage: {
packageId: 'TODO: Fill this in...',
discountHouseId: 'TODO: Fill this in...',
},
renewalsPackageId: '0x54800ebb4606fd0c03b4554976264373b3374eeb3fd63e7ff69f31cac786ba8c',
subNamesPackageId: '0x3c272bc45f9157b7818ece4f7411bdfa8af46303b071aca4e18c03119c9ff636',
tempSubdomainsProxyPackageId: '0x3489ab5dcd346afee8b681267bcab2583a5eba9855680ec9931355e50e21c148'
}
}




mainnet: {
packageId: '0xd22b24490e0bae52676651b4f56660a5ff8022a2576e0089f79b3c88d44e08f0',
registrationPackageId: '0x9d451fa0139fef8f7c1f0bd5d7e45b7fa9dbb84c2e63c2819c7abd0a7f7d749d',
upgradeCap: '0x9cda28244a0d0de294d2b271e772a9c33eb47d316c59913d7369b545b4af098c',
publisherId: '0x7339f23f06df3601167d67a31752781d307136fd18304c48c928778e752caae1',
adminAddress: normalizeSuiAddress(
'0xa81a2328b7bbf70ab196d6aca400b5b0721dec7615bf272d95e0b0df04517e72',
),
adminCap: '0x3f8d702d90c572b60ac692fb5074f7a7ac350b80d9c59eab4f6b7692786cae0a',
suins: '0x6e0ddefc0ad98889c04bab9639e512c21766c5e6366f89e696956d9be6952871',
displayObject: '0x866fbd8e51b6637c25f0e811ece9a85eb417f3987ecdfefb80f15d1192d72b4c',
discountsPackage: {
packageId: '0x6a6ea140e095ddd82f7c745905054b3203129dd04a09d0375416c31161932d2d',
discountHouseId: '0x7fdd883c0b7427f18cdb498c4c87a4a79d6bec4783cb3f21aa3816bbc64ce8ef',
},
directSetupPackageId: '0xdac22652eb400beb1f5e2126459cae8eedc116b73b8ad60b71e3e8d7fdb317e2',
renewalsPackageId: '0xd5e5f74126e7934e35991643b0111c3361827fc0564c83fa810668837c6f0b0f',
subNamesPackageId: 'TODO: Fill this in...',
tempSubdomainsProxyPackageId: 'TODO: Fill this in...',
},
testnet: {
packageId: '0x22fa05f21b1ad71442491220bb9338f7b7095fe35000ef88d5400d28523bdd93',
registrationPackageId: '0x4255184a0143c0ce4394a3f16a6f5aa5d64507269e54e51ea396d569fe8f1ba5',
publisherId: '0x62d9690d7e6234bfd57170a89c9c8ec54604ea31cefaa3869e8be4912ee1a4ab',
adminAddress: '0xfe09cf0b3d77678b99250572624bf74fe3b12af915c5db95f0ed5d755612eb68',
adminCap: normalizeSuiAddress(
'0x5def5bd9dc94b7d418d081a91c533ec619fb4350e6c4e4602aea96fd49331b15',
),
suins: '0x300369e8909b9a6464da265b9a5a9ab6fe2158a040e84e808628cde7a07ee5a3',
directSetupPackageId: '0x6ed81fd808a23eae2da488052334d50478b36527474fc99707c1aed0e43104b1',
discountsPackage: {
packageId: 'TODO: Fill this in...',
discountHouseId: 'TODO: Fill this in...',
},
renewalsPackageId: '0x54800ebb4606fd0c03b4554976264373b3374eeb3fd63e7ff69f31cac786ba8c',
subNamesPackageId: '0x3c272bc45f9157b7818ece4f7411bdfa8af46303b071aca4e18c03119c9ff636',
tempSubdomainsProxyPackageId:
'0x3489ab5dcd346afee8b681267bcab2583a5eba9855680ec9931355e50e21c148',
},
};
86 changes: 44 additions & 42 deletions scripts/config/day_one.ts
Original file line number Diff line number Diff line change
@@ -1,51 +1,53 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
export type AirdropConfig = {
isMainnet?: boolean;
packageId: string;
dropListObj: {
objectId: string,
initialSharedVersion: string;
mutable: boolean;
},
setupCap: string;
massMintingAddress: string;
baseCoinObjectId: string;
publisher: string;
bufferPackageId: string;
}
isMainnet?: boolean;
packageId: string;
dropListObj: {
objectId: string;
initialSharedVersion: string;
mutable: boolean;
};
setupCap: string;
massMintingAddress: string;
baseCoinObjectId: string;
publisher: string;
bufferPackageId: string;
};

export const mainnetConfig: AirdropConfig = {
isMainnet: true,
packageId: '0xbf1431324a4a6eadd70e0ac6c5a16f36492f255ed4d011978b2cf34ad738efe6',
dropListObj: {
objectId: '0xde761c5e1bd3bdece2fd8d57be72b7a85f09d44438cafc731a693fc856ccff28',
initialSharedVersion: '3854467',
mutable: true
},
publisher: '0x7b9fa20eb51210af6060f88fd1468b405d6306f6518deecf93c5ab1955165ce0',
setupCap: '0x3ac4499e0d0da8b4902691131bc6d63143e065a8182db23ee033533d00efe22a',
// these are static.
massMintingAddress: '0x245937f348ad9cd4f0478b9766a611d8c16cf3c4d08045d6168ef5a356cb3eb9',
baseCoinObjectId: '0x0021765dfb6569a5a8e52bacdd81fe0ae9169d264b416e924ece14edac64b6fa',
isMainnet: true,
packageId: '0xbf1431324a4a6eadd70e0ac6c5a16f36492f255ed4d011978b2cf34ad738efe6',
dropListObj: {
objectId: '0xde761c5e1bd3bdece2fd8d57be72b7a85f09d44438cafc731a693fc856ccff28',
initialSharedVersion: '3854467',
mutable: true,
},
publisher: '0x7b9fa20eb51210af6060f88fd1468b405d6306f6518deecf93c5ab1955165ce0',
setupCap: '0x3ac4499e0d0da8b4902691131bc6d63143e065a8182db23ee033533d00efe22a',
// these are static.
massMintingAddress: '0x245937f348ad9cd4f0478b9766a611d8c16cf3c4d08045d6168ef5a356cb3eb9',
baseCoinObjectId: '0x0021765dfb6569a5a8e52bacdd81fe0ae9169d264b416e924ece14edac64b6fa',

// the buffer package to help setup the amount of addresses.
bufferPackageId: '0xfeecbb29272d34b78c402b894ea63b48cff4a717dafc96df8aa205edca89610c'
}
// the buffer package to help setup the amount of addresses.
bufferPackageId: '0xfeecbb29272d34b78c402b894ea63b48cff4a717dafc96df8aa205edca89610c',
};

// The latest testnet test run.
export const addressConfig: AirdropConfig = {
packageId: '0x71c2dc2ce8a3cde0f7fa6638519c64f24b1b7bc20e8272d2ca0690ffbbfabc4a',
dropListObj: {
objectId: '0x51a8f7949f55acfd9c75bcaa2a76c473a1be8ef02538f5c6b975e6e44cd20a04',
initialSharedVersion: '6430469',
mutable: true
},
publisher: '0xf70aa88ab83f47bbc9809baebe13d8107f23100d2a01807ca91e1d8078d4f3bf',
setupCap: '0x206eb1dc4dd76cbad883b33f54574030447e6ad29b9f60e894566cbdf5d9e578',
packageId: '0x71c2dc2ce8a3cde0f7fa6638519c64f24b1b7bc20e8272d2ca0690ffbbfabc4a',
dropListObj: {
objectId: '0x51a8f7949f55acfd9c75bcaa2a76c473a1be8ef02538f5c6b975e6e44cd20a04',
initialSharedVersion: '6430469',
mutable: true,
},
publisher: '0xf70aa88ab83f47bbc9809baebe13d8107f23100d2a01807ca91e1d8078d4f3bf',
setupCap: '0x206eb1dc4dd76cbad883b33f54574030447e6ad29b9f60e894566cbdf5d9e578',

// these are static.
massMintingAddress: '0xfe09cf0b3d77678b99250572624bf74fe3b12af915c5db95f0ed5d755612eb68',
baseCoinObjectId: '0x000351d8ef91bcb5a6750f7ecd218fab600a07d2f11e8dab4fa2941b6e91ee73',
// these are static.
massMintingAddress: '0xfe09cf0b3d77678b99250572624bf74fe3b12af915c5db95f0ed5d755612eb68',
baseCoinObjectId: '0x000351d8ef91bcb5a6750f7ecd218fab600a07d2f11e8dab4fa2941b6e91ee73',

// a static buffer package id.
bufferPackageId: '0x06bf34f13caae7a08f8864ccae73bca987b937446bd2b345a46b3d4ef6300da8'
}
// a static buffer package id.
bufferPackageId: '0x06bf34f13caae7a08f8864ccae73bca987b937446bd2b345a46b3d4ef6300da8',
};
Loading
Loading