nem-ruby 0.0.11 → 0.0.12
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 +5 -5
- data/examples/transaction/multisig_aggregate_modification_add.rb +39 -0
- data/examples/transaction/multisig_aggregate_modification_remove.rb +37 -0
- data/examples/transaction/transfer.rb +1 -1
- data/lib/nem/model/mosaic_attachment.rb +1 -1
- data/lib/nem/model/multisig_aggregate_modification_transaction.rb +1 -2
- data/lib/nem/transaction/multisig_aggregate_modification.rb +7 -2
- data/lib/nem/transaction/transfer.rb +2 -1
- data/lib/nem/util/serializer.rb +3 -0
- data/lib/nem/version.rb +1 -1
- metadata +5 -4
- data/examples/transaction/multisig_aggregate_modification.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2c104bf4ffdfcd8954c670d56c1b72202752567829f1f7dbbd841e1b5636f9a1
|
4
|
+
data.tar.gz: 645333200d0f4f3e04e1c47fe1494bbd5b3f4a9275c22da46bdffa2a256ddac5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 022d240d606975c63d08b15de7ee452621dd7d9f429d1eba330df2b3afec3dc9c8f743503dc39650b39d1a5b862cffe0a9f601674ce30e039fb2a5ed5982f83b
|
7
|
+
data.tar.gz: 45224ce8240732980bb3d8750a97297c31ecf871bad1ea3667cf4ce64a616c57e2d7718f433962ed03dd6a89405ba9be6f40a12ea45dcd01864990c1122e0362
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'pp'
|
2
|
+
require 'nem'
|
3
|
+
|
4
|
+
Nem.logger.level = Logger::DEBUG
|
5
|
+
|
6
|
+
# multisig
|
7
|
+
M_PRIVATE_KEY = '5dde437eadf98b4c97a3ef2fbfaa11211a1bce5fba6c30e383872a85cd6971ac'
|
8
|
+
|
9
|
+
# cosignatory(A)
|
10
|
+
A_PUBLIC_KEY = '9c345085d83b12220b351807643d35d179feaa871147c0245e95b7a5284dcc34'
|
11
|
+
|
12
|
+
# cosignatory(B)
|
13
|
+
B_PUBLIC_KEY = 'c96e5efb62475dd1686ab525be6837ca932e278f82412d40155e2f0e62ad24c0'
|
14
|
+
|
15
|
+
# cosignatory(C)
|
16
|
+
C_PUBLIC_KEY = '93084f6772ead71af12acad0f2b1068919ad5f709eb0ef3f8fbe2913fdde75f5'
|
17
|
+
|
18
|
+
kp = Nem::Keypair.new(M_PRIVATE_KEY)
|
19
|
+
node = Nem::Node.new(host: 'bigalice2.nem.ninja')
|
20
|
+
tx_endpoint = Nem::Endpoint::Transaction.new(node)
|
21
|
+
|
22
|
+
modifications = [
|
23
|
+
Nem::Transaction::MultisigCosignatoryModification.new(:add, A_PUBLIC_KEY),
|
24
|
+
Nem::Transaction::MultisigCosignatoryModification.new(:add, B_PUBLIC_KEY),
|
25
|
+
Nem::Transaction::MultisigCosignatoryModification.new(:add, C_PUBLIC_KEY)
|
26
|
+
]
|
27
|
+
|
28
|
+
relative_change = 2
|
29
|
+
tx = Nem::Transaction::MultisigAggregateModification.new(
|
30
|
+
modifications,
|
31
|
+
relative_change
|
32
|
+
)
|
33
|
+
pp "Fee: #{tx.fee.to_i}"
|
34
|
+
|
35
|
+
req = Nem::Request::Announce.new(tx, kp)
|
36
|
+
res = tx_endpoint.announce(req)
|
37
|
+
|
38
|
+
pp "Message: #{res.message}"
|
39
|
+
pp "TransactionHash: #{res.transaction_hash}"
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'pp'
|
2
|
+
require 'nem'
|
3
|
+
|
4
|
+
Nem.logger.level = Logger::DEBUG
|
5
|
+
|
6
|
+
# multisig
|
7
|
+
M_PUBLIC_KEY = 'e41f6fcfe6e311b8302f6f3d9b856e059f2a1ba7012159b8518328d5c584551b'
|
8
|
+
|
9
|
+
# initiator(A)
|
10
|
+
A_PRIVATE_KEY = '5a713ebe837e3f426489374d321d7255ba5de868af6be745636a348608177f87'
|
11
|
+
|
12
|
+
# cosignatory(C) to be remove from cosignatories
|
13
|
+
C_PUBLIC_KEY = '93084f6772ead71af12acad0f2b1068919ad5f709eb0ef3f8fbe2913fdde75f5'
|
14
|
+
|
15
|
+
kp = Nem::Keypair.new(A_PRIVATE_KEY)
|
16
|
+
node = Nem::Node.new(host: 'bigalice2.nem.ninja')
|
17
|
+
tx_endpoint = Nem::Endpoint::Transaction.new(node)
|
18
|
+
|
19
|
+
modifications = [
|
20
|
+
Nem::Transaction::MultisigCosignatoryModification.new(:remove, C_PUBLIC_KEY)
|
21
|
+
]
|
22
|
+
|
23
|
+
relative_change = 0
|
24
|
+
|
25
|
+
mamtx = Nem::Transaction::MultisigAggregateModification.new(
|
26
|
+
modifications,
|
27
|
+
relative_change
|
28
|
+
)
|
29
|
+
|
30
|
+
tx = Nem::Transaction::Multisig.new(mamtx, M_PUBLIC_KEY)
|
31
|
+
pp "Fee: #{tx.fee.to_i}"
|
32
|
+
|
33
|
+
req = Nem::Request::Announce.new(tx, kp)
|
34
|
+
res = tx_endpoint.announce(req)
|
35
|
+
|
36
|
+
pp "Message: #{res.message}"
|
37
|
+
pp "TransactionHash: #{res.transaction_hash}"
|
@@ -14,7 +14,7 @@ node = Nem::Node.new(host: 'bigalice2.nem.ninja')
|
|
14
14
|
tx_endpoint = Nem::Endpoint::Transaction.new(node)
|
15
15
|
|
16
16
|
# with plain message
|
17
|
-
tx = Nem::Transaction::Transfer.new(B_ADDRESS,
|
17
|
+
tx = Nem::Transaction::Transfer.new(B_ADDRESS, 9.85, 'Good luck!')
|
18
18
|
pp "Fee: #{tx.fee.to_i}"
|
19
19
|
|
20
20
|
req = Nem::Request::Announce.new(tx, kp)
|
@@ -10,8 +10,7 @@ module Nem
|
|
10
10
|
Modification.new(mod[:modificationType], mod[:cosignatoryAccount])
|
11
11
|
end
|
12
12
|
attrs = common_part_meta_data_pair(hash).merge(
|
13
|
-
|
14
|
-
# relative_change: transaction[:minCosignatories][:relativeChange],
|
13
|
+
min_cosignatories: transaction[:minCosignatories],
|
15
14
|
modifications: modifications
|
16
15
|
)
|
17
16
|
new(attrs)
|
@@ -29,13 +29,18 @@ module Nem
|
|
29
29
|
|
30
30
|
# attributes must be CAMEL CASE for NIS params
|
31
31
|
# @return [Hash]
|
32
|
+
# Modifications need to be sorted by address.
|
33
|
+
# if not it will occur FAILURE_SIGNATURE_NOT_VERIFIABLE
|
32
34
|
def to_hash
|
33
|
-
{
|
34
|
-
modifications: modifications.map(&:to_hash),
|
35
|
+
tmp = {
|
35
36
|
minCosignatories: {
|
36
37
|
relativeChange: relative_change
|
37
38
|
}
|
38
39
|
}
|
40
|
+
tmp[:modifications] = modifications
|
41
|
+
.sort_by { |mo| Nem::Unit::Address.from_public_key(mo.cosignatory_account) }
|
42
|
+
.map(&:to_hash)
|
43
|
+
tmp
|
39
44
|
end
|
40
45
|
end
|
41
46
|
end
|
@@ -44,7 +44,8 @@ module Nem
|
|
44
44
|
|
45
45
|
# attributes must be CAMEL CASE for NIS params
|
46
46
|
# @return [Hash]
|
47
|
-
# Mosaics need to be sorted by fqn.
|
47
|
+
# Mosaics need to be sorted by fqn.
|
48
|
+
# if not it will occur FAILURE_SIGNATURE_NOT_VERIFIABLE
|
48
49
|
def to_hash
|
49
50
|
tmp = {
|
50
51
|
amount: (amount * 1_000_000).to_i,
|
data/lib/nem/util/serializer.rb
CHANGED
@@ -83,6 +83,9 @@ module Nem
|
|
83
83
|
when 0x0101 then serialize_transfer(trans)
|
84
84
|
when 0x0801 then serialize_importance_transfer(trans)
|
85
85
|
when 0x1001 then serialize_multisig_aggregate_modification(trans)
|
86
|
+
when 0x2001 then serialize_provision_namespace(trans)
|
87
|
+
when 0x4001 then serialize_mosaic_definition_creation(entity)
|
88
|
+
when 0x4002 then serialize_mosaic_supply_change(entity)
|
86
89
|
else raise "Unexpected type #{trans[:type]}"
|
87
90
|
end
|
88
91
|
tx = serialize_common(trans) + tx
|
data/lib/nem/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nem-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoshiyuki Ieyama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -239,7 +239,8 @@ files:
|
|
239
239
|
- examples/transaction/mosaic_definition_creation.rb
|
240
240
|
- examples/transaction/mosaic_supply_change.rb
|
241
241
|
- examples/transaction/multisig_add_cosignatory.rb
|
242
|
-
- examples/transaction/
|
242
|
+
- examples/transaction/multisig_aggregate_modification_add.rb
|
243
|
+
- examples/transaction/multisig_aggregate_modification_remove.rb
|
243
244
|
- examples/transaction/multisig_signature.rb
|
244
245
|
- examples/transaction/multisig_transfer.rb
|
245
246
|
- examples/transaction/provision_namespace.rb
|
@@ -380,7 +381,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
380
381
|
version: '0'
|
381
382
|
requirements: []
|
382
383
|
rubyforge_project:
|
383
|
-
rubygems_version: 2.
|
384
|
+
rubygems_version: 2.7.3
|
384
385
|
signing_key:
|
385
386
|
specification_version: 4
|
386
387
|
summary: Ruby gem for communicating with the nem
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'pp'
|
2
|
-
require 'nem'
|
3
|
-
|
4
|
-
Nem.logger.level = Logger::DEBUG
|
5
|
-
|
6
|
-
# multisig
|
7
|
-
M_PRIVATE_KEY = '00f077782658ae91b77f238ba5fcd7ef110564b5c189072e4d4590d9b17f9d76f3'
|
8
|
-
|
9
|
-
# cosignatory(A)
|
10
|
-
A_PUBLIC_KEY = 'be2ba9cb15a547110d511a4d43c0482fbb584d78781abac01fb053d18f4a0033'
|
11
|
-
|
12
|
-
kp = Nem::Keypair.new(M_PRIVATE_KEY)
|
13
|
-
node = Nem::Node.new(host: 'bigalice2.nem.ninja')
|
14
|
-
tx_endpoint = Nem::Endpoint::Transaction.new(node)
|
15
|
-
|
16
|
-
msig_cosignatories = [
|
17
|
-
Nem::Transaction::MultisigCosignatoryModification.new(:add, A_PUBLIC_KEY)
|
18
|
-
]
|
19
|
-
relative_change = 1
|
20
|
-
tx = Nem::Transaction::MultisigAggregateModification.new(
|
21
|
-
msig_cosignatories,
|
22
|
-
relative_change
|
23
|
-
)
|
24
|
-
pp "Fee: #{tx.fee.to_i}"
|
25
|
-
|
26
|
-
req = Nem::Request::Announce.new(tx, kp)
|
27
|
-
res = tx_endpoint.announce(req)
|
28
|
-
|
29
|
-
pp "Message: #{res.message}"
|
30
|
-
pp "TransactionHash: #{res.transaction_hash}"
|