Skip to content

Commit 6fe151c

Browse files
committed
add vault-sdk package
1 parent fd9b0a5 commit 6fe151c

File tree

16 files changed

+2289
-15
lines changed

16 files changed

+2289
-15
lines changed

apps/dashboard/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"@tanstack/react-query": "5.67.3",
5151
"@tanstack/react-table": "^8.21.2",
5252
"@thirdweb-dev/service-utils": "workspace:*",
53+
"@thirdweb-dev/vault-sdk": "workspace:*",
5354
"@vercel/functions": "2.0.0",
5455
"@vercel/og": "^0.6.5",
5556
"abitype": "1.0.8",

apps/dashboard/src/@/constants/env.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ export const DASHBOARD_THIRDWEB_CLIENT_ID =
44
export const DASHBOARD_THIRDWEB_SECRET_KEY =
55
process.env.DASHBOARD_SECRET_KEY || "";
66

7+
export const THIRDWEB_VAULT_URL =
8+
process.env.NEXT_PUBLIC_THIRDWEB_VAULT_URL || "";
9+
710
export const THIRDWEB_API_SECRET = process.env.API_SERVER_SECRET || "";
811

912
export const IPFS_GATEWAY_URL =
Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1-
export default function TransactionsServerWalletsPage() {
2-
return <div>Server Wallets</div>;
1+
import { THIRDWEB_VAULT_URL } from "@/constants/env";
2+
import { createVaultClient, listEoas } from "@thirdweb-dev/vault-sdk";
3+
4+
export default async function TransactionsServerWalletsPage() {
5+
const vaultClient = await createVaultClient({
6+
baseUrl: THIRDWEB_VAULT_URL,
7+
});
8+
9+
console.log(vaultClient);
10+
11+
const eoas = await listEoas({
12+
client: vaultClient,
13+
request: {
14+
auth: {
15+
adminKey:
16+
"sa_adm_UHST_NIWG_AR5B_VLWM_LBLS_OQFT_793e1701-9a96-4625-9f53-35a8c41d7068",
17+
},
18+
options: {
19+
page: 1,
20+
pageSize: 10,
21+
},
22+
},
23+
}).catch((e) => console.log(e));
24+
25+
console.log(eoas);
26+
27+
return <div>Server Wallets {JSON.stringify(eoas, null, 4)}</div>;
328
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"playground:build": "turbo run build --filter=./apps/playground-web",
2323
"portal": "turbo run dev --filter=./apps/portal --filter=./packages/thirdweb",
2424
"portal:build": "turbo run build --filter=./apps/portal",
25-
"dashboard": "turbo run dev --filter=./apps/dashboard --filter=./packages/thirdweb",
25+
"dashboard": "turbo run dev --filter=./apps/dashboard --filter=./packages/thirdweb --filter=./packages/vault-sdk",
2626
"dashboard:build": "turbo run build --filter=./apps/dashboard",
2727
"build": "turbo run build --filter=./packages/*",
2828
"build:release": "turbo run build --filter=./packages/* --force",

packages/vault-sdk/CHANGELOG.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# @thirdweb-dev/react-native-adapter
2+
3+
## 1.5.4
4+
5+
### Patch Changes
6+
7+
- [#6527](https://github.com/thirdweb-dev/js/pull/6527) [`4f51201`](https://github.com/thirdweb-dev/js/commit/4f51201249713cdac28bf7d6062cdf67a4e89144) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Update dependencies
8+
9+
## 1.5.3
10+
11+
### Patch Changes
12+
13+
- [#5746](https://github.com/thirdweb-dev/js/pull/5746) [`e42ffc6`](https://github.com/thirdweb-dev/js/commit/e42ffc6a931a8d80492a091d79e2d9b38e4ba1d7) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Downgrade aws libraries
14+
15+
## 1.5.2
16+
17+
### Patch Changes
18+
19+
- [#5594](https://github.com/thirdweb-dev/js/pull/5594) [`b7c8854`](https://github.com/thirdweb-dev/js/commit/b7c885432726eeaf3401217573f2cff0f5247ff7) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Support for Expo 52 and React Native 0.76
20+
21+
## 1.5.1
22+
23+
### Patch Changes
24+
25+
- [#5150](https://github.com/thirdweb-dev/js/pull/5150) [`9fadbcc`](https://github.com/thirdweb-dev/js/commit/9fadbcc17abfe302933f7b860ab7c3b4fb577789) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
26+
27+
- [#5151](https://github.com/thirdweb-dev/js/pull/5151) [`06c0cf3`](https://github.com/thirdweb-dev/js/commit/06c0cf3898419edc79ba042d041612a8ae6967f8) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - update to latest @mobile-wallet-protocol/client
28+
29+
## 1.5.0
30+
31+
### Minor Changes
32+
33+
- [#4992](https://github.com/thirdweb-dev/js/pull/4992) [`1994d9e`](https://github.com/thirdweb-dev/js/commit/1994d9e52d3a3874e6111ff7bc688f95618fbc25) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Updated required dependencies
34+
35+
## 1.4.4
36+
37+
### Patch Changes
38+
39+
- [#4874](https://github.com/thirdweb-dev/js/pull/4874) [`783d844`](https://github.com/thirdweb-dev/js/commit/783d84467d81db856a1f0b3509036bbc612ba7e5) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
40+
41+
## 1.4.3
42+
43+
### Patch Changes
44+
45+
- [#4789](https://github.com/thirdweb-dev/js/pull/4789) [`e384001`](https://github.com/thirdweb-dev/js/commit/e38400195f2644ef8dfcfbce5fa127a9a218247d) Thanks [@MananTank](https://github.com/MananTank)! - Fix whitespaces in UI components
46+
47+
## 1.4.2
48+
49+
### Patch Changes
50+
51+
- [#4665](https://github.com/thirdweb-dev/js/pull/4665) [`6ce7c83`](https://github.com/thirdweb-dev/js/commit/6ce7c83a3b9eb2374ad2f8163d9c6a68bba4bc42) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Update @mobile-wallet-protocol/client to 0.0.3
52+
53+
## 1.4.1
54+
55+
### Patch Changes
56+
57+
- [#4603](https://github.com/thirdweb-dev/js/pull/4603) [`b837b69`](https://github.com/thirdweb-dev/js/commit/b837b690ae27fb8bf45f6cd51820f7591e94dab0) Thanks [@jnsdls](https://github.com/jnsdls)! - bump various dependencies
58+
59+
## 1.4.0
60+
61+
### Minor Changes
62+
63+
- [#4527](https://github.com/thirdweb-dev/js/pull/4527) [`b76a82c`](https://github.com/thirdweb-dev/js/commit/b76a82c30345e06d7b2c203c1e20bf7ec7e0dd9d) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Update React Native dependencies and add support for React Native 0.75
64+
65+
## 1.3.0
66+
67+
### Minor Changes
68+
69+
- [#4094](https://github.com/thirdweb-dev/js/pull/4094) [`f1d087e`](https://github.com/thirdweb-dev/js/commit/f1d087e24e8ad74948c0cdfa85d3705319753850) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Support for Coinbase Smart Wallet in React Native
70+
71+
You can now use the Coinbase Smart Wallet in your React Native apps.
72+
73+
```ts
74+
const wallet = createWallet("com.coinbase.wallet", {
75+
appMetadata: {
76+
name: "My app name",
77+
},
78+
mobileConfig: {
79+
callbackURL: "https://example.com",
80+
},
81+
walletConfig: {
82+
options: "smartWalletOnly",
83+
},
84+
});
85+
86+
await wallet.connect({
87+
client,
88+
});
89+
```
90+
91+
## 1.2.0
92+
93+
### Minor Changes
94+
95+
- [#3271](https://github.com/thirdweb-dev/js/pull/3271) [`3a1fd98`](https://github.com/thirdweb-dev/js/commit/3a1fd985fc4b2720f4d46d54b562c00b2edf21ce) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Align inAppWallet secret sharing implementation with web and previous RN SDK
96+
97+
## 1.1.1
98+
99+
### Patch Changes
100+
101+
- [#3162](https://github.com/thirdweb-dev/js/pull/3162) [`b9b185b`](https://github.com/thirdweb-dev/js/commit/b9b185b665e9cc2085f0cc07e3a3cc06a755b42a) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Add support for CB wallet in react native
102+
103+
## 1.1.0
104+
105+
### Minor Changes
106+
107+
- [#3064](https://github.com/thirdweb-dev/js/pull/3064) [`f55fa4c`](https://github.com/thirdweb-dev/js/commit/f55fa4ca856924a0a1eb6b8e5fe743d76b6e2760) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - In-app wallet support for react native
108+
109+
### Patch Changes
110+
111+
- [#3110](https://github.com/thirdweb-dev/js/pull/3110) [`49aa6e4`](https://github.com/thirdweb-dev/js/commit/49aa6e41d5df93204821b72f17f1ba5c3cfe41f7) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Phone number sign in for React Native
112+
113+
## 1.0.0
114+
115+
### Major Changes
116+
117+
- [#3037](https://github.com/thirdweb-dev/js/pull/3037) [`f006429`](https://github.com/thirdweb-dev/js/commit/f006429d7c2415e9f2206e081f6b867854842f0b) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - initial release

packages/vault-sdk/README.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# React Native Adapter
2+
3+
This package is required to run the thirdweb connect SDK in React Native.
4+
5+
## Instructions
6+
7+
### 1. Install the packages
8+
9+
Using your favorite pacakge manager, install all the require dependencies
10+
11+
```shell
12+
npx expo install thirdweb @thirdweb-dev/react-native-adapter
13+
```
14+
15+
Since react native requires installing native dependencies directly, you also have to install these required peer dependencies:
16+
17+
```shell
18+
npx expo install react-native-get-random-values @react-native-community/netinfo expo-application @react-native-async-storage/async-storage expo-web-browser expo-linking react-native-aes-gcm-crypto [email protected] amazon-cognito-identity-js @coinbase/wallet-mobile-sdk react-native-mmkv react-native-svg @react-native-clipboard/clipboard
19+
```
20+
21+
Here's an explanation of each peer dependency and why its needed:
22+
23+
```
24+
// needed for wallet connect
25+
react-native-get-random-values
26+
@react-native-community/netinfo
27+
expo-application
28+
29+
// needed wallet connect + in-app wallet
30+
@react-native-async-storage/async-storage
31+
32+
// needed for inapp wallet
33+
expo-web-browser // for oauth flows
34+
amazon-cognito-identity-js // for authentication
35+
react-native-aes-gcm-crypto // for encryption
36+
[email protected] //for fast hashing
37+
38+
// needed for the prebuilt UIs
39+
react-native-svg
40+
@react-native-clipboard/clipboard
41+
```
42+
43+
### 2. Edit your `metro.config.js`
44+
45+
If you don't already have a `metro.config.file.js` in your project, you can create one by running:
46+
47+
```shell
48+
npx expo customize metro.config.js
49+
```
50+
51+
Then, you need to add 2 properties to the metro resolver: `unstable_enablePackageExports` and `unstable_conditionNames`. This is to tell metro to resolve named `exports` properly.
52+
53+
```js
54+
// file: metro.config.js
55+
56+
// Learn more https://docs.expo.io/guides/customizing-metro
57+
const { getDefaultConfig } = require("expo/metro-config");
58+
59+
/** @type {import('expo/metro-config').MetroConfig} */
60+
const config = getDefaultConfig(__dirname);
61+
62+
// ADD THESE 2 PROPERTIES
63+
config.resolver.unstable_enablePackageExports = true;
64+
config.resolver.unstable_conditionNames = [
65+
"react-native",
66+
"browser",
67+
"require",
68+
];
69+
70+
module.exports = config;
71+
```
72+
73+
### 3. Import `@thirdweb-dev/react-native-adapter` at the top of your `App.tsx`
74+
75+
This will polyfill all the required functionality needed.
76+
77+
```js
78+
// this needs to be imported before anything else
79+
import "@thirdweb-dev/react-native-adapter";
80+
// the rest of your app
81+
```
82+
83+
If you're using `expo-router`, you need to polyfill before the router entry:
84+
85+
1. create a `app/index.ts`
86+
87+
This will be the new entrypoint to your app, ensuring the polyfills happen before any routing.
88+
89+
```ts
90+
// file: app/index.ts
91+
92+
// this needs to be imported before expo-router
93+
import "@thirdweb-dev/react-native-adapter";
94+
import "expo-router/entry";
95+
```
96+
97+
2. Change your main entrypoint in `package.json`
98+
99+
Now you can replace `expo-router/entry` with `./app/index` as your main entrypoint.
100+
101+
```
102+
// file: package.json
103+
104+
"main": "./app/index",
105+
```
106+
107+
### Additional notes
108+
109+
1. `react-native-aes-gcm-crypto` requires `minSDK 26` for android, you can edit this in your `build.gradle` file
110+
2. You will get some warnings about unresolved exports, this is normal and will get better as the libraries get updated.
111+
112+
113+
### Use the `thirdweb` package in React Native
114+
115+
Once all the setup above is all done, you can use the most of functionality in the `thirdweb` package out of the box, without having to do any react native specific code.
116+
117+
This means that you can follow all the React documentation and expect it all to be exactly the same.
118+
119+
Examples:
120+
121+
```tsx
122+
import { ThirdwebProvider } form "thirdweb/react";
123+
```
124+
125+
### Resources
126+
127+
- [Full working demo](https://github.com/thirdweb-dev/expo-starter)
128+
- [React docs](https://portal.thirdweb.com/typescript/v5/react)
129+
- [TypeScript docs](https://portal.thirdweb.com/typescript/v5)

packages/vault-sdk/package.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"name": "@thirdweb-dev/vault-sdk",
3+
"version": "1.5.4",
4+
"repository": {
5+
"type": "git",
6+
"url": "git+https://github.com/thirdweb-dev/js.git#main"
7+
},
8+
"license": "Apache-2.0",
9+
"bugs": {
10+
"url": "https://github.com/thirdweb-dev/js/issues"
11+
},
12+
"author": "thirdweb eng <[email protected]>",
13+
"type": "module",
14+
"main": "./dist/cjs/exports/thirdweb.js",
15+
"module": "./dist/esm/exports/thirdweb.js",
16+
"types": "./dist/types/exports/thirdweb.d.ts",
17+
"typings": "./dist/types/exports/thirdweb.d.ts",
18+
"exports": {
19+
".": {
20+
"types": "./dist/types/exports/thirdweb.d.ts",
21+
"import": "./dist/esm/exports/thirdweb.js",
22+
"default": "./dist/cjs/exports/thirdweb.js"
23+
},
24+
"./package.json": "./package.json"
25+
},
26+
"files": [
27+
"dist/*",
28+
"src/*"
29+
],
30+
"dependencies": {
31+
"@noble/ciphers": "^1.2.1",
32+
"@noble/curves": "1.8.1",
33+
"@noble/hashes": "1.7.1",
34+
"abitype": "1.0.8",
35+
"ky": "^1.8.0"
36+
},
37+
"devDependencies": {
38+
"rimraf": "6.0.1"
39+
},
40+
"peerDependencies": {
41+
"typescript": ">=5.0.4"
42+
},
43+
"peerDependenciesMeta": {
44+
"typescript": {
45+
"optional": true
46+
}
47+
},
48+
"scripts": {
49+
"format": "biome format ./src --write",
50+
"lint": "biome check ./src",
51+
"fix": "biome check ./src --fix",
52+
"dev": "tsc --project ./tsconfig.build.json --module es2020 --outDir ./dist/esm --watch",
53+
"build": "pnpm clean && pnpm build:cjs && pnpm build:esm && pnpm build:types",
54+
"build:cjs": "tsc --project ./tsconfig.build.json --module commonjs --outDir ./dist/cjs --verbatimModuleSyntax false && printf '{\"type\":\"commonjs\"}' > ./dist/cjs/package.json",
55+
"build:esm": "tsc --project ./tsconfig.build.json --module es2020 --outDir ./dist/esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/esm/package.json",
56+
"build:types": "tsc --project ./tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
57+
"clean": "rimraf dist"
58+
},
59+
"engines": {
60+
"node": ">=18"
61+
}
62+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export {
2+
type VaultClient,
3+
createAccessToken,
4+
createEoa,
5+
createServiceAccount,
6+
createVaultClient,
7+
getServiceAccount,
8+
listEoas,
9+
ping,
10+
revokeAccessToken,
11+
rotateServiceAccount,
12+
signMessage,
13+
signTransaction,
14+
signTypedData,
15+
} from "../sdk.js";
16+
17+
export {
18+
ParseTransactionError,
19+
parseTransaction,
20+
} from "../transaction-parser.js";

0 commit comments

Comments
 (0)