Skip to content

feat: wallet-connect v2 #114

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 26 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a0e7f1d
feat(walleteconnect): v2
triniwiz Jan 14, 2023
a84c8fb
feat(wallet-connect): android v2
triniwiz Jan 15, 2023
2157a38
chore(wallet-connect): ios v2 clean up
triniwiz Jan 15, 2023
db013cb
feat(wallet-connect): v2 impl
triniwiz Jan 15, 2023
21e5c31
feat(wallet-connect): client impl
triniwiz Jan 15, 2023
c65394f
feat(wallet-connect): expose enums & codable class values
triniwiz Jan 16, 2023
bd77f1e
feat(wallet-connect): deserialize & events
triniwiz Jan 16, 2023
5e051e2
Update nativescript-walletconnect.ts
triniwiz Jan 16, 2023
7c58c6a
feat: full API
triniwiz Jan 17, 2023
a8b51f6
chore(wallet-connect): update demo
triniwiz Jan 20, 2023
d7d7faf
feat(wallet-connect): init update
triniwiz Jan 20, 2023
2347450
feat(wallet-connect): ios
triniwiz Jan 20, 2023
a845a55
chroe: match major version with sdk major
NathanWalker Jan 20, 2023
f82ab09
fix: buildscript
triniwiz Jan 21, 2023
d7b2941
feat: android full api
triniwiz Jan 24, 2023
d821298
feat: @nstudio/nativescript-cardview (#116)
NathanWalker Jan 18, 2023
822f1df
chore: bump plugin-tools
NathanWalker Jan 19, 2023
16b8dbd
Merge remote-tracking branch 'origin/main' into feat/wallet-connect-v2
NathanWalker Jan 31, 2023
5a8cd53
chore: 2.0.0-alpha.1
NathanWalker Jan 31, 2023
ec9a00b
fix: cancellable
NathanWalker Feb 4, 2023
ede9fae
fix(walletconnect): resolve from callback
triniwiz Feb 17, 2023
d849629
chore: bump
triniwiz Feb 17, 2023
10376e7
fix(android): arg handling issue with signRespond
NathanWalker Apr 19, 2023
b795607
chore: cleanup ios promises
NathanWalker Apr 26, 2023
c255e50
fix(android): use reflection
NathanWalker Apr 26, 2023
f477278
chore(walletconnect): 2.0.0-alpha.4
NathanWalker Apr 26, 2023
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
59 changes: 59 additions & 0 deletions apps/demo/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,65 @@
import { Application } from '@nativescript/core';
import { Client, eth_personalSign, eth_signTypedData, init, PrivateKey } from '@nstudio/nativescript-walletconnect';
init();
// import { Inquiry } from '@nstudio/nativescript-persona';

// Inquiry.init();
declare const com, io;
Client.initialize('a296125a15cc255e4aa63fffdc421458', null, {
description: 'WalletConnect Developer App',
url: 'https://walletconnect.org',
icons: ['https://walletconnect.org/walletconnect-logo.png'],
name: 'WalletConnect',
});

console.dir((io as any).nstudio.plugins.walletconnect.NSCWalletConnectV2.Numeric);

const key = new PrivateKey();


const data = ['0x4d7920656d61696c206973206a6f686e40646f652e636f6d202d2031363734353533313833303131', '0x8e210C23Fc543B754F7eA84EC10e1aDA0Efe944b'];
console.log(eth_personalSign(key, data));


const typedData = {
types: {
EIP712Domain: [
{ name: "name", type: "string" },
{ name: "version", type: "string" },
{ name: "chainId", type: "uint256" },
{ name: "verifyingContract", type: "address" },
],
Person: [
{ name: "name", type: "string" },
{ name: "account", type: "address" },
],
Mail: [
{ name: "from", type: "Person" },
{ name: "to", type: "Person" },
{ name: "contents", type: "string" },
],
},
primaryType: "Mail",
domain: {
name: "Example Dapp",
version: "1.0",
chainId: 1,
verifyingContract: "0x0000000000000000000000000000000000000000",
},
message: {
from: {
name: "Alice",
account: "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
},
to: {
name: "Bob",
account: "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
},
contents: "Hey, Bob!",
},
};

console.log(eth_signTypedData(key, typedData));


Application.run({ moduleName: 'app-root' });
187 changes: 179 additions & 8 deletions apps/demo/src/plugin-demos/nativescript-walletconnect.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Observable, EventData, Page, Application, Dialogs } from '@nativescript/core';
import { DemoSharedNativescriptWalletconnect } from '@demo/shared';
import { toHex, WalletConnect } from '@nstudio/nativescript-walletconnect';
import { Client, Namespaces, PrivateKey, eth_signTypedData, eth_personalSign, eth_sendTransaction, eth_sign, eth_signTransaction } from '@nstudio/nativescript-walletconnect';

import { PrivateKey, CoinType, CoinTypeInstance, Utils } from '@nstudio/nativescript-walletconnect/utils';
//import {PrivateKey, CoinType, CoinTypeInstance, Utils} from '@nstudio/nativescript-walletconnect/utils';

declare const io;

export function navigatingTo(args: EventData) {
const page = <Page>args.object;
@@ -11,18 +13,158 @@ export function navigatingTo(args: EventData) {

export class DemoModel extends DemoSharedNativescriptWalletconnect {
state: 'Disconnected';
wallet: WalletConnect;
//wallet: Client;
wcurl: string = '';
accounts: string;
key: PrivateKey;
address: string;
accounts: string[];
key = new PrivateKey('0xe56da0e170b5e09a8bb8f1b693392c7d56c3739a9c75740fbc558a2877868540');
constructor() {
super();
this.key = new PrivateKey('ba005cd605d8a02e3d5dfd04234cef3a3ee4f76bfbad2722d1fb5af8e12e6764');

this.address = CoinType.getInstance(CoinTypeInstance.Ethereum).deriveAddress(this.key);
Client.instance.sign.on('session_settle', (args) => {
const event = args.event;
const namespaces = event.namespaces;
const firstNs = Object.keys(namespaces)[0];
this.accounts = namespaces[firstNs].accounts;
console.log('session_settle', event);
});

Client.instance.sign.on('session_proposal', (args) => {
const meta = args.event.proposer;
Dialogs.confirm({
title: `Connect to ${meta.name}`,
message: `${meta.description}\n${meta.url}`,
okButtonText: 'Approve',
cancelButtonText: 'Reject',
}).then((done) => {
if (done) {
const proposed = args.event.requiredNamespaces;
const ns: Namespaces = {};

Object.keys(proposed).forEach((key) => {
const value = proposed[key];
const accounts = value.chains.map((id) => {
return `${id}:${this.key.address.hex(id.indexOf('eip55') > -1)}`;
});
this.accounts = accounts;
ns[key] = {
accounts,
methods: value.methods,
chains: value.chains,
events: value.events,
extension:
value?.extensions?.map?.((item) => {
return { ...item, accounts };
}) ?? undefined,
};
});

Client.instance.sign.approve({ id: args.event.id, namespaces: ns }).catch((e) => {
console.log('session_proposal', 'approve', 'error', e);
});
} else {
Client.instance.sign.reject({ id: args.event.id, reason: 'rejected' }).catch((e) => {
console.log('session_proposal', 'reject', 'error', e);
});
}
});
});

Client.instance.sign.on('session_event', (args) => {
console.log('session_event', args.event);
});

Client.instance.sign.on('session_ping', (args) => {
console.log('session_ping', args.event?.topic);
});

Client.instance.sign.on('session_request', (args) => {
const event = args.event;
const request = event.request;
const method = request.method;
const isTransaction = method === 'eth_signTransaction' || method === 'eth_sendTransaction';

console.log(request.params);

const message = JSON.stringify(request?.params);

Dialogs.confirm({
title: method,
message,
okButtonText: isTransaction ? 'Approve' : 'Sign',
cancelButtonText: isTransaction ? 'Deny' : 'Cancel',
}).then((done) => {
if (done) {
let value;

if (!this.accounts) {
const first = Client.instance.sign.getSessions()[0];
const namespaces = first?.namespaces;
const firstNs = Object.keys(namespaces)[0];
this.accounts = namespaces[firstNs].accounts;
}

if (!isTransaction) {
switch (method) {
case 'eth_sign':
value = eth_sign(this.key, request.params);
break;
case 'personal_sign':
value = eth_personalSign(this.key, request.params);
break;
case 'eth_signTypedData':
value = eth_signTypedData(this.key, request.params);
break;
}
} else {
if (method === 'eth_signTransaction') {
value = eth_signTransaction(this.key, request.params);
console.log(value);
} else {
value = eth_sendTransaction(this.key, request.params);
}
}
console.log('aaa', value);

console.log({ topic: event.topic, id: request.id, response: value });

Client.instance.sign.respond({ topic: event.topic, id: request.id, response: value });
} else {
Client.instance.sign.respond({
id: event.request.id,
topic: event.topic,
response: {
code: 1000,
message: 'User Rejected Session Request',
},
});
}
});
});

Client.instance.sign.on('session_update', (args) => {
console.log(args.event.namespaces);
console.log('session_update', args.event);
});

Client.instance.sign.on('session_delete', (args) => {
console.log('session_delete', args.event);
});

// this.key = new PrivateKey('ba005cd605d8a02e3d5dfd04234cef3a3ee4f76bfbad2722d1fb5af8e12e6764');

// this.address = CoinType.getInstance(CoinTypeInstance.Ethereum).deriveAddress(this.key);
}

pair() {
Client.instance.pair.pair({ uri: this.wcurl });

Client.instance.pair.getPairings().forEach((item) => {
Client.instance.pair.disconnect({ topic: item.topic });
});
}

/*
resetConnection() {
this.wallet = new WalletConnect({
uri: this.wcurl,
@@ -179,4 +321,33 @@ export class DemoModel extends DemoSharedNativescriptWalletconnect {
rejectSession() {
this.wallet.rejectSession();
}
*/
}

/*
[
{
types: {
EIP712Domain: [
{ name: 'name', type: 'string' },
{ name: 'version', type: 'string' },
{ name: 'chainId', type: 'uint256' },
{ name: 'verifyingContract', type: 'address' },
],
Person: [
{ name: 'name', type: 'string' },
{ name: 'wallet', type: 'address' },
],
Mail: [
{ name: 'from', type: 'Person' },
{ name: 'to', type: 'Person' },
{ name: 'contents', type: 'string' },
],
},
primaryType: 'Mail',
domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC' },
message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826' }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB' }, contents: 'Hello, Bob!' },
},
];
*/
2 changes: 1 addition & 1 deletion apps/demo/src/plugin-demos/nativescript-walletconnect.xml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
<Label text="{{ state }}" />
<Label text="{{ accounts }}" />
<TextView text="{{ wcurl }}" hint="Enter WCURL"/>
<Button text="Create Session" tap="{{ createSession }}" class="btn btn-primary"/>
<Button text="Pair" tap="{{ pair }}" class="btn btn-primary"/>
<Button text="Approve Session" tap="{{ approveSession }}" class="btn btn-primary"/>
<Button text="Open WCUrl" tap="{{ openWCUrl }}" class="btn btn-primary"/>
<Button text="Reject Session" tap="{{ rejectSession }}" class="btn btn-primary"/>
Binary file not shown.
3 changes: 2 additions & 1 deletion packages/nativescript-walletconnect/common.ts
Original file line number Diff line number Diff line change
@@ -2,4 +2,5 @@ export function generateId() {
const datePart = new Date().getTime() * Math.pow(10, 3);
const extraPart = Math.floor(Math.random() * Math.pow(10, 3));
return datePart + extraPart;
}
}

2,058 changes: 1,591 additions & 467 deletions packages/nativescript-walletconnect/index.android.ts

Large diffs are not rendered by default.

366 changes: 261 additions & 105 deletions packages/nativescript-walletconnect/index.d.ts

Large diffs are not rendered by default.

1,719 changes: 1,237 additions & 482 deletions packages/nativescript-walletconnect/index.ios.ts

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/nativescript-walletconnect/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@nstudio/nativescript-walletconnect",
"version": "1.0.0",
"description": "Add a plugin description",
"version": "2.0.0-alpha.4",
"description": "WalletConnect SDK for NativeScript",
"main": "index",
"typings": "index.d.ts",
"nativescript": {
Original file line number Diff line number Diff line change
@@ -4,7 +4,11 @@ repositories {
}

dependencies {
implementation "com.github.TrustWallet:wallet-connect-kotlin:1.5.6"
implementation(platform("com.walletconnect:android-bom:1.3.0"))
implementation "com.walletconnect:android-core"
implementation "com.walletconnect:auth"
implementation "com.walletconnect:sign"
implementation 'com.walletconnect:web3wallet'
implementation "com.squareup.okhttp3:okhttp:4.9.3"
implementation "com.google.code.gson:gson:2.9.0"
implementation "com.google.code.gson:gson:2.9.0"
}

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
Binary file not shown.
9 changes: 7 additions & 2 deletions packages/nativescript-walletconnect/platforms/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
pod 'WalletConnect', git: 'https://github.com/triniwiz/wallet-connect-swift', branch: 'master'
pod 'TrustWalletCore', '~> 3.0.4'
#pod 'WalletConnect', git: 'https://github.com/triniwiz/wallet-connect-swift', branch: 'master'
pod 'TrustWalletCore', '~> 3.1.9'
pod 'WalletConnectSwiftV2', '~> 1.1.0'
pod 'WalletConnectSwiftV2/WalletConnectAuth', '~> 1.1.0'
pod 'WalletConnectSwiftV2/WalletConnectRelay', '~> 1.1.0'
pod 'Starscream', '~> 3.1.1'
pod 'WalletConnectWeb3', '~> 1.0.2'
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// AuthSignerFactory.swift
//
// Created by Osei Fortune on 09/01/2023.
// Copyright © 2023 NativeScript. All rights reserved.
//

import Foundation
import CryptoSwift
import Web3
import WalletConnectSwiftV2

public struct AuthSignerFactory: SignerFactory {

public func createEthereumSigner() -> EthereumSigner {
return Web3Signer()
}
}

public struct Web3Signer: EthereumSigner {

public func sign(message: Data, with key: Data) throws -> EthereumSignature {
let privateKey = try EthereumPrivateKey(privateKey: [UInt8](key))
let signature = try privateKey.sign(message: message.bytes)
return EthereumSignature(v: UInt8(signature.v), r: signature.r, s: signature.s)
}

public func recoverPubKey(signature: EthereumSignature, message: Data) throws -> Data {
let publicKey = try EthereumPublicKey(
message: message.bytes,
v: EthereumQuantity(quantity: BigUInt(signature.v)),
r: EthereumQuantity(signature.r),
s: EthereumQuantity(signature.s)
)
return Data(publicKey.rawPublicKey)
}

public func keccak256(_ data: Data) -> Data {
let digest = SHA3(variant: .keccak256)
let hash = digest.calculate(for: [UInt8](data))
return Data(hash)
}

public func keccak256(_ data: [UInt8]) -> Data {
let digest = SHA3(variant: .keccak256)
let hash = digest.calculate(for: data)
return Data(hash)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// DefaultSocketFactory.swift
//
// Created by Osei Fortune on 09/01/2023.
// Copyright © 2023 NativeScript. All rights reserved.
//
import Foundation
import Starscream
import WalletConnectSwiftV2

extension WebSocket: WebSocketConnecting {}

struct SocketFactory: WebSocketFactory {
func create(with url: URL) -> WebSocketConnecting {
return WebSocket(url: url)
}
}

This file was deleted.

This file was deleted.

1,560 changes: 1,560 additions & 0 deletions packages/nativescript-walletconnect/platforms/ios/src/NSCWalletConnectV2.swift

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// NSCWalletConnectV2Helpers.swift
//
// Created by Osei Fortune on 20/01/2023.
// Copyright © 2023 NativeScript. All rights reserved.
//

import Foundation
import WalletCore

@objcMembers
@objc(NSCWalletConnectV2Helpers)
public class NSCWalletConnectV2Helpers: NSObject {
public static func stringToData(hex: String) -> Data {
return Data(hex: hex)
}
}


public extension NSCWalletConnectV2ETHSigner {

// keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))

static func signTypedData(_ privateKey: NSCWalletConnectV2EthereumPrivateKey,_ params: NSCWalletConnectV2Codable) -> NSCWalletConnectV2Codable {
let params = try! params.get([String].self)

let messageToSign = params[1]

let encodedMessage = EthereumAbi.encodeTyped(messageJson: messageToSign)

let dataToHash = dataToPrefix(encodedMessage)

let (v, r, s) = try! privateKey.key.sign(message: .init(hex: dataToHash.toHexString()))

let result = "0x" + r.toHexString() + s.toHexString() + String(v + 27, radix: 16)

return NSCWalletConnectV2Codable(string: result)

}
}
25,535 changes: 0 additions & 25,535 deletions packages/nativescript-walletconnect/typings/android-trust-wallet.d.ts

This file was deleted.

17,251 changes: 16,224 additions & 1,027 deletions packages/nativescript-walletconnect/typings/android.d.ts

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions packages/nativescript-walletconnect/typings/kotlin.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
declare module kotlin {
export module jvm {
export module functions {
export class Function0 {
public static class: java.lang.Class<kotlin.jvm.functions.Function0>;
/**
* Constructs a new instance of the kotlin.jvm.functions.Function0 interface with the provided implementation. An empty constructor exists calling super() when extending the interface class.
*/
public constructor(implementation: {
invoke(): void;
});
public constructor();
public invoke(): void;
}

export class Function1<A> {
public static class: java.lang.Class<kotlin.jvm.functions.Function1>;
/**
* Constructs a new instance of the kotlin.jvm.functions.Function1 interface with the provided implementation. An empty constructor exists calling super() when extending the interface class.
*/
public constructor(implementation: {
invoke(param0: A): void;
});
public constructor();
public invoke(param0: A): void;
}

export class Function2<A,B> {
public static class: java.lang.Class<kotlin.jvm.functions.Function2>;
/**
* Constructs a new instance of the kotlin.jvm.functions.Function2 interface with the provided implementation. An empty constructor exists calling super() when extending the interface class.
*/
public constructor(implementation: {
invoke(param0: A, param1: B): void;
});
public constructor();
public invoke(param0: A, param1: B): void;
}
}
}
}
1,314 changes: 0 additions & 1,314 deletions packages/nativescript-walletconnect/typings/objc!WalletCore.d.ts

This file was deleted.

628 changes: 522 additions & 106 deletions packages/nativescript-walletconnect/typings/objc!nsswiftsupport.d.ts

Large diffs are not rendered by default.

197 changes: 197 additions & 0 deletions packages/nativescript-walletconnect/typings/plugin-android.d.ts

Large diffs are not rendered by default.

597 changes: 597 additions & 0 deletions packages/nativescript-walletconnect/typings/web3-crypto-android.d.ts

Large diffs are not rendered by default.

194 changes: 194 additions & 0 deletions packages/nativescript-walletconnect/typings/web3-utils-android.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
declare module org {
export module web3j {
export module commons {
export class ChainId {
public static class: java.lang.Class<org.web3j.commons.ChainId>;
public static MAIN_NET: org.web3j.commons.ChainId;
public static values(): androidNative.Array<org.web3j.commons.ChainId>;
public static valueOf(param0: string): org.web3j.commons.ChainId;
public getId(): number;
}
}
}
}

declare module org {
export module web3j {
export module commons {
export class JavaVersion {
public static class: java.lang.Class<org.web3j.commons.JavaVersion>;
public static getJavaVersionAsDouble(): number;
public static getJavaVersion(): string;
public constructor();
}
}
}
}

declare module org {
export module web3j {
export module crypto {
export class Hash {
public static class: java.lang.Class<org.web3j.crypto.Hash>;
public static hash(param0: androidNative.Array<number>, param1: string): androidNative.Array<number>;
public static sha3(param0: androidNative.Array<number>): androidNative.Array<number>;
public static blake2b256(param0: androidNative.Array<number>): androidNative.Array<number>;
public static sha3String(param0: string): string;
public static sha3(param0: string): string;
public static sha256(param0: androidNative.Array<number>): androidNative.Array<number>;
public static sha256hash160(param0: androidNative.Array<number>): androidNative.Array<number>;
public static sha3(param0: androidNative.Array<number>, param1: number, param2: number): androidNative.Array<number>;
public static hmacSha512(param0: androidNative.Array<number>, param1: androidNative.Array<number>): androidNative.Array<number>;
}
}
}
}

declare module org {
export module web3j {
export module crypto {
export class Pair {
public static class: java.lang.Class<org.web3j.crypto.Pair>;
public constructor(param0: any, param1: any);
public getFirst(): any;
public getSecond(): any;
}
}
}
}

declare module org {
export module web3j {
export module exceptions {
export class MessageDecodingException {
public static class: java.lang.Class<org.web3j.exceptions.MessageDecodingException>;
public constructor(param0: string, param1: java.lang.Throwable);
public constructor(param0: string);
}
}
}
}

declare module org {
export module web3j {
export module exceptions {
export class MessageEncodingException {
public static class: java.lang.Class<org.web3j.exceptions.MessageEncodingException>;
public constructor(param0: string, param1: java.lang.Throwable);
public constructor(param0: string);
}
}
}
}

declare module org {
export module web3j {
export module utils {
export class Assertions {
public static class: java.lang.Class<org.web3j.utils.Assertions>;
public static verifyPrecondition(param0: boolean, param1: string): void;
public constructor();
}
}
}
}

declare module org {
export module web3j {
export module utils {
export class Bytes {
public static class: java.lang.Class<org.web3j.utils.Bytes>;
public static trimLeadingZeroes(param0: androidNative.Array<number>): androidNative.Array<number>;
public static trimLeadingBytes(param0: androidNative.Array<number>, param1: number): androidNative.Array<number>;
}
}
}
}

declare module org {
export module web3j {
export module utils {
export class Convert {
public static class: java.lang.Class<org.web3j.utils.Convert>;
public static fromWei(param0: string, param1: org.web3j.utils.Convert.Unit): java.math.BigDecimal;
public static toWei(param0: string, param1: org.web3j.utils.Convert.Unit): java.math.BigDecimal;
public static toWei(param0: java.math.BigDecimal, param1: org.web3j.utils.Convert.Unit): java.math.BigDecimal;
public static fromWei(param0: java.math.BigDecimal, param1: org.web3j.utils.Convert.Unit): java.math.BigDecimal;
}
export module Convert {
export class Unit {
public static class: java.lang.Class<org.web3j.utils.Convert.Unit>;
public static WEI: org.web3j.utils.Convert.Unit;
public static KWEI: org.web3j.utils.Convert.Unit;
public static MWEI: org.web3j.utils.Convert.Unit;
public static GWEI: org.web3j.utils.Convert.Unit;
public static SZABO: org.web3j.utils.Convert.Unit;
public static FINNEY: org.web3j.utils.Convert.Unit;
public static ETHER: org.web3j.utils.Convert.Unit;
public static KETHER: org.web3j.utils.Convert.Unit;
public static METHER: org.web3j.utils.Convert.Unit;
public static GETHER: org.web3j.utils.Convert.Unit;
public toString(): string;
public static valueOf(param0: string): org.web3j.utils.Convert.Unit;
public getWeiFactor(): java.math.BigDecimal;
public static fromString(param0: string): org.web3j.utils.Convert.Unit;
public static values(): androidNative.Array<org.web3j.utils.Convert.Unit>;
}
}
}
}
}

declare module org {
export module web3j {
export module utils {
export class Numeric {
public static class: java.lang.Class<org.web3j.utils.Numeric>;
public static toBigInt(param0: string): java.math.BigInteger;
public static prependHexPrefix(param0: string): string;
public static toHexStringWithPrefixZeroPadded(param0: java.math.BigInteger, param1: number): string;
public static toHexStringWithPrefix(param0: java.math.BigInteger): string;
public static decodeQuantity(param0: string): java.math.BigInteger;
public static removeDoubleQuotes(param0: string): string;
/** @deprecated */
public static toHexStringWithPrefixSafe(param0: java.math.BigInteger): string;
public static toBytesPadded(param0: java.math.BigInteger, param1: number): androidNative.Array<number>;
public static toHexString(param0: androidNative.Array<number>, param1: number, param2: number, param3: boolean): string;
public static toHexStringNoPrefix(param0: java.math.BigInteger): string;
public static toBigIntNoPrefix(param0: string): java.math.BigInteger;
public static cleanHexPrefix(param0: string): string;
public static isIntegerValue(param0: java.math.BigDecimal): boolean;
public static hexStringToByteArray(param0: string): androidNative.Array<number>;
public static asByte(param0: number, param1: number): number;
public static encodeQuantity(param0: java.math.BigInteger): string;
public static toBigInt(param0: androidNative.Array<number>): java.math.BigInteger;
public static containsHexPrefix(param0: string): boolean;
public static toBigInt(param0: androidNative.Array<number>, param1: number, param2: number): java.math.BigInteger;
public static toHexStringNoPrefixZeroPadded(param0: java.math.BigInteger, param1: number): string;
public static toHexString(param0: androidNative.Array<number>): string;
public static toHexStringNoPrefix(param0: androidNative.Array<number>): string;
}
}
}
}

declare module org {
export module web3j {
export module utils {
export class Strings {
public static class: java.lang.Class<org.web3j.utils.Strings>;
public static toCsv(param0: java.util.List<string>): string;
public static zeros(param0: number): string;
public static isBlank(param0: string): boolean;
public static capitaliseFirstLetter(param0: string): string;
public static repeat(param0: string, param1: number): string;
public static lowercaseFirstLetter(param0: string): string;
public static isEmpty(param0: string): boolean;
public static join(param0: java.util.List<string>, param1: string): string;
}
}
}
}

//Generics information:

4 changes: 4 additions & 0 deletions packages/nativescript-walletconnect/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
declare const io;
let didLoad = false;
@@ -214,3 +215,6 @@ export class Utils {
}
}
}
*/
2 changes: 1 addition & 1 deletion references.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/// <reference path="./node_modules/@nativescript/types-ios/index.d.ts" />
/// <reference path="./node_modules/@nativescript/types-android/lib/android-29.d.ts" />
/// <reference path="./node_modules/@nativescript/types-android/lib/android-33.d.ts" />
18 changes: 18 additions & 0 deletions tools/assets/App_Resources/Android/app.gradle
Original file line number Diff line number Diff line change
@@ -24,3 +24,21 @@ android {
additionalParameters "--no-version-vectors"
}
}


configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'androidx.lifecycle') {
if(requested.name == 'lifecycle-viewmodel'){
details.useTarget 'androidx.lifecycle:lifecycle-viewmodel:2.5.1'
}

if(requested.name == 'lifecycle-viewmodel-ktx'){
details.useTarget 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
}

}
}
}

Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

<application
android:largeHeap="true"
android:name="com.tns.NativeScriptApplication"
android:allowBackup="true"
android:icon="@drawable/icon"