Module: EverSdk::Net

Defined in:
lib/ever_sdk_client/net.rb

Defined Under Namespace

Modules: ErrorCode Classes: FieldAggregation, OrderBy, ParamsOfQueryOperation

Constant Summary collapse

ParamsOfQueryCollection =
KwStruct.new(:collection, :filter, :result, :order, :limit) do
  def initialize(collection: , filter: nil, result: , order: [], limit: nil)
    super
  end

  def to_h
    h = super
    ord_h_s = if !self.order.nil?
      self.order.map do |x|
        {
          path: x.path,
          direction: x.direction.to_s.upcase
        }
      end
    end

    h[:order] = ord_h_s
    h
  end
end
ResultOfQueryCollection =
KwStruct.new(:result)
ResultOfWaitForCollection =
KwStruct.new(:result)
ResultOfQuery =
KwStruct.new(:result)
ResultOfBatchQuery =
KwStruct.new(:results)
ParamsOfWaitForCollection =
KwStruct.new(:collection, :filter, :result, :timeout) do
  def initialize(collection:, filter: nil, result:, timeout: nil)
    super
  end
end
ParamsOfSubscribeCollection =
KwStruct.new(:collection, :filter, :result) do
  def initialize(collection:, filter: nil, result:)
    super
  end
end
ParamsOfSubscribe =
KwStruct.new(:subscription, :variables)
ResultOfSubscribeCollection =
KwStruct.new(:handle)
ParamsOfQuery =
KwStruct.new(:query, :variables) do
  def initialize(query:, variables: nil)
    super
  end
end
ParamsOfFindLastShardBlock =
KwStruct.new(:address)
ResultOfFindLastShardBlock =
KwStruct.new(:block_id)
EndpointsSet =
KwStruct.new(:endpoints)
ParamsOfBatchQuery =
KwStruct.new(:operations) do
  def to_h
    {
      operations: self.operations.compact.map(&:to_h)
    }
  end
end
ParamsOfAggregateCollection =
KwStruct.new(:collection, :filter, :fields) do
  def initialize(collection:, filter: nil, fields: [])
    super
  end

  def to_h
    h = super
    h[:fields] = fields.map(&:to_h)
    h
  end
end
ResultOfAggregateCollection =
KwStruct.new(:values)
ParamsOfQueryCounterparties =
KwStruct.new(:account, :result, :first, :after) do
  def initialize(account:, result:, first: nil, after: nil)
    super
  end
end
ResultOfGetEndpoints =
KwStruct.new(:query, :endpoints)
TransactionNode =
KwStruct.new(
  :id_,
  :in_msg,
  :out_msgs,
  :account_addr,
  :total_fees,
  :aborted,
  :exit_code
) do
  def initialize(id_:, in_msg:, out_msgs:, account_addr:, total_fees:, aborted:, exit_code: nil)
    super
  end
end
MessageNode =
KwStruct.new(
  :id_,
  :src_transaction_id,
  :dst_transaction_id,
  :src,
  :dst,
  :value,
  :bounce,
  :decoded_body
) do
  def initialize(
    id_:,
    src_transaction_id: nil,
    dst_transaction_id: nil,
    src: nil,
    dst: nil,
    value: nil,
    bounce:,
    decoded_body: nil
  )
    super
  end
end
ParamsOfQueryTransactionTree =
KwStruct.new(:in_msg, :abi_registry, :timeout) do
  def initialize(in_msg:, abi_registry: [], timeout: nil)
    super
  end

  def to_h
    h = super
    h[:abi_registry] = abi_registry&.map(&:to_h)
    h
  end
end
ResultOfQueryTransactionTree =
KwStruct.new(:messages, :transactions)
ParamsOfCreateBlockIterator =
KwStruct.new(:start_time, :end_time, :shard_filter, :result)
RegisteredIterator =
KwStruct.new(:handle)
ParamsOfResumeBlockIterator =
KwStruct.new(:resume_state)
ParamsOfCreateTransactionIterator =
KwStruct.new(:start_time, :end_time, :shard_filter, :accounts_filter, :result, :include_transfers)
ParamsOfResumeTransactionIterator =
KwStruct.new(:resume_state, :accounts_filter) do
  def initialize(resume_state:, accounts_filter: nil)
    super
  end
end
ParamsOfIteratorNext =
KwStruct.new(:iterator, :limit, :return_resume_state) do
  def initialize(iterator:, limit: nil, return_resume_state: nil)
    super
  end
end
ResultOfIteratorNext =
KwStruct.new(:items, :has_more, :resume_state) do
  def initialize(items: [], has_more:, resume_state: nil)
    super
  end
end

Class Method Summary collapse

Class Method Details

.aggregate_collection(ctx, params) ⇒ Object



421
422
423
424
425
426
427
428
429
430
431
# File 'lib/ever_sdk_client/net.rb', line 421

def self.aggregate_collection(ctx, params)
  Interop::request_to_native_lib(ctx, "net.aggregate_collection", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfAggregateCollection.new(values: resp.result["values"])
      )
    else
      yield resp
    end
  end
end

.batch_query(ctx, params) ⇒ Object



409
410
411
412
413
414
415
416
417
418
419
# File 'lib/ever_sdk_client/net.rb', line 409

def self.batch_query(ctx, params)
  Interop::request_to_native_lib(ctx, "net.batch_query", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfBatchQuery.new(results: resp.result["results"])
      )
    else
      yield resp
    end
  end
end

.create_block_iterator(ctx, params) ⇒ Object



475
476
477
478
479
480
481
482
483
484
485
# File 'lib/ever_sdk_client/net.rb', line 475

def self.create_block_iterator(ctx, params)
  Interop::request_to_native_lib(ctx, "net.create_block_iterator", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: RegisteredIterator.new(handle: resp.result["handle"])
      )
    else
      yield resp
    end
  end
end

.create_transaction_iterator(ctx, params) ⇒ Object



499
500
501
502
503
504
505
506
507
508
509
# File 'lib/ever_sdk_client/net.rb', line 499

def self.create_transaction_iterator(ctx, params)
  Interop::request_to_native_lib(ctx, "net.create_transaction_iterator", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: RegisteredIterator.new(handle: resp.result["handle"])
      )
    else
      yield resp
    end
  end
end

.fetch_endpoints(ctx) ⇒ Object



385
386
387
388
389
390
391
392
393
394
395
# File 'lib/ever_sdk_client/net.rb', line 385

def self.fetch_endpoints(ctx)
  Interop::request_to_native_lib(ctx, "net.fetch_endpoints") do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: EndpointsSet.new(endpoints: resp.result["endpoints"])
      )
    else
      yield resp
    end
  end
end

.find_last_shard_block(ctx, params) ⇒ Object



373
374
375
376
377
378
379
380
381
382
383
# File 'lib/ever_sdk_client/net.rb', line 373

def self.find_last_shard_block(ctx, params)
  Interop::request_to_native_lib(ctx, "net.find_last_shard_block", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfFindLastShardBlock.new(block_id: resp.result["block_id"])
      )
    else
      yield resp
    end
  end
end

.get_endpoints(ctx) ⇒ Object



433
434
435
436
437
438
439
440
441
442
443
444
445
446
# File 'lib/ever_sdk_client/net.rb', line 433

def self.get_endpoints(ctx)
  Interop::request_to_native_lib(ctx, "net.get_endpoints") do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfGetEndpoints.new(
          query: resp.result["query"],
          endpoints: resp.result["endpoints"],
        )
      )
    else
      yield resp
    end
  end
end

.iterator_next(ctx, params) ⇒ Object



523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
# File 'lib/ever_sdk_client/net.rb', line 523

def self.iterator_next(ctx, params)
  Interop::request_to_native_lib(ctx, "net.iterator_next", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfIteratorNext.new(
          items: resp.result["items"],
          has_more: resp.result["has_more"],
          resume_state: resp.result["resume_state"]
        )
      )
    else
      yield resp
    end
  end
end

.query(ctx, params) ⇒ Object



341
342
343
344
345
346
347
348
349
350
351
# File 'lib/ever_sdk_client/net.rb', line 341

def self.query(ctx, params)
  Interop::request_to_native_lib(ctx, "net.query", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfQuery.new(result: resp.result["result"])
      )
    else
      yield resp
    end
  end
end

.query_collection(ctx, params) ⇒ Object

functions



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/ever_sdk_client/net.rb', line 259

def self.query_collection(ctx, params)
  Interop::request_to_native_lib(
    ctx,
    "net.query_collection",
    params,
    is_single_thread_only: false
  ) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfQueryCollection.new(result: resp.result["result"])
      )
    else
      yield resp
    end
  end
end

.query_counterparties(ctx, params) ⇒ Object



448
449
450
451
452
453
454
455
456
457
458
# File 'lib/ever_sdk_client/net.rb', line 448

def self.query_counterparties(ctx, params)
  Interop::request_to_native_lib(ctx, "net.query_counterparties", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfQueryCollection.new(result: resp.result["result"])
      )
    else
      yield resp
    end
  end
end

.query_transaction_tree(ctx, params) ⇒ Object



460
461
462
463
464
465
466
467
468
469
470
471
472
473
# File 'lib/ever_sdk_client/net.rb', line 460

def self.query_transaction_tree(ctx, params)
  Interop::request_to_native_lib(ctx, "net.query_transaction_tree", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfQueryTransactionTree.new(
          messages: resp.result["messages"],
          transactions: resp.result["transactions"],
        )
      )
    else
      yield resp
    end
  end
end

.remove_iterator(ctx, params) ⇒ Object



539
540
541
542
543
544
545
546
547
548
549
# File 'lib/ever_sdk_client/net.rb', line 539

def self.remove_iterator(ctx, params)
  Interop::request_to_native_lib(ctx, "net.remove_iterator", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: nil
      )
    else
      yield resp
    end
  end
end

.resume(ctx) ⇒ Object



363
364
365
366
367
368
369
370
371
# File 'lib/ever_sdk_client/net.rb', line 363

def self.resume(ctx)
  Interop::request_to_native_lib(ctx, "net.resume") do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(result: "")
    else
      yield resp
    end
  end
end

.resume_block_iterator(ctx, params) ⇒ Object



487
488
489
490
491
492
493
494
495
496
497
# File 'lib/ever_sdk_client/net.rb', line 487

def self.resume_block_iterator(ctx, params)
  Interop::request_to_native_lib(ctx, "net.resume_block_iterator", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: RegisteredIterator.new(handle: resp.result["handle"])
      )
    else
      yield resp
    end
  end
end

.resume_transaction_iterator(ctx, params) ⇒ Object



511
512
513
514
515
516
517
518
519
520
521
# File 'lib/ever_sdk_client/net.rb', line 511

def self.resume_transaction_iterator(ctx, params)
  Interop::request_to_native_lib(ctx, "net.resume_transaction_iterator", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: RegisteredIterator.new(handle: resp.result["handle"])
      )
    else
      yield resp
    end
  end
end

.set_endpoints(ctx, params) ⇒ Object



397
398
399
400
401
402
403
404
405
406
407
# File 'lib/ever_sdk_client/net.rb', line 397

def self.set_endpoints(ctx, params)
  Interop::request_to_native_lib(ctx, "net.set_endpoints", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: nil
      )
    else
      yield resp
    end
  end
end

.subscribe(ctx, params, client_callback: nil) ⇒ Object



323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/ever_sdk_client/net.rb', line 323

def self.subscribe(ctx, params, client_callback: nil)
  Interop::request_to_native_lib(
    ctx,
    "net.subscribe",
    params,
    client_callback: client_callback,
    is_single_thread_only: false
  ) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfSubscribeCollection.new(handle: resp.result["handle"])
      )
    else
      yield resp
    end
  end
end

.subscribe_collection(ctx, params, client_callback: nil) ⇒ Object



305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/ever_sdk_client/net.rb', line 305

def self.subscribe_collection(ctx, params, client_callback: nil)
  Interop::request_to_native_lib(
    ctx,
    "net.subscribe_collection",
    params,
    client_callback: client_callback,
    is_single_thread_only: false
  ) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfSubscribeCollection.new(handle: resp.result["handle"])
      )
    else
      yield resp
    end
  end
end

.suspend(ctx) ⇒ Object



353
354
355
356
357
358
359
360
361
# File 'lib/ever_sdk_client/net.rb', line 353

def self.suspend(ctx)
  Interop::request_to_native_lib(ctx, "net.suspend") do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(result: "")
    else
      yield resp
    end
  end
end

.unsubscribe(ctx, params) ⇒ Object



293
294
295
296
297
298
299
300
301
302
303
# File 'lib/ever_sdk_client/net.rb', line 293

def self.unsubscribe(ctx, params)
  Interop::request_to_native_lib(ctx, "net.unsubscribe", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ""
      )
    else
      yield resp
    end
  end
end

.wait_for_collection(ctx, params) ⇒ Object



276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/ever_sdk_client/net.rb', line 276

def self.wait_for_collection(ctx, params)
  Interop::request_to_native_lib(
    ctx,
    "net.wait_for_collection",
    params,
    is_single_thread_only: false
  ) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfWaitForCollection.new(result: resp.result["result"])
      )
    else
      yield resp
    end
  end
end