@column-org/wallet-sdk 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@column-org/wallet-sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Column Wallet Mobile Deep-Link SDK for Movement/Aptos ecosystem",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -18,6 +18,10 @@
18
18
  "lint": "eslint src/**/*.ts",
19
19
  "prepublishOnly": "npm run build"
20
20
  },
21
+ "peerDependencies": {
22
+ "react": ">=16.8.0",
23
+ "react-native": ">=0.60.0"
24
+ },
21
25
  "keywords": [
22
26
  "column",
23
27
  "wallet",
@@ -36,6 +40,8 @@
36
40
  "tweetnacl": "^1.0.3"
37
41
  },
38
42
  "devDependencies": {
43
+ "react": "^18.2.0",
44
+ "react-native": "^0.73.0",
39
45
  "tsup": "^8.0.2",
40
46
  "typescript": "^5.3.3"
41
47
  }
@@ -8,3 +8,4 @@ if (typeof global.Buffer === 'undefined') {
8
8
 
9
9
  export * from './ColumnWalletSDK';
10
10
  export * from './ColumnShared';
11
+ export * from './ui/native/ColumnWalletModal';
@@ -0,0 +1,157 @@
1
+ import React from 'react';
2
+ import { View, Text, Modal, StyleSheet, TouchableOpacity, Linking, Image } from 'react-native';
3
+ import { ColumnWalletSDK } from '../../ColumnWalletSDK';
4
+
5
+ interface Props {
6
+ visible: boolean;
7
+ onClose: () => void;
8
+ onConnect: () => void;
9
+ sdk: ColumnWalletSDK; // Pass the initialized SDK instance
10
+ }
11
+
12
+ export function ColumnWalletModal({ visible, onClose, onConnect, sdk }: Props) {
13
+ const handleConnect = async () => {
14
+ try {
15
+ const url = sdk.connect();
16
+
17
+ // Attempt to open the deep link
18
+ // Use relaxed check for Expo Go / Android 11+ visibility rules
19
+ try {
20
+ const supported = await Linking.canOpenURL(url);
21
+ if (supported) {
22
+ await Linking.openURL(url);
23
+ onConnect();
24
+ onClose();
25
+ return;
26
+ }
27
+ } catch (e) {
28
+ // Ignore check errors
29
+ }
30
+
31
+ // Fallback: Try to open anyway
32
+ await Linking.openURL(url).catch(() => {
33
+ // If failed, show alert or similar (handling logic can be refined)
34
+ });
35
+
36
+ onConnect();
37
+ onClose();
38
+ } catch (error) {
39
+ console.error("Deep link error:", error);
40
+ }
41
+ };
42
+
43
+ return (
44
+ <Modal
45
+ animationType="slide"
46
+ transparent={true}
47
+ visible={visible}
48
+ onRequestClose={onClose}
49
+ >
50
+ <View style={styles.centeredView}>
51
+ {/* Transparent overlay as requested */}
52
+ <TouchableOpacity style={styles.overlay} onPress={onClose} activeOpacity={1} />
53
+
54
+ <View style={styles.modalView}>
55
+ <Text style={styles.modalTitle}>Connect Wallet</Text>
56
+
57
+ <TouchableOpacity style={styles.walletOption} onPress={handleConnect}>
58
+ <View style={styles.walletIconContainer}>
59
+ {/* Embed default SVG or icon here if possible, for now using simple view */}
60
+ <View style={styles.walletIcon} />
61
+ </View>
62
+ <View style={styles.walletInfo}>
63
+ <Text style={styles.walletName}>Column Wallet</Text>
64
+ <Text style={styles.walletTag}>Recommended</Text>
65
+ </View>
66
+ </TouchableOpacity>
67
+
68
+ <TouchableOpacity style={styles.closeButton} onPress={onClose}>
69
+ <Text style={styles.closeButtonText}>Cancel</Text>
70
+ </TouchableOpacity>
71
+ </View>
72
+ </View>
73
+ </Modal>
74
+ );
75
+ }
76
+
77
+ const styles = StyleSheet.create({
78
+ centeredView: {
79
+ flex: 1,
80
+ justifyContent: 'flex-end',
81
+ alignItems: 'center',
82
+ },
83
+ overlay: {
84
+ ...StyleSheet.absoluteFillObject,
85
+ // Setting background to transparent as requested
86
+ backgroundColor: 'transparent',
87
+ },
88
+ modalView: {
89
+ width: '100%',
90
+ backgroundColor: '#1C1F2E',
91
+ borderTopLeftRadius: 20,
92
+ borderTopRightRadius: 20,
93
+ padding: 24,
94
+ paddingBottom: 40,
95
+ shadowColor: '#000',
96
+ shadowOffset: {
97
+ width: 0,
98
+ height: -2,
99
+ },
100
+ shadowOpacity: 0.25,
101
+ shadowRadius: 4,
102
+ elevation: 5,
103
+ },
104
+ modalTitle: {
105
+ fontSize: 20,
106
+ fontWeight: '600',
107
+ color: 'white',
108
+ marginBottom: 20,
109
+ textAlign: 'center',
110
+ },
111
+ walletOption: {
112
+ flexDirection: 'row',
113
+ alignItems: 'center',
114
+ backgroundColor: '#252938',
115
+ padding: 16,
116
+ borderRadius: 16,
117
+ marginBottom: 16,
118
+ borderWidth: 1,
119
+ borderColor: 'rgba(255,255,255,0.1)',
120
+ },
121
+ walletIconContainer: {
122
+ width: 40,
123
+ height: 40,
124
+ borderRadius: 10,
125
+ backgroundColor: '#ffda34',
126
+ justifyContent: 'center',
127
+ alignItems: 'center',
128
+ marginRight: 16,
129
+ },
130
+ walletIcon: {
131
+ width: 20,
132
+ height: 20,
133
+ backgroundColor: '#000',
134
+ borderRadius: 10,
135
+ },
136
+ walletInfo: {
137
+ flex: 1,
138
+ },
139
+ walletName: {
140
+ color: 'white',
141
+ fontSize: 16,
142
+ fontWeight: '600',
143
+ },
144
+ walletTag: {
145
+ color: '#8B98A5',
146
+ fontSize: 12,
147
+ },
148
+ closeButton: {
149
+ marginTop: 8,
150
+ alignItems: 'center',
151
+ padding: 12,
152
+ },
153
+ closeButtonText: {
154
+ color: '#8B98A5',
155
+ fontSize: 16,
156
+ },
157
+ });