near 0.3.1 → 0.3.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.
- checksums.yaml +4 -4
- data/CHANGES.md +8 -5
- data/README.md +6 -5
- data/VERSION +1 -1
- data/lib/near/cli/contract.rb +12 -12
- data/lib/near/transaction.rb +6 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa0995c2a2fec35657f6ce459546a2f3a83b69d306965a301da46a99fb64afc3
|
4
|
+
data.tar.gz: 56826739970ee57d1485fd533404523408fc8072f1db2b7cd64f18864e6c99ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfa74fb61db51e15c37af7c9b95c2b0d5ae15595f59bdce9b1198ed866eec9a2c7bc739b2149e0217593ee340af72af78e674fd7891b2b825f487f66bf979985
|
7
|
+
data.tar.gz: dfce931afa3709136c6f1f5bf42d9d1bdbf180af3e1d172d179c702b6614678cfae746829f3a3fb698c59d26c2bec17e5aa37169deb05f89e55312dbac86dab9
|
data/CHANGES.md
CHANGED
@@ -5,32 +5,35 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## 0.3.2 - 2025-05-12
|
9
|
+
### Changed
|
10
|
+
- Enhance `call_function` and `deploy_contract`
|
11
|
+
### Added
|
12
|
+
- Define `NEAR::Transaction::MAX_SIZE`
|
13
|
+
### Fixed
|
14
|
+
- Fix detection of printable strings
|
15
|
+
|
8
16
|
## 0.3.1 - 2025-02-05
|
9
17
|
|
10
18
|
## 0.3.0 - 2025-02-02
|
11
|
-
|
12
19
|
### Added
|
13
20
|
- Implement block data accessors
|
14
21
|
- Implement transaction data accessors
|
15
22
|
- Implement action parsing
|
16
|
-
|
17
23
|
### Changed
|
18
24
|
- Adopt Faraday as the HTTP client
|
19
25
|
- Improve HTTP error handling and retries
|
20
26
|
|
21
27
|
## 0.2.0 - 2025-01-29
|
22
|
-
|
23
28
|
### Added
|
24
29
|
- `Network#fetch(block)`
|
25
30
|
- `NEAR.testnet`, `NEAR.mainnet`
|
26
|
-
|
27
31
|
### Changed
|
28
32
|
- Use the NEAR_CLI environmnet variable, if set
|
29
33
|
- Use a temporary file for `call_function`
|
30
34
|
- Enhance `call_function()`
|
31
35
|
- Enhance `create_account_with_funding()`
|
32
36
|
- Enhance `delete_account()`
|
33
|
-
|
34
37
|
### Fixed
|
35
38
|
- Fix the formatting of balances
|
36
39
|
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# NEAR.rb: NEAR for Ruby
|
2
2
|
|
3
3
|
[](https://unlicense.org)
|
4
|
-
[](https://
|
4
|
+
[](https://rubyreferences.github.io/rubychanges/3.0.html)
|
5
5
|
[](https://rubygems.org/gems/near)
|
6
6
|
[](https://rubydoc.info/gems/near)
|
7
7
|
|
@@ -313,12 +313,13 @@ https://rubydoc.info/gems/near
|
|
313
313
|
git clone https://github.com/dryruby/near.rb.git
|
314
314
|
```
|
315
315
|
|
316
|
-
|
316
|
+
---
|
317
317
|
|
318
|
-
[](https://x.com/intent/post?url=https://github.com/dryruby/near.rb&text=NEAR.rb)
|
319
319
|
[](https://reddit.com/submit?url=https://github.com/dryruby/near.rb&title=NEAR.rb)
|
320
|
-
[](https://news.ycombinator.com/submitlink?u=https://github.com/dryruby/near.rb&t=NEAR.rb)
|
321
|
+
[](https://www.facebook.com/sharer/sharer.php?u=https://github.com/dryruby/near.rb)
|
322
|
+
[](https://www.linkedin.com/sharing/share-offsite/?url=https://github.com/dryruby/near.rb)
|
322
323
|
|
323
324
|
[NEAR CLI]: https://github.com/near/near-cli-rs
|
324
325
|
[NEAR Protocol]: https://near.org
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/lib/near/cli/contract.rb
CHANGED
@@ -36,12 +36,12 @@ module NEAR::CLI::Contract
|
|
36
36
|
# @param [NEAR::Balance] deposit Amount of NEAR to attach
|
37
37
|
# @param [NEAR::Gas, #to_s] gas Amount of gas to attach
|
38
38
|
# @return [String] Transaction result
|
39
|
-
def call_function(contract, method_name, args = {}, signer
|
39
|
+
def call_function(contract, method_name, args = {}, signer: nil, deposit: nil, gas: '100.0 Tgas')
|
40
40
|
args = case args
|
41
41
|
when Hash, Array then ['json-args', args.to_json]
|
42
|
-
when String then case
|
43
|
-
when
|
44
|
-
else ['
|
42
|
+
when String then case args
|
43
|
+
when /[^[:print:]]/ then ['base64-args', Base64.strict_encode64(args)]
|
44
|
+
else ['text-args', args]
|
45
45
|
end
|
46
46
|
when Pathname then ['file-args', args.to_s]
|
47
47
|
else raise ArgumentError, "Invalid argument type: #{args.inspect}"
|
@@ -53,7 +53,7 @@ module NEAR::CLI::Contract
|
|
53
53
|
*args,
|
54
54
|
'prepaid-gas', gas.to_s,
|
55
55
|
'attached-deposit', (deposit ? deposit.to_s : '0') + ' NEAR',
|
56
|
-
'sign-as', signer.to_s,
|
56
|
+
'sign-as', (signer || contract).to_s,
|
57
57
|
'network-config', @network,
|
58
58
|
'sign-with-keychain',
|
59
59
|
'send'
|
@@ -65,34 +65,34 @@ module NEAR::CLI::Contract
|
|
65
65
|
##
|
66
66
|
# Deploys a new contract.
|
67
67
|
#
|
68
|
-
# @param [
|
68
|
+
# @param [NEAR::Account, #to_s] contract Account to deploy the contract to
|
69
69
|
# @param [String] wasm_path Path to the .wasm file
|
70
|
-
# @param [String] signer_id Account that signs the transaction
|
71
70
|
# @param [String, nil] init_method Method to call after deployment
|
72
71
|
# @param [Hash] init_args Arguments for the init method
|
73
72
|
# @param [String] init_deposit Deposit for the init method
|
74
73
|
# @param [String] init_gas Gas for the init method
|
75
74
|
# @return [String] Transaction result
|
76
|
-
def deploy_contract(
|
75
|
+
def deploy_contract(contract, wasm_path, init_method: nil, init_args: {},
|
77
76
|
init_deposit: '0 NEAR', init_gas: '30 TGas')
|
78
77
|
args = [
|
79
78
|
'contract',
|
80
79
|
'deploy',
|
81
|
-
|
80
|
+
contract.to_s,
|
82
81
|
'use-file', wasm_path
|
83
82
|
]
|
84
83
|
|
85
|
-
if init_method
|
86
|
-
|
84
|
+
args += if init_method
|
85
|
+
[
|
87
86
|
'with-init-call', init_method,
|
88
87
|
'json-args', init_args.to_json,
|
89
88
|
'prepaid-gas', init_gas,
|
90
89
|
'attached-deposit', init_deposit
|
91
90
|
]
|
91
|
+
else
|
92
|
+
['without-init-call']
|
92
93
|
end
|
93
94
|
|
94
95
|
args += [
|
95
|
-
'sign-as', signer_id,
|
96
96
|
'network-config', @network,
|
97
97
|
'sign-with-keychain',
|
98
98
|
'send'
|
data/lib/near/transaction.rb
CHANGED
@@ -3,6 +3,12 @@
|
|
3
3
|
##
|
4
4
|
# Represents a NEAR transaction.
|
5
5
|
class NEAR::Transaction
|
6
|
+
##
|
7
|
+
# The maximum byte size of a NEAR transaction.
|
8
|
+
#
|
9
|
+
# @see https://github.com/near/nearcore/blob/3a584c2/core/parameters/res/runtime_configs/parameters.snap#L187
|
10
|
+
MAX_SIZE = 1_572_864
|
11
|
+
|
6
12
|
##
|
7
13
|
# @param [Hash] json
|
8
14
|
# @return [NEAR::Transaction]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: near
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arto Bendiken
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-05-12 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: base64
|
@@ -85,14 +85,14 @@ dependencies:
|
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '3.
|
88
|
+
version: '3.13'
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '3.
|
95
|
+
version: '3.13'
|
96
96
|
- !ruby/object:Gem::Dependency
|
97
97
|
name: yard
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|