Skip to content

Commit

Permalink
Merge branch 'main' into feat/actions-poc
Browse files Browse the repository at this point in the history
# Conflicts:
#	packages/sdk/src/index.ts
  • Loading branch information
tsmbl committed Apr 23, 2024
2 parents d0aedcf + 5ebf184 commit 5c7e2e3
Show file tree
Hide file tree
Showing 19 changed files with 645 additions and 42 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
lib/
node_modules/

# Version
/packages/**/version.ts

# Logs
logs
*.log
Expand Down Expand Up @@ -36,3 +33,5 @@ lerna-debug.log*
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json!/prisma/node_modules/

dist/
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"ts-node": "^10.9.1",
"tsc-alias": "^1.7.0",
"tsconfig-paths": "^4.1.0",
"tsup": "^8.0.2",
"typescript": "^4.8.3"
},
"dependencies": {},
Expand Down
27 changes: 15 additions & 12 deletions packages/blockchain-sdk-solana/package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
{
"name": "@dialectlabs/blockchain-sdk-solana",
"version": "1.1.1",
"version": "1.2.0",
"type": "module",
"repository": "[email protected]:dialectlabs/sdk.git",
"author": "dialectlabs",
"license": "Apache-2.0",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts",
"sideEffects": false,
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
"import": "./lib/esm/index.js",
"require": "./lib/cjs/index.js"
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"files": [
"dist"
],
"scripts": {
"clean": "rm -rf lib",
"build": "yarn clean && yarn build:cjs; yarn build:esm",
"build": "tsup-node",
"lint": "eslint \"{src,test}/**/*.ts\" --fix",
"build:cjs": "tsc --project tsconfig.cjs.json",
"build:cjs:watch": "concurrently \"tsc --project tsconfig.cjs.json --watch\"",
"build:esm": "tsc --project tsconfig.esm.json",
"build:esm:watch": "concurrently \"tsc --project tsconfig.esm.json --watch\"",
"dev": "yarn clean && concurrently \"npm:build:cjs:watch\" \"npm:build:esm:watch\"",
"dev": "tsup-node --watch",
"test": "jest",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\""
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@solana/web3.js';
import type { DialectSolanaWalletAdapter } from './dialect-solana-wallet-adapter.interface';
import nacl from 'tweetnacl';
import { convertKeyPair } from 'ed2curve';
import ed2curve from 'ed2curve';

export class NodeDialectSolanaWalletAdapter
implements DialectSolanaWalletAdapter
Expand Down Expand Up @@ -73,7 +73,7 @@ export class NodeDialectSolanaWalletAdapter
diffieHellman(
publicKey: Uint8Array,
): Promise<{ publicKey: Uint8Array; secretKey: Uint8Array }> {
const keypair = convertKeyPair({
const keypair = ed2curve.convertKeyPair({
secretKey: this.keypair.secretKey,
publicKey,
});
Expand Down
11 changes: 11 additions & 0 deletions packages/blockchain-sdk-solana/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from 'tsup';

export default defineConfig({
entry: ['src/index.ts'],
splitting: false,
sourcemap: true,
clean: true,
dts: true,
format: ['cjs', 'esm'],
target: ['esnext'],
});
1 change: 1 addition & 0 deletions packages/identity-dialect/src/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const SDK_VERSION = '1.0.0';
4 changes: 4 additions & 0 deletions packages/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## [1.7.8] - 2024-04-18

- feat: expose dapp id in notification channel subscriptions

## [1.7.7] - 2024-04-12

- feat: hide req id from client error message
Expand Down
28 changes: 15 additions & 13 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
{
"name": "@dialectlabs/sdk",
"version": "1.7.7",
"version": "1.8.0",
"type": "module",
"repository": "[email protected]:dialectlabs/sdk.git",
"author": "dialectlabs",
"license": "Apache-2.0",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts",
"sideEffects": false,
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
"import": "./lib/esm/index.js",
"require": "./lib/cjs/index.js"
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"files": [
"dist"
],
"scripts": {
"clean": "rm -rf lib",
"generate-version": "node ./prebuild.js",
"lint": "eslint \"{src,test}/**/*.ts\" --fix",
"build": "yarn generate-version && yarn clean && yarn build:cjs; yarn build:esm",
"build:cjs": "tsc --project tsconfig.cjs.json && tsc-alias --project tsconfig.cjs.json --verbose",
"build:cjs:watch": "concurrently \"tsc --project tsconfig.cjs.json --watch\" \"tsc-alias --project tsconfig.cjs.json --verbose --watch\"",
"build:esm": "tsc --project tsconfig.esm.json && tsc-alias --project tsconfig.esm.json --verbose",
"build:esm:watch": "concurrently \"tsc --project tsconfig.esm.json --watch\" \"tsc-alias --project tsconfig.esm.json --verbose --watch\"",
"dev": "yarn clean && concurrently \"npm:build:cjs:watch\" \"npm:build:esm:watch\"",
"build": "tsup-node",
"dev": "tsup-node --watch",
"token:generate": "ts-node examples/generate-token.ts",
"test": "jest",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\""
Expand Down
6 changes: 0 additions & 6 deletions packages/sdk/prebuild.js

This file was deleted.

1 change: 1 addition & 0 deletions packages/sdk/src/address/addresses.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export function toAddressType(type: AddressTypeDto): AddressType {

export interface DappAddress {
id: string;
dappId: string;
enabled: boolean;
channelId?: string | null;
address: Address;
Expand Down
5 changes: 3 additions & 2 deletions packages/sdk/src/auth/ed25519/ed25519-token-signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import type {
TokenSigner,
TokenSignerResult,
} from '../auth.interface';
import { sign, SignKeyPair } from 'tweetnacl';
import nacl from 'tweetnacl';
import type { SignKeyPair } from 'tweetnacl';
import { Ed25519PublicKey } from './ed25519-public-key';
import { generateEd25519Keypair } from './utils';

Expand All @@ -22,7 +23,7 @@ export class Ed25519TokenSigner implements TokenSigner {
) {}

async sign(payload: Uint8Array): Promise<TokenSignerResult> {
const signature = sign.detached(payload, this.keypair.secretKey);
const signature = nacl.sign.detached(payload, this.keypair.secretKey);
return {
signature,
payload,
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/auth/ed25519/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { randomBytes, sign } from 'tweetnacl';
import nacl from 'tweetnacl';

export function generateEd25519Keypair() {
return sign.keyPair.fromSeed(Uint8Array.from(randomBytes(32)));
return nacl.sign.keyPair.fromSeed(Uint8Array.from(nacl.randomBytes(32)));
}
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export class DappTelegramBotConfigurationDto {
export class DappAddressDto {
readonly id!: string;
readonly enabled!: boolean;
readonly dapp!: DappDto;
readonly channelId?: string;
readonly address!: AddressDto;
}
Expand Down
1 change: 1 addition & 0 deletions packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ export * from './internal/identity/identity-resolvers';
export * from './dialect-cloud-api/data-service-api';
export * from './dialect-cloud-api/data-service-api-factory';
export * from './dialect-cloud-api/data-service-wallets-api.v1';
export * from './version';
export * from './dialect-cloud-api/smart-message-spec.dto';
export * from './dialect-cloud-api/smart-message.dto';
1 change: 1 addition & 0 deletions packages/sdk/src/internal/dapp/dapp-addresses-facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export class DappAddressesFacade implements DappAddresses {
walletDappAddresses.reduce((prev, curr) => ({
id: prev.id,
enabled: prev.enabled && curr.enabled,
dappId: prev.dappId,
address: {
id: prev.id,
value: walletPublicKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export function toDappAddress(dto: DappAddressDto) {
id: dto.id,
enabled: dto.enabled,
channelId: dto.channelId,
dappId: dto.dapp.id,
address: {
id: dto.address.id,
type: toAddressType(dto.address.type),
Expand Down
1 change: 1 addition & 0 deletions packages/sdk/src/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { version as SDK_VERSION } from '../package.json';
11 changes: 11 additions & 0 deletions packages/sdk/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from 'tsup';

export default defineConfig({
entry: ['src/index.ts'],
splitting: false,
sourcemap: true,
clean: true,
dts: true,
format: ['cjs', 'esm'],
target: ['esnext'],
});
Loading

0 comments on commit 5c7e2e3

Please sign in to comment.