Class: Klaytn

Inherits:
Base
  • Object
show all
Defined in:
lib/blocksdk_ruby/klaytn.rb

Instance Attribute Summary

Attributes inherited from Base

#api_token

Instance Method Summary collapse

Methods inherited from Base

#initialize, #request

Constructor Details

This class inherits a constructor from Base

Instance Method Details

#createAddress(request = {}) ⇒ Object



42
43
44
45
# File 'lib/blocksdk_ruby/klaytn.rb', line 42

def createAddress(request = {})
	request["name"].to_s.empty? ? request['name'] = 0 : request["name"]
	return request("POST","/klay/addresses",{"name" => request['name']})
end

#getAddress(request = {}) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/blocksdk_ruby/klaytn.rb', line 24

def getAddress(request = {})
	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
	
	return request("GET","/klay/addresses",{
		"offset" => request['offset'],
		"limit" => request['limit']
	})
end

#getAddressBalance(request = {}) ⇒ Object



57
58
59
# File 'lib/blocksdk_ruby/klaytn.rb', line 57

def getAddressBalance(request = {})
	return request("GET","/klay/addresses/" + (request['address']).to_s + "/balance")
end

#getAddressInfo(request = {}) ⇒ Object



47
48
49
50
51
52
53
54
55
# File 'lib/blocksdk_ruby/klaytn.rb', line 47

def getAddressInfo(request = {})

	request["reverse"].to_s.empty? ? request['reverse'] = true : request['reverse']
	request["rawtx"].to_s.empty? ? request['rawtx'] = false : request['rawtx']
	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
	
	return request("GET","/klay/addresses/" + (request['address']).to_s ,{"reverse" => request['reverse'],"rawtx" => request['rawtx'],"offset" => request['offset'],"limit" => request['limit']})
end

#getAuctionNfts(request = {}) ⇒ Object



141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/blocksdk_ruby/klaytn.rb', line 141

def getAuctionNfts(request = {})
	request["order_by"].to_s.empty? ? request['order_by'] = 'end_time' : request["order_by"]
	request["order_direction"].to_s.empty? ? request['order_direction'] = 'desc' : request["order_direction"]
	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
	
	return request("GET","/klay/kip17-tokens/" + (request['contract_address']).to_s + "/auction",{
		"order_by" => request['order_by'],
		"order_direction" => request['order_direction'],
		"offset" => request['offset'],
		"limit" => request['limit']
	})
end

#getBlock(request = {}) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/blocksdk_ruby/klaytn.rb', line 8

def getBlock(request = {})
	request["rawtx"].to_s.empty? ? request['rawtx'] = false : request['rawtx']
	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]

	return request("GET","/klay/blocks/" + (request['block']).to_s,{"rawtx" => request['rawtx'],"offset" => request['offset'],"limit" => request['limit']})
end

#getBlockChain(request = {}) ⇒ Object



4
5
6
# File 'lib/blocksdk_ruby/klaytn.rb', line 4

def getBlockChain(request = {})
	return request("GET","/klay/info")		
end

#getContractRead(request = {}) ⇒ Object



289
290
291
292
293
294
295
296
297
298
299
# File 'lib/blocksdk_ruby/klaytn.rb', line 289

def getContractRead(request = {})
	request["parameter_type"].to_s.empty? ? request['parameter_type'] = nil : request["parameter_type"]
	request["parameter_data"].to_s.empty? ? request['parameter_data'] = nil : request["parameter_data"]
	
	return request("POST","/klay/contracts/" + (request['contract_address']).to_s + "/read",{
		"method" => request['method'],
		"return_type" => request['return_type'],
		"parameter_type" => request['parameter_type'],
		"parameter_data" => request['parameter_data']
	})
end

#getContractWrite(request = {}) ⇒ Object



301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/blocksdk_ruby/klaytn.rb', line 301

def getContractWrite(request = {})
	request["private_key"].to_s.empty? ? request['private_key'] = nil : request["private_key"]
	request["password"].to_s.empty? ? request['password'] = nil : request["password"]
	request["gas_limit"].to_s.empty? ? request['gas_limit'] = nil : request["gas_limit"]
	
	request["parameter_type"].to_s.empty? ? request['parameter_type'] = nil : request["parameter_type"]
	request["parameter_data"].to_s.empty? ? request['parameter_data'] = nil : request["parameter_data"]
	
	return request("POST","/klay/contracts/" + (request['contract_address']).to_s + "/write",{
		"method" => request['method'],
		"return_type" => request['return_type'],
		"parameter_type" => request['parameter_type'],
		"parameter_data" => request['parameter_data'],
		"from" => request['from'],
		"private_key" => request['private_key'],
		"password" => request['password'],
		"amount" => request['amount'],
		"gas_limit" => request['gas_limit']
	})
end

#getContractWriteFeedelegated(request = {}) ⇒ Object



343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/blocksdk_ruby/klaytn.rb', line 343

def getContractWriteFeedelegated(request = {})
	request["private_key"].to_s.empty? ? request['private_key'] = nil : request["private_key"]
	request["password"].to_s.empty? ? request['password'] = nil : request["password"]
	request["gas_limit"].to_s.empty? ? request['gas_limit'] = nil : request["gas_limit"]
	
	request["parameter_type"].to_s.empty? ? request['parameter_type'] = nil : request["parameter_type"]
	request["parameter_data"].to_s.empty? ? request['parameter_data'] = nil : request["parameter_data"]
	
	return request("POST","/klay/contracts/" + (request['contract_address']).to_s + "/write/feedelegated",{
		"method" => request['method'],
		"return_type" => request['return_type'],
		"parameter_type" => request['parameter_type'],
		"parameter_data" => request['parameter_data'],
		"from" => request['from'],
		"fee_payer" => request['fee_payer'],
		"private_key" => request['private_key'],
		"password" => request['password'],
		"amount" => request['amount'],
		"gwei" => request['gwei'],
		"gas_limit" => request['gas_limit']
	})
end

#getContractWriteFees(request = {}) ⇒ Object



366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
# File 'lib/blocksdk_ruby/klaytn.rb', line 366

def getContractWriteFees(request = {})
	request["gas_limit"].to_s.empty? ? request['gas_limit'] = nil : request["gas_limit"]
	
	request["parameter_type"].to_s.empty? ? request['parameter_type'] = nil : request["parameter_type"]
	request["parameter_data"].to_s.empty? ? request['parameter_data'] = nil : request["parameter_data"]
	
	return request("POST","/klay/kip17-tokens/" + (request['contract_address']).to_s + "/write/fees",{
		"method" => request['method'],
		"return_type" => request['return_type'],
		"parameter_type" => request['parameter_type'],
		"parameter_data" => request['parameter_data'],
		"from" => request['from'],
		"amount" => request['amount'],
		"gas_limit" => request['gas_limit']
	})
end

#getContractWriteSign(request = {}) ⇒ Object



322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/blocksdk_ruby/klaytn.rb', line 322

def getContractWriteSign(request = {})
	request["private_key"].to_s.empty? ? request['private_key'] = nil : request["private_key"]
	request["password"].to_s.empty? ? request['password'] = nil : request["password"]
	request["gas_limit"].to_s.empty? ? request['gas_limit'] = nil : request["gas_limit"]
	
	request["parameter_type"].to_s.empty? ? request['parameter_type'] = nil : request["parameter_type"]
	request["parameter_data"].to_s.empty? ? request['parameter_data'] = nil : request["parameter_data"]
	
	return request("POST","/klay/contracts/" + (request['contract_address']).to_s + "/write/sign",{
		"method" => request['method'],
		"return_type" => request['return_type'],
		"parameter_type" => request['parameter_type'],
		"parameter_data" => request['parameter_data'],
		"from" => request['from'],
		"private_key" => request['private_key'],
		"password" => request['password'],
		"amount" => request['amount'],
		"gas_limit" => request['gas_limit']
	})
end

#getCreatorNfts(request = {}) ⇒ Object



131
132
133
134
135
136
137
138
139
# File 'lib/blocksdk_ruby/klaytn.rb', line 131

def getCreatorNfts(request = {})
	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
	
	return request("GET","/klay/kip17-tokens/" + (request['contract_address']).to_s + "/" + (request['creator_address']).to_s + "/creator",{
		"offset" => request['offset'],
		"limit" => request['limit']
	})
end

#getKIP7(request = {}) ⇒ Object



79
80
81
# File 'lib/blocksdk_ruby/klaytn.rb', line 79

def getKIP7(request = {})
	return request("GET","/klay/kip7-tokens/" + (request['contract_address']).to_s)
end

#getKIP7Balance(request = {}) ⇒ Object



83
84
85
# File 'lib/blocksdk_ruby/klaytn.rb', line 83

def getKIP7Balance(request = {})
	return request("GET","/klay/kip7-tokens/" + (request['contract_address']).to_s + "/" + (request['from']).to_s + "/balance")
end

#getKIP7Feedelegated(request = {}) ⇒ Object



103
104
105
106
107
108
109
# File 'lib/blocksdk_ruby/klaytn.rb', line 103

def getKIP7Feedelegated(request = {})
	request["private_key"].to_s.empty? ? request['private_key'] = nil : request["private_key"]
	request["password"].to_s.empty? ? request['password'] = nil : request["password"]
	request["gas_limit"].to_s.empty? ? request['gas_limit'] = nil : request["gas_limit"]
	
	return request("POST","/klay/kip7-tokens/" + (request['contract_address']).to_s + "/" + (request['from']).to_s + "/transfer/sign",{"from" => request['from'], "to" => request['to'],"amount" => request['amount'],"private_key" => request['private_key'],"password" => request['password'],"gwei" => request['gwei'],"gas_limit" => request['gas_limit'],"nonce" => request["nonce"],"v" => request['v'],"r" => request['r'],"s" => request['s'],})
end

#getKIP7Sign(request = {}) ⇒ Object



95
96
97
98
99
100
101
# File 'lib/blocksdk_ruby/klaytn.rb', line 95

def getKIP7Sign(request = {})
	request["private_key"].to_s.empty? ? request['private_key'] = nil : request["private_key"]
	request["password"].to_s.empty? ? request['password'] = nil : request["password"]
	request["gas_limit"].to_s.empty? ? request['gas_limit'] = nil : request["gas_limit"]
	
	return request("POST","/klay/kip7-tokens/" + (request['contract_address']).to_s + "/" + (request['from']).to_s + "/transfer/sign",{"to" => request['to'],"amount" => request['amount'],"private_key" => request['private_key'],"password" => request['password'],"gas_limit" => request['gas_limit']})
end

#getKIP7Transfer(request = {}) ⇒ Object



87
88
89
90
91
92
93
# File 'lib/blocksdk_ruby/klaytn.rb', line 87

def getKIP7Transfer(request = {})
	request["private_key"].to_s.empty? ? request['private_key'] = nil : request["private_key"]
	request["password"].to_s.empty? ? request['password'] = nil : request["password"]
	request["gas_limit"].to_s.empty? ? request['gas_limit'] = nil : request["gas_limit"]
	
	return request("POST","/klay/kip7-tokens/" + (request['contract_address']).to_s + "/" + (request['from']).to_s + "/transfer",{"to" => request['to'],"amount" => request['amount'],"private_key" => request['private_key'],"password" => request['password'],"gas_limit" => request['gas_limit']})
end

#getMemPool(request = {}) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/blocksdk_ruby/klaytn.rb', line 16

def getMemPool(request = {})
	request["rawtx"].to_s.empty? ? request['rawtx'] = false : request['rawtx']
	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
	
	return request("GET","/klay/mempool",{"rawtx" => request['rawtx'],"offset" => request['offset'],"limit" => request['limit']})
end

#getMultiNft(request = {}) ⇒ Object



198
199
200
201
202
203
204
205
206
# File 'lib/blocksdk_ruby/klaytn.rb', line 198

def getMultiNft(request = {})
	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
	
	return request("GET","/bsc/bep1155-tokens/" + (request['contract_address']).to_s + "/tokens",{
		"offset" => request['offset'],
		"limit" => request['limit']
	})
end

#getMultiNftContractCreator(request = {}) ⇒ Object



238
239
240
241
242
243
244
245
246
# File 'lib/blocksdk_ruby/klaytn.rb', line 238

def getMultiNftContractCreator(request = {})
	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
	
	return request("GET","/bsc/bep1155-tokens/" + (request['contract_address']).to_s + "/" + (request['creator_address']).to_s + "/creators",{
		"offset" => request['offset'],
		"limit" => request['limit']
	})
end

#getMultiNftContractOwner(request = {}) ⇒ Object



218
219
220
221
222
223
224
225
226
# File 'lib/blocksdk_ruby/klaytn.rb', line 218

def getMultiNftContractOwner(request = {})
	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
	
	return request("GET","/bsc/bep1155-tokens/" + (request['contract_address']).to_s + "/" + (request['owner_address']).to_s + "/owners",{
		"offset" => request['offset'],
		"limit" => request['limit']
	})
end

#getMultiNftCreator(request = {}) ⇒ Object



248
249
250
251
252
253
254
255
256
# File 'lib/blocksdk_ruby/klaytn.rb', line 248

def getMultiNftCreator(request = {})
	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
	
	return request("GET","/bsc/bep1155-tokens/" + (request['creator_address']).to_s + "/creator",{
		"offset" => request['offset'],
		"limit" => request['limit']
	})
end

#getMultiNftInfo(request = {}) ⇒ Object



258
259
260
261
# File 'lib/blocksdk_ruby/klaytn.rb', line 258

def getMultiNftInfo(request = {})
	return request("GET","/bsc/bep1155-tokens/" + (request['contract_address']).to_s + "/" + (request['token_id']).to_s + "/info",{
	})
end

#getMultiNftOwner(request = {}) ⇒ Object



228
229
230
231
232
233
234
235
236
# File 'lib/blocksdk_ruby/klaytn.rb', line 228

def getMultiNftOwner(request = {})
	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
	
	return request("GET","/bsc/bep1155-tokens/" + (request['owner_address']).to_s + "/owner",{
		"offset" => request['offset'],
		"limit" => request['limit']
	})
end

#getMultiNftOwnerList(request = {}) ⇒ Object



208
209
210
211
212
213
214
215
216
# File 'lib/blocksdk_ruby/klaytn.rb', line 208

def getMultiNftOwnerList(request = {})
	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
	
	return request("GET","/bsc/bep1155-tokens/" + (request['contract_address']).to_s + "/" + (request['token_id']).to_s + "/list",{
		"offset" => request['offset'],
		"limit" => request['limit']
	})
end

#getMultiNftTransfers(request = {}) ⇒ Object



263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/blocksdk_ruby/klaytn.rb', line 263

def getMultiNftTransfers(request = {})
	request["rawtx"].to_s.empty? ? request['rawtx'] = 0 : request["rawtx"]

	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
	
	return request("GET","/bsc/bep1155-tokens/" + (request['contract_address']).to_s + "/" + (request['token_id']).to_s + "/transfers",{
		"rawtx" => request['rawtx'],
		"offset" => request['offset'],
		"limit" => request['limit']
	})
end

#getMultiSaleNfts(request = {}) ⇒ Object



276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/blocksdk_ruby/klaytn.rb', line 276

def getMultiSaleNfts(request = {})
	request["order_direction"].to_s.empty? ? request['order_direction'] = 'desc' : request["order_direction"]

	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
	
	return request("GET","/bsc/bep1155-tokens/" + (request['contract_address']).to_s + "/" + (request['seller_address']).to_s + "/sale",{
		"order_direction" => request['order_direction'],
		"offset" => request['offset'],
		"limit" => request['limit']
	})
end

#getNftBids(request = {}) ⇒ Object



167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/blocksdk_ruby/klaytn.rb', line 167

def getNftBids(request = {})
	request["rawtx"].to_s.empty? ? request['rawtx'] = 0 : request["rawtx"]
	request["order_direction"].to_s.empty? ? request['order_direction'] = 'desc' : request["order_direction"]
	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
	
	return request("GET","/klay/kip17-tokens/" + (request['contract_address']).to_s + "/" + (request['token_id']).to_s + "/bid",{
		"rawtx" => request['rawtx'],
		"order_direction" => request['order_direction'],
		"offset" => request['offset'],
		"limit" => request['limit']
	})
end

#getNftInfo(request = {}) ⇒ Object



181
182
183
# File 'lib/blocksdk_ruby/klaytn.rb', line 181

def getNftInfo(request = {})		
	return request("GET","/klay/kip17-tokens/" + (request['contract_address']).to_s + "/" + (request['token_id']).to_s + "/info")
end

#getNfts(request = {}) ⇒ Object



111
112
113
114
115
116
117
118
119
# File 'lib/blocksdk_ruby/klaytn.rb', line 111

def getNfts(request = {})
	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
	
	return request("GET","/klay/kip17-tokens/" + (request['contract_address']).to_s + "/tokens",{
		"offset" => request['offset'],
		"limit" => request['limit']
	})
end

#getNftTransfers(request = {}) ⇒ Object



185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/blocksdk_ruby/klaytn.rb', line 185

def getNftTransfers(request = {})
	request["rawtx"].to_s.empty? ? request['rawtx'] = 0 : request["rawtx"]
	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
	
	return request("GET","/klay/kip17-tokens/" + (request['contract_address']).to_s + "/" + (request['token_id']).to_s + "/bid",{
		"rawtx" => request['rawtx'],
		"order_direction" => request['order_direction'],
		"offset" => request['offset'],
		"limit" => request['limit']
	})
end

#getOwnerNfts(request = {}) ⇒ Object



121
122
123
124
125
126
127
128
129
# File 'lib/blocksdk_ruby/klaytn.rb', line 121

def getOwnerNfts(request = {})
	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
	
	return request("GET","/klay/kip17-tokens/" + (request['contract_address']).to_s + "/" + (request['owner_address']).to_s + "/owner",{
		"offset" => request['offset'],
		"limit" => request['limit']
	})
end

#getSaleNfts(request = {}) ⇒ Object



155
156
157
158
159
160
161
162
163
164
165
# File 'lib/blocksdk_ruby/klaytn.rb', line 155

def getSaleNfts(request = {})
	request["order_direction"].to_s.empty? ? request['order_direction'] = 'desc' : request["order_direction"]
	request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
	request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
	
	return request("GET","/klay/kip17-tokens/" + (request['contract_address']).to_s + "/" + (request['seller_address']).to_s + "/sale",{
		"order_direction" => request['order_direction'],
		"offset" => request['offset'],
		"limit" => request['limit']
	})
end

#getTransactions(request = {}) ⇒ Object



75
76
77
# File 'lib/blocksdk_ruby/klaytn.rb', line 75

def getTransactions(request = {})
	return request("GET","/klay/transactions/" + (request['hash']).to_s)
end

#loadAddress(request = {}) ⇒ Object



34
35
36
# File 'lib/blocksdk_ruby/klaytn.rb', line 34

def loadAddress(request = {})
	return request("POST","/klay/addresses/" + (request['address']).to_s + "/load",{"private_key" => request['private_key'],"password" => request['password']})
end

#sendToAddress(request = {}) ⇒ Object



61
62
63
64
65
66
67
68
69
# File 'lib/blocksdk_ruby/klaytn.rb', line 61

def sendToAddress(request = {})
	request["nonce"].to_s.empty? ? request['nonce'] = nil : request["nonce"]
	request["data"].to_s.empty? ? request['data'] = nil : request["data"]
	request["private_key"].to_s.empty? ? request['private_key'] = nil : request["private_key"]
	request["password"].to_s.empty? ? request['password'] = nil : request["password"]
	request["gas_limit"].to_s.empty? ? request['gas_limit'] = nil : request["gas_limit"]
	
	return request("POST","/klay/addresses/" + (request['from']).to_s + "/sendtoaddress",{"to" => request['to'],"amount" => request['amount'],"private_key" => request['private_key'],"password" => request['password'],"gas_limit" => request['gas_limit']})
end

#sendTransaction(request = {}) ⇒ Object



71
72
73
# File 'lib/blocksdk_ruby/klaytn.rb', line 71

def sendTransaction(request = {})
	return request("POST","/klay/transactions/send",{"hex" => request['hex']})
end

#unloadAddress(request = {}) ⇒ Object



38
39
40
# File 'lib/blocksdk_ruby/klaytn.rb', line 38

def unloadAddress(request = {})
	return request("POST","/klay/addresses/" + (request['address']).to_s + "/unload")
end