Skip to content

Commit

Permalink
Merge pull request #4486 from iron-fish/staging
Browse files Browse the repository at this point in the history
STAGING -> MASTER
  • Loading branch information
dguenther authored Dec 14, 2023
2 parents 8fa601f + 8b37052 commit 64c70d2
Show file tree
Hide file tree
Showing 54 changed files with 539 additions and 325 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-ironfish-rust-nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ jobs:
${{ contains(matrix.settings.host, 'windows-') && 'Get-WmiObject -Class Win32_Processor -ComputerName.' || '' }}
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
Expand Down Expand Up @@ -112,14 +112,14 @@ jobs:
runs-on: ${{ matrix.settings.host }}
steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up QEMU for Docker
if: ${{ matrix.settings.docker }}
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-regenerate-fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: staging

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
Expand All @@ -45,10 +45,10 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
# Tests will only run on Node v20 due to https://github.com/nodejs/node/issues/35889
node-version: 20
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
# Tests will only run on Node v20 due to https://github.com/nodejs/node/issues/35889
node-version: 20
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-brew.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.refToBuild }}

Expand All @@ -22,7 +22,7 @@ jobs:
shared-key: nodejs

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-node-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Login to GitHub Registry
run: echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_USER} --password-stdin ghcr.io
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-npm-ironfish-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-npm-ironfish-rust-nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
working-directory: ./ironfish-rust-nodejs

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-npm-ironfish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/perf_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
find . -name . -o -prune -exec rm -rf -- {} +
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push-version-to-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Push version string to mainnet API
if: ${{ inputs.push_mainnet }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/rust_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
name: Lint Rust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Cache Rust
uses: Swatinem/rust-cache@v2
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
name: Test ironfish-rust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Cache Rust
uses: Swatinem/rust-cache@v2
Expand All @@ -94,7 +94,7 @@ jobs:
name: Test ironfish-zkp
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Cache Rust
uses: Swatinem/rust-cache@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rust_ci_cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
name: Build and cache rust code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Cache Rust
uses: Swatinem/rust-cache@v2
Expand Down
6 changes: 3 additions & 3 deletions ironfish-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ironfish",
"version": "1.13.0",
"version": "1.14.0",
"description": "CLI for running and interacting with an Iron Fish node",
"author": "Iron Fish <[email protected]> (https://ironfish.network)",
"main": "build/src/index.js",
Expand Down Expand Up @@ -62,8 +62,8 @@
"@aws-sdk/client-s3": "3",
"@aws-sdk/client-secrets-manager": "3",
"@aws-sdk/s3-request-presigner": "3",
"@ironfish/rust-nodejs": "1.11.0",
"@ironfish/sdk": "1.13.0",
"@ironfish/rust-nodejs": "1.12.0",
"@ironfish/sdk": "1.14.0",
"@oclif/core": "1.23.1",
"@oclif/plugin-help": "5.1.12",
"@oclif/plugin-not-found": "2.3.1",
Expand Down
5 changes: 5 additions & 0 deletions ironfish-cli/src/commands/peers/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ export class AddCommand extends IronfishCommand {

if (response.content.added) {
this.log(`Successfully added peer ${request.host}:${request.port}`)
} else if (response.content.error !== undefined) {
this.log(
`Failed to add peer ${request.host}:${request.port} because: ${response.content.error}`,
)
this.exit(0)
} else {
this.log(`Could not add peer ${request.host}:${request.port}`)
this.exit(0)
Expand Down
7 changes: 7 additions & 0 deletions ironfish-cli/src/commands/wallet/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ export class ImportCommand extends IronfishCommand {
const client = await this.sdk.connectRpc()

let account: string

if (blob && blob.length !== 0 && flags.path && flags.path.length !== 0) {
this.error(
`Your command includes an unexpected argument. Please pass either --path or the output of wallet:export.`,
)
}

if (blob) {
account = blob
} else if (flags.path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import { CurrencyUtils } from '@ironfish/sdk'
import { CliUx } from '@oclif/core'
import { IronfishCommand } from '../../command'
import { RemoteFlags } from '../../flags'
import { TableCols } from '../../utils/table'
import { IronfishCommand } from '../../../command'
import { RemoteFlags } from '../../../flags'
import { TableCols } from '../../../utils/table'

const { sort: _, ...tableFlags } = CliUx.ux.table.flags()
export class NotesCommand extends IronfishCommand {
Expand Down
58 changes: 34 additions & 24 deletions ironfish-cli/src/commands/wallet/send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,33 @@ export class Send extends IronfishCommand {
}),
}

renderTransactionSummary(
transaction: RawTransaction,
assetId: string,
amount: bigint,
from: string,
to: string,
memo: string,
): void {
const amountString = CurrencyUtils.renderIron(amount, true, assetId)
const feeString = CurrencyUtils.renderIron(transaction.fee, true)

const summary = `\
\nTRANSACTION DETAILS:
From ${from}
To ${to}
Amount ${amountString}
Fee ${feeString}
Memo ${memo}
Outputs ${transaction.outputs.length}
Spends ${transaction.spends.length}
Expiration ${transaction.expiration ? transaction.expiration.toString() : ''}
Version ${transaction.version}
`

this.log(summary)
}

async start(): Promise<void> {
const { flags } = await this.parse(Send)
let amount = flags.amount
Expand Down Expand Up @@ -219,8 +246,13 @@ export class Send extends IronfishCommand {
this.exit(0)
}

if (!flags.confirm && !(await this.confirm(assetId, amount, raw.fee, from, to, memo))) {
this.error('Transaction aborted.')
this.renderTransactionSummary(raw, assetId, amount, from, to, memo)

if (!flags.confirm) {
const confirmed = await CliUx.ux.confirm('Do you confirm (Y/N)?')
if (!confirmed) {
this.error('Transaction aborted.')
}
}

CliUx.ux.action.start('Sending the transaction')
Expand Down Expand Up @@ -266,26 +298,4 @@ export class Send extends IronfishCommand {
})
}
}

async confirm(
assetId: string,
amount: bigint,
fee: bigint,
from: string,
to: string,
memo: string,
): Promise<boolean> {
this.log(
`You are about to send a transaction: ${CurrencyUtils.renderIron(
amount,
true,
assetId,
)} plus a transaction fee of ${CurrencyUtils.renderIron(
fee,
true,
)} to ${to} from the account "${from}" with the memo "${memo}"`,
)

return await CliUx.ux.confirm('Do you confirm (Y/N)?')
}
}
15 changes: 9 additions & 6 deletions ironfish-cli/src/commands/wallet/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,19 @@ import { IronfishCommand } from '../../command'
import { RemoteFlags } from '../../flags'

export class StatusCommand extends IronfishCommand {
static description = `Get status of an account`
static description = `Get status of all accounts`

static flags = {
...RemoteFlags,
...CliUx.ux.table.flags(),
}

async start(): Promise<void> {
const { args, flags } = await this.parse(StatusCommand)
const account = args.account as string | undefined
const { flags } = await this.parse(StatusCommand)

const client = await this.sdk.connectRpc()

const response = await client.wallet.getAccountsStatus({
account: account,
})
const response = await client.wallet.getAccountsStatus()

CliUx.ux.table(
response.content.accounts,
Expand All @@ -33,13 +30,19 @@ export class StatusCommand extends IronfishCommand {
id: {
header: 'Account ID',
},
viewOnly: {
header: 'View Only',
},
headHash: {
get: (row) => row.head?.hash ?? 'NULL',
header: 'Head Hash',
},
headInChain: {
get: (row) => row.head?.inChain ?? 'NULL',
header: 'Head In Chain',
},
sequence: {
get: (row) => row.head?.sequence ?? 'NULL',
header: 'Head Sequence',
},
},
Expand Down
Loading

0 comments on commit 64c70d2

Please sign in to comment.