@withautonomi/autonomi 0.6.1 → 0.6.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.
Files changed (3) hide show
  1. package/Cargo.toml +2 -2
  2. package/package.json +5 -5
  3. package/src/lib.rs +19 -0
package/Cargo.toml CHANGED
@@ -1,7 +1,7 @@
1
1
  [package]
2
2
  edition = "2024"
3
3
  name = "autonomi-nodejs"
4
- version = "0.2.1"
4
+ version = "0.2.2"
5
5
  description = "NodeJS bindings for the autonomi client"
6
6
  license = "GPL-3.0"
7
7
 
@@ -9,7 +9,7 @@ license = "GPL-3.0"
9
9
  crate-type = ["cdylib"]
10
10
 
11
11
  [dependencies]
12
- autonomi = { path = "../autonomi", version = "0.6.1" }
12
+ autonomi = { path = "../autonomi", version = "0.6.2" }
13
13
  bytes = { version = "1.0.1", features = ["serde"] }
14
14
  eyre = "0.6.12"
15
15
  futures = "0.3"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withautonomi/autonomi",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "NodeJS bindings for Autonomi client",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -57,9 +57,9 @@
57
57
  "includeVersion": true
58
58
  },
59
59
  "optionalDependencies": {
60
- "@withautonomi/autonomi-win32-x64-msvc": "0.6.1",
61
- "@withautonomi/autonomi-darwin-x64": "0.6.1",
62
- "@withautonomi/autonomi-linux-x64-gnu": "0.6.1",
63
- "@withautonomi/autonomi-darwin-arm64": "0.6.1"
60
+ "@withautonomi/autonomi-win32-x64-msvc": "0.6.2",
61
+ "@withautonomi/autonomi-darwin-x64": "0.6.2",
62
+ "@withautonomi/autonomi-linux-x64-gnu": "0.6.2",
63
+ "@withautonomi/autonomi-darwin-arm64": "0.6.2"
64
64
  }
65
65
  }
package/src/lib.rs CHANGED
@@ -116,6 +116,16 @@ impl Client {
116
116
  Network(self.0.evm_network().clone())
117
117
  }
118
118
 
119
+ /// Set the payment mode for uploads.
120
+ #[napi]
121
+ pub fn with_payment_mode(&self, payment_mode: PaymentMode) -> Self {
122
+ let mode = match payment_mode {
123
+ PaymentMode::Standard => autonomi::PaymentMode::Standard,
124
+ PaymentMode::SingleNode => autonomi::PaymentMode::SingleNode,
125
+ };
126
+ Self(self.0.clone().with_payment_mode(mode))
127
+ }
128
+
119
129
  // Chunks
120
130
 
121
131
  /// Get a chunk from the network.
@@ -1605,6 +1615,15 @@ impl TransactionConfig {
1605
1615
  }
1606
1616
  }
1607
1617
 
1618
+ /// Payment strategy for uploads
1619
+ #[napi]
1620
+ pub enum PaymentMode {
1621
+ /// Default mode: Pay 3 nodes
1622
+ Standard,
1623
+ /// Alternative mode: Pay only the median priced node with 3x the quoted amount
1624
+ SingleNode,
1625
+ }
1626
+
1608
1627
  /// Options for making payments on the network
1609
1628
  #[napi]
1610
1629
  pub struct PaymentOption(autonomi::client::payment::PaymentOption);