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

Prerelease/v7 #181

Merged
merged 5 commits into from
Sep 3, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/gh-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- master
- v6
- prerelease/v*

jobs:
tests:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/gh-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
branches:
- master
- v6
- v7
types: [closed]

permissions:
Expand Down
16 changes: 1 addition & 15 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
{
"version": "1.0.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest: current file",
//"env": { "NODE_ENV": "test" },
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["${fileBasenameNoExtension}", "--config", "jest.config.js"],
"console": "integratedTerminal",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
}
}
]
"configurations": []
}
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"prettier.requireConfig": true,
"prettier.requireConfig": false,
"eslint.enable": true,
"eslint.debug": false,
"eslint.workingDirectories": [
Expand All @@ -10,5 +10,8 @@
],
"cSpell.words": [
"Streamflow"
]
],
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.preferences.importModuleSpecifierEnding": "js",
"javascript.preferences.importModuleSpecifierEnding": "js",
}
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"packages": [
"packages/*"
],
"version": "6.3.8",
"version": "7.0.0-alpha.1",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@
},
"devDependencies": {
"@types/eslint": "^8.56.3",
"@types/jest": "29.2.4",
"eslint": "^8.56.0",
"husky": "^8.0.0",
"jest": "^29.7.0",
"lerna": "7.1.4",
"lint-staged": "^13.1.0",
"ts-jest": "^29.1.1",
"typedoc": "0.25.11",
"typescript": "^5.3.3"
"typescript": "^5.3.3",
"vitest": "^2.0.5"
},
"version": "4.0.1",
"workspaces": [
Expand Down
4 changes: 2 additions & 2 deletions packages/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from "./types";
export * from "./utils";
export * from "./types.js";
export * from "./utils.js";
33 changes: 17 additions & 16 deletions packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
{
"name": "@streamflow/common",
"version": "6.3.8",
"version": "7.0.0-alpha.1",
"description": "Common utilities and types used by streamflow packages.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"main": "./dist/esm/index.js",
"types": "./dist/esm/index.d.ts",
"type": "module",
"exports": {
".": "./dist/index.js",
"./solana": "./dist/solana/index.js"
},
"typesVersions": {
"*": {
"solana": [
"dist/solana/index.d.ts"
]
".": {
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"types": "./dist/esm/index.d.ts"
},
"./solana": {
"import": "./dist/esm/solana/index.js",
"require": "./dist/cjs/solana/index.js",
"types": "./dist/esm/solana/index.d.ts"
}
},
"scripts": {
"build": "rm -rf dist; tsc -p tsconfig.json",
"build:cjs": "rm -rf dist/cjs; tsc -p tsconfig.cjs.json",
"build:esm": "rm -rf dist/esm; tsc -p tsconfig.esm.json",
"build": "rm -rf dist; pnpm run build:cjs && pnpm run build:esm",
"pack": "pnpm build && pnpm pack",
"lint": "eslint --fix .",
"lint-config": "eslint --print-config",
Expand All @@ -27,10 +31,7 @@
"devDependencies": {
"@streamflow/eslint-config": "workspace:*",
"@types/bn.js": "5.1.1",
"@types/jest": "29.2.4",
"date-fns": "2.28.0",
"jest": "29.3.1",
"ts-jest": "29.0.3",
"typescript": "^4.9.5"
},
"dependencies": {
Expand All @@ -43,6 +44,6 @@
"bn.js": "5.2.1",
"borsh": "^2.0.0",
"bs58": "5.0.0",
"p-queue": "^6.6.2"
"p-queue": "^8.0.1"
}
}
6 changes: 3 additions & 3 deletions packages/common/solana/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./instructions";
export * from "./types";
export * from "./utils";
export * from "./instructions.js";
export * from "./types.js";
export * from "./utils.js";
2 changes: 1 addition & 1 deletion packages/common/solana/instructions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
getAssociatedTokenAddress,
NATIVE_MINT,
createAssociatedTokenAccountInstruction,
createSyncNativeInstruction,
getAssociatedTokenAddress,
} from "@solana/spl-token";
import { Connection, PublicKey, SystemProgram, TransactionInstruction } from "@solana/web3.js";
import BN from "bn.js";
Expand Down
8 changes: 4 additions & 4 deletions packages/common/solana/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import {
ITransactionSolanaExt,
ThrottleParams,
TransactionFailedError,
} from "./types";
import { sleep } from "../utils";
} from "./types.js";
import { sleep } from "../utils.js";

const SIMULATE_TRIES = 3;

Expand Down Expand Up @@ -254,7 +254,7 @@ export async function sendAndConfirmTransaction(

let signature: string;
if (isVersioned) {
signature = bs58.encode(tx.signatures[0]);
signature = bs58.encode(tx.signatures[0]!);
} else {
signature = bs58.encode(tx.signature!);
}
Expand Down Expand Up @@ -513,7 +513,7 @@ export async function checkOrCreateAtaBatch(
const response = await connection.getMultipleAccountsInfo(atas);
for (let i = 0; i < response.length; i++) {
if (!response[i]) {
ixs.push(createAssociatedTokenAccountInstruction(invoker.publicKey!, atas[i], owners[i], mint, programId));
ixs.push(createAssociatedTokenAccountInstruction(invoker.publicKey!, atas[i]!, owners[i]!, mint, programId));
}
}
return ixs;
Expand Down
6 changes: 6 additions & 0 deletions packages/common/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../../tsconfig.cjs.json",
"compilerOptions": {
"outDir": "./dist/cjs"
}
}
6 changes: 6 additions & 0 deletions packages/common/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../../tsconfig.esm.json",
"compilerOptions": {
"outDir": "./dist/esm"
}
}
6 changes: 0 additions & 6 deletions packages/common/tsconfig.json

This file was deleted.

3 changes: 1 addition & 2 deletions packages/common/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { TransactionInstruction } from "@solana/web3.js";
import { Types } from "aptos";

export interface ITransactionResult {
ixs: (TransactionInstruction | Types.TransactionPayload)[];
ixs: TransactionInstruction[];
txId: string;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/common/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import BN from "bn.js";

import { ContractError } from "./types";
import { ContractError } from "./types.js";

/**
* Used for conversion of token amounts to their Big Number representation.
Expand Down
33 changes: 17 additions & 16 deletions packages/distributor/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
{
"name": "@streamflow/distributor",
"version": "6.3.8",
"version": "7.0.0-alpha.1",
"description": "JavaScript SDK to interact with Streamflow Airdrop protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"main": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"type": "module",
"exports": {
".": "./dist/index.js",
"./solana": "./dist/solana/index.js"
},
"typesVersions": {
"*": {
"solana": [
"dist/solana/index.d.ts"
]
".": {
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"types": "./dist/esm/index.d.ts"
},
"./solana": {
"import": "./dist/esm/solana/index.js",
"require": "./dist/cjs/solana/index.js",
"types": "./dist/esm/solana/index.d.ts"
}
},
"scripts": {
"build": "rm -rf dist; tsc -p tsconfig.json",
"build:cjs": "rm -rf dist/cjs; tsc -p tsconfig.cjs.json",
"build:esm": "rm -rf dist/esm; tsc -p tsconfig.esm.json",
"build": "rm -rf dist; pnpm run build:cjs && pnpm run build:esm",
"pack": "pnpm build && pnpm pack",
"lint": "eslint --fix .",
"prepublishOnly": "npm run lint && npm run build"
Expand All @@ -26,10 +30,7 @@
"devDependencies": {
"@streamflow/eslint-config": "workspace:*",
"@types/bn.js": "5.1.1",
"@types/jest": "29.2.4",
"date-fns": "2.28.0",
"jest": "29.3.1",
"ts-jest": "29.0.3",
"typescript": "^4.9.5"
},
"dependencies": {
Expand All @@ -42,6 +43,6 @@
"bn.js": "5.2.1",
"borsh": "^2.0.0",
"bs58": "5.0.0",
"p-queue": "^6.6.2"
"p-queue": "^8.0.1"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js"; // eslint-disable-line @typescript-eslint/no-unused-vars
import BN from "bn.js"; // eslint-disable-line @typescript-eslint/no-unused-vars
import * as borsh from "@coral-xyz/borsh"; // eslint-disable-line @typescript-eslint/no-unused-vars
import { Buffer } from "buffer";

import { PROGRAM_ID } from "../programId";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js"; // eslint-disable-line @typescript-eslint/no-unused-vars
import BN from "bn.js"; // eslint-disable-line @typescript-eslint/no-unused-vars
import * as borsh from "@coral-xyz/borsh"; // eslint-disable-line @typescript-eslint/no-unused-vars
import { Buffer } from "buffer";

import { PROGRAM_ID } from "../programId";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js"; // eslint-disable-line @typescript-eslint/no-unused-vars
import BN from "bn.js"; // eslint-disable-line @typescript-eslint/no-unused-vars
import * as borsh from "@coral-xyz/borsh"; // eslint-disable-line @typescript-eslint/no-unused-vars
import { Buffer } from "buffer";

import { PROGRAM_ID } from "../programId";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js"; // eslint-disable-line @typescript-eslint/no-unused-vars
import BN from "bn.js"; // eslint-disable-line @typescript-eslint/no-unused-vars
import * as borsh from "@coral-xyz/borsh"; // eslint-disable-line @typescript-eslint/no-unused-vars
import { Buffer } from "buffer";

import { PROGRAM_ID } from "../programId";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js"; // eslint-disable-line @typescript-eslint/no-unused-vars
import BN from "bn.js"; // eslint-disable-line @typescript-eslint/no-unused-vars
import * as borsh from "@coral-xyz/borsh"; // eslint-disable-line @typescript-eslint/no-unused-vars
import { Buffer } from "buffer";

import { PROGRAM_ID } from "../programId";

Expand Down
1 change: 1 addition & 0 deletions packages/distributor/solana/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { TransferFeeConfig } from "@solana/spl-token";
import { SignerWalletAdapter } from "@solana/wallet-adapter-base";
import { Buffer } from "buffer";
import { Connection, Keypair, PublicKey, Transaction, VersionedTransaction } from "@solana/web3.js";
import { ContractError } from "@streamflow/common";
import { ConfirmationParams, signAndExecuteTransaction, ThrottleParams } from "@streamflow/common/solana";
Expand Down
6 changes: 6 additions & 0 deletions packages/distributor/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../../tsconfig.cjs.json",
"compilerOptions": {
"outDir": "./dist/cjs"
}
}
6 changes: 6 additions & 0 deletions packages/distributor/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../../tsconfig.esm.json",
"compilerOptions": {
"outDir": "./dist/esm"
}
}
6 changes: 0 additions & 6 deletions packages/distributor/tsconfig.json

This file was deleted.

7 changes: 3 additions & 4 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@
module.exports = {
extends: [
"airbnb-typescript",
"plugin:jest/recommended",
"plugin:import/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
],
plugins: ["@typescript-eslint", "jest", "import"],
plugins: ["@typescript-eslint", "import"],
env: {
browser: true,
es6: true,
jest: true,
},
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2020,
sourceType: "module",
project: ["./tsconfig.json"],
project: ["./tsconfig.esm.json"],
},
ignorePatterns: ["**/dist/**/*"],
rules: {
Expand All @@ -40,6 +38,7 @@ module.exports = {
"no-debugger": "warn",
"no-console": "warn",
"import/prefer-default-export": "off",
"import/no-unresolved": "warn",
"no-plusplus": "off",
"import/named": "off",
"@typescript-eslint/no-use-before-define": "off",
Expand Down
Loading
Loading