antd 0.1.0

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.
@@ -0,0 +1,198 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Antd
4
+ # Result of a health check.
5
+ #
6
+ # The diagnostic fields (:version, :evm_network, :uptime_seconds,
7
+ # :build_commit, :payment_token_address, :payment_vault_address) were added
8
+ # in antd 0.4.0. They default to "" / 0 so existing two-arg
9
+ # `HealthStatus.new(ok:, network:)` calls keep working and pre-0.4.0 daemon
10
+ # responses parse cleanly.
11
+ HealthStatus = Struct.new(
12
+ :ok, :network,
13
+ :version, :evm_network, :uptime_seconds,
14
+ :build_commit, :payment_token_address, :payment_vault_address,
15
+ keyword_init: true
16
+ ) do
17
+ def initialize(ok:, network:, version: "", evm_network: "",
18
+ uptime_seconds: 0, build_commit: "",
19
+ payment_token_address: "", payment_vault_address: "")
20
+ super
21
+ end
22
+ end
23
+
24
+ # Payment-batching strategy for uploads.
25
+ #
26
+ # +AUTO+ -- server picks (merkle for 64+ chunks, single otherwise).
27
+ # +MERKLE+ -- force merkle-batch (saves gas, min 2 chunks).
28
+ # +SINGLE+ -- force per-chunk payments.
29
+ module PaymentMode
30
+ AUTO = "auto"
31
+ MERKLE = "merkle"
32
+ SINGLE = "single"
33
+ end
34
+
35
+ # Result of a single-chunk put (used by +chunk_put+). Data and file puts
36
+ # return richer types (+DataPutResult+ / +DataPutPublicResult+ /
37
+ # +FilePutResult+ / +FilePutPublicResult+).
38
+ PutResult = Struct.new(:cost, :address, keyword_init: true)
39
+
40
+ # Result of a private data put. The DataMap is returned to the caller;
41
+ # it is NOT stored on-network.
42
+ DataPutResult = Struct.new(:data_map, :chunks_stored, :payment_mode_used, keyword_init: true) do
43
+ def initialize(data_map: "", chunks_stored: 0, payment_mode_used: "")
44
+ super
45
+ end
46
+ end
47
+
48
+ # Result of a public data put. The DataMap is stored on-network as an extra
49
+ # chunk; +address+ is the shareable retrieval handle.
50
+ DataPutPublicResult = Struct.new(:address, :chunks_stored, :payment_mode_used, keyword_init: true) do
51
+ def initialize(address: "", chunks_stored: 0, payment_mode_used: "")
52
+ super
53
+ end
54
+ end
55
+
56
+ # Result of a private file upload. The DataMap is returned to the caller;
57
+ # it is NOT stored on-network.
58
+ FilePutResult = Struct.new(
59
+ :data_map, # hex-encoded msgpack DataMap
60
+ :storage_cost_atto, # "0" if all chunks already existed
61
+ :gas_cost_wei, # decimal string
62
+ :chunks_stored, # uint64
63
+ :payment_mode_used, # "auto", "merkle", or "single"
64
+ keyword_init: true
65
+ )
66
+
67
+ # Result of a public file upload. The DataMap is stored on-network as an
68
+ # extra chunk; +address+ is the shareable retrieval handle.
69
+ FilePutPublicResult = Struct.new(
70
+ :address, # hex network address of the stored DataMap
71
+ :storage_cost_atto,
72
+ :gas_cost_wei,
73
+ :chunks_stored,
74
+ :payment_mode_used,
75
+ keyword_init: true
76
+ )
77
+
78
+ # Wallet address result.
79
+ WalletAddress = Struct.new(:address, keyword_init: true)
80
+
81
+ # Wallet balance result.
82
+ WalletBalance = Struct.new(:balance, :gas_balance, keyword_init: true)
83
+
84
+ # A single payment required for an upload.
85
+ PaymentInfo = Struct.new(:quote_hash, :rewards_address, :amount, keyword_init: true)
86
+
87
+ # A candidate node within a merkle payment pool.
88
+ CandidateNodeEntry = Struct.new(:rewards_address, :amount, keyword_init: true)
89
+
90
+ # A pool commitment containing candidate nodes for merkle batch payment.
91
+ PoolCommitmentEntry = Struct.new(:pool_hash, :candidates, keyword_init: true)
92
+
93
+ # Result of preparing an upload for external signing.
94
+ # +total_chunks+ and +already_stored_count+ (added in antd 0.10.0) describe
95
+ # the already-stored preflight: +total_chunks+ includes chunks already on the
96
+ # network, +already_stored_count+ is how many were skipped (no payment/PUT).
97
+ # Older daemons omit them and they default to 0.
98
+ PrepareUploadResult = Struct.new(
99
+ :upload_id, :payments, :total_amount,
100
+ :payment_vault_address, :payment_token_address, :rpc_url,
101
+ :payment_type, :depth, :pool_commitments,
102
+ :merkle_payment_timestamp,
103
+ :total_chunks, :already_stored_count,
104
+ keyword_init: true
105
+ )
106
+
107
+ # Result of finalizing an externally-signed upload.
108
+ #
109
+ # +data_map+ is the hex-encoded msgpack DataMap (always returned by the
110
+ # daemon — kept as a convenience even when the caller doesn't need it).
111
+ # +data_map_address+ is populated only when prepare was called with
112
+ # +visibility: "public"+ — the DataMap chunk was paid + stored in the same
113
+ # external-signer batch, and this is the shareable retrieval handle.
114
+ FinalizeUploadResult = Struct.new(
115
+ :address, :chunks_stored, :data_map, :data_map_address,
116
+ keyword_init: true
117
+ ) do
118
+ def initialize(address: "", chunks_stored: 0, data_map: "", data_map_address: "")
119
+ super
120
+ end
121
+ end
122
+
123
+ # Result of preparing a single-chunk external-signer publish via
124
+ # +Client#prepare_chunk_upload+.
125
+ #
126
+ # When +already_stored+ is true the chunk is already on-network and no
127
+ # payment or finalize step is needed — +upload_id+ and the payment fields
128
+ # are empty. Otherwise the wave-batch payment fields describe what the
129
+ # external signer must submit before calling +finalize_chunk_upload+.
130
+ PrepareChunkResult = Struct.new(
131
+ :address, :already_stored, :upload_id, :payment_type,
132
+ :payments, :total_amount,
133
+ :payment_vault_address, :payment_token_address, :rpc_url,
134
+ keyword_init: true
135
+ ) do
136
+ def initialize(address: "", already_stored: false, upload_id: "",
137
+ payment_type: "", payments: [], total_amount: "",
138
+ payment_vault_address: "", payment_token_address: "",
139
+ rpc_url: "")
140
+ super
141
+ end
142
+ end
143
+
144
+ # Pre-upload cost breakdown returned by +data_cost+ and +file_cost+.
145
+ # The server samples up to 5 chunk addresses and extrapolates the storage
146
+ # cost. Gas is an advisory heuristic, not a live gas-oracle query.
147
+ UploadCostEstimate = Struct.new(
148
+ :cost, # storage cost in atto tokens
149
+ :file_size, # original file size in bytes
150
+ :chunk_count, # number of data chunks
151
+ :estimated_gas_cost_wei, # advisory gas heuristic in wei
152
+ :payment_mode, # "auto" | "merkle" | "single"
153
+ keyword_init: true
154
+ )
155
+
156
+ # A fetch-progress update emitted during a streaming download when progress
157
+ # is requested. Counts are in *chunks*, not bytes — the byte denominator is
158
+ # the download's total size (the +x-content-length+ header over gRPC, the
159
+ # leading NDJSON +meta+ frame over REST). +total+ is 0 while still unknown
160
+ # (mid DataMap-resolution).
161
+ #
162
+ # +phase+ is one of:
163
+ # * +"resolving_map"+ -- walking the hierarchical DataMap to learn the count
164
+ # * +"resolved"+ -- DataMap resolved; +total+ now holds the chunk count
165
+ # * +"fetching"+ -- fetching data chunks; +fetched+/+total+ advance the bar
166
+ DownloadProgress = Struct.new(:phase, :fetched, :total, keyword_init: true) do
167
+ def initialize(phase: "", fetched: 0, total: 0)
168
+ super
169
+ end
170
+ end
171
+
172
+ # One frame of a progress-enabled streaming download: the total size
173
+ # (+meta+), a plaintext data chunk (+data+), or a +DownloadProgress+ update
174
+ # (+progress+). At most one of the three is set. Yielded by the
175
+ # +*_with_progress+ streaming methods; the plain +data_stream+ /
176
+ # +data_stream_public+ methods stay a pure byte stream for callers that don't
177
+ # need progress.
178
+ DownloadFrame = Struct.new(:data, :progress, :meta, keyword_init: true) do
179
+ def initialize(data: nil, progress: nil, meta: nil)
180
+ super
181
+ end
182
+
183
+ # True if this frame carries a progress update rather than data bytes.
184
+ def progress?
185
+ !progress.nil?
186
+ end
187
+ alias_method :is_progress, :progress?
188
+
189
+ # True if this frame carries the total-size denominator (in bytes).
190
+ #
191
+ # Surfaced from the gRPC +x-content-length+ response metadata or the REST
192
+ # NDJSON +meta+ frame. Emitted at most once, before any data.
193
+ def meta?
194
+ !meta.nil?
195
+ end
196
+ alias_method :is_meta, :meta?
197
+ end
198
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: antd/v1/chunks.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'antd/v1/common_pb'
8
+
9
+
10
+ descriptor_data = "\n\x14\x61ntd/v1/chunks.proto\x12\x07\x61ntd.v1\x1a\x14\x61ntd/v1/common.proto\"\"\n\x0fGetChunkRequest\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\" \n\x10GetChunkResponse\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\"\x1f\n\x0fPutChunkRequest\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\"@\n\x10PutChunkResponse\x12\x1b\n\x04\x63ost\x18\x01 \x01(\x0b\x32\r.antd.v1.Cost\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\"#\n\x13PrepareChunkRequest\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\"\xf6\x01\n\x14PrepareChunkResponse\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\x16\n\x0e\x61lready_stored\x18\x02 \x01(\x08\x12\x11\n\tupload_id\x18\x03 \x01(\t\x12\x14\n\x0cpayment_type\x18\x04 \x01(\t\x12\'\n\x08payments\x18\x05 \x03(\x0b\x32\x15.antd.v1.PaymentEntry\x12\x14\n\x0ctotal_amount\x18\x06 \x01(\t\x12\x1d\n\x15payment_vault_address\x18\x07 \x01(\t\x12\x1d\n\x15payment_token_address\x18\x08 \x01(\t\x12\x0f\n\x07rpc_url\x18\t \x01(\t\"\x9a\x01\n\x14\x46inalizeChunkRequest\x12\x11\n\tupload_id\x18\x01 \x01(\t\x12>\n\ttx_hashes\x18\x02 \x03(\x0b\x32+.antd.v1.FinalizeChunkRequest.TxHashesEntry\x1a/\n\rTxHashesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"(\n\x15\x46inalizeChunkResponse\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t2\xa3\x02\n\x0c\x43hunkService\x12:\n\x03Get\x12\x18.antd.v1.GetChunkRequest\x1a\x19.antd.v1.GetChunkResponse\x12:\n\x03Put\x12\x18.antd.v1.PutChunkRequest\x1a\x19.antd.v1.PutChunkResponse\x12K\n\x0cPrepareChunk\x12\x1c.antd.v1.PrepareChunkRequest\x1a\x1d.antd.v1.PrepareChunkResponse\x12N\n\rFinalizeChunk\x12\x1d.antd.v1.FinalizeChunkRequest\x1a\x1e.antd.v1.FinalizeChunkResponseBDZ8github.com/WithAutonomi/ant-sdk/antd-go/proto/antd/v1;v1\xaa\x02\x07\x41ntd.V1b\x06proto3"
11
+
12
+ pool = ::Google::Protobuf::DescriptorPool.generated_pool
13
+ pool.add_serialized_file(descriptor_data)
14
+
15
+ module Antd
16
+ module V1
17
+ GetChunkRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.GetChunkRequest").msgclass
18
+ GetChunkResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.GetChunkResponse").msgclass
19
+ PutChunkRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PutChunkRequest").msgclass
20
+ PutChunkResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PutChunkResponse").msgclass
21
+ PrepareChunkRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PrepareChunkRequest").msgclass
22
+ PrepareChunkResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PrepareChunkResponse").msgclass
23
+ FinalizeChunkRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.FinalizeChunkRequest").msgclass
24
+ FinalizeChunkResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.FinalizeChunkResponse").msgclass
25
+ end
26
+ end
@@ -0,0 +1,32 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: antd/v1/chunks.proto for package 'antd.v1'
3
+
4
+ require 'grpc'
5
+ require 'antd/v1/chunks_pb'
6
+
7
+ module Antd
8
+ module V1
9
+ module ChunkService
10
+ class Service
11
+
12
+ include ::GRPC::GenericService
13
+
14
+ self.marshal_class_method = :encode
15
+ self.unmarshal_class_method = :decode
16
+ self.service_name = 'antd.v1.ChunkService'
17
+
18
+ rpc :Get, ::Antd::V1::GetChunkRequest, ::Antd::V1::GetChunkResponse
19
+ rpc :Put, ::Antd::V1::PutChunkRequest, ::Antd::V1::PutChunkResponse
20
+ # External-signer single-chunk publish. Mirrors REST
21
+ # `/v1/chunks/prepare` + `/v1/chunks/finalize`. Single chunks are always
22
+ # below the merkle threshold, so the payment shape is always wave-batch.
23
+ # When the chunk is already on-network, the prepare response has
24
+ # `already_stored = true` and the caller can skip the finalize step.
25
+ rpc :PrepareChunk, ::Antd::V1::PrepareChunkRequest, ::Antd::V1::PrepareChunkResponse
26
+ rpc :FinalizeChunk, ::Antd::V1::FinalizeChunkRequest, ::Antd::V1::FinalizeChunkResponse
27
+ end
28
+
29
+ Stub = Service.rpc_stub_class
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: antd/v1/common.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+
8
+ descriptor_data = "\n\x14\x61ntd/v1/common.proto\x12\x07\x61ntd.v1\"y\n\x04\x43ost\x12\x13\n\x0b\x61tto_tokens\x18\x01 \x01(\t\x12\x11\n\tfile_size\x18\x02 \x01(\x04\x12\x13\n\x0b\x63hunk_count\x18\x03 \x01(\r\x12\x1e\n\x16\x65stimated_gas_cost_wei\x18\x04 \x01(\t\x12\x14\n\x0cpayment_mode\x18\x05 \x01(\t\"\x16\n\x07\x41\x64\x64ress\x12\x0b\n\x03hex\x18\x01 \x01(\t\"\x1d\n\x0ePublicKeyProto\x12\x0b\n\x03hex\x18\x01 \x01(\t\"\x1d\n\x0eSecretKeyProto\x12\x0b\n\x03hex\x18\x01 \x01(\t\"K\n\x0cPaymentEntry\x12\x12\n\nquote_hash\x18\x01 \x01(\t\x12\x17\n\x0frewards_address\x18\x02 \x01(\t\x12\x0e\n\x06\x61mount\x18\x03 \x01(\tBDZ8github.com/WithAutonomi/ant-sdk/antd-go/proto/antd/v1;v1\xaa\x02\x07\x41ntd.V1b\x06proto3"
9
+
10
+ pool = ::Google::Protobuf::DescriptorPool.generated_pool
11
+ pool.add_serialized_file(descriptor_data)
12
+
13
+ module Antd
14
+ module V1
15
+ Cost = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.Cost").msgclass
16
+ Address = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.Address").msgclass
17
+ PublicKeyProto = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PublicKeyProto").msgclass
18
+ SecretKeyProto = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.SecretKeyProto").msgclass
19
+ PaymentEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PaymentEntry").msgclass
20
+ end
21
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: antd/v1/data.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'antd/v1/common_pb'
8
+
9
+
10
+ descriptor_data = "\n\x12\x61ntd/v1/data.proto\x12\x07\x61ntd.v1\x1a\x14\x61ntd/v1/common.proto\"\'\n\x14GetPublicDataRequest\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\"%\n\x15GetPublicDataResponse\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\":\n\x14PutPublicDataRequest\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12\x14\n\x0cpayment_mode\x18\x02 \x01(\t\"w\n\x15PutPublicDataResponse\x12\x1b\n\x04\x63ost\x18\x01 \x01(\x0b\x32\r.antd.v1.Cost\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\x12\x15\n\rchunks_stored\x18\x03 \x01(\x04\x12\x19\n\x11payment_mode_used\x18\x04 \x01(\t\"D\n\x17StreamPublicDataRequest\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\x18\n\x10include_progress\x18\x02 \x01(\x08\"R\n\tDataChunk\x12\x0e\n\x04\x64\x61ta\x18\x01 \x01(\x0cH\x00\x12-\n\x08progress\x18\x02 \x01(\x0b\x32\x19.antd.v1.DownloadProgressH\x00\x42\x06\n\x04kind\"A\n\x10\x44ownloadProgress\x12\r\n\x05phase\x18\x01 \x01(\t\x12\x0f\n\x07\x66\x65tched\x18\x02 \x01(\x04\x12\r\n\x05total\x18\x03 \x01(\x04\"\"\n\x0eGetDataRequest\x12\x10\n\x08\x64\x61ta_map\x18\x01 \x01(\t\"?\n\x11StreamDataRequest\x12\x10\n\x08\x64\x61ta_map\x18\x01 \x01(\t\x12\x18\n\x10include_progress\x18\x02 \x01(\x08\"\x1f\n\x0fGetDataResponse\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\"4\n\x0ePutDataRequest\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12\x14\n\x0cpayment_mode\x18\x02 \x01(\t\"r\n\x0fPutDataResponse\x12\x1b\n\x04\x63ost\x18\x01 \x01(\x0b\x32\r.antd.v1.Cost\x12\x10\n\x08\x64\x61ta_map\x18\x02 \x01(\t\x12\x15\n\rchunks_stored\x18\x03 \x01(\x04\x12\x19\n\x11payment_mode_used\x18\x04 \x01(\t\"5\n\x0f\x44\x61taCostRequest\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12\x14\n\x0cpayment_mode\x18\x02 \x01(\t2\xce\x03\n\x0b\x44\x61taService\x12\x38\n\x03Put\x12\x17.antd.v1.PutDataRequest\x1a\x18.antd.v1.PutDataResponse\x12J\n\tPutPublic\x12\x1d.antd.v1.PutPublicDataRequest\x1a\x1e.antd.v1.PutPublicDataResponse\x12\x38\n\x03Get\x12\x17.antd.v1.GetDataRequest\x1a\x18.antd.v1.GetDataResponse\x12J\n\tGetPublic\x12\x1d.antd.v1.GetPublicDataRequest\x1a\x1e.antd.v1.GetPublicDataResponse\x12:\n\x06Stream\x12\x1a.antd.v1.StreamDataRequest\x1a\x12.antd.v1.DataChunk0\x01\x12\x46\n\x0cStreamPublic\x12 .antd.v1.StreamPublicDataRequest\x1a\x12.antd.v1.DataChunk0\x01\x12/\n\x04\x43ost\x12\x18.antd.v1.DataCostRequest\x1a\r.antd.v1.CostBDZ8github.com/WithAutonomi/ant-sdk/antd-go/proto/antd/v1;v1\xaa\x02\x07\x41ntd.V1b\x06proto3"
11
+
12
+ pool = ::Google::Protobuf::DescriptorPool.generated_pool
13
+ pool.add_serialized_file(descriptor_data)
14
+
15
+ module Antd
16
+ module V1
17
+ GetPublicDataRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.GetPublicDataRequest").msgclass
18
+ GetPublicDataResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.GetPublicDataResponse").msgclass
19
+ PutPublicDataRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PutPublicDataRequest").msgclass
20
+ PutPublicDataResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PutPublicDataResponse").msgclass
21
+ StreamPublicDataRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.StreamPublicDataRequest").msgclass
22
+ DataChunk = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.DataChunk").msgclass
23
+ DownloadProgress = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.DownloadProgress").msgclass
24
+ GetDataRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.GetDataRequest").msgclass
25
+ StreamDataRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.StreamDataRequest").msgclass
26
+ GetDataResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.GetDataResponse").msgclass
27
+ PutDataRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PutDataRequest").msgclass
28
+ PutDataResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PutDataResponse").msgclass
29
+ DataCostRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.DataCostRequest").msgclass
30
+ end
31
+ end
@@ -0,0 +1,36 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: antd/v1/data.proto for package 'antd.v1'
3
+
4
+ require 'grpc'
5
+ require 'antd/v1/data_pb'
6
+
7
+ module Antd
8
+ module V1
9
+ module DataService
10
+ class Service
11
+
12
+ include ::GRPC::GenericService
13
+
14
+ self.marshal_class_method = :encode
15
+ self.unmarshal_class_method = :decode
16
+ self.service_name = 'antd.v1.DataService'
17
+
18
+ # Private = unqualified verb (the DataMap is returned to the caller; it is
19
+ # NOT stored on the network). Public = `_public` suffix (the DataMap is
20
+ # additionally stored on-network and the call returns the resulting address).
21
+ rpc :Put, ::Antd::V1::PutDataRequest, ::Antd::V1::PutDataResponse
22
+ rpc :PutPublic, ::Antd::V1::PutPublicDataRequest, ::Antd::V1::PutPublicDataResponse
23
+ rpc :Get, ::Antd::V1::GetDataRequest, ::Antd::V1::GetDataResponse
24
+ rpc :GetPublic, ::Antd::V1::GetPublicDataRequest, ::Antd::V1::GetPublicDataResponse
25
+ # Streaming downloads — constant memory, one decrypt batch at a time.
26
+ # Private streams from a caller-held DataMap; public resolves the address
27
+ # to a DataMap first (Stream is the primitive, StreamPublic wraps it).
28
+ rpc :Stream, ::Antd::V1::StreamDataRequest, stream(::Antd::V1::DataChunk)
29
+ rpc :StreamPublic, ::Antd::V1::StreamPublicDataRequest, stream(::Antd::V1::DataChunk)
30
+ rpc :Cost, ::Antd::V1::DataCostRequest, ::Antd::V1::Cost
31
+ end
32
+
33
+ Stub = Service.rpc_stub_class
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: antd/v1/files.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'antd/v1/common_pb'
8
+
9
+
10
+ descriptor_data = "\n\x13\x61ntd/v1/files.proto\x12\x07\x61ntd.v1\x1a\x14\x61ntd/v1/common.proto\"4\n\x0ePutFileRequest\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x14\n\x0cpayment_mode\x18\x02 \x01(\t\"\x97\x01\n\x15PutFilePublicResponse\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\x12\x19\n\x11storage_cost_atto\x18\x03 \x01(\t\x12\x14\n\x0cgas_cost_wei\x18\x04 \x01(\t\x12\x15\n\rchunks_stored\x18\x05 \x01(\x04\x12\x19\n\x11payment_mode_used\x18\x06 \x01(\tJ\x04\x08\x01\x10\x02R\x04\x63ost\"\x86\x01\n\x0fPutFileResponse\x12\x10\n\x08\x64\x61ta_map\x18\x01 \x01(\t\x12\x19\n\x11storage_cost_atto\x18\x02 \x01(\t\x12\x14\n\x0cgas_cost_wei\x18\x03 \x01(\t\x12\x15\n\rchunks_stored\x18\x04 \x01(\x04\x12\x19\n\x11payment_mode_used\x18\x05 \x01(\t\":\n\x14GetFilePublicRequest\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\x11\n\tdest_path\x18\x02 \x01(\t\"5\n\x0eGetFileRequest\x12\x10\n\x08\x64\x61ta_map\x18\x01 \x01(\t\x12\x11\n\tdest_path\x18\x02 \x01(\t\"\x11\n\x0fGetFileResponse\"H\n\x0f\x46ileCostRequest\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x11\n\tis_public\x18\x02 \x01(\x08\x12\x14\n\x0cpayment_mode\x18\x03 \x01(\t2\xbe\x02\n\x0b\x46ileService\x12\x38\n\x03Put\x12\x17.antd.v1.PutFileRequest\x1a\x18.antd.v1.PutFileResponse\x12\x44\n\tPutPublic\x12\x17.antd.v1.PutFileRequest\x1a\x1e.antd.v1.PutFilePublicResponse\x12\x38\n\x03Get\x12\x17.antd.v1.GetFileRequest\x1a\x18.antd.v1.GetFileResponse\x12\x44\n\tGetPublic\x12\x1d.antd.v1.GetFilePublicRequest\x1a\x18.antd.v1.GetFileResponse\x12/\n\x04\x43ost\x12\x18.antd.v1.FileCostRequest\x1a\r.antd.v1.CostBDZ8github.com/WithAutonomi/ant-sdk/antd-go/proto/antd/v1;v1\xaa\x02\x07\x41ntd.V1b\x06proto3"
11
+
12
+ pool = ::Google::Protobuf::DescriptorPool.generated_pool
13
+ pool.add_serialized_file(descriptor_data)
14
+
15
+ module Antd
16
+ module V1
17
+ PutFileRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PutFileRequest").msgclass
18
+ PutFilePublicResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PutFilePublicResponse").msgclass
19
+ PutFileResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PutFileResponse").msgclass
20
+ GetFilePublicRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.GetFilePublicRequest").msgclass
21
+ GetFileRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.GetFileRequest").msgclass
22
+ GetFileResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.GetFileResponse").msgclass
23
+ FileCostRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.FileCostRequest").msgclass
24
+ end
25
+ end
@@ -0,0 +1,31 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: antd/v1/files.proto for package 'antd.v1'
3
+
4
+ require 'grpc'
5
+ require 'antd/v1/files_pb'
6
+
7
+ module Antd
8
+ module V1
9
+ module FileService
10
+ class Service
11
+
12
+ include ::GRPC::GenericService
13
+
14
+ self.marshal_class_method = :encode
15
+ self.unmarshal_class_method = :decode
16
+ self.service_name = 'antd.v1.FileService'
17
+
18
+ # Private = unqualified verb (the DataMap is returned to the caller; it is
19
+ # NOT stored on the network). Public = `_public` suffix (the DataMap is
20
+ # additionally stored on-network and the call returns the resulting address).
21
+ rpc :Put, ::Antd::V1::PutFileRequest, ::Antd::V1::PutFileResponse
22
+ rpc :PutPublic, ::Antd::V1::PutFileRequest, ::Antd::V1::PutFilePublicResponse
23
+ rpc :Get, ::Antd::V1::GetFileRequest, ::Antd::V1::GetFileResponse
24
+ rpc :GetPublic, ::Antd::V1::GetFilePublicRequest, ::Antd::V1::GetFileResponse
25
+ rpc :Cost, ::Antd::V1::FileCostRequest, ::Antd::V1::Cost
26
+ end
27
+
28
+ Stub = Service.rpc_stub_class
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: antd/v1/health.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+
8
+ descriptor_data = "\n\x14\x61ntd/v1/health.proto\x12\x07\x61ntd.v1\"\x14\n\x12HealthCheckRequest\"\xc8\x01\n\x13HealthCheckResponse\x12\x0e\n\x06status\x18\x01 \x01(\t\x12\x0f\n\x07network\x18\x02 \x01(\t\x12\x0f\n\x07version\x18\x03 \x01(\t\x12\x13\n\x0b\x65vm_network\x18\x04 \x01(\t\x12\x16\n\x0euptime_seconds\x18\x05 \x01(\x04\x12\x14\n\x0c\x62uild_commit\x18\x06 \x01(\t\x12\x1d\n\x15payment_token_address\x18\x07 \x01(\t\x12\x1d\n\x15payment_vault_address\x18\x08 \x01(\t2S\n\rHealthService\x12\x42\n\x05\x43heck\x12\x1b.antd.v1.HealthCheckRequest\x1a\x1c.antd.v1.HealthCheckResponseBDZ8github.com/WithAutonomi/ant-sdk/antd-go/proto/antd/v1;v1\xaa\x02\x07\x41ntd.V1b\x06proto3"
9
+
10
+ pool = ::Google::Protobuf::DescriptorPool.generated_pool
11
+ pool.add_serialized_file(descriptor_data)
12
+
13
+ module Antd
14
+ module V1
15
+ HealthCheckRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.HealthCheckRequest").msgclass
16
+ HealthCheckResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.HealthCheckResponse").msgclass
17
+ end
18
+ end
@@ -0,0 +1,24 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: antd/v1/health.proto for package 'antd.v1'
3
+
4
+ require 'grpc'
5
+ require 'antd/v1/health_pb'
6
+
7
+ module Antd
8
+ module V1
9
+ module HealthService
10
+ class Service
11
+
12
+ include ::GRPC::GenericService
13
+
14
+ self.marshal_class_method = :encode
15
+ self.unmarshal_class_method = :decode
16
+ self.service_name = 'antd.v1.HealthService'
17
+
18
+ rpc :Check, ::Antd::V1::HealthCheckRequest, ::Antd::V1::HealthCheckResponse
19
+ end
20
+
21
+ Stub = Service.rpc_stub_class
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: antd/v1/upload.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'antd/v1/common_pb'
8
+
9
+
10
+ descriptor_data = "\n\x14\x61ntd/v1/upload.proto\x12\x07\x61ntd.v1\x1a\x14\x61ntd/v1/common.proto\"<\n\x18PrepareFileUploadRequest\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x12\n\nvisibility\x18\x02 \x01(\t\"<\n\x18PrepareDataUploadRequest\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12\x12\n\nvisibility\x18\x02 \x01(\t\"\xb7\x02\n\x15PrepareUploadResponse\x12\x11\n\tupload_id\x18\x01 \x01(\t\x12\x14\n\x0cpayment_type\x18\x02 \x01(\t\x12\'\n\x08payments\x18\x03 \x03(\x0b\x32\x15.antd.v1.PaymentEntry\x12\r\n\x05\x64\x65pth\x18\x04 \x01(\r\x12\x36\n\x10pool_commitments\x18\x05 \x03(\x0b\x32\x1c.antd.v1.PoolCommitmentEntry\x12 \n\x18merkle_payment_timestamp\x18\x06 \x01(\x04\x12\x14\n\x0ctotal_amount\x18\x07 \x01(\t\x12\x1d\n\x15payment_vault_address\x18\x08 \x01(\t\x12\x1d\n\x15payment_token_address\x18\t \x01(\t\x12\x0f\n\x07rpc_url\x18\n \x01(\t\"Y\n\x13PoolCommitmentEntry\x12\x11\n\tpool_hash\x18\x01 \x01(\t\x12/\n\ncandidates\x18\x02 \x03(\x0b\x32\x1b.antd.v1.CandidateNodeEntry\"=\n\x12\x43\x61ndidateNodeEntry\x12\x17\n\x0frewards_address\x18\x01 \x01(\t\x12\x0e\n\x06\x61mount\x18\x02 \x01(\t\"\xce\x01\n\x15\x46inalizeUploadRequest\x12\x11\n\tupload_id\x18\x01 \x01(\t\x12?\n\ttx_hashes\x18\x02 \x03(\x0b\x32,.antd.v1.FinalizeUploadRequest.TxHashesEntry\x12\x18\n\x10winner_pool_hash\x18\x03 \x01(\t\x12\x16\n\x0estore_data_map\x18\x04 \x01(\x08\x1a/\n\rTxHashesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"l\n\x16\x46inalizeUploadResponse\x12\x10\n\x08\x64\x61ta_map\x18\x01 \x01(\t\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\x12\x18\n\x10\x64\x61ta_map_address\x18\x03 \x01(\t\x12\x15\n\rchunks_stored\x18\x04 \x01(\x04\x32\x92\x02\n\rUploadService\x12V\n\x11PrepareFileUpload\x12!.antd.v1.PrepareFileUploadRequest\x1a\x1e.antd.v1.PrepareUploadResponse\x12V\n\x11PrepareDataUpload\x12!.antd.v1.PrepareDataUploadRequest\x1a\x1e.antd.v1.PrepareUploadResponse\x12Q\n\x0e\x46inalizeUpload\x12\x1e.antd.v1.FinalizeUploadRequest\x1a\x1f.antd.v1.FinalizeUploadResponseBDZ8github.com/WithAutonomi/ant-sdk/antd-go/proto/antd/v1;v1\xaa\x02\x07\x41ntd.V1b\x06proto3"
11
+
12
+ pool = ::Google::Protobuf::DescriptorPool.generated_pool
13
+ pool.add_serialized_file(descriptor_data)
14
+
15
+ module Antd
16
+ module V1
17
+ PrepareFileUploadRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PrepareFileUploadRequest").msgclass
18
+ PrepareDataUploadRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PrepareDataUploadRequest").msgclass
19
+ PrepareUploadResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PrepareUploadResponse").msgclass
20
+ PoolCommitmentEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PoolCommitmentEntry").msgclass
21
+ CandidateNodeEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.CandidateNodeEntry").msgclass
22
+ FinalizeUploadRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.FinalizeUploadRequest").msgclass
23
+ FinalizeUploadResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.FinalizeUploadResponse").msgclass
24
+ end
25
+ end
@@ -0,0 +1,51 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: antd/v1/upload.proto for package 'antd.v1'
3
+
4
+ require 'grpc'
5
+ require 'antd/v1/upload_pb'
6
+
7
+ module Antd
8
+ module V1
9
+ module UploadService
10
+ # External-signer flow for files + in-memory data. Mirrors the REST
11
+ # `/v1/upload/prepare`, `/v1/data/prepare`, `/v1/upload/finalize` surface 1:1.
12
+ #
13
+ # Two-phase: caller submits a prepare request, daemon collects quotes from the
14
+ # network and stashes server-side state keyed by `upload_id`. Caller then
15
+ # signs + submits the EVM payment off-daemon, then calls FinalizeUpload with
16
+ # the resulting transaction artefacts.
17
+ #
18
+ # Wave-batch (files with < 64 chunks): per-quote payments via `payForQuotes()`.
19
+ # Merkle (files with >= 64 chunks): pool commitments via `payForMerkleTree2()`.
20
+ #
21
+ # File and data prepares are intentionally separate RPCs (their request shapes
22
+ # differ — filesystem path vs raw bytes), but they share one finalize RPC
23
+ # because the server-side stored state is the same shape either way.
24
+ class Service
25
+
26
+ include ::GRPC::GenericService
27
+
28
+ self.marshal_class_method = :encode
29
+ self.unmarshal_class_method = :decode
30
+ self.service_name = 'antd.v1.UploadService'
31
+
32
+ # Phase 1: prepare a file upload for external signing. Returns payment
33
+ # details + an upload_id. For files with < 64 chunks returns
34
+ # `payment_type = "wave_batch"`; otherwise `payment_type = "merkle"`.
35
+ rpc :PrepareFileUpload, ::Antd::V1::PrepareFileUploadRequest, ::Antd::V1::PrepareUploadResponse
36
+ # Phase 1 (data): prepare an in-memory data upload for external signing.
37
+ # Same as PrepareFileUpload but takes raw bytes instead of a filesystem
38
+ # path. Honours visibility = "public" (requires ant-client #73, already
39
+ # merged on main since 2026-05-05).
40
+ rpc :PrepareDataUpload, ::Antd::V1::PrepareDataUploadRequest, ::Antd::V1::PrepareUploadResponse
41
+ # Phase 2: finalize an upload after the external EVM payment has landed.
42
+ # For wave-batch uploads pass `tx_hashes`; for merkle uploads pass
43
+ # `winner_pool_hash` from the `MerklePaymentMade` event. The server-side
44
+ # stored upload state is consumed (one-shot).
45
+ rpc :FinalizeUpload, ::Antd::V1::FinalizeUploadRequest, ::Antd::V1::FinalizeUploadResponse
46
+ end
47
+
48
+ Stub = Service.rpc_stub_class
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: antd/v1/wallet.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+
8
+ descriptor_data = "\n\x14\x61ntd/v1/wallet.proto\x12\x07\x61ntd.v1\"\x19\n\x17GetWalletAddressRequest\"+\n\x18GetWalletAddressResponse\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\"\x19\n\x17GetWalletBalanceRequest\"@\n\x18GetWalletBalanceResponse\x12\x0f\n\x07\x62\x61lance\x18\x01 \x01(\t\x12\x13\n\x0bgas_balance\x18\x02 \x01(\t\"\x16\n\x14WalletApproveRequest\")\n\x15WalletApproveResponse\x12\x10\n\x08\x61pproved\x18\x01 \x01(\x08\x32\xff\x01\n\rWalletService\x12Q\n\nGetAddress\x12 .antd.v1.GetWalletAddressRequest\x1a!.antd.v1.GetWalletAddressResponse\x12Q\n\nGetBalance\x12 .antd.v1.GetWalletBalanceRequest\x1a!.antd.v1.GetWalletBalanceResponse\x12H\n\x07\x41pprove\x12\x1d.antd.v1.WalletApproveRequest\x1a\x1e.antd.v1.WalletApproveResponseBDZ8github.com/WithAutonomi/ant-sdk/antd-go/proto/antd/v1;v1\xaa\x02\x07\x41ntd.V1b\x06proto3"
9
+
10
+ pool = ::Google::Protobuf::DescriptorPool.generated_pool
11
+ pool.add_serialized_file(descriptor_data)
12
+
13
+ module Antd
14
+ module V1
15
+ GetWalletAddressRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.GetWalletAddressRequest").msgclass
16
+ GetWalletAddressResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.GetWalletAddressResponse").msgclass
17
+ GetWalletBalanceRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.GetWalletBalanceRequest").msgclass
18
+ GetWalletBalanceResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.GetWalletBalanceResponse").msgclass
19
+ WalletApproveRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.WalletApproveRequest").msgclass
20
+ WalletApproveResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.WalletApproveResponse").msgclass
21
+ end
22
+ end
@@ -0,0 +1,42 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: antd/v1/wallet.proto for package 'antd.v1'
3
+
4
+ require 'grpc'
5
+ require 'antd/v1/wallet_pb'
6
+
7
+ module Antd
8
+ module V1
9
+ module WalletService
10
+ # Wallet operations. Mirrors the REST `/v1/wallet/*` surface 1:1.
11
+ #
12
+ # All three RPCs require the daemon to have been started with a configured
13
+ # wallet (the `AUTONOMI_WALLET_KEY` env var). When the wallet is absent the
14
+ # daemon returns `Status::failed_precondition` with the same "wallet not
15
+ # configured" message the REST handlers return as 503.
16
+ #
17
+ # External-signer flows do NOT use this service — they pay via off-daemon
18
+ # EVM transactions, see `UploadService` and `ChunkService.PrepareChunk` /
19
+ # `FinalizeChunk` for the prepare/finalize surface. `WalletService` is only
20
+ # for callers that have entrusted a key to the daemon.
21
+ class Service
22
+
23
+ include ::GRPC::GenericService
24
+
25
+ self.marshal_class_method = :encode
26
+ self.unmarshal_class_method = :decode
27
+ self.service_name = 'antd.v1.WalletService'
28
+
29
+ # Returns the wallet's on-chain address (hex with 0x prefix).
30
+ rpc :GetAddress, ::Antd::V1::GetWalletAddressRequest, ::Antd::V1::GetWalletAddressResponse
31
+ # Returns the wallet's token + gas balances.
32
+ rpc :GetBalance, ::Antd::V1::GetWalletBalanceRequest, ::Antd::V1::GetWalletBalanceResponse
33
+ # Approves the wallet to spend tokens on the payment vault contract.
34
+ # One-time operation; safe to call repeatedly (idempotent at the contract
35
+ # level — a no-op once approval is in place).
36
+ rpc :Approve, ::Antd::V1::WalletApproveRequest, ::Antd::V1::WalletApproveResponse
37
+ end
38
+
39
+ Stub = Service.rpc_stub_class
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Antd
4
+ VERSION = "0.1.0"
5
+ end
data/lib/antd.rb ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "antd/version"
4
+ require_relative "antd/models"
5
+ require_relative "antd/errors"
6
+ require_relative "antd/discover"
7
+ require_relative "antd/client"
8
+
9
+ # gRPC client is optional — requires the `grpc` gem and proto-generated stubs.
10
+ begin
11
+ require_relative "antd/grpc_client"
12
+ rescue LoadError
13
+ # grpc gem not installed; GrpcClient not available
14
+ end