name-service-js: Add to CI, clean up packages (#3097)
This commit is contained in:
parent
f7d4ebecc6
commit
b5e301b210
|
@ -56,3 +56,21 @@ jobs:
|
|||
|
||||
- name: Build and test
|
||||
run: ./ci/cargo-test-bpf.sh name-service
|
||||
|
||||
js-test:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
NODE_VERSION: 14.x
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.cache/yarn
|
||||
key: node-${{ hashFiles('name-service/js/yarn.lock') }}
|
||||
restore-keys: |
|
||||
node-
|
||||
- run: ./ci/js-test-name-service.sh
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
cd "$(dirname "$0")/.."
|
||||
source ./ci/solana-version.sh install
|
||||
|
||||
set -x
|
||||
cd name-service/js
|
||||
|
||||
yarn install --pure-lockfile
|
||||
yarn lint
|
||||
yarn build
|
File diff suppressed because it is too large
Load Diff
|
@ -21,10 +21,10 @@
|
|||
"dev": "tsc && node --trace-warnings dist/transfer.js",
|
||||
"build": "tsc",
|
||||
"prepublish": "tsc",
|
||||
"lint": "yarn pretty && eslint .",
|
||||
"lint:fix": "yarn pretty:fix && eslint . --fix",
|
||||
"pretty": "prettier --check 'src/*.[jt]s'",
|
||||
"pretty:fix": "prettier --write 'src/*.[jt]s'",
|
||||
"lint": "yarn pretty && eslint 'src/*.ts'",
|
||||
"lint:fix": "yarn pretty:fix && eslint 'src/*.ts' --fix",
|
||||
"pretty": "prettier --check 'src/*.ts'",
|
||||
"pretty:fix": "prettier --write 'src/*.ts'",
|
||||
"doc": "yarn typedoc src/index.ts"
|
||||
},
|
||||
"prettier": {
|
||||
|
@ -32,7 +32,6 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/recommended": "^1.0.1",
|
||||
"@types/bs58": "^4.0.1",
|
||||
"@types/node": "^14.14.20",
|
||||
"@typescript-eslint/eslint-plugin": "^4.0.1",
|
||||
"@typescript-eslint/parser": "^4.0.1",
|
||||
|
@ -42,26 +41,15 @@
|
|||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-functional": "^3.0.2",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
"nodemon": "^2.0.7",
|
||||
"prettier": "^2.2.1",
|
||||
"save-dev": "0.0.1-security",
|
||||
"ts-node": "^9.1.1",
|
||||
"tslib": "^2.2.0",
|
||||
"typedoc": "^0.20.35",
|
||||
"typescript": "^4.1.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@solana/spl-token": "0.1.4",
|
||||
"@solana/web3.js": "^1.11.0",
|
||||
"bip32": "^2.0.6",
|
||||
"bn.js": "^5.1.3",
|
||||
"borsh": "^0.4.0",
|
||||
"bs58": "4.0.1",
|
||||
"core-util-is": "^1.0.2",
|
||||
"crypto": "^1.0.1",
|
||||
"crypto-ts": "^1.0.2",
|
||||
"fs": "^0.0.1-security",
|
||||
"tweetnacl": "^1.0.3",
|
||||
"webpack-dev-server": "^3.11.2"
|
||||
"borsh": "^0.4.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ export function updateInstruction(
|
|||
];
|
||||
|
||||
const data = Buffer.concat(buffers);
|
||||
let keys = [
|
||||
const keys = [
|
||||
{
|
||||
pubkey: nameAccountKey,
|
||||
isSigner: false,
|
||||
|
@ -139,7 +139,7 @@ export function transferInstruction(
|
|||
newOwnerKey: PublicKey,
|
||||
currentNameOwnerKey: PublicKey,
|
||||
nameClassKey?: PublicKey,
|
||||
nameParent?:PublicKey
|
||||
nameParent?: PublicKey
|
||||
): TransactionInstruction {
|
||||
const buffers = [Buffer.from(Int8Array.from([2])), newOwnerKey.toBuffer()];
|
||||
|
||||
|
@ -166,7 +166,7 @@ export function transferInstruction(
|
|||
});
|
||||
}
|
||||
|
||||
if(nameParent){
|
||||
if (nameParent) {
|
||||
keys.push({
|
||||
pubkey: nameParent,
|
||||
isSigner: false,
|
||||
|
|
|
@ -35,7 +35,7 @@ export class NameRegistryState {
|
|||
connection: Connection,
|
||||
nameAccountKey: PublicKey
|
||||
): Promise<NameRegistryState> {
|
||||
let nameAccount = await connection.getAccountInfo(
|
||||
const nameAccount = await connection.getAccountInfo(
|
||||
nameAccountKey,
|
||||
'processed'
|
||||
);
|
||||
|
@ -43,7 +43,7 @@ export class NameRegistryState {
|
|||
throw new Error('Invalid name account provided');
|
||||
}
|
||||
|
||||
let res: NameRegistryState = deserializeUnchecked(
|
||||
const res: NameRegistryState = deserializeUnchecked(
|
||||
this.schema,
|
||||
NameRegistryState,
|
||||
nameAccount.data
|
||||
|
|
|
@ -4,6 +4,7 @@ import {
|
|||
SystemProgram,
|
||||
TransactionInstruction,
|
||||
} from '@solana/web3.js';
|
||||
import { deserialize, deserializeUnchecked, Schema, serialize } from 'borsh';
|
||||
|
||||
import { deleteNameRegistry, NAME_PROGRAM_ID } from './bindings';
|
||||
import {
|
||||
|
@ -20,7 +21,6 @@ import {
|
|||
Numberu32,
|
||||
Numberu64,
|
||||
} from './utils';
|
||||
import { deserialize, deserializeUnchecked, Schema, serialize } from 'borsh';
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// Global Variables
|
||||
|
@ -139,14 +139,6 @@ export async function changeVerifiedPubkey(
|
|||
];
|
||||
|
||||
// Delete the current reverse registry
|
||||
const currentHashedVerifiedPubkey = await getHashedName(
|
||||
currentVerifiedPubkey.toString()
|
||||
);
|
||||
const currentReverseRegistryKey = await getNameAccountKey(
|
||||
currentHashedVerifiedPubkey,
|
||||
TWITTER_VERIFICATION_AUTHORITY,
|
||||
undefined
|
||||
);
|
||||
instructions.push(
|
||||
await deleteNameRegistry(
|
||||
connection,
|
||||
|
@ -254,7 +246,7 @@ export async function getHandleAndRegistryKey(
|
|||
TWITTER_ROOT_PARENT_REGISTRY_KEY
|
||||
);
|
||||
|
||||
let reverseRegistryState = await ReverseTwitterRegistryState.retrieve(
|
||||
const reverseRegistryState = await ReverseTwitterRegistryState.retrieve(
|
||||
connection,
|
||||
reverseRegistryKey
|
||||
);
|
||||
|
@ -298,8 +290,8 @@ export async function getTwitterHandleandRegistryKeyViaFilters(
|
|||
|
||||
for (const f of filteredAccounts) {
|
||||
if (f.accountInfo.data.length > NameRegistryState.HEADER_LEN + 32) {
|
||||
let data = f.accountInfo.data.slice(NameRegistryState.HEADER_LEN);
|
||||
let state: ReverseTwitterRegistryState = deserialize(
|
||||
const data = f.accountInfo.data.slice(NameRegistryState.HEADER_LEN);
|
||||
const state: ReverseTwitterRegistryState = deserialize(
|
||||
ReverseTwitterRegistryState.schema,
|
||||
ReverseTwitterRegistryState,
|
||||
data
|
||||
|
@ -380,7 +372,7 @@ export class ReverseTwitterRegistryState {
|
|||
connection: Connection,
|
||||
reverseTwitterAccountKey: PublicKey
|
||||
): Promise<ReverseTwitterRegistryState> {
|
||||
let reverseTwitterAccount = await connection.getAccountInfo(
|
||||
const reverseTwitterAccount = await connection.getAccountInfo(
|
||||
reverseTwitterAccountKey,
|
||||
'processed'
|
||||
);
|
||||
|
@ -388,7 +380,7 @@ export class ReverseTwitterRegistryState {
|
|||
throw new Error('Invalid reverse Twitter account provided');
|
||||
}
|
||||
|
||||
let res: ReverseTwitterRegistryState = deserializeUnchecked(
|
||||
const res: ReverseTwitterRegistryState = deserializeUnchecked(
|
||||
this.schema,
|
||||
ReverseTwitterRegistryState,
|
||||
reverseTwitterAccount.data.slice(NameRegistryState.HEADER_LEN)
|
||||
|
@ -412,7 +404,7 @@ export async function createReverseTwitterRegistry(
|
|||
TWITTER_VERIFICATION_AUTHORITY,
|
||||
TWITTER_ROOT_PARENT_REGISTRY_KEY
|
||||
);
|
||||
let reverseTwitterRegistryStateBuff = serialize(
|
||||
const reverseTwitterRegistryStateBuff = serialize(
|
||||
ReverseTwitterRegistryState.schema,
|
||||
new ReverseTwitterRegistryState({
|
||||
twitterRegistryKey: twitterRegistryKey.toBytes(),
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue