diff --git a/README.md b/README.md
index e82b88b6..eba7905a 100644
--- a/README.md
+++ b/README.md
@@ -25,6 +25,7 @@
- [@nstudio/nativescript-qr](packages/nativescript-qr/README.md)
- [@nstudio/nativescript-tracking-transparency](packages/nativescript-tracking-transparency/README.md)
- [@nstudio/nativescript-walletconnect](packages/nativescript-walletconnect/README.md)
+- [@nstudio/nativescript-walletconnect-legacy](packages/nativescript-walletconnect-legacy/README.md)
# How to use?
diff --git a/apps/demo-angular/package.json b/apps/demo-angular/package.json
index 46a9202d..81c47e19 100644
--- a/apps/demo-angular/package.json
+++ b/apps/demo-angular/package.json
@@ -2,11 +2,12 @@
"main": "./src/main.ts",
"dependencies": {
"@nativescript/core": "file:../../node_modules/@nativescript/core",
- "@nstudio/nativescript-appcues": "file:../../dist/packages/nativescript-appcues",
+ "@nstudio/nativescript-walletconnect-legacy": "file:../../dist/packages/nativescript-walletconnect-legacy",
"@nstudio/nativescript-airship": "file:../../dist/packages/nativescript-airship",
"@nstudio/nativescript-airship-adm": "file:../../dist/packages/nativescript-airship-adm",
"@nstudio/nativescript-airship-fcm": "file:../../dist/packages/nativescript-airship-fcm",
"@nstudio/nativescript-airship-hms": "file:../../dist/packages/nativescript-airship-hms",
+ "@nstudio/nativescript-appcues": "file:../../dist/packages/nativescript-appcues",
"@nstudio/nativescript-aptabase": "file:../../dist/packages/nativescript-aptabase",
"@nstudio/nativescript-barcodescanner": "file:../../dist/packages/nativescript-barcodescanner",
"@nstudio/nativescript-blur": "file:../../dist/packages/nativescript-blur",
diff --git a/apps/demo-angular/src/app-routing.module.ts b/apps/demo-angular/src/app-routing.module.ts
index 73c62f6b..b64d8ab2 100644
--- a/apps/demo-angular/src/app-routing.module.ts
+++ b/apps/demo-angular/src/app-routing.module.ts
@@ -32,7 +32,8 @@ const routes: Routes = [
{ path: 'nativescript-plaid', loadChildren: () => import('./plugin-demos/nativescript-plaid.module').then(m => m.NativescriptPlaidModule) },
{ path: 'nativescript-qr', loadChildren: () => import('./plugin-demos/nativescript-qr.module').then(m => m.NativescriptQrModule) },
{ path: 'nativescript-tracking-transparency', loadChildren: () => import('./plugin-demos/nativescript-tracking-transparency.module').then(m => m.NativescriptTrackingTransparencyModule) },
- { path: 'nativescript-walletconnect', loadChildren: () => import('./plugin-demos/nativescript-walletconnect.module').then(m => m.NativescriptWalletconnectModule) }
+ { path: 'nativescript-walletconnect', loadChildren: () => import('./plugin-demos/nativescript-walletconnect.module').then(m => m.NativescriptWalletconnectModule) },
+ { path: 'nativescript-walletconnect-legacy', loadChildren: () => import('./plugin-demos/nativescript-walletconnect-legacy.module').then(m => m.NativescriptWalletconnectLegacyModule) }
];
@NgModule({
diff --git a/apps/demo-angular/src/home.component.ts b/apps/demo-angular/src/home.component.ts
index 09216b98..a59d4da9 100644
--- a/apps/demo-angular/src/home.component.ts
+++ b/apps/demo-angular/src/home.component.ts
@@ -86,6 +86,9 @@ export class HomeComponent {
},
{
name: 'nativescript-walletconnect'
+ },
+ {
+ name: 'nativescript-walletconnect-legacy'
}
];
}
\ No newline at end of file
diff --git a/apps/demo-angular/src/plugin-demos/nativescript-walletconnect-legacy.component.html b/apps/demo-angular/src/plugin-demos/nativescript-walletconnect-legacy.component.html
new file mode 100644
index 00000000..6f27edd1
--- /dev/null
+++ b/apps/demo-angular/src/plugin-demos/nativescript-walletconnect-legacy.component.html
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/apps/demo-angular/src/plugin-demos/nativescript-walletconnect-legacy.component.ts b/apps/demo-angular/src/plugin-demos/nativescript-walletconnect-legacy.component.ts
new file mode 100644
index 00000000..d35ecb37
--- /dev/null
+++ b/apps/demo-angular/src/plugin-demos/nativescript-walletconnect-legacy.component.ts
@@ -0,0 +1,17 @@
+import { Component, NgZone } from '@angular/core';
+import { DemoSharedNativescriptWalletconnectLegacy } from '@demo/shared';
+import {} from '@nstudio/nativescript-walletconnect-legacy';
+
+@Component({
+ selector: 'demo-nativescript-walletconnect-legacy',
+ templateUrl: 'nativescript-walletconnect-legacy.component.html',
+})
+export class NativescriptWalletconnectLegacyComponent {
+ demoShared: DemoSharedNativescriptWalletconnectLegacy;
+
+ constructor(private _ngZone: NgZone) {}
+
+ ngOnInit() {
+ this.demoShared = new DemoSharedNativescriptWalletconnectLegacy();
+ }
+}
diff --git a/apps/demo-angular/src/plugin-demos/nativescript-walletconnect-legacy.module.ts b/apps/demo-angular/src/plugin-demos/nativescript-walletconnect-legacy.module.ts
new file mode 100644
index 00000000..d7297c4e
--- /dev/null
+++ b/apps/demo-angular/src/plugin-demos/nativescript-walletconnect-legacy.module.ts
@@ -0,0 +1,10 @@
+import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
+import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular';
+import { NativescriptWalletconnectLegacyComponent } from './nativescript-walletconnect-legacy.component';
+
+@NgModule({
+ imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: NativescriptWalletconnectLegacyComponent }])],
+ declarations: [NativescriptWalletconnectLegacyComponent],
+ schemas: [NO_ERRORS_SCHEMA],
+})
+export class NativescriptWalletconnectLegacyModule {}
diff --git a/apps/demo/package.json b/apps/demo/package.json
index 1622e73a..1edb3137 100644
--- a/apps/demo/package.json
+++ b/apps/demo/package.json
@@ -3,11 +3,12 @@
"description": "NativeScript Application",
"dependencies": {
"@nativescript/core": "file:../../node_modules/@nativescript/core",
- "@nstudio/nativescript-appcues": "file:../../packages/nativescript-appcues",
+ "@nstudio/nativescript-walletconnect-legacy": "file:../../packages/nativescript-walletconnect-legacy",
"@nstudio/nativescript-airship": "file:../../packages/nativescript-airship",
"@nstudio/nativescript-airship-adm": "file:../../packages/nativescript-airship-adm",
"@nstudio/nativescript-airship-fcm": "file:../../packages/nativescript-airship-fcm",
"@nstudio/nativescript-airship-hms": "file:../../packages/nativescript-airship-hms",
+ "@nstudio/nativescript-appcues": "file:../../packages/nativescript-appcues",
"@nstudio/nativescript-aptabase": "file:../../packages/nativescript-aptabase",
"@nstudio/nativescript-barcodescanner": "file:../../packages/nativescript-barcodescanner",
"@nstudio/nativescript-blur": "file:../../packages/nativescript-blur",
diff --git a/apps/demo/src/main-page.xml b/apps/demo/src/main-page.xml
index 91f4d754..4ced6cf9 100644
--- a/apps/demo/src/main-page.xml
+++ b/apps/demo/src/main-page.xml
@@ -32,6 +32,7 @@
+
diff --git a/apps/demo/src/plugin-demos/nativescript-walletconnect-legacy.ts b/apps/demo/src/plugin-demos/nativescript-walletconnect-legacy.ts
new file mode 100644
index 00000000..98dea872
--- /dev/null
+++ b/apps/demo/src/plugin-demos/nativescript-walletconnect-legacy.ts
@@ -0,0 +1,57 @@
+import { Observable, EventData, Page } from '@nativescript/core';
+import { DemoSharedNativescriptWalletconnectLegacy } from '@demo/shared';
+import { WalletConnect } from '@nstudio/nativescript-walletconnect-legacy';
+
+export function navigatingTo(args: EventData) {
+ const page = args.object;
+ page.bindingContext = new DemoModel();
+}
+
+export class DemoModel extends DemoSharedNativescriptWalletconnectLegacy {
+ wc: WalletConnect;
+ uri = '';
+ connect() {
+ if (this.wc) {
+ this.wc.killSession();
+ this.wc = null;
+ return;
+ }
+ //const uri = decodeURIComponent(this.uri);
+
+ this.wc = new WalletConnect({
+ uri: this.uri,
+ clientMeta: {
+ description: 'WalletConnect Developer App',
+ url: 'https://walletconnect.org',
+ icons: ['https://walletconnect.org/walletconnect-logo.png'],
+ name: 'WalletConnect',
+ },
+ });
+
+ this.wc.on('session_request', (error, payload) => {
+ this.wc.approveSession({
+ accounts: ['0xCF4140193531B8b2d6864cA7486Ff2e18da5cA95'],
+ chainId: 1,
+ });
+ });
+
+ this.wc.on('connect', (error, payload) => {});
+
+ this.wc
+ .createSession()
+ .then((value) => {
+ console.log('hello', value);
+ })
+ .catch((error) => {
+ console.log(error);
+ });
+ }
+
+ killSession() {
+ this.wc?.killSession();
+ }
+
+ disconnect() {
+ this.wc?.disconnect();
+ }
+}
diff --git a/apps/demo/src/plugin-demos/nativescript-walletconnect-legacy.xml b/apps/demo/src/plugin-demos/nativescript-walletconnect-legacy.xml
new file mode 100644
index 00000000..2cbb25f2
--- /dev/null
+++ b/apps/demo/src/plugin-demos/nativescript-walletconnect-legacy.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/nativescript-walletconnect-legacy/.eslintrc.json b/packages/nativescript-walletconnect-legacy/.eslintrc.json
new file mode 100644
index 00000000..be41074b
--- /dev/null
+++ b/packages/nativescript-walletconnect-legacy/.eslintrc.json
@@ -0,0 +1,18 @@
+{
+ "extends": ["../../.eslintrc.json"],
+ "ignorePatterns": ["!**/*", "node_modules/**/*"],
+ "overrides": [
+ {
+ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
+ "rules": {}
+ },
+ {
+ "files": ["*.ts", "*.tsx"],
+ "rules": {}
+ },
+ {
+ "files": ["*.js", "*.jsx"],
+ "rules": {}
+ }
+ ]
+}
diff --git a/packages/nativescript-walletconnect-legacy/README.md b/packages/nativescript-walletconnect-legacy/README.md
new file mode 100644
index 00000000..7668894c
--- /dev/null
+++ b/packages/nativescript-walletconnect-legacy/README.md
@@ -0,0 +1,13 @@
+# @nstudio/nativescript-walletconnect-legacy
+
+```javascript
+npm install @nstudio/nativescript-walletconnect-legacy
+```
+
+## Usage
+
+// TODO
+
+## License
+
+Apache License Version 2.0
diff --git a/packages/nativescript-walletconnect-legacy/common.ts b/packages/nativescript-walletconnect-legacy/common.ts
new file mode 100644
index 00000000..30d1e814
--- /dev/null
+++ b/packages/nativescript-walletconnect-legacy/common.ts
@@ -0,0 +1,3 @@
+import { Observable } from '@nativescript/core';
+
+export class NativescriptWalletconnectLegacyCommon extends Observable {}
diff --git a/packages/nativescript-walletconnect-legacy/index.android.ts b/packages/nativescript-walletconnect-legacy/index.android.ts
new file mode 100644
index 00000000..1784781e
--- /dev/null
+++ b/packages/nativescript-walletconnect-legacy/index.android.ts
@@ -0,0 +1,394 @@
+import { Utils, fromObject } from '@nativescript/core';
+import { IClientMeta, IWalletConnect, IWalletConnectSession, WalletConnectConfig, WalletEvent } from '.';
+
+export class WalletConnectError extends Error {
+ private _native: java.lang.Exception;
+ static fromNative(native: java.lang.Exception, message?: string) {
+ const error = new WalletConnectError(message || native?.getMessage?.());
+ error._native = native;
+ return error;
+ }
+
+ get native() {
+ return this._native;
+ }
+
+ intoNative() {
+ if (!this._native) {
+ return new java.lang.Exception(this.message);
+ }
+ return this._native;
+ }
+}
+
+function getClientMeta(meta) {
+ const ret = {
+ description: null,
+ url: null,
+ icons: null,
+ name: null,
+ };
+ const peer = meta.getPeer();
+ if (peer) {
+ ret.description = peer.getDescription();
+ ret.url = peer.getUrl();
+ const nativeIcons = peer.getIcons() as java.util.List;
+ const size = nativeIcons.size();
+ const icons = [];
+ for (let i = 0; i < size; i++) {
+ icons.push(nativeIcons.get(i));
+ }
+ ret.icons = icons.length ? icons : null;
+ ret.name = peer.getName();
+ }
+
+ return ret;
+}
+
+export class WalletConnect implements IWalletConnect {
+ _internal_events = fromObject({});
+ _events = {
+ connected: [],
+ disconnected: [],
+ closed: [],
+ error: [],
+ session_update: [],
+ call_request: [],
+ session_request: [],
+ };
+ _native: io.nstudio.plugins.walletconnect_legacy.WalletConnect;
+ constructor(config: WalletConnectConfig) {
+ let icons: java.util.List = null;
+
+ if (Array.isArray(config.clientMeta.icons)) {
+ icons = new java.util.ArrayList();
+ config.clientMeta.icons.forEach((item) => {
+ icons.add(item);
+ });
+ }
+
+ const meta = new io.nstudio.plugins.walletconnect_legacy.WalletConnect.Meta(config.clientMeta.url ?? null, config.clientMeta.name ?? null, config.clientMeta.description ?? null, icons);
+
+ if (config.uri) {
+ this._native = new io.nstudio.plugins.walletconnect_legacy.WalletConnect(Utils.android.getApplicationContext(), meta, config.uri);
+ } else {
+ this._native = new io.nstudio.plugins.walletconnect_legacy.WalletConnect(Utils.android.getApplicationContext(), meta, null, config.bridge ?? null, config.key ?? null, null, 1);
+ }
+
+ const ref = new WeakRef(this);
+ this.native.setListener(
+ new io.nstudio.plugins.walletconnect_legacy.WalletConnect.Callback({
+ onMethod(event, json) {
+ const data = JSON.parse(json);
+ const owner = ref.get();
+ if (owner) {
+ switch (event) {
+ case 'session_request':
+ const id = data.id;
+ const peerId = data.peer.id;
+ const payload = {
+ id,
+ method: 'session_request',
+ params: [peerId, data.peer],
+ };
+ owner._internal_events.notify({
+ eventName: 'session_request',
+ payload,
+ });
+ owner._emitEvent('session_request', [null, payload]);
+ break;
+ case 'session_update':
+ break;
+ case 'send_transaction':
+ break;
+ case 'sign_message':
+ {
+ const payload = {
+ id: data.id,
+ method: 'eth_sign',
+ params: [data.address, data.message],
+ };
+ owner._internal_events.notify({
+ eventName: 'call_request',
+ payload,
+ });
+ }
+ break;
+ case 'custom':
+ break;
+ case 'response':
+ break;
+ }
+ }
+ },
+ onStatus(event, data) {
+ console.log('onStatus', event, data);
+ const owner = ref.get();
+ if (owner) {
+ switch (event) {
+ case 'approve':
+ break;
+ case 'connect':
+ break;
+ case 'close':
+ break;
+ case 'disconnect':
+ owner._emitEvent('disconnect', [null, null]);
+ break;
+ case 'error':
+ const err = WalletConnectError.fromNative(data, data.getMessage?.());
+ owner._internal_events.notify({
+ eventName: 'error',
+ err,
+ });
+ owner._emitEvent('error', [err, null]);
+ break;
+ }
+ }
+ },
+ })
+ );
+ }
+
+ get native() {
+ return this._native;
+ }
+
+ accounts: string[];
+
+ get connected(): boolean {
+ return this.native.getConnected();
+ }
+
+ get uri(): string {
+ return this.native.getUri();
+ }
+
+ get bridge(): string {
+ return this.native.getBridge();
+ }
+
+ get clientId(): string {
+ return this.native.getClientId();
+ }
+
+ get handshakeId(): number {
+ return this.native.getHandshakeId();
+ }
+
+ get handshakeTopic(): string {
+ return this.native.getHandshakeTopic();
+ }
+
+ get chainId(): number {
+ return this.native.getChainId();
+ }
+
+ get key(): string {
+ return this.native.getKey();
+ }
+
+ clientMeta: IClientMeta;
+
+ peerId: string;
+
+ peerMeta: IClientMeta;
+
+ get session(): IWalletConnectSession {
+ return {
+ connected: this.connected,
+ accounts: this.accounts,
+ chainId: this.chainId,
+ bridge: this.bridge,
+ key: this.key,
+ clientId: this.clientId,
+ clientMeta: this.clientMeta,
+ peerId: this.peerId,
+ peerMeta: this.peerMeta,
+ handshakeId: this.handshakeId,
+ handshakeTopic: this.handshakeTopic,
+ };
+ }
+
+ _emitEvent(event: WalletEvent, data) {
+ switch (event) {
+ case 'connect':
+ this._events.connected.forEach((cb) => {
+ cb(...data);
+ });
+ break;
+ case 'disconnect':
+ this._events.disconnected.forEach((cb) => {
+ cb(...data);
+ });
+ break;
+ case 'error':
+ this._events.error.forEach((cb) => {
+ cb(...data);
+ });
+ break;
+ case 'session_update':
+ this._events.session_update.forEach((cb) => {
+ cb(...data);
+ });
+ break;
+ case 'session_request':
+ this._events.session_request.forEach((cb) => {
+ cb(...data);
+ });
+ break;
+ case 'call_request':
+ this._events.call_request.forEach((cb) => {
+ cb(...data);
+ });
+ break;
+ }
+ }
+
+ createSession(): Promise<{ chainId: number; accounts: string[] }> {
+ return new Promise((resolve, reject) => {
+ this.native.offer();
+ });
+ }
+ approveSession(sessionStatus: { chainId: number; accounts: string[] }) {
+ this.native.approve(java.util.Arrays.asList(sessionStatus.accounts), sessionStatus.chainId);
+ }
+ rejectSession(sessionError?: { message: string }) {
+ this.native.reject();
+ }
+ updateSession(sessionStatus: { chainId: number; accounts: string[] }) {
+ this.native.updateSession(java.util.Arrays.asList(sessionStatus.accounts), sessionStatus.chainId);
+ }
+ killSession(sessionError?: { message: string }): Promise {
+ return new Promise((resolve, reject) => {
+ this.native.kill();
+ });
+ }
+ approveRequest(response: { id: number; result?: any }) {
+ this.native.approveRequest(response.id, Utils.dataSerialize(response.result));
+ }
+ rejectRequest(response: { id: number; error?: { code?: number; message?: string } }) {
+ this.native.rejectRequest(response.id, response.error?.code, response.error?.message);
+ }
+ disconnect() {
+ this.native.kill();
+ }
+
+ on(event: WalletEvent, callback: (error: Error, payload: any) => void) {
+ if (typeof callback !== 'function') {
+ return;
+ }
+ switch (event) {
+ case 'disconnect':
+ {
+ const has = this._events.disconnected.find(callback);
+ if (has) {
+ return;
+ }
+ this._events.disconnected.push(callback);
+ }
+ break;
+ case 'connect':
+ {
+ const has = this._events.connected.find(callback);
+ if (has) {
+ return;
+ }
+ this._events.connected.push(callback);
+ }
+ break;
+ case 'error':
+ {
+ const has = this._events.error.find(callback);
+ if (has) {
+ return;
+ }
+ this._events.error.push(callback);
+ }
+ break;
+ case 'session_update':
+ {
+ const has = this._events.session_update.find(callback);
+ if (has) {
+ return;
+ }
+ this._events.session_update.push(callback);
+ }
+ break;
+ case 'call_request':
+ {
+ const has = this._events.call_request.find(callback);
+ if (has) {
+ return;
+ }
+ this._events.call_request.push(callback);
+ }
+ break;
+ case 'session_request':
+ {
+ const has = this._events.session_request.find(callback);
+ if (has) {
+ return;
+ }
+ this._events.session_request.push(callback);
+ }
+ break;
+ }
+ }
+
+ off(event: WalletEvent, callback) {
+ if (typeof callback !== 'function') {
+ return;
+ }
+ switch (event) {
+ case 'disconnect':
+ {
+ const index = this._events.disconnected.indexOf(callback);
+ if (index > -1) {
+ this._events.disconnected.splice(index, 1);
+ }
+ }
+ break;
+ case 'connect':
+ {
+ const index = this._events.connected.indexOf(callback);
+ if (index > -1) {
+ this._events.connected.splice(index, 1);
+ }
+ }
+ break;
+ case 'error':
+ {
+ const index = this._events.error.indexOf(callback);
+ if (index > -1) {
+ this._events.error.splice(index, 1);
+ }
+ }
+ break;
+ case 'session_update':
+ {
+ const index = this._events.session_update.indexOf(callback);
+ if (index > -1) {
+ this._events.session_update.splice(index, 1);
+ }
+ }
+ break;
+ case 'call_request':
+ {
+ const index = this._events.call_request.indexOf(callback);
+ if (index > -1) {
+ this._events.call_request.splice(index, 1);
+ }
+ }
+ break;
+ case 'session_request':
+ {
+ const index = this._events.session_request.indexOf(callback);
+ if (index > -1) {
+ this._events.session_request.splice(index, 1);
+ }
+ }
+ break;
+ }
+ }
+}
diff --git a/packages/nativescript-walletconnect-legacy/index.d.ts b/packages/nativescript-walletconnect-legacy/index.d.ts
new file mode 100644
index 00000000..6a59d5e6
--- /dev/null
+++ b/packages/nativescript-walletconnect-legacy/index.d.ts
@@ -0,0 +1,154 @@
+export type WalletEvent = 'connect' | 'disconnect' | 'session_update' | 'call_request' | 'session_request' | 'error';
+
+export interface IClientMeta {
+ description?: string;
+ url?: string;
+ icons?: string[];
+ name?: string;
+}
+
+export declare class ClientMeta implements IClientMeta {
+ readonly description?: string;
+ readonly url?: string;
+ readonly icons?: string[];
+ readonly name?: string;
+}
+
+export interface WalletConnectConfig {
+ bridge?: string;
+ key?: string;
+ uri?: string;
+ clientMeta: IClientMeta;
+}
+
+export interface IWalletConnectSession {
+ connected: boolean;
+ accounts: string[];
+ chainId: number;
+ bridge: string;
+ key: string;
+ clientId: string;
+ clientMeta: IClientMeta | null;
+ peerId: string;
+ peerMeta: IClientMeta | null;
+ handshakeId: number;
+ handshakeTopic: string;
+}
+
+export interface IWalletConnect {
+ readonly accounts: string[];
+
+ readonly connected: boolean;
+
+ readonly uri: string | null;
+
+ readonly bridge: string;
+
+ readonly clientId: string;
+
+ readonly handshakeId: number;
+
+ readonly handshakeTopic: string;
+
+ readonly chainId: number;
+
+ readonly key: string;
+
+ readonly clientMeta: IClientMeta | null;
+
+ readonly peerId: string;
+
+ readonly peerMeta: IClientMeta | null;
+
+ readonly session: IWalletConnectSession;
+
+ on(event: WalletEvent, callback: (error: Error | null, payload: any | null) => void);
+
+ createSession(): Promise<{ chainId: number; accounts: string[] }>;
+
+ approveSession(sessionStatus: { chainId: number; accounts: string[] });
+
+ rejectSession(sessionError?: { message: string });
+
+ updateSession(sessionStatus: { chainId: number; accounts: string[] });
+
+ killSession(sessionError?: { message: string }): Promise;
+
+ approveRequest(response: { id: number; result?: any });
+
+ rejectRequest(response: {
+ id: number;
+ error?: {
+ code?: number;
+ message?: string;
+ };
+ });
+
+ disconnect();
+}
+
+export declare class WalletConnect implements IWalletConnect {
+ constructor(configuration: WalletConnectConfig);
+
+ readonly accounts: string[];
+
+ readonly connected: boolean;
+
+ readonly uri: string | null;
+
+ readonly bridge: string;
+
+ readonly clientId: string;
+
+ readonly handshakeId: number;
+
+ readonly handshakeTopic: string;
+
+ readonly chainId: number;
+
+ readonly key: string;
+
+ readonly clientMeta: IClientMeta | null;
+
+ readonly peerId: string;
+
+ readonly peerMeta: IClientMeta | null;
+
+ readonly session: IWalletConnectSession;
+
+ on(event: WalletEvent, callback: (error: Error | null, payload: any | null) => void);
+
+ connect(modal?: 'default' | 'custom', renderModal?: (qrCode: ImageSource) => View): Promise<{ chainId: number; accounts: string[] }>;
+
+ createSession(): Promise<{ chainId: number; accounts: string[] }>;
+
+ approveSession(sessionStatus: { chainId: number; accounts: string[] });
+
+ rejectSession(sessionError?: { message: string });
+
+ updateSession(sessionStatus: { chainId: number; accounts: string[] });
+
+ killSession(sessionError?: { message: string }): Promise;
+
+ sendTransaction(tx: TransactionConfig): Promise;
+
+ signMessage(params: any[]): Promise;
+
+ signPersonalMessage(params: any[]): Promise;
+
+ signTypedData(params: any[]): Promise;
+
+ sendCustomRequest(request: { id: number; method: string; params: any[] }): Promise;
+
+ approveRequest(response: { id: number; result?: any });
+
+ rejectRequest(response: {
+ id: number;
+ error?: {
+ code?: number;
+ message?: string;
+ };
+ });
+
+ disconnect();
+}
diff --git a/packages/nativescript-walletconnect-legacy/index.ios.ts b/packages/nativescript-walletconnect-legacy/index.ios.ts
new file mode 100644
index 00000000..d7d26a01
--- /dev/null
+++ b/packages/nativescript-walletconnect-legacy/index.ios.ts
@@ -0,0 +1,3 @@
+import { NativescriptWalletconnectLegacyCommon } from './common';
+
+export class NativescriptWalletconnectLegacy extends NativescriptWalletconnectLegacyCommon {}
diff --git a/packages/nativescript-walletconnect-legacy/package.json b/packages/nativescript-walletconnect-legacy/package.json
new file mode 100644
index 00000000..1f52d4ab
--- /dev/null
+++ b/packages/nativescript-walletconnect-legacy/package.json
@@ -0,0 +1,35 @@
+{
+ "name": "@nstudio/nativescript-walletconnect-legacy",
+ "version": "1.0.0",
+ "description": "Add a plugin description",
+ "main": "index",
+ "typings": "index.d.ts",
+ "nativescript": {
+ "platforms": {
+ "ios": "6.0.0",
+ "android": "6.0.0"
+ }
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/nstudio/nativescript-plugins.git"
+ },
+ "keywords": [
+ "NativeScript",
+ "JavaScript",
+ "TypeScript",
+ "iOS",
+ "Android"
+ ],
+ "author": {
+ "name": "nstudio",
+ "email": "oss@nstudio.io"
+ },
+ "bugs": {
+ "url": "https://github.com/nstudio/nativescript-plugins/issues"
+ },
+ "license": "Apache-2.0",
+ "homepage": "https://github.com/nstudio/nativescript-plugins",
+ "readmeFilename": "README.md",
+ "bootstrapper": "@nativescript/plugin-seed"
+}
diff --git a/packages/nativescript-walletconnect-legacy/platforms/android/include.gradle b/packages/nativescript-walletconnect-legacy/platforms/android/include.gradle
new file mode 100644
index 00000000..15110f33
--- /dev/null
+++ b/packages/nativescript-walletconnect-legacy/platforms/android/include.gradle
@@ -0,0 +1,12 @@
+repositories {
+ maven { url 'https://jitpack.io' }
+}
+
+dependencies {
+ implementation 'com.github.WalletConnect:kotlin-walletconnect-lib:0.9.9'
+ implementation "com.squareup.okhttp3:okhttp:4.9.3"
+ implementation "com.google.code.gson:gson:2.9.0"
+ implementation 'com.squareup.moshi:moshi:1.13.0'
+ implementation 'com.squareup.moshi:moshi-kotlin:1.13.0'
+ implementation "com.github.komputing:khex:1.0.0"
+}
\ No newline at end of file
diff --git a/packages/nativescript-walletconnect-legacy/platforms/android/java/io/nstudio/plugins/walletconnect_legacy/WalletConnect.kt b/packages/nativescript-walletconnect-legacy/platforms/android/java/io/nstudio/plugins/walletconnect_legacy/WalletConnect.kt
new file mode 100644
index 00000000..f075b71e
--- /dev/null
+++ b/packages/nativescript-walletconnect-legacy/platforms/android/java/io/nstudio/plugins/walletconnect_legacy/WalletConnect.kt
@@ -0,0 +1,274 @@
+package io.nstudio.plugins.walletconnect_legacy
+
+import android.content.Context
+import com.google.gson.Gson
+import com.squareup.moshi.Moshi
+import okhttp3.OkHttpClient
+import org.json.JSONObject
+import org.walletconnect.Session
+import org.walletconnect.impls.FileWCSessionStore
+import org.walletconnect.impls.WCSessionStore
+import java.io.File
+import java.util.Random
+import java.util.UUID
+import org.komputing.khex.extensions.toNoPrefixHexString
+import org.walletconnect.impls.MoshiPayloadAdapter
+import org.walletconnect.impls.OkHttpTransport
+import org.walletconnect.impls.WCSession
+import java.math.BigInteger
+import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
+
+class WalletConnect constructor(context: Context) {
+ private var client: OkHttpClient = OkHttpClient.Builder()
+ .build()
+ private var moshi: Moshi = Moshi.Builder()
+ .add(KotlinJsonAdapterFactory())
+ .build()
+ private var storage: WCSessionStore
+ private lateinit var config: Session.Config
+ private lateinit var session: Session
+
+ private lateinit var meta: Meta
+
+ var listener: Callback? = null
+
+ val clientId: String = UUID.randomUUID().toString()
+
+ val handshakeId: Long = - 1
+
+ data class Meta(
+ val url: String? = null,
+ val name: String? = null,
+ val description: String? = null,
+ val icons: List? = null
+ ) {
+ internal fun toMeta(): Session.PeerMeta {
+ return Session.PeerMeta(url, name, description, icons)
+ }
+ }
+
+ init {
+ storage = FileWCSessionStore(File(context.cacheDir, "session_store.json").apply { createNewFile() }, moshi)
+ }
+
+ constructor(context: Context, meta: Meta, topic: String = UUID.randomUUID().toString(), bridge: String? = null, key: String = ByteArray(32).also { Random().nextBytes(it) }.toNoPrefixHexString(), protocol: String = "wc", version: Int = 1) : this(context) {
+ config = Session.Config(
+ topic, bridge, key, protocol, version
+ )
+ this.meta = meta
+ initSession()
+ }
+
+ constructor(context: Context, meta: Meta, uri: String) : this(context) {
+ config = Session.Config.fromWCUri(uri)
+ this.meta = meta
+ initSession()
+ }
+
+ interface Callback {
+ fun onStatus(event: String, data: Any?)
+
+ fun onMethod(event: String, data: String)
+ }
+
+ interface RequestCallback {
+ fun onResponse(id: Long, error: Session.Error?, result: Any?)
+ }
+
+ private fun initSession() {
+ val session = WCSession(
+ config.toFullyQualifiedConfig(),
+ MoshiPayloadAdapter(moshi),
+ storage,
+ OkHttpTransport.Builder(client, moshi),
+ meta.toMeta()
+ )
+ session.addCallback(object : Session.Callback {
+ override fun onMethodCall(call: Session.MethodCall) {
+ val response = Gson()
+ when (call) {
+ is Session.MethodCall.SessionRequest -> {
+ chainId = call.id
+ listener?.onMethod("session_request", response.toJson(call))
+ }
+
+ is Session.MethodCall.SessionUpdate -> {
+ listener?.onMethod("session_update", response.toJson(call))
+ }
+
+ is Session.MethodCall.SendTransaction -> {
+ listener?.onMethod("send_transaction", response.toJson(call))
+ }
+
+ is Session.MethodCall.SignMessage -> {
+ listener?.onMethod("sign_message", response.toJson(call))
+ }
+
+ is Session.MethodCall.Custom -> {
+ listener?.onMethod("custom", response.toJson(call))
+ }
+
+ is Session.MethodCall.Response -> {
+ listener?.onMethod("response", response.toJson(call))
+ }
+ }
+ }
+
+ override fun onStatus(status: Session.Status) {
+ when (status) {
+ Session.Status.Connected -> {
+ connected = true
+ listener?.onStatus("connected", null)
+ }
+
+ Session.Status.Disconnected -> {
+ connected = false
+ listener?.onStatus("disconnected", null)
+ }
+
+ Session.Status.Approved -> {
+ listener?.onStatus("approved", null)
+ }
+
+ Session.Status.Closed -> {
+ listener?.onStatus("closed", null)
+ }
+
+ is Session.Status.Error -> {
+ listener?.onStatus("error", status.throwable)
+ }
+ }
+ }
+ })
+ this.session = session
+ }
+
+ val uri: String
+ get() {
+ return config.toWCUri()
+ }
+
+
+ val bridge: String
+ get() {
+ return config.bridge ?: ""
+ }
+
+ val handshakeTopic: String
+ get() {
+ return config.handshakeTopic
+ }
+
+ var connected: Boolean = false
+ private set
+
+ var chainId: Long = 0
+ private set
+
+ val key: String
+ get() {
+ return config.key ?: ""
+ }
+
+ val approvedAccounts: List
+ get() {
+ return session.approvedAccounts() ?: listOf()
+ }
+
+ fun init() {
+ session.init()
+ }
+
+ fun offer() {
+ session.offer()
+ }
+
+ fun kill() {
+ session.kill()
+ }
+
+ fun approveRequest(id: Long, response: Any) {
+ session.approveRequest(id, response)
+ }
+
+ fun approve(accounts: List, chainId: Long) {
+ session.approve(accounts, chainId)
+ }
+
+ fun reject() {
+ session.reject()
+ }
+
+ fun rejectRequest(id: Long, errorCode: Long, errorMsg: String) {
+ session.rejectRequest(id, errorCode, errorMsg)
+ }
+
+ fun updateSession(accounts: List, chainId: Long) {
+ session.update(accounts, chainId)
+ }
+
+ fun sendTransaction(id: Long,
+ from: String,
+ to: String?,
+ nonce: String?,
+ gasPrice: String?,
+ gas: String?,
+ value: String,
+ data: String,
+ callback: RequestCallback){
+ session.performMethodCall(Session.MethodCall.SendTransaction(
+ id, from, to, nonce, gasPrice, gas, value, data
+ )){ response ->
+ callback.onResponse(response.id, response.error, response.result)
+ }
+ }
+
+
+ fun signTransaction(id: Long,
+ from: String,
+ to: String?,
+ nonce: String?,
+ gasPrice: String?,
+ gas: String?,
+ value: String,
+ data: String, callback: RequestCallback){
+
+ session.performMethodCall(Session.MethodCall.Custom(
+ id, "eth_signTransaction", listOf(from, to, nonce, gasPrice, gas, value, data)
+ )){ response ->
+ callback.onResponse(response.id, response.error, response.result)
+ }
+ }
+
+ fun signMessage(id: Long, address: String, message: String, callback: RequestCallback){
+ session.performMethodCall(Session.MethodCall.SignMessage(id, address, message)){ response ->
+ callback.onResponse(response.id, response.error, response.result)
+ }
+ }
+
+ fun signPersonalMessage(id: Long, address: String, message: String, callback: RequestCallback){
+ session.performMethodCall(Session.MethodCall.Custom(id, "personal_sign", listOf(message, address))){ response ->
+ callback.onResponse(response.id, response.error, response.result)
+ }
+ }
+
+ fun signTypedData(params: List, callback: RequestCallback){
+ session.performMethodCall(Session.MethodCall.Custom(payloadId(), "eth_signTypedData", params)){ response ->
+ callback.onResponse(response.id, response.error, response.result)
+ }
+ }
+
+ fun customRequest(id: Long, method: String, params: List<*>?, callback: RequestCallback){
+ session.performMethodCall(Session.MethodCall.Custom(id, method, params)){ response ->
+ callback.onResponse(response.id, response.error, response.result)
+ }
+ }
+
+ companion object {
+ fun payloadId(entropy: Int = 3): Long {
+ val date = System.currentTimeMillis().toDouble() * Math.pow(10.0, entropy.toDouble())
+ val extra = Math.floor(Math.random() * Math.pow(10.0, entropy.toDouble()))
+ return (date + extra).toLong()
+ }
+ }
+}
diff --git a/packages/nativescript-walletconnect-legacy/platforms/android/nativescript_walletconnect_legacy.aar b/packages/nativescript-walletconnect-legacy/platforms/android/nativescript_walletconnect_legacy.aar
new file mode 100644
index 00000000..7c5b805b
Binary files /dev/null and b/packages/nativescript-walletconnect-legacy/platforms/android/nativescript_walletconnect_legacy.aar differ
diff --git a/packages/nativescript-walletconnect-legacy/platforms/ios/Podfile b/packages/nativescript-walletconnect-legacy/platforms/ios/Podfile
new file mode 100644
index 00000000..0aef3409
--- /dev/null
+++ b/packages/nativescript-walletconnect-legacy/platforms/ios/Podfile
@@ -0,0 +1,4 @@
+platform :ios, '13.0'
+use_frameworks!
+
+pod 'WalletConnectSwift'
\ No newline at end of file
diff --git a/packages/nativescript-walletconnect-legacy/platforms/ios/src/NSCWallConnectLegacyTypes.swift b/packages/nativescript-walletconnect-legacy/platforms/ios/src/NSCWallConnectLegacyTypes.swift
new file mode 100644
index 00000000..77b0ce03
--- /dev/null
+++ b/packages/nativescript-walletconnect-legacy/platforms/ios/src/NSCWallConnectLegacyTypes.swift
@@ -0,0 +1,105 @@
+import Foundation
+import WalletConnectSwift
+
+
+enum NSCParamType: Codable {
+ case bool(Bool)
+ case string(String)
+ case int(Int)
+ case double(Double)
+ case date(Date)
+ case object([String:NSCParamType])
+ case array([NSCParamType])
+ case null
+
+ public init(from decoder: Decoder) throws {
+ if let keyedContainer = try? decoder.container(keyedBy: KeyType.self) {
+ var result = [String: NSCParamType]()
+ for key in keyedContainer.allKeys {
+ result[key.stringValue] = try keyedContainer.decode(NSCParamType.self, forKey: key)
+ }
+ self = .object(result)
+ } else if var unkeyedContainer = try? decoder.unkeyedContainer() {
+ var result = [NSCParamType]()
+ while !unkeyedContainer.isAtEnd {
+ let value = try unkeyedContainer.decode(NSCParamType.self)
+ result.append(value)
+ }
+ self = .array(result)
+ } else if let singleContainer = try? decoder.singleValueContainer() {
+ if let string = try? singleContainer.decode(String.self) {
+ self = .string(string)
+ } else if let int = try? singleContainer.decode(Int.self) {
+ self = .int(int)
+ } else if let double = try? singleContainer.decode(Double.self) {
+ self = .double(double)
+ } else if let bool = try? singleContainer.decode(Bool.self) {
+ self = .bool(bool)
+ } else if singleContainer.decodeNil() {
+ self = .null
+ } else {
+ let context = DecodingError.Context(codingPath: decoder.codingPath,
+ debugDescription: "Value is not a String, Number, Bool or Null")
+ throw DecodingError.typeMismatch(NSCParamType.self, context)
+ }
+ } else {
+ let context = DecodingError.Context(codingPath: decoder.codingPath,
+ debugDescription: "Did not match any container")
+ throw DecodingError.typeMismatch(NSCParamType.self, context)
+ }
+ }
+
+
+ func encode(to encoder: Encoder) throws {
+ switch(self){
+ case .bool(let value):
+ var container = encoder.singleValueContainer()
+ try container.encode(value)
+ case .string(let value):
+ var container = encoder.singleValueContainer()
+ try container.encode(value)
+ case .int(let value):
+ var container = encoder.singleValueContainer()
+ try container.encode(value)
+ case .double(let value):
+ var container = encoder.singleValueContainer()
+ try container.encode(value)
+ case .date(let value):
+ var container = encoder.singleValueContainer()
+ try container.encode(value)
+ case .object(let object):
+ var container = encoder.container(keyedBy: KeyType.self)
+ for (key, value) in object {
+ try container.encode(value, forKey: KeyType(stringValue: key)!)
+ }
+
+ case .array(let array):
+ var container = encoder.unkeyedContainer()
+ for value in array {
+ try container.encode(value)
+ }
+ case .null:
+ var container = encoder.singleValueContainer()
+ try container.encodeNil()
+ }
+
+ }
+}
+
+
+
+struct KeyType: CodingKey {
+ var stringValue: String
+
+ init?(stringValue: String) {
+ self.stringValue = stringValue
+ self.intValue = Int(stringValue)
+ }
+
+ var intValue: Int?
+
+ init?(intValue: Int) {
+ self.intValue = intValue
+ self.stringValue = String(describing: intValue)
+ }
+}
\ No newline at end of file
diff --git a/packages/nativescript-walletconnect-legacy/platforms/ios/src/NSCWalletConnectLegacy.swift b/packages/nativescript-walletconnect-legacy/platforms/ios/src/NSCWalletConnectLegacy.swift
new file mode 100644
index 00000000..99102927
--- /dev/null
+++ b/packages/nativescript-walletconnect-legacy/platforms/ios/src/NSCWalletConnectLegacy.swift
@@ -0,0 +1,524 @@
+import Foundation
+import WalletConnectSwift
+
+@objc(NSCWalletConnectLegacyDelegate)
+protocol NSCWalletConnectLegacyDelegate {
+ func didFailToConnect()
+
+ func didConnect()
+
+ func didDisConnect()
+
+ func didUpdate()
+}
+
+
+private let ERROR_SESSION_CONNECTED = "Session currently connected"
+private let ERROR_SESSION_DISCONNECTED = "Session currently disconnected"
+private let ERROR_SESSION_REJECTED = "Session Rejected"
+
+
+
+@objc(NSCWalletConnectLegacyMeta)
+@objcMembers
+public class NSCWalletConnectLegacyMeta: NSObject {
+
+ let meta: Session.ClientMeta
+
+ public init(_ url: URL, _ name: String, _ description: String? = nil, _ icons: [URL]? = nil) {
+ meta = Session.ClientMeta(name: name, description: description, icons: icons ?? [], url: url)
+ super.init()
+ }
+
+
+ public init(meta: Session.ClientMeta) {
+ self.meta = meta
+ super.init()
+ }
+
+
+ public var name: String {
+ get {
+ return meta.name
+ }
+ }
+
+ public var desc: String? {
+ get {
+ return meta.description
+ }
+ }
+
+ public var icons: [URL] {
+ get {
+ return meta.icons
+ }
+ }
+
+ public var url: URL {
+ get {
+ return meta.url
+ }
+ }
+
+ public var scheme: String? {
+ get {
+ return meta.scheme
+ }
+ }
+}
+
+
+@objc(NSCWalletConnectLegacySession)
+@objcMembers
+public class NSCWalletConnectLegacySession: NSObject {
+ var session: Session
+ var walletCollect: NSCWalletConnectLegacy? = nil
+ public init(session: Session, walletCollect: NSCWalletConnectLegacy? = nil) {
+ self.session = session
+ self.walletCollect = walletCollect
+ super.init()
+ }
+
+ var connected: Bool {
+ get {
+ return self.walletCollect?.isConnect(session: self.session) ?? false
+ }
+ }
+ var accounts: [String] {
+ get {
+ self.session.walletInfo?.accounts ?? []
+ }
+ }
+ var chainId: Int {
+ get {
+ return self.session.walletInfo?.chainId ?? 0
+ }
+ }
+ var bridge: String {
+ get {
+ return self.session.url.absoluteString
+ }
+ }
+
+ var key: String {
+ get {
+ return self.session.url.key
+ }
+ }
+
+
+ var clientMeta: NSCWalletConnectLegacyMeta {
+ get {
+ return NSCWalletConnectLegacyMeta(meta: self.session.dAppInfo.peerMeta)
+ }
+ }
+
+ var peerId: String {
+ get {
+ return self.session.dAppInfo.peerId
+ }
+ }
+
+ var peerMeta: NSCWalletConnectLegacyMeta? {
+ get {
+ if(self.session.walletInfo != nil){
+ return NSCWalletConnectLegacyMeta(meta: self.session.walletInfo!.peerMeta)
+ }
+ return nil
+ }
+ }
+
+ var handshakeId: Int {
+ get {
+ return -1
+ }
+ }
+
+ var handshakeTopic: String {
+ get {
+ return session.url.topic
+ }
+ }
+
+
+}
+
+
+@objc(NSCWalletConnectLegacy)
+@objcMembers
+public class NSCWalletConnectLegacy: NSObject, ClientDelegate {
+ var delegate: NSCWalletConnectLegacyDelegate? = nil
+ public func client(_ client: WalletConnectSwift.Client, didFailToConnect url: WalletConnectSwift.WCURL) {
+ delegate?.didFailToConnect()
+ }
+
+ public func client(_ client: WalletConnectSwift.Client, didConnect url: WalletConnectSwift.WCURL) {
+
+ }
+
+ public func client(_ client: WalletConnectSwift.Client, didConnect session: WalletConnectSwift.Session) {
+ self.session = session
+ delegate?.didConnect()
+ }
+
+ public func client(_ client: WalletConnectSwift.Client, didDisconnect session: WalletConnectSwift.Session) {
+ delegate?.didDisConnect()
+ }
+
+ public func client(_ client: WalletConnectSwift.Client, didUpdate session: WalletConnectSwift.Session) {
+ delegate?.didUpdate()
+ }
+
+ internal var client: Client?
+ internal var session: Session?
+
+ internal var url: WCURL
+
+ init(_ meta: NSCWalletConnectLegacyMeta, _ topic: String?, _ bridge: String?, _ key: String?, _ proto: String? , _ version: Int) {
+ let topic = topic ?? UUID().uuidString
+ let key = key ?? NSCWalletConnectLegacy.randomKey()
+ let _ = proto ?? "wc"
+ url = WCURL(topic: topic, bridgeURL: URL(string: bridge ?? "https://bridge.walletconnect.org")!, key: key)
+ super.init()
+
+ self.client = Client(delegate: self)
+ }
+
+ func isConnect(session: Session) -> Bool{
+ var ret = false
+ for openSession in self.client?.openSessions() ?? [] {
+ if(session.url == openSession.url){
+ ret = true
+ break
+ }
+ }
+ return ret
+ }
+
+
+ var uri: String {
+ get {
+ return session?.url.absoluteString ?? ""
+ }
+ }
+
+ var bridge: String {
+ get {
+ return session?.url.bridgeURL.absoluteString ?? ""
+ }
+ }
+
+ var handshakeTopic: String {
+ get {
+ return session?.url.topic ?? ""
+ }
+ }
+
+ var connected: Bool {
+ get {
+ guard let session = session else {
+ return false
+ }
+ return isConnect(session: session)
+ }
+ }
+
+ var chainId: Int {
+ get {
+ return session?.dAppInfo.chainId ?? 0
+ }
+ }
+
+ var key: String {
+ get {
+ return session?.url.key ?? ""
+ }
+ }
+
+ var approvedAccounts: [String] {
+ get {
+ return session?.walletInfo?.accounts ?? []
+ }
+ }
+
+ var peerId: String {
+ get {
+ return session?.dAppInfo.peerId ?? ""
+ }
+ }
+
+
+ var peerMeta: NSCWalletConnectLegacyMeta? {
+ get {
+ if(self.session?.walletInfo != nil){
+ return NSCWalletConnectLegacyMeta(meta: self.session!.walletInfo!.peerMeta)
+ }
+ return nil
+ }
+ }
+
+
+
+ private func currentSession() -> Session? {
+ var session: Session? = nil
+ for openSession in self.client?.openSessions() ?? [] {
+ if(openSession.url == url){
+ session = openSession
+ break
+ }
+ }
+ return session
+ }
+
+
+ private(set) var pending: Bool = false
+
+ public func connect(_ callback:@escaping (NSError?) -> Void){
+ if(connected){
+ callback(NSCWalletConnectLegacy.toError(message: ERROR_SESSION_CONNECTED))
+ return
+ }
+ if(pending){
+ return
+ }
+ do {
+ try client!.connect(to: url)
+ callback(nil)
+ }catch {
+ callback(error as NSError)
+ }
+ }
+
+ public func createSession(_ callback:@escaping (NSError?) -> Void){
+ if(connected){
+ callback(NSCWalletConnectLegacy.toError(message: ERROR_SESSION_CONNECTED))
+ return
+ }
+ if(pending){
+ return
+ }
+ do {
+ try client!.connect(to: url)
+ callback(nil)
+ }catch {
+ callback(error as NSError)
+ }
+ }
+
+ public func approveRequest(id: Int, result: String, _ callback:@escaping (NSError?) -> Void){
+
+ do {
+ let response = try Response(url: url, value: result, id: id)
+ try client!.send(response)
+ callback(nil)
+ }catch {
+ callback(error as NSError)
+ }
+ }
+
+ public func rejectSession(_ callback:@escaping (NSError?) -> Void){
+ do {
+
+ let reject = try Response(url: url, error: ResponseError.requestRejected)
+ try client!.send(reject)
+ callback(nil)
+ }catch {
+ callback(error as NSError)
+ }
+ }
+
+ public func approveSession(chainId: Int, accounts: [String], _ callback:@escaping (NSError?) -> Void){
+ if(connected){
+ callback(NSCWalletConnectLegacy.toError(message: ERROR_SESSION_CONNECTED))
+ return
+ }
+
+ do {
+ let walletInfo = Session.WalletInfo(approved: true, accounts: accounts, chainId: chainId, peerId: peerId, peerMeta: peerMeta!.meta)
+ let request = try Request(url: url, method: "wc_sessionUpdate", params: [walletInfo], id: nil)
+ try client?.send(request, completion: { response in
+ if(response.error != nil){
+ callback(response.error)
+ }else {
+ callback(nil)
+ }
+ })
+ }catch {
+ callback(error as NSError)
+ }
+ }
+
+ public func updateSession(chainId: Int, accounts: [String], _ callback:@escaping (NSError?) -> Void){
+ do {
+ let currentSession = currentSession()!
+ let walletInfo = Session.WalletInfo(approved: true, accounts: accounts, chainId: chainId, peerId: currentSession.dAppInfo.peerId, peerMeta: currentSession.dAppInfo.peerMeta)
+
+ let request = try Request(url: url, method: "wc_sessionUpdate", params: [walletInfo], id: nil)
+
+ try client?.send(request, completion: { response in
+ if(response.error != nil){
+ callback(response.error)
+ }else {
+ callback(nil)
+ }
+ })
+
+ }catch {
+ callback(error as NSError)
+ }
+ }
+
+ public func rejectRequest(id: Int, errorCode: Int, errorMessage: String, callback:@escaping (NSError?) -> Void){
+ do {
+ let reject = try Response(url: url, errorCode: errorCode, message: errorMessage, id: id)
+ try client!.send(reject)
+ callback(nil)
+ }catch {
+ callback(error as NSError)
+ }
+ }
+
+
+ public func rejectRequest(id: Int, callback:@escaping (NSError?) -> Void){
+ do {
+ let reject = try Response(url: url, error: .requestRejected)
+ try client!.send(reject)
+ callback(nil)
+ }catch {
+ callback(error as NSError)
+ }
+ }
+
+
+
+ public func killSession(_ callback:@escaping (NSError?) -> Void){
+ let currentSession = currentSession()
+ if(currentSession != nil){
+ do {
+ try client!.disconnect(from: currentSession!)
+ callback(nil)
+ }catch{
+ callback(error as NSError)
+ }
+ }
+ }
+
+ public func signMessage(_ account: String, _ message: String, _ callback:@escaping (String?, NSError?) -> Void){
+ try? client!.eth_sign(url: url, account: account, message: message) {response in
+ if(response.error != nil){
+ callback(nil, response.error)
+ }else {
+ callback(try? response.result(as: String.self), nil)
+ }
+ }
+ }
+
+ public func signTransaction(_ tx: String, _ callback:@escaping (String?, NSError?) -> Void){
+
+ do {
+ let decoder = JSONDecoder()
+ let transaction = try decoder.decode(Client.Transaction.self, from: tx.data(using: .utf8)!)
+ try client!.eth_signTransaction(url: url, transaction: transaction) {response in
+ if(response.error != nil){
+ callback(nil, response.error)
+ }else {
+ callback(try? response.result(as: String.self), nil)
+ }
+ }
+ }catch {
+ callback(nil, error as NSError)
+ }
+
+ }
+
+
+ public func sendTransaction(_ tx: String, _ callback:@escaping (String?, NSError?) -> Void){
+ do {
+ let decoder = JSONDecoder()
+ let transaction = try decoder.decode(Client.Transaction.self, from: tx.data(using: .utf8)!)
+
+ try client!.eth_sendTransaction(url: url, transaction: transaction) {response in
+ if(response.error != nil){
+ callback(nil, response.error)
+ }else {
+ callback(try? response.result(as: String.self), nil)
+ }
+ }
+ }catch {}
+ }
+
+ public func signPersonalMessage(_ account: String, _ message: String, _ callback:@escaping (String?, NSError?) -> Void){
+ try? client!.personal_sign(url: url, message: message, account: account) {response in
+ if(response.error != nil){
+ callback(nil, response.error)
+ }else {
+ callback(try? response.result(as: String.self), nil)
+ }
+ }
+ }
+
+
+ public func signTypedData(_ account: String, _ message: String, _ callback:@escaping (String?, NSError?) -> Void){
+ try? client!.eth_signTypedData(url: url,account: account, message: message) {response in
+ if(response.error != nil){
+ callback(nil, response.error)
+ }else {
+ callback(try? response.result(as: String.self), nil)
+ }
+ }
+ }
+
+
+ public func sendRawTransaction(_ data: String, _ callback:@escaping (String?, NSError?) -> Void){
+ try? client?.eth_sendRawTransaction(url: url, data: data) {response in
+ if(response.error != nil){
+ callback(nil, response.error)
+ }else {
+ callback(try? response.result(as: String.self), nil)
+ }
+ }
+ }
+
+
+ public func sendCustomRequest(_ method: String, _ id: Int, _ params: String , _ callback:@escaping (String?, NSError?) -> Void){
+ do {
+ let decoder = JSONDecoder()
+ let values = try decoder.decode(Array.self, from: params.data(using: .utf8)!)
+ let request = try Request(url: url, method: method, params: values, id: id)
+ try? client!.send(request) {response in
+ if(response.error != nil){
+ callback(nil, response.error)
+ }else {
+ callback(try? response.result(as: String.self), nil)
+ }
+ }
+ }catch {
+ callback(nil, error as NSError)
+ }
+ }
+
+
+ private static func randomKey() -> String {
+ var bytes = [Int8](repeating: 0, count: 32)
+ let status = SecRandomCopyBytes(kSecRandomDefault, bytes.count, &bytes)
+ if status == errSecSuccess {
+ return Data(bytes: bytes, count: 32).toHexString()
+ } else {
+ return UUID().uuidString.bytes.toHexString()
+ }
+ }
+
+
+ private static func toError(message: String) -> NSError {
+ let exception = NSException(name: .genericException, reason: message, userInfo: nil)
+ var info: [String: Any] = [:]
+ info["ExceptionName"] = exception.name
+ info["ExceptionReason"] = exception.reason
+ info["ExceptionCallStackReturnAddresses"] = exception.callStackReturnAddresses
+ info["ExceptionCallStackSymbols"] = exception.callStackSymbols
+ info["ExceptionUserInfo"] = exception.userInfo
+ return NSError(domain: "NativeScript", code: 1001, userInfo: info)
+ }
+
+}
diff --git a/packages/nativescript-walletconnect-legacy/project.json b/packages/nativescript-walletconnect-legacy/project.json
new file mode 100644
index 00000000..a7cddb6f
--- /dev/null
+++ b/packages/nativescript-walletconnect-legacy/project.json
@@ -0,0 +1,65 @@
+{
+ "name": "nativescript-walletconnect-legacy",
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
+ "projectType": "library",
+ "sourceRoot": "packages/nativescript-walletconnect-legacy",
+ "targets": {
+ "build": {
+ "executor": "@nrwl/js:tsc",
+ "options": {
+ "outputPath": "dist/packages/nativescript-walletconnect-legacy",
+ "tsConfig": "packages/nativescript-walletconnect-legacy/tsconfig.json",
+ "packageJson": "packages/nativescript-walletconnect-legacy/package.json",
+ "main": "packages/nativescript-walletconnect-legacy/index.d.ts",
+ "assets": [
+ "packages/nativescript-walletconnect-legacy/*.md",
+ "packages/nativescript-walletconnect-legacy/index.d.ts",
+ "LICENSE",
+ {
+ "glob": "**/*",
+ "input": "packages/nativescript-walletconnect-legacy/platforms/",
+ "output": "./platforms/"
+ }
+ ],
+ "dependsOn": [
+ {
+ "target": "build.all",
+ "projects": "dependencies"
+ }
+ ]
+ }
+ },
+ "build.all": {
+ "executor": "nx:run-commands",
+ "options": {
+ "commands": ["node tools/scripts/build-finish.ts nativescript-walletconnect-legacy"],
+ "parallel": false
+ },
+ "outputs": ["dist/packages/nativescript-walletconnect-legacy"],
+ "dependsOn": [
+ {
+ "target": "build.all",
+ "projects": "dependencies"
+ },
+ {
+ "target": "build",
+ "projects": "self"
+ }
+ ]
+ },
+ "focus": {
+ "executor": "nx:run-commands",
+ "options": {
+ "commands": ["nx g @nativescript/plugin-tools:focus-packages nativescript-walletconnect-legacy"],
+ "parallel": false
+ }
+ },
+ "lint": {
+ "executor": "@nrwl/linter:eslint",
+ "options": {
+ "lintFilePatterns": ["packages/nativescript-walletconnect-legacy/**/*.ts"]
+ }
+ }
+ },
+ "tags": []
+}
diff --git a/packages/nativescript-walletconnect-legacy/references.d.ts b/packages/nativescript-walletconnect-legacy/references.d.ts
new file mode 100644
index 00000000..22bac92c
--- /dev/null
+++ b/packages/nativescript-walletconnect-legacy/references.d.ts
@@ -0,0 +1 @@
+///
diff --git a/packages/nativescript-walletconnect-legacy/tsconfig.json b/packages/nativescript-walletconnect-legacy/tsconfig.json
new file mode 100644
index 00000000..52cfe522
--- /dev/null
+++ b/packages/nativescript-walletconnect-legacy/tsconfig.json
@@ -0,0 +1,9 @@
+{
+ "extends": "../../tsconfig.base.json",
+ "compilerOptions": {
+ "outDir": "../../dist/out-tsc",
+ "rootDir": "."
+ },
+ "exclude": ["**/*.spec.ts", "**/*.test.ts", "angular"],
+ "include": ["**/*.ts", "references.d.ts"]
+}
diff --git a/packages/nativescript-walletconnect-legacy/typings/android.d.ts b/packages/nativescript-walletconnect-legacy/typings/android.d.ts
new file mode 100644
index 00000000..2c07c7da
--- /dev/null
+++ b/packages/nativescript-walletconnect-legacy/typings/android.d.ts
@@ -0,0 +1,90 @@
+declare module io {
+ export module nstudio {
+ export module plugins {
+ export module walletconnect_legacy {
+ export class WalletConnect {
+ public static class: java.lang.Class;
+ public getListener(): io.nstudio.plugins.walletconnect_legacy.WalletConnect.Callback;
+ public getBridge(): string;
+ public signTypedData(param0: java.util.List, param1: io.nstudio.plugins.walletconnect_legacy.WalletConnect.RequestCallback): void;
+ public signPersonalMessage(param0: number, param1: string, param2: string, param3: io.nstudio.plugins.walletconnect_legacy.WalletConnect.RequestCallback): void;
+ public rejectRequest(param0: number, param1: number, param2: string): void;
+ public getUri(): string;
+ public approve(param0: java.util.List, param1: number): void;
+ public reject(): void;
+ public getConnected(): boolean;
+ public getKey(): string;
+ public signTransaction(param0: number, param1: string, param2: string, param3: string, param4: string, param5: string, param6: string, param7: string, param8: io.nstudio.plugins.walletconnect_legacy.WalletConnect.RequestCallback): void;
+ public approveRequest(param0: number, param1: any): void;
+ public customRequest(param0: number, param1: string, param2: java.util.List, param3: io.nstudio.plugins.walletconnect_legacy.WalletConnect.RequestCallback): void;
+ public getApprovedAccounts(): java.util.List;
+ public getClientId(): string;
+ public getChainId(): number;
+ public getHandshakeTopic(): string;
+ public updateSession(param0: java.util.List, param1: number): void;
+ public init(): void;
+ public kill(): void;
+ public constructor(param0: globalAndroid.content.Context, param1: io.nstudio.plugins.walletconnect_legacy.WalletConnect.Meta, param2: string, param3: string, param4: string, param5: string, param6: number);
+ public constructor(param0: globalAndroid.content.Context, param1: io.nstudio.plugins.walletconnect_legacy.WalletConnect.Meta, param2: string);
+ public constructor(param0: globalAndroid.content.Context);
+ public sendTransaction(param0: number, param1: string, param2: string, param3: string, param4: string, param5: string, param6: string, param7: string, param8: io.nstudio.plugins.walletconnect_legacy.WalletConnect.RequestCallback): void;
+ public setListener(param0: io.nstudio.plugins.walletconnect_legacy.WalletConnect.Callback): void;
+ public offer(): void;
+ public signMessage(param0: number, param1: string, param2: string, param3: io.nstudio.plugins.walletconnect_legacy.WalletConnect.RequestCallback): void;
+ public getHandshakeId(): number;
+ }
+ export module WalletConnect {
+ export class Callback {
+ public static class: java.lang.Class;
+ /**
+ * Constructs a new instance of the io.nstudio.plugins.walletconnect_legacy.WalletConnect$Callback interface with the provided implementation. An empty constructor exists calling super() when extending the interface class.
+ */
+ public constructor(implementation: {
+ onStatus(param0: string, param1: any): void;
+ onMethod(param0: string, param1: string): void;
+ });
+ public constructor();
+ public onStatus(param0: string, param1: any): void;
+ public onMethod(param0: string, param1: string): void;
+ }
+ export class Companion {
+ public static class: java.lang.Class;
+ public payloadId(param0: number): number;
+ }
+ export class Meta {
+ public static class: java.lang.Class;
+ public component3(): string;
+ public constructor();
+ public constructor(param0: string, param1: string, param2: string, param3: java.util.List);
+ public component1(): string;
+ public hashCode(): number;
+ public equals(param0: any): boolean;
+ public getUrl(): string;
+ public copy(param0: string, param1: string, param2: string, param3: java.util.List): io.nstudio.plugins.walletconnect_legacy.WalletConnect.Meta;
+ public getName(): string;
+ public toString(): string;
+ public getIcons(): java.util.List;
+ public component2(): string;
+ public component4(): java.util.List;
+ public getDescription(): string;
+ public toMeta$nativescript_walletconnect_legacy_release(): org.walletconnect.Session.PeerMeta;
+ }
+ export class RequestCallback {
+ public static class: java.lang.Class;
+ /**
+ * Constructs a new instance of the io.nstudio.plugins.walletconnect_legacy.WalletConnect$RequestCallback interface with the provided implementation. An empty constructor exists calling super() when extending the interface class.
+ */
+ public constructor(implementation: {
+ onResponse(param0: number, param1: org.walletconnect.Session.Error, param2: any): void;
+ });
+ public constructor();
+ public onResponse(param0: number, param1: org.walletconnect.Session.Error, param2: any): void;
+ }
+ }
+ }
+ }
+ }
+}
+
+//Generics information:
+
diff --git a/packages/nativescript-walletconnect-legacy/typings/objc!nsswiftsupport.d.ts b/packages/nativescript-walletconnect-legacy/typings/objc!nsswiftsupport.d.ts
new file mode 100644
index 00000000..99d6738e
--- /dev/null
+++ b/packages/nativescript-walletconnect-legacy/typings/objc!nsswiftsupport.d.ts
@@ -0,0 +1,130 @@
+
+declare class NSCWalletConnectLegacy extends NSObject {
+
+ static alloc(): NSCWalletConnectLegacy; // inherited from NSObject
+
+ static new(): NSCWalletConnectLegacy; // inherited from NSObject
+
+ readonly approvedAccounts: NSArray;
+
+ readonly bridge: string;
+
+ readonly chainId: number;
+
+ readonly connected: boolean;
+
+ delegate: NSCWalletConnectLegacyDelegate;
+
+ readonly handshakeTopic: string;
+
+ readonly key: string;
+
+ readonly peerId: string;
+
+ readonly peerMeta: NSCWalletConnectLegacyMeta;
+
+ readonly pending: boolean;
+
+ readonly uri: string;
+
+ constructor();
+
+ approveRequestWithIdResult(id: number, result: string, callback: (p1: NSError) => void): void;
+
+ approveSessionWithChainIdAccounts(chainId: number, accounts: NSArray | string[], callback: (p1: NSError) => void): void;
+
+ connect(callback: (p1: NSError) => void): void;
+
+ createSession(callback: (p1: NSError) => void): void;
+
+ init(meta: NSCWalletConnectLegacyMeta, topic: string, bridge: string, key: string, proto: string, version: number): this;
+
+ killSession(callback: (p1: NSError) => void): void;
+
+ rejectRequestWithIdCallback(id: number, callback: (p1: NSError) => void): void;
+
+ rejectRequestWithIdErrorCodeErrorMessageCallback(id: number, errorCode: number, errorMessage: string, callback: (p1: NSError) => void): void;
+
+ rejectSession(callback: (p1: NSError) => void): void;
+
+ sendCustomRequest(method: string, id: number, params: string, callback: (p1: string, p2: NSError) => void): void;
+
+ sendRawTransaction(data: string, callback: (p1: string, p2: NSError) => void): void;
+
+ sendTransaction(tx: string, callback: (p1: string, p2: NSError) => void): void;
+
+ signMessage(account: string, message: string, callback: (p1: string, p2: NSError) => void): void;
+
+ signPersonalMessage(account: string, message: string, callback: (p1: string, p2: NSError) => void): void;
+
+ signTransaction(tx: string, callback: (p1: string, p2: NSError) => void): void;
+
+ signTypedData(account: string, message: string, callback: (p1: string, p2: NSError) => void): void;
+
+ updateSessionWithChainIdAccounts(chainId: number, accounts: NSArray | string[], callback: (p1: NSError) => void): void;
+}
+
+interface NSCWalletConnectLegacyDelegate {
+
+ didConnect(): void;
+
+ didDisConnect(): void;
+
+ didFailToConnect(): void;
+
+ didUpdate(): void;
+}
+declare var NSCWalletConnectLegacyDelegate: {
+
+ prototype: NSCWalletConnectLegacyDelegate;
+};
+
+declare class NSCWalletConnectLegacyMeta extends NSObject {
+
+ static alloc(): NSCWalletConnectLegacyMeta; // inherited from NSObject
+
+ static new(): NSCWalletConnectLegacyMeta; // inherited from NSObject
+
+ readonly desc: string;
+
+ readonly icons: NSArray;
+
+ readonly name: string;
+
+ readonly scheme: string;
+
+ readonly url: NSURL;
+
+ constructor();
+
+ init(url: NSURL, name: string, description: string, icons: NSArray | NSURL[]): this;
+}
+
+declare class NSCWalletConnectLegacySession extends NSObject {
+
+ static alloc(): NSCWalletConnectLegacySession; // inherited from NSObject
+
+ static new(): NSCWalletConnectLegacySession; // inherited from NSObject
+
+ readonly accounts: NSArray;
+
+ readonly bridge: string;
+
+ readonly chainId: number;
+
+ readonly clientMeta: NSCWalletConnectLegacyMeta;
+
+ readonly connected: boolean;
+
+ readonly handshakeId: number;
+
+ readonly handshakeTopic: string;
+
+ readonly key: string;
+
+ readonly peerId: string;
+
+ readonly peerMeta: NSCWalletConnectLegacyMeta;
+
+ walletCollect: NSCWalletConnectLegacy;
+}
diff --git a/tools/demo/index.ts b/tools/demo/index.ts
index d1f27e45..81d42bec 100644
--- a/tools/demo/index.ts
+++ b/tools/demo/index.ts
@@ -26,3 +26,4 @@ export * from './nativescript-plaid';
export * from './nativescript-qr';
export * from './nativescript-tracking-transparency';
export * from './nativescript-walletconnect';
+export * from './nativescript-walletconnect-legacy';
diff --git a/tools/demo/nativescript-walletconnect-legacy/index.ts b/tools/demo/nativescript-walletconnect-legacy/index.ts
new file mode 100644
index 00000000..b0a12fa7
--- /dev/null
+++ b/tools/demo/nativescript-walletconnect-legacy/index.ts
@@ -0,0 +1,8 @@
+import { DemoSharedBase } from '../utils';
+import {} from '@nstudio/nativescript-walletconnect-legacy';
+
+export class DemoSharedNativescriptWalletconnectLegacy extends DemoSharedBase {
+ testIt() {
+ console.log('test nativescript-walletconnect-legacy!');
+ }
+}
diff --git a/tools/workspace-scripts.js b/tools/workspace-scripts.js
index b0f7e5de..d5f12c88 100644
--- a/tools/workspace-scripts.js
+++ b/tools/workspace-scripts.js
@@ -267,7 +267,7 @@ module.exports = {
build: {
script: 'nx run nativescript-persona:build.all',
description: '@nstudio/nativescript-persona: Build',
- }
+ },
},
// @nstudio/nativescript-walletconnect
'nativescript-walletconnect': {
@@ -288,7 +288,7 @@ module.exports = {
build: {
script: 'nx run nativescript-appcues:build.all',
description: '@nstudio/nativescript-appcues: Build',
- }
+ },
},
// @nstudio/nativescript-cardview
'nativescript-cardview': {
@@ -304,6 +304,13 @@ module.exports = {
description: '@nstudio/nativescript-aptabase: Build',
},
},
+ // @nstudio/nativescript-walletconnect-legacy
+ 'nativescript-walletconnect-legacy': {
+ build: {
+ script: 'nx run nativescript-walletconnect-legacy:build.all',
+ description: '@nstudio/nativescript-walletconnect-legacy: Build',
+ },
+ },
'build-all': {
script: 'nx run-many --target=build.all --all',
description: 'Build all packages',
@@ -426,6 +433,10 @@ module.exports = {
script: 'nx run nativescript-aptabase:focus',
description: 'Focus on @nstudio/nativescript-aptabase',
},
+ 'nativescript-walletconnect-legacy': {
+ script: 'nx run nativescript-walletconnect-legacy:focus',
+ description: 'Focus on @nstudio/nativescript-walletconnect-legacy',
+ },
reset: {
script: 'nx g @nativescript/plugin-tools:focus-packages',
description: 'Reset Focus',
diff --git a/tsconfig.base.json b/tsconfig.base.json
index 1bd4c628..d19df797 100644
--- a/tsconfig.base.json
+++ b/tsconfig.base.json
@@ -1,123 +1,58 @@
{
- "compilerOptions": {
- "rootDir": ".",
- "sourceMap": true,
- "declaration": true,
- "moduleResolution": "node",
- "emitDecoratorMetadata": true,
- "experimentalDecorators": true,
- "noEmitHelpers": false,
- "jsx": "react",
- "target": "ES2020",
- "module": "ESNext",
- "lib": [
- "ESNext",
- "dom"
- ],
- "skipLibCheck": true,
- "skipDefaultLibCheck": true,
- "baseUrl": ".",
- "plugins": [
- {
- "transform": "@nativescript/webpack/dist/transformers/NativeClass",
- "type": "raw"
- }
- ],
- "paths": {
- "@demo/shared": [
- "tools/demo/index.ts"
- ],
- "@nstudio/nativescript-airship": [
- "packages/nativescript-airship/index.d.ts"
- ],
- "@nstudio/nativescript-airship-adm": [
- "packages/nativescript-airship-adm/index.ts"
- ],
- "@nstudio/nativescript-airship-fcm": [
- "packages/nativescript-airship-fcm/index.ts"
- ],
- "@nstudio/nativescript-airship-hms": [
- "packages/nativescript-airship-hms/index.ts"
- ],
- "@nstudio/nativescript-barcodescanner": [
- "packages/nativescript-barcodescanner/index.d.ts"
- ],
- "@nstudio/nativescript-blur": [
- "packages/nativescript-blur/index.d.ts"
- ],
- "@nstudio/nativescript-camera-plus": [
- "packages/nativescript-camera-plus/index.d.ts"
- ],
- "@nstudio/nativescript-camera-plus/angular": [
- "packages/nativescript-camera-plus/angular/index.ts"
- ],
- "@nstudio/nativescript-cardview": [
- "packages/nativescript-cardview/index.d.ts"
- ],
- "@nstudio/nativescript-carousel": [
- "packages/nativescript-carousel/index.d.ts"
- ],
- "@nstudio/nativescript-checkbox": [
- "packages/nativescript-checkbox/index.d.ts"
- ],
- "@nstudio/nativescript-checkbox/angular": [
- "packages/nativescript-checkbox/angular/index.ts"
- ],
- "@nstudio/nativescript-dynatrace": [
- "packages/nativescript-dynatrace/index.d.ts"
- ],
- "@nstudio/nativescript-embrace": [
- "packages/nativescript-embrace/index.d.ts"
- ],
- "@nstudio/nativescript-exoplayer": [
- "packages/nativescript-exoplayer/index.d.ts"
- ],
- "@nstudio/nativescript-fancyalert": [
- "packages/nativescript-fancyalert/index.d.ts"
- ],
- "@nstudio/nativescript-filterable-listpicker": [
- "packages/nativescript-filterable-listpicker/index.d.ts"
- ],
- "@nstudio/nativescript-freshchat": [
- "packages/nativescript-freshchat/index.d.ts"
- ],
- "@nstudio/nativescript-input-mask": [
- "packages/nativescript-input-mask/index.d.ts"
- ],
- "@nstudio/nativescript-intercom": [
- "packages/nativescript-intercom/index.d.ts"
- ],
- "@nstudio/nativescript-loading-indicator": [
- "packages/nativescript-loading-indicator/index.d.ts"
- ],
- "@nstudio/nativescript-onfido": [
- "packages/nativescript-onfido/index.d.ts"
- ],
- "@nstudio/nativescript-persona": [
- "packages/nativescript-persona/index.d.ts"
- ],
- "@nstudio/nativescript-plaid": [
- "packages/nativescript-plaid/index.d.ts"
- ],
- "@nstudio/nativescript-qr": [
- "packages/nativescript-qr/index.d.ts"
- ],
- "@nstudio/nativescript-tracking-transparency": [
- "packages/nativescript-tracking-transparency/index.d.ts"
- ],
- "@nstudio/nativescript-walletconnect": [
- "packages/nativescript-walletconnect/index.d.ts"
- ],
- "@nstudio/nativescript-appcues": [
- "packages/nativescript-appcues/index.d.ts"
- ],
- "@nstudio/nativescript-aptabase": [
- "packages/nativescript-aptabase/index.d.ts"
- ]
- }
- },
- "exclude": [
- "node_modules",
- "tmp"
- ]
+ "compilerOptions": {
+ "rootDir": ".",
+ "sourceMap": true,
+ "declaration": true,
+ "moduleResolution": "node",
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "noEmitHelpers": false,
+ "jsx": "react",
+ "target": "ES2020",
+ "module": "ESNext",
+ "lib": ["ESNext", "dom"],
+ "skipLibCheck": true,
+ "skipDefaultLibCheck": true,
+ "baseUrl": ".",
+ "plugins": [
+ {
+ "transform": "@nativescript/webpack/dist/transformers/NativeClass",
+ "type": "raw"
+ }
+ ],
+ "paths": {
+ "@demo/shared": ["tools/demo/index.ts"],
+ "@nstudio/nativescript-airship": ["packages/nativescript-airship/index.d.ts"],
+ "@nstudio/nativescript-airship-adm": ["packages/nativescript-airship-adm/index.ts"],
+ "@nstudio/nativescript-airship-fcm": ["packages/nativescript-airship-fcm/index.ts"],
+ "@nstudio/nativescript-airship-hms": ["packages/nativescript-airship-hms/index.ts"],
+ "@nstudio/nativescript-barcodescanner": ["packages/nativescript-barcodescanner/index.d.ts"],
+ "@nstudio/nativescript-blur": ["packages/nativescript-blur/index.d.ts"],
+ "@nstudio/nativescript-camera-plus": ["packages/nativescript-camera-plus/index.d.ts"],
+ "@nstudio/nativescript-camera-plus/angular": ["packages/nativescript-camera-plus/angular/index.ts"],
+ "@nstudio/nativescript-cardview": ["packages/nativescript-cardview/index.d.ts"],
+ "@nstudio/nativescript-carousel": ["packages/nativescript-carousel/index.d.ts"],
+ "@nstudio/nativescript-checkbox": ["packages/nativescript-checkbox/index.d.ts"],
+ "@nstudio/nativescript-checkbox/angular": ["packages/nativescript-checkbox/angular/index.ts"],
+ "@nstudio/nativescript-dynatrace": ["packages/nativescript-dynatrace/index.d.ts"],
+ "@nstudio/nativescript-embrace": ["packages/nativescript-embrace/index.d.ts"],
+ "@nstudio/nativescript-exoplayer": ["packages/nativescript-exoplayer/index.d.ts"],
+ "@nstudio/nativescript-fancyalert": ["packages/nativescript-fancyalert/index.d.ts"],
+ "@nstudio/nativescript-filterable-listpicker": ["packages/nativescript-filterable-listpicker/index.d.ts"],
+ "@nstudio/nativescript-freshchat": ["packages/nativescript-freshchat/index.d.ts"],
+ "@nstudio/nativescript-input-mask": ["packages/nativescript-input-mask/index.d.ts"],
+ "@nstudio/nativescript-intercom": ["packages/nativescript-intercom/index.d.ts"],
+ "@nstudio/nativescript-loading-indicator": ["packages/nativescript-loading-indicator/index.d.ts"],
+ "@nstudio/nativescript-onfido": ["packages/nativescript-onfido/index.d.ts"],
+ "@nstudio/nativescript-persona": ["packages/nativescript-persona/index.d.ts"],
+ "@nstudio/nativescript-plaid": ["packages/nativescript-plaid/index.d.ts"],
+ "@nstudio/nativescript-qr": ["packages/nativescript-qr/index.d.ts"],
+ "@nstudio/nativescript-tracking-transparency": ["packages/nativescript-tracking-transparency/index.d.ts"],
+ "@nstudio/nativescript-walletconnect": ["packages/nativescript-walletconnect/index.d.ts"],
+ "@nstudio/nativescript-appcues": ["packages/nativescript-appcues/index.d.ts"],
+ "@nstudio/nativescript-aptabase": ["packages/nativescript-aptabase/index.d.ts"],
+ "@nstudio/nativescript-walletconnect-legacy": ["packages/nativescript-walletconnect-legacy/index.d.ts"]
+ }
+ },
+ "exclude": ["node_modules", "tmp"]
}