Skip to content

Commit 03bfdc4

Browse files
authored
Merge pull request #3817 from iron-fish/staging
STAGING -> MASTER
2 parents 79e7e05 + 3a83b27 commit 03bfdc4

File tree

9 files changed

+45
-9
lines changed

9 files changed

+45
-9
lines changed

ironfish-cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ironfish",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "CLI for running and interacting with an Iron Fish node",
55
"author": "Iron Fish <[email protected]> (https://ironfish.network)",
66
"main": "build/src/index.js",
@@ -61,7 +61,7 @@
6161
"@aws-sdk/client-secrets-manager": "3.276.0",
6262
"@aws-sdk/s3-request-presigner": "3.127.0",
6363
"@ironfish/rust-nodejs": "1.0.0",
64-
"@ironfish/sdk": "1.0.0",
64+
"@ironfish/sdk": "1.0.1",
6565
"@oclif/core": "1.23.1",
6666
"@oclif/plugin-help": "5.1.12",
6767
"@oclif/plugin-not-found": "2.3.1",

ironfish-cli/src/commands/status.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
/* This Source Code Form is subject to the terms of the Mozilla Public
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4-
import { FileUtils, GetNodeStatusResponse, PromiseUtils, TimeUtils } from '@ironfish/sdk'
4+
import {
5+
defaultNetworkName,
6+
FileUtils,
7+
GetNodeStatusResponse,
8+
PromiseUtils,
9+
TimeUtils,
10+
} from '@ironfish/sdk'
511
import { Assert } from '@ironfish/sdk'
612
import { Flags } from '@oclif/core'
713
import blessed from 'blessed'
@@ -111,6 +117,9 @@ function renderStatus(content: GetNodeStatusResponse, debugOutput: boolean): str
111117

112118
const blockGraffiti = `${content.miningDirector.blockGraffiti}`
113119

120+
const network =
121+
defaultNetworkName(content.node.networkId) || content.node.networkId.toString()
122+
114123
const peerNetworkStatus = `${
115124
content.peerNetwork.isReady ? 'CONNECTED' : 'WAITING'
116125
} - In: ${FileUtils.formatFileSize(
@@ -195,6 +204,7 @@ Version ${content.node.version} @ ${content.node.git}
195204
Node ${nodeStatus}
196205
Node Name ${nodeName}
197206
Block Graffiti ${blockGraffiti}
207+
Network ${network}
198208
Memory ${memoryStatus}
199209
CPU ${cpuStatus}
200210
P2P Network ${peerNetworkStatus}

ironfish-cli/src/commands/wallet/send.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export class Send extends IronfishCommand {
9999
let assetId = flags.assetId
100100
let to = flags.to?.trim()
101101
let from = flags.account?.trim()
102+
let memo = flags.memo?.trim()
102103

103104
const client = await this.sdk.connectRpc()
104105

@@ -162,6 +163,10 @@ export class Send extends IronfishCommand {
162163
})
163164
}
164165

166+
if (!memo) {
167+
memo = await CliUx.ux.prompt('Enter the memo (or leave blank)', { required: false })
168+
}
169+
165170
if (!isValidPublicAddress(to)) {
166171
this.log(`A valid public address is required`)
167172
this.exit(1)
@@ -178,7 +183,7 @@ export class Send extends IronfishCommand {
178183
{
179184
publicAddress: to,
180185
amount: CurrencyUtils.encode(amount),
181-
memo: flags.memo,
186+
memo,
182187
assetId,
183188
},
184189
],
@@ -208,7 +213,7 @@ export class Send extends IronfishCommand {
208213
this.exit(0)
209214
}
210215

211-
if (!flags.confirm && !(await this.confirm(assetId, amount, raw.fee, from, to))) {
216+
if (!flags.confirm && !(await this.confirm(assetId, amount, raw.fee, from, to, memo))) {
212217
this.error('Transaction aborted.')
213218
}
214219

@@ -227,6 +232,7 @@ export class Send extends IronfishCommand {
227232
this.log(`Sent ${CurrencyUtils.renderIron(amount, true, assetId)} to ${to} from ${from}`)
228233
this.log(`Hash: ${transaction.hash().toString('hex')}`)
229234
this.log(`Fee: ${CurrencyUtils.renderIron(transaction.fee(), true)}`)
235+
this.log(`Memo: ${memo}`)
230236
this.log(
231237
`\nIf the transaction is mined, it will appear here https://explorer.ironfish.network/transaction/${transaction
232238
.hash()
@@ -251,6 +257,7 @@ export class Send extends IronfishCommand {
251257
fee: bigint,
252258
from: string,
253259
to: string,
260+
memo: string,
254261
): Promise<boolean> {
255262
this.log(
256263
`You are about to send a transaction: ${CurrencyUtils.renderIron(
@@ -260,7 +267,7 @@ export class Send extends IronfishCommand {
260267
)} plus a transaction fee of ${CurrencyUtils.renderIron(
261268
fee,
262269
true,
263-
)} to ${to} from the account ${from}`,
270+
)} to ${to} from the account "${from}" with the memo "${memo}"`,
264271
)
265272

266273
return await CliUx.ux.confirm('Do you confirm (Y/N)?')

ironfish/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ironfish/sdk",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "SDK for running and interacting with an Iron Fish node",
55
"author": "Iron Fish <[email protected]> (https://ironfish.network)",
66
"main": "build/src/index.js",

ironfish/src/defaultNetworkDefinitions.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ export function isDefaultNetworkId(networkId: number): boolean {
66
return networkId <= 100
77
}
88

9+
export function defaultNetworkName(networkId: number): string | undefined {
10+
switch (networkId) {
11+
case 0:
12+
return 'Testnet'
13+
case 1:
14+
return 'Mainnet'
15+
case 2:
16+
return 'Dev'
17+
}
18+
}
19+
920
/**
1021
* This account (IronFishGenesisAccount) can be imported to access the funds in the genesis block.
1122
*

ironfish/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ export * from './wallet'
55
export * from './assert'
66
export * from './blockchain'
77
export * from './consensus'
8-
export { DEV_GENESIS_ACCOUNT } from './defaultNetworkDefinitions'
8+
export {
9+
DEV_GENESIS_ACCOUNT,
10+
defaultNetworkName,
11+
isDefaultNetworkId,
12+
} from './defaultNetworkDefinitions'
913
export * from './chainProcessor'
1014
export * from './event'
1115
export * from './fileStores'

ironfish/src/rpc/routes/node/getStatus.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export type GetNodeStatusResponse = {
1818
version: string
1919
git: string
2020
nodeName: string
21+
networkId: number
2122
}
2223
cpu: {
2324
cores: number
@@ -116,6 +117,7 @@ export const GetStatusResponseSchema: yup.ObjectSchema<GetNodeStatusResponse> =
116117
version: yup.string().defined(),
117118
git: yup.string().defined(),
118119
nodeName: yup.string().defined(),
120+
networkId: yup.number().defined(),
119121
})
120122
.defined(),
121123
cpu: yup
@@ -289,6 +291,7 @@ function getStatus(node: IronfishNode): GetNodeStatusResponse {
289291
version: node.pkg.version,
290292
git: node.pkg.git,
291293
nodeName: node.config.get('nodeName'),
294+
networkId: node.internal.get('networkId'),
292295
},
293296
cpu: {
294297
cores: node.metrics.cpuCores,

ironfish/src/webApi.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ export class WebApi {
128128
graffiti: block.graffiti,
129129
main: block.main,
130130
transactions: block.transactions,
131+
work: block.work,
131132
}))
132133

133134
const options = this.options({ 'Content-Type': 'application/json' })

simulator/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"docs:open": "open docs/index.html"
5757
},
5858
"dependencies": {
59-
"@ironfish/sdk": "1.0.0",
59+
"@ironfish/sdk": "1.0.1",
6060
"@oclif/core": "1.23.1",
6161
"@oclif/plugin-help": "5.1.12",
6262
"@oclif/plugin-not-found": "2.3.1",

0 commit comments

Comments
 (0)