Skip to content

Commit bf5ea01

Browse files
committed
improve: nix flakebox fmt
1 parent dafa007 commit bf5ea01

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1029
-262
lines changed

.config/flakebox/id

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6ed8d7bac0d49950f28394f623607c29d00896bcf1505d366717626babadd81f8f111f93afd1b991b7087d5ce0684b4bcc10124aad93b3876ba1aba600a09cb4

.config/flakebox/shellHook.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
root="$(git rev-parse --show-toplevel)"
3+
dot_git="$(git rev-parse --git-common-dir)"
4+
if [[ ! -d "${dot_git}/hooks" ]]; then mkdir -p "${dot_git}/hooks"; fi
5+
# fix old bug
6+
rm -f "${dot_git}/hooks/comit-msg"
7+
rm -f "${dot_git}/hooks/commit-msg"
8+
ln -sf "${root}/misc/git-hooks/commit-msg" "${dot_git}/hooks/commit-msg"
9+
10+
root="$(git rev-parse --show-toplevel)"
11+
dot_git="$(git rev-parse --git-common-dir)"
12+
if [[ ! -d "${dot_git}/hooks" ]]; then mkdir -p "${dot_git}/hooks"; fi
13+
# fix old bug
14+
rm -f "${dot_git}/hooks/pre-comit"
15+
rm -f "${dot_git}/hooks/pre-commit"
16+
ln -sf "${root}/misc/git-hooks/pre-commit" "${dot_git}/hooks/pre-commit"
17+
18+
# set template
19+
git config commit.template misc/git-hooks/commit-template.txt
20+
21+
if ! flakebox lint --silent; then
22+
>&2 echo "ℹ️ Project recommendations detected. Run 'flakebox lint' for more info."
23+
fi
24+
25+
if [ -n "${DIRENV_IN_ENVRC:-}" ]; then
26+
# and not set DIRENV_LOG_FORMAT
27+
if [ -n "${DIRENV_LOG_FORMAT:-}" ]; then
28+
>&2 echo "💡 Set 'DIRENV_LOG_FORMAT=\"\"' in your shell environment variables for a cleaner output of direnv"
29+
fi
30+
fi
31+
32+
>&2 echo "💡 Run 'just' for a list of available 'just ...' helper recipes"

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.github/workflows/flakebox-ci.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# THIS FILE IS AUTOGENERATED FROM FLAKEBOX CONFIGURATION
2+
3+
jobs:
4+
build:
5+
name: Build
6+
runs-on: ${{ matrix.runs-on }}
7+
steps:
8+
- uses: actions/checkout@v4
9+
- name: Install Nix
10+
uses: DeterminateSystems/nix-installer-action@v4
11+
- name: Magic Nix Cache
12+
uses: DeterminateSystems/magic-nix-cache-action@v2
13+
- name: Build on ${{ matrix.host }}
14+
run: 'nix flake check -L .#
15+
16+
'
17+
strategy:
18+
matrix:
19+
host:
20+
- macos
21+
- linux
22+
include:
23+
- host: linux
24+
runs-on: ubuntu-latest
25+
timeout: 60
26+
- host: macos
27+
runs-on: macos-12
28+
timeout: 60
29+
timeout-minutes: ${{ matrix.timeout }}
30+
flake:
31+
name: Flake self-check
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
- name: Check Nix flake inputs
36+
uses: DeterminateSystems/flake-checker-action@v5
37+
with:
38+
fail-mode: true
39+
lint:
40+
name: Lint
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v4
44+
- name: Install Nix
45+
uses: DeterminateSystems/nix-installer-action@v4
46+
- name: Magic Nix Cache
47+
uses: DeterminateSystems/magic-nix-cache-action@v2
48+
- name: Cargo Cache
49+
uses: actions/cache@v3
50+
with:
51+
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
52+
path: ~/.cargo
53+
- name: Commit Check
54+
run: '# run the same check that git `pre-commit` hook does
55+
56+
nix develop --ignore-environment .#lint --command ./misc/git-hooks/pre-commit
57+
58+
'
59+
name: CI
60+
'on':
61+
merge_group:
62+
branches:
63+
- master
64+
- main
65+
pull_request:
66+
branches:
67+
- master
68+
- main
69+
push:
70+
branches:
71+
- master
72+
- main
73+
tags:
74+
- v*
75+
workflow_dispatch: {}
76+
77+
78+
# THIS FILE IS AUTOGENERATED FROM FLAKEBOX CONFIGURATION
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# THIS FILE IS AUTOGENERATED FROM FLAKEBOX CONFIGURATION
2+
3+
jobs:
4+
flakehub-publish:
5+
permissions:
6+
contents: read
7+
id-token: write
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
ref: ${{ (inputs.tag != null) && format('refs/tags/{0}', inputs.tag) || ''
13+
}}
14+
- name: Install Nix
15+
uses: DeterminateSystems/nix-installer-action@v4
16+
- name: Flakehub Push
17+
uses: DeterminateSystems/flakehub-push@main
18+
with:
19+
name: ${{ github.repository }}
20+
tag: ${{ inputs.tag }}
21+
visibility: public
22+
name: Publish to Flakehub
23+
'on':
24+
push:
25+
tags:
26+
- v?[0-9]+.[0-9]+.[0-9]+*
27+
workflow_dispatch:
28+
inputs:
29+
tags:
30+
description: The existing tag to publish to FlakeHub
31+
required: true
32+
type: string
33+
34+
35+
# THIS FILE IS AUTOGENERATED FROM FLAKEBOX CONFIGURATION

.rustfmt.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
group_imports = "StdExternalCrate"
2+
wrap_comments = true
3+
format_code_in_doc_comments = true
4+
imports_granularity = "Module"

bindings/cashu-ffi/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ url = { workspace = true }
1717
uniffi = { workspace = true }
1818

1919
[build-dependencies]
20-
uniffi = { workspace = true, features = ["build"] }
20+
uniffi = { workspace = true, features = ["build"] }

bindings/cashu-ffi/src/lib.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ mod nuts;
33
mod types;
44

55
mod ffi {
6+
pub use cashu::types::InvoiceStatus;
7+
68
pub use crate::error::CashuError;
79
pub use crate::nuts::nut00::blinded_message::BlindedMessage;
810
pub use crate::nuts::nut00::blinded_messages::BlindedMessages;
911
pub use crate::nuts::nut00::blinded_signature::BlindedSignature;
1012
pub use crate::nuts::nut00::mint_proofs::MintProofs;
11-
pub use crate::nuts::nut00::proof::{mint::Proof as MintProof, Proof};
13+
pub use crate::nuts::nut00::proof::mint::Proof as MintProof;
14+
pub use crate::nuts::nut00::proof::Proof;
1215
pub use crate::nuts::nut00::token::Token;
1316
pub use crate::nuts::nut01::key_pair::KeyPair;
1417
pub use crate::nuts::nut01::keys::{Keys, KeysResponse};
@@ -26,11 +29,7 @@ mod ffi {
2629
pub use crate::nuts::nut08::{MeltRequest, MeltResponse};
2730
pub use crate::nuts::nut09::{MintInfo, MintVersion};
2831
pub use crate::types::amount::Amount;
29-
pub use crate::types::Bolt11Invoice;
30-
pub use crate::types::KeySetInfo;
31-
pub use crate::types::Secret;
32-
33-
pub use cashu::types::InvoiceStatus;
32+
pub use crate::types::{Bolt11Invoice, KeySetInfo, Secret};
3433

3534
// UDL
3635
uniffi::include_scaffolding!("cashu");

bindings/cashu-ffi/src/nuts/nut00/blinded_messages.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
use std::{ops::Deref, sync::Arc};
1+
use std::ops::Deref;
2+
use std::sync::Arc;
23

34
use cashu::nuts::nut00::wallet::BlindedMessages as BlindedMessagesSdk;
45

5-
use crate::{error::Result, Amount, BlindedMessage, Secret, SecretKey};
6+
use crate::error::Result;
7+
use crate::{Amount, BlindedMessage, Secret, SecretKey};
68

79
pub struct BlindedMessages {
810
inner: BlindedMessagesSdk,

bindings/cashu-ffi/src/nuts/nut00/blinded_signature.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ use std::sync::Arc;
33

44
use cashu::nuts::nut00::BlindedSignature as BlindedSignatureSdk;
55

6-
use crate::Amount;
7-
use crate::Id;
8-
use crate::PublicKey;
6+
use crate::{Amount, Id, PublicKey};
97

108
pub struct BlindedSignature {
119
inner: BlindedSignatureSdk,

bindings/cashu-ffi/src/nuts/nut00/proof.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
use std::{ops::Deref, sync::Arc};
1+
use std::ops::Deref;
2+
use std::sync::Arc;
23

34
use cashu::nuts::nut00::Proof as ProofSdk;
45

5-
use crate::{types::Secret, Amount, Id, PublicKey};
6+
use crate::types::Secret;
7+
use crate::{Amount, Id, PublicKey};
68

79
pub struct Proof {
810
inner: ProofSdk,
@@ -73,9 +75,7 @@ pub mod mint {
7375
use cashu::nuts::nut00::mint::Proof as ProofSdk;
7476

7577
use crate::types::Secret;
76-
use crate::Amount;
77-
use crate::Id;
78-
use crate::PublicKey;
78+
use crate::{Amount, Id, PublicKey};
7979

8080
pub struct Proof {
8181
inner: ProofSdk,

bindings/cashu-ffi/src/nuts/nut00/token.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use cashu::nuts::nut00::wallet::Token as TokenSdk;
55
use cashu::url::UncheckedUrl;
66

77
use crate::error::Result;
8-
use crate::MintProofs;
9-
use crate::Proof;
8+
use crate::{MintProofs, Proof};
109

1110
pub struct Token {
1211
inner: TokenSdk,

bindings/cashu-ffi/src/nuts/nut01/key_pair.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
use std::{ops::Deref, sync::Arc};
1+
use std::ops::Deref;
2+
use std::sync::Arc;
23

3-
use crate::{PublicKey, SecretKey};
44
use cashu::nuts::nut01::mint::KeyPair as KeyPairSdk;
55

6+
use crate::{PublicKey, SecretKey};
7+
68
pub struct KeyPair {
79
inner: KeyPairSdk,
810
}

bindings/cashu-ffi/src/nuts/nut01/keys.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
use std::{collections::HashMap, ops::Deref, sync::Arc};
1+
use std::collections::HashMap;
2+
use std::ops::Deref;
3+
use std::sync::Arc;
24

3-
use crate::{Amount, PublicKey};
45
use cashu::nuts::nut01::{Keys as KeysSdk, Response as KeysResponseSdk};
56
use cashu::Amount as AmountSdk;
67

8+
use crate::{Amount, PublicKey};
9+
710
pub struct Keys {
811
inner: KeysSdk,
912
}

bindings/cashu-ffi/src/nuts/nut02/key_set.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
use std::ops::Deref;
22
use std::sync::Arc;
33

4-
use cashu::nuts::nut02::Id as IdSdk;
5-
use cashu::nuts::nut02::KeySet as KeySetSdk;
6-
use cashu::nuts::nut02::Response;
4+
use cashu::nuts::nut02::{Id as IdSdk, KeySet as KeySetSdk, Response};
75

86
use crate::error::Result;
97
use crate::nuts::nut01::keys::Keys;

bindings/cashu-ffi/src/nuts/nut03/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::str::FromStr;
22

3-
use cashu::{nuts::nut03::RequestMintResponse as RequestMintResponseSdk, Bolt11Invoice};
3+
use cashu::nuts::nut03::RequestMintResponse as RequestMintResponseSdk;
4+
use cashu::Bolt11Invoice;
45

56
use crate::error::Result;
67

bindings/cashu-ffi/src/nuts/nut04/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use std::{ops::Deref, sync::Arc};
1+
use std::ops::Deref;
2+
use std::sync::Arc;
23

34
use cashu::nuts::nut04::{MintRequest as MintRequestSdk, PostMintResponse as PostMintResponseSdk};
45

bindings/cashu-ffi/src/nuts/nut05/mod.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
use std::{ops::Deref, str::FromStr, sync::Arc};
2-
3-
use cashu::{
4-
nuts::nut05::{
5-
CheckFeesRequest as CheckFeesRequestSdk, CheckFeesResponse as CheckFeesResponseSdk,
6-
MeltRequest as MeltRequestSdk, MeltResponse as MeltResponseSdk,
7-
},
8-
Bolt11Invoice,
1+
use std::ops::Deref;
2+
use std::str::FromStr;
3+
use std::sync::Arc;
4+
5+
use cashu::nuts::nut05::{
6+
CheckFeesRequest as CheckFeesRequestSdk, CheckFeesResponse as CheckFeesResponseSdk,
7+
MeltRequest as MeltRequestSdk, MeltResponse as MeltResponseSdk,
98
};
9+
use cashu::Bolt11Invoice;
1010

11-
use crate::{error::Result, Amount, Proof};
11+
use crate::error::Result;
12+
use crate::{Amount, Proof};
1213

1314
pub struct CheckFeesRequest {
1415
inner: CheckFeesRequestSdk,

bindings/cashu-ffi/src/nuts/nut06/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use std::{ops::Deref, sync::Arc};
1+
use std::ops::Deref;
2+
use std::sync::Arc;
23

34
use cashu::nuts::nut06::{SplitRequest as SplitRequestSdk, SplitResponse as SplitResponseSdk};
45

bindings/cashu-ffi/src/nuts/nut07/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use std::{ops::Deref, sync::Arc};
1+
use std::ops::Deref;
2+
use std::sync::Arc;
23

34
use cashu::nuts::nut07::{
45
CheckSpendableRequest as CheckSpendableRequestSdk,

bindings/cashu-ffi/src/nuts/nut09/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use std::{ops::Deref, sync::Arc};
1+
use std::ops::Deref;
2+
use std::sync::Arc;
23

34
use cashu::nuts::nut09::{MintInfo as MintInfoSdk, MintVersion as MintVersionSdk};
45

bindings/cashu-ffi/src/types/amount.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use std::{ops::Deref, sync::Arc};
1+
use std::ops::Deref;
2+
use std::sync::Arc;
23

34
use cashu::Amount as AmountSdk;
45

bindings/cashu-ffi/src/types/bolt11_invoice.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
use std::{ops::Deref, str::FromStr, sync::Arc};
1+
use std::ops::Deref;
2+
use std::str::FromStr;
3+
use std::sync::Arc;
24

35
use cashu::Bolt11Invoice as Bolt11InvoiceSdk;
46

5-
use crate::{error::Result, Amount};
7+
use crate::error::Result;
8+
use crate::Amount;
69

710
pub struct Bolt11Invoice {
811
inner: Bolt11InvoiceSdk,

bindings/cashu-ffi/src/types/keyset_info.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use std::{ops::Deref, sync::Arc};
1+
use std::ops::Deref;
2+
use std::sync::Arc;
23

34
use cashu::types::KeysetInfo as KeySetInfoSdk;
45

bindings/cashu-js/examples/amount.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ function main() {
99
console.log(amount.toSat())
1010
}
1111

12-
main();
12+
main();

bindings/cashu-js/justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ build:
22
wasm-pack build
33

44
pack:
5-
npm run package
5+
npm run package

0 commit comments

Comments
 (0)