wative 1.2.5 → 1.2.7

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": "wative",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "description": "An agile keystore management toolkit",
5
5
  "main": "lib/index.umd.js",
6
6
  "types": "src/index.d.ts",
@@ -33,26 +33,26 @@
33
33
  "@metamask/bip39": "4.0.0",
34
34
  "@metaplex-foundation/js": "0.20.1",
35
35
  "@rollup/plugin-commonjs": "21.0.1",
36
- "@rollup/plugin-typescript": "^12.1.2",
36
+ "@rollup/plugin-typescript": "12.1.2",
37
37
  "@solana/web3.js": "1.91.8",
38
38
  "@types/figlet": "1.5.8",
39
- "@types/ini": "^4.1.1",
39
+ "@types/ini": "4.1.1",
40
40
  "@types/inquirer": "9.0.7",
41
41
  "@types/node-fetch": "2.6.11",
42
42
  "bip39": "3.1.0",
43
43
  "cli-progress": "3.12.0",
44
44
  "commander": "^9.5.0",
45
- "crypto-js": "^4.2.0",
45
+ "crypto-js": "4.2.0",
46
46
  "dotenv": "16.4.5",
47
47
  "ethereumjs-wallet": "1.0.2",
48
48
  "ethers-multicall": "0.2.3",
49
49
  "figlet": "1.7.0",
50
- "ini": "^5.0.0",
50
+ "ini": "5.0.0",
51
51
  "inquirer": "8.0.0",
52
52
  "inquirer-table-input": "0.0.3",
53
53
  "inquirer-tree-prompt": "1.1.2",
54
54
  "keythereum": "2.0.0",
55
- "log4js": "^6.9.1",
55
+ "log4js": "6.9.1",
56
56
  "micro-ed25519-hdkey": "0.1.2",
57
57
  "node-fetch": "2.6.0",
58
58
  "rollup": "2.79.1",
@@ -61,7 +61,7 @@
61
61
  "rpc-websockets": "7.10.0",
62
62
  "ssh2": "1.14.0",
63
63
  "uuid": "9.0.0",
64
- "wative-core": "^1.0.21",
64
+ "wative-core": "1.0.21",
65
65
  "web3": "1.7.3"
66
66
  },
67
67
  "directories": {
@@ -70,10 +70,10 @@
70
70
  },
71
71
  "keywords": [],
72
72
  "devDependencies": {
73
- "@rollup/plugin-json": "^6.1.0",
74
- "@types/node": "^24.2.0",
75
- "@types/ssh2": "^1.15.4",
76
- "rollup-plugin-copy": "^3.5.0",
77
- "ts-node": "^10.9.2"
73
+ "@rollup/plugin-json": "6.1.0",
74
+ "@types/node": "24.2.0",
75
+ "@types/ssh2": "1.15.4",
76
+ "rollup-plugin-copy": "3.5.0",
77
+ "ts-node": "10.9.2"
78
78
  }
79
79
  }
package/src/ssh/types.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { TxParams } from "@walletbunker/core/lib/types"
2
-
3
1
  type SubAccountMessageParams = {
4
2
  rootAccount: string,
5
3
  chainId: string,
@@ -8,7 +6,7 @@ type SubAccountMessageParams = {
8
6
  }
9
7
 
10
8
  type SignMessageParams = {
11
- txParams: TxParams,
9
+ txParams: any,
12
10
  rpcUrl: string
13
11
  }
14
12
 
package/src/utils.ts CHANGED
@@ -326,6 +326,8 @@ export const getMulticallAddress = async (text: string) => {
326
326
  console.log(chalk.red("Multicall address length must be 42"));
327
327
  continue;
328
328
  }
329
+
330
+ return multicall_address;
329
331
  }
330
332
 
331
333
  return null;
package/src/ssh/client.rs DELETED
@@ -1,221 +0,0 @@
1
- use crate::setting::Settings;
2
- use std::error;
3
- use std::io;
4
- use std::net::{TcpStream, ToSocketAddrs};
5
- use std::path::Path;
6
- use std::sync::Arc;
7
-
8
- use async_executor::{Executor, LocalExecutor, Task};
9
- use async_io::Async;
10
- use easy_parallel::Parallel;
11
- use futures::executor::block_on;
12
- use futures::future::FutureExt;
13
- use futures::select;
14
- use futures::{AsyncReadExt, AsyncWriteExt};
15
-
16
- #[cfg(not(unix))]
17
- use std::net::TcpListener;
18
- #[cfg(unix)]
19
- use std::os::unix::net::{UnixListener, UnixStream};
20
- #[cfg(unix)]
21
- use tempfile::tempdir;
22
-
23
- use async_ssh2_lite::AsyncSession;
24
-
25
- async fn run(ex: Arc<Executor<'_>>, command: String) -> Result<String, Box<dyn error::Error>> {
26
- let ssh_config = &Settings::get().ssh2;
27
-
28
- let use_bastion = ssh_config.use_bastion;
29
-
30
- let addr = ssh_config.addr.to_owned();
31
- let username = ssh_config.username.to_owned();
32
-
33
- let bastion_addr;
34
- let bastion_username;
35
-
36
- if use_bastion {
37
- bastion_addr = ssh_config.bastion_addr.to_owned();
38
- bastion_username = ssh_config.bastion_username.to_owned();
39
- } else {
40
- bastion_addr = ssh_config.addr.to_owned();
41
- bastion_username = ssh_config.username.to_owned();
42
- }
43
-
44
- let passphrase = ssh_config.passphrase.to_owned();
45
- let addr = addr.to_socket_addrs().unwrap().next().unwrap();
46
- let bastion_addr = bastion_addr.to_socket_addrs().unwrap().next().unwrap();
47
-
48
- let public_key_path_str = String::from(ssh_config.public_key_path.to_owned());
49
- let private_key_path_str = String::from(ssh_config.private_key_path.to_owned());
50
-
51
- let task_with_main = ex.clone().spawn(async move {
52
- let public_key_path = Path::new(&public_key_path_str);
53
- let private_key_path = Path::new(&private_key_path_str);
54
- let bastion_stream = Async::<TcpStream>::connect(bastion_addr).await?;
55
-
56
- let mut bastion_session = AsyncSession::new(bastion_stream, None)?;
57
-
58
- bastion_session.handshake().await?;
59
-
60
- bastion_session
61
- .userauth_pubkey_file(
62
- &bastion_username,
63
- Some(public_key_path),
64
- private_key_path,
65
- Some(&passphrase),
66
- )
67
- .await?;
68
-
69
- if !bastion_session.authenticated() {
70
- return Err(bastion_session
71
- .last_error()
72
- .map( io::Error::from)
73
- .unwrap_or_else(||io::Error::new(
74
- io::ErrorKind::Other,
75
- "bastion unknown userauth error",
76
- )));
77
- }
78
-
79
- if !use_bastion {
80
- let mut channel = bastion_session.channel_session().await?;
81
-
82
- channel.exec(&command).await?;
83
- let mut res = String::new();
84
- channel.read_to_string(&mut res).await?;
85
- channel.close().await?;
86
-
87
- bastion_session.disconnect(None, "foo", None).await?;
88
-
89
- return Ok(res);
90
- }
91
-
92
- let mut bastion_channel = bastion_session
93
- .channel_direct_tcpip(addr.ip().to_string().as_ref(), addr.port(), None)
94
- .await?;
95
-
96
- let (forward_stream_s, mut forward_stream_r) = {
97
- cfg_if::cfg_if! {
98
- if #[cfg(unix)] {
99
- let dir = tempdir()?;
100
- let path = dir.path().join("ssh_channel_direct_tcpip");
101
- let listener = Async::<UnixListener>::bind(&path)?;
102
- let stream_s = Async::<UnixStream>::connect(&path).await?;
103
- } else {
104
- let listen_addr = TcpListener::bind("localhost:0")
105
- .unwrap()
106
- .local_addr()
107
- .unwrap();
108
- let listener = Async::<TcpListener>::bind(listen_addr)?;
109
- let stream_s = Async::<TcpStream>::connect(listen_addr).await?;
110
- }
111
- }
112
-
113
- let (stream_r,_) = listener.accept().await.unwrap();
114
-
115
- (stream_s, stream_r)
116
- };
117
-
118
- let task_with_forward: Task<io::Result<()>> = ex.clone().spawn(async move {
119
- let mut buf_bastion_channel = vec![0; 2048];
120
- let mut buf_forward_stream_r = vec![0; 2048];
121
-
122
- loop {
123
- select! {
124
- ret_forward_stream_r = forward_stream_r.read(&mut buf_forward_stream_r).fuse() => match ret_forward_stream_r {
125
- Ok(n) if n == 0 => {
126
- break
127
- },
128
- Ok(n) => {
129
- bastion_channel.write(&buf_forward_stream_r[..n]).await.map(|_| ()).map_err(|err| {
130
- err
131
- })?
132
- },
133
- Err(err) => {
134
- return Err(err);
135
- }
136
- },
137
- ret_bastion_channel = bastion_channel.read(&mut buf_bastion_channel).fuse() => match ret_bastion_channel {
138
- Ok(n) if n == 0 => {
139
- break
140
- },
141
- Ok(n) => {
142
- forward_stream_r.write(&buf_bastion_channel[..n]).await.map(|_| ()).map_err(|err| {
143
- err
144
- })?
145
- },
146
- Err(err) => {
147
- return Err(err);
148
- }
149
- },
150
- }
151
- }
152
-
153
- Ok(())
154
- });
155
- task_with_forward.detach();
156
-
157
- let mut session = AsyncSession::new(forward_stream_s, None)?;
158
- session.handshake().await?;
159
-
160
- session.userauth_pubkey_file(
161
- &username,
162
- Some(public_key_path),
163
- private_key_path,
164
- Some(&passphrase),
165
- )
166
- .await?;
167
-
168
- if !session.authenticated() {
169
- return Err(session
170
- .last_error()
171
- .map(io::Error::from)
172
- .unwrap_or_else(||io::Error::new(
173
- io::ErrorKind::Other,
174
- "unknown userauth error",
175
- )));
176
- }
177
-
178
- let mut channel = session.channel_session().await?;
179
-
180
- channel.exec(&command).await?;
181
- let mut res = String::new();
182
- channel.read_to_string(&mut res).await?;
183
- channel.close().await?;
184
-
185
- session.disconnect(None, "foo", None).await?;
186
-
187
- Ok(res)
188
- });
189
-
190
- let result = task_with_main.await.map(|message| message).map_err(|err| {
191
- eprintln!("task_with_main run failed, err:{err:?}");
192
-
193
- err
194
- })?;
195
-
196
- let signed_data = json::parse(&result).unwrap();
197
- if signed_data["status"] == false {
198
- panic!("{}", signed_data["msg"].to_string())
199
- }
200
-
201
- Ok(json::stringify(signed_data["data"].clone()))
202
- }
203
-
204
- pub fn ssh2_call(command: String) -> Result<String, Box<dyn error::Error>> {
205
- let ex = Executor::new();
206
- let ex = Arc::new(ex);
207
- let local_ex = LocalExecutor::new();
208
- let (trigger, shutdown) = async_channel::unbounded::<()>();
209
-
210
- let ret_vec = Parallel::new()
211
- .each(0..4, |_| block_on(ex.run(async { shutdown.recv().await })))
212
- .finish(|| {
213
- block_on(local_ex.run(async {
214
- let result = run(ex.clone(), command).await.unwrap();
215
- drop(trigger);
216
- result
217
- }))
218
- });
219
-
220
- Ok(ret_vec.1)
221
- }