Skip to content

feat(sdk-typescript): extract nautilus-wallet-client-core package #154

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

Draft
wants to merge 4 commits into
base: sdk-typescript/initial-version
Choose a base branch
from
Draft
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
29 changes: 17 additions & 12 deletions web-client-workspace/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@
"prettier": "^2.5.1",
"prettier-plugin-organize-imports": "^2.3.4",
"typescript": "^4.5.4"
},
"dependencies": {
"@msgpack/msgpack": "^2.7.1"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** MessagePack helper functions. */

import { Decoder, Encoder } from '@msgpack/msgpack';
import { Bytes } from './types';
import { Bytes } from '../schema/types';

/// Enable for verbose from_msgpack / to_msgpack console debugging logs.
const LOG_DEBUG = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
/** Core request / response message types. */

import { AlgorandTransactionSigned, WalletDisplay } from './entities';
import { Bytes, WalletId, WalletPin } from './types';
import {
AlgorandTransactionSigned,
WalletDisplay,
} from './entities';
import {
Bytes,
WalletId,
WalletPin,
} from './types';

export type CreateWallet = {
owner_name: string;
Expand Down
58 changes: 58 additions & 0 deletions web-client-workspace/sdk-typescript/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,67 @@

__metadata:
version: 5
cacheKey: 8

"@msgpack/msgpack@npm:^2.7.1":
version: 2.7.1
resolution: "@msgpack/msgpack@npm:2.7.1"
checksum: 29b4eb42aa8b300944165e1fe88c022662680b77905c108dcadba8350cc3496d56fb4de4e009d9660e7e84d5e35d206b3b829293f7d0d5944a48be60ee0ab278
languageName: node
linkType: hard

"nautilus-wallet-client-core@workspace:packages/nautilus-wallet-client-core":
version: 0.0.0-use.local
resolution: "nautilus-wallet-client-core@workspace:packages/nautilus-wallet-client-core"
dependencies:
"@msgpack/msgpack": ^2.7.1
prettier: ^2.5.1
prettier-plugin-organize-imports: ^2.3.4
typescript: ^4.5.4
languageName: unknown
linkType: soft

"prettier-plugin-organize-imports@npm:^2.3.4":
version: 2.3.4
resolution: "prettier-plugin-organize-imports@npm:2.3.4"
peerDependencies:
prettier: ">=2.0"
typescript: ">=2.9"
checksum: 2298fcae0f16fd1a095cc3a33ba5d51b679b291518d404ad5eaca56fdcfbd55d35e26c5adffcb8664bfb45c2339b551b385cf03f48888c46d0348843d96024e1
languageName: node
linkType: hard

"prettier@npm:^2.5.1":
version: 2.5.1
resolution: "prettier@npm:2.5.1"
bin:
prettier: bin-prettier.js
checksum: 21b9408476ea1c544b0e45d51ceb94a84789ff92095abb710942d780c862d0daebdb29972d47f6b4d0f7ebbfb0ffbf56cc2cfa3e3e9d1cca54864af185b15b66
languageName: node
linkType: hard

"sdk-typescript@workspace:.":
version: 0.0.0-use.local
resolution: "sdk-typescript@workspace:."
languageName: unknown
linkType: soft

"typescript@npm:^4.5.4":
version: 4.5.4
resolution: "typescript@npm:4.5.4"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 59f3243f9cd6fe3161e6150ff6bf795fc843b4234a655dbd938a310515e0d61afd1ac942799e7415e4334255e41c2c49b7dd5d9fd38a17acd25a6779ca7e0961
languageName: node
linkType: hard

"typescript@patch:typescript@^4.5.4#~builtin<compat/typescript>":
version: 4.5.4
resolution: "typescript@patch:typescript@npm%3A4.5.4#~builtin<compat/typescript>::version=4.5.4&hash=493e53"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 2e488dde7d2c4a2fa2e79cf2470600f8ce81bc0563c276b72df8ff412d74456ae532ba824650ae936ce207440c79720ddcfaa25e3cb4477572b8534fa4e34d49
languageName: node
linkType: hard
18 changes: 4 additions & 14 deletions web-client-workspace/web-client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion web-client-workspace/web-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"@fortawesome/free-solid-svg-icons": "^5.15.4",
"@ionic/angular": "^6.0.0",
"@ionic/pwa-elements": "^3.1.0",
"@msgpack/msgpack": "^2.7.1",
"@ngneat/input-mask": "^3.0.4",
"@ngneat/transloco": "^3.1.1",
"@sentry/angular": "^6.16.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import {
HttpTestingController,
} from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
import { environment } from 'src/environments/environment';
import {
from_msgpack_as,
to_msgpack_as,
} from 'nautilus-wallet-client-core/codec/msgpack';
import {
CreateWallet,
CreateWalletResult,
Expand All @@ -13,10 +16,10 @@ import {
SignTransactionResult,
WalletRequest,
WalletResponse,
} from 'src/schema/actions';
} from 'nautilus-wallet-client-core/schema/actions';
import { environment } from 'src/environments/environment';
import { AttestationReport } from 'src/schema/attestation';
import { TweetNaClCrypto } from 'src/schema/crypto';
import { from_msgpack_as, to_msgpack_as } from 'src/schema/msgpack';
import {
SealedMessage,
seal_msgpack_as,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import algosdk from 'algosdk';
import { environment } from 'src/environments/environment';
import { from_msgpack_as } from 'nautilus-wallet-client-core/codec/msgpack';
import {
CreateWallet,
CreateWalletResult,
OpenWallet,
OpenWalletResult,
SignTransaction,
SignTransactionResult,
} from 'src/schema/actions';
} from 'nautilus-wallet-client-core/schema/actions';
import { environment } from 'src/environments/environment';
import {
makePaymentTxnHelper,
OptionalParameters,
RequiredParameters,
} from 'src/schema/algorand.helpers';
import { AttestationReport } from 'src/schema/attestation';
import { PublicKey, TweetNaClCrypto } from 'src/schema/crypto';
import { from_msgpack_as } from 'src/schema/msgpack';
import { seal_msgpack_as, unseal_msgpack_as } from 'src/schema/sealing';
import { TransactionConfirmation, waitForConfirmation } from '../algosdk.utils';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { AlgorandTransactionSigned } from 'nautilus-wallet-client-core/schema/entities';
import { SessionStore } from 'src/app/stores/session';
import { never } from 'src/helpers/helpers';
import { AlgorandTransactionSigned } from 'src/schema/entities';
import { EnclaveService } from '../enclave';

type MaybeError = string | undefined;
Expand Down
2 changes: 1 addition & 1 deletion web-client-workspace/web-client/src/schema/attestation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Bytes } from 'nautilus-wallet-client-core/schema/types';
import { PublicKey } from './crypto';
import { Bytes } from './types';

export type AttestationReport = {
report: SgxReport;
Expand Down
6 changes: 5 additions & 1 deletion web-client-workspace/web-client/src/schema/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
* Interface patterned after `SodaBoxCrypto` on the server, but implemented using TweetNaCl.
*/

import {
Bytes,
Bytes24,
Bytes32,
} from 'nautilus-wallet-client-core/schema/types';
import * as nacl from 'tweetnacl';
import { BoxKeyPair } from 'tweetnacl';
import { Bytes, Bytes24, Bytes32 } from './types';

export type PublicKey = Bytes32;
export type PrivateKey = Bytes32;
Expand Down
8 changes: 6 additions & 2 deletions web-client-workspace/web-client/src/schema/sealing.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
/** [`SealedMessage`] sealing and unsealing. */

import {
from_msgpack,
from_msgpack_as,
to_msgpack,
} from 'nautilus-wallet-client-core/codec/msgpack';
import { Bytes } from 'nautilus-wallet-client-core/schema/types';
import { Nonce, PublicKey, TweetNaClCrypto } from './crypto';
import { from_msgpack, from_msgpack_as, to_msgpack } from './msgpack';
import { Bytes } from './types';

/** A sealed message */
export type SealedMessage = {
Expand Down