Class: Privy::Resources::Wallets
- Inherits:
-
Object
- Object
- Privy::Resources::Wallets
- Defined in:
- lib/privy/resources/wallets.rb,
lib/privy/resources/wallets/earn.rb,
lib/privy/resources/wallets/balance.rb,
lib/privy/resources/wallets/transactions.rb,
lib/privy/resources/wallets/earn/ethereum.rb,
lib/privy/resources/wallets/earn/ethereum/incentive.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Balance, Earn, Transactions
Instance Attribute Summary collapse
-
#balance ⇒ Privy::Resources::Wallets::Balance
readonly
Operations related to wallets.
- #earn ⇒ Privy::Resources::Wallets::Earn readonly
-
#transactions ⇒ Privy::Resources::Wallets::Transactions
readonly
Operations related to wallets.
Instance Method Summary collapse
-
#_init_import(body:, request_options: {}) ⇒ Privy::Models::WalletInitImportResponse
Initialize a wallet import.
-
#_submit_import(wallet:, additional_signers: nil, display_name: nil, external_id: nil, owner: nil, owner_id: nil, policy_ids: nil, request_options: {}) ⇒ Privy::Models::Wallet
Some parameter documentations has been truncated, see Models::WalletSubmitImportParams for more details.
-
#_transfer(wallet_id, destination:, source:, amount_type: nil, fee_configuration: nil, slippage_bps: nil, privy_authorization_signature: nil, privy_idempotency_key: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::TransferActionResponse
Some parameter documentations has been truncated, see Models::WalletTransferParams for more details.
-
#authenticate_with_jwt(encryption_type:, recipient_public_key:, user_jwt:, request_options: {}) ⇒ Privy::Models::WalletAuthenticateWithJwtResponse::WithEncryption, Privy::Models::WalletAuthenticateWithJwtResponse::WithoutEncryption
Some parameter documentations has been truncated, see Models::WalletAuthenticateWithJwtParams for more details.
-
#create(chain_type:, additional_signers: nil, display_name: nil, external_id: nil, owner: nil, owner_id: nil, policy_ids: nil, privy_idempotency_key: nil, request_options: {}) ⇒ Privy::Models::Wallet
Some parameter documentations has been truncated, see Models::WalletCreateParams for more details.
- #create_wallets_with_recovery(primary_signer:, recovery_user:, wallets:, request_options: {}) ⇒ Privy::Models::WalletCreateWalletsWithRecoveryResponse deprecated Deprecated.
-
#export(wallet_id, encryption_type:, recipient_public_key:, export_seed_phrase: nil, privy_authorization_signature: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::WalletExportResponseBody
Some parameter documentations has been truncated, see Models::WalletExportParams for more details.
-
#get(wallet_id, request_options: {}) ⇒ Privy::Models::Wallet
Get a wallet by wallet ID.
-
#get_wallet_by_address(address:, request_options: {}) ⇒ Privy::Models::Wallet
Look up a wallet by its blockchain address.
-
#initialize(client:) ⇒ Wallets
constructor
private
A new instance of Wallets.
-
#list(authorization_key: nil, chain_type: nil, cursor: nil, external_id: nil, limit: nil, user_id: nil, request_options: {}) ⇒ Privy::Internal::Cursor<Privy::Models::Wallet>
Some parameter documentations has been truncated, see Models::WalletListParams for more details.
-
#raw_sign(wallet_id, params:, privy_authorization_signature: nil, privy_idempotency_key: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::RawSignResponse
Some parameter documentations has been truncated, see Models::WalletRawSignParams for more details.
-
#rpc(wallet_id, wallet_rpc_request_body:, privy_authorization_signature: nil, privy_idempotency_key: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::EthereumPersonalSignRpcResponse, ...
Some parameter documentations has been truncated, see Models::WalletRpcParams for more details.
-
#update(wallet_id, additional_signers: nil, display_name: nil, owner: nil, owner_id: nil, policy_ids: nil, privy_authorization_signature: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::Wallet
Some parameter documentations has been truncated, see Models::WalletUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Wallets
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Wallets.
465 466 467 468 469 470 |
# File 'lib/privy/resources/wallets.rb', line 465 def initialize(client:) @client = client @earn = Privy::Resources::Wallets::Earn.new(client: client) @transactions = Privy::Resources::Wallets::Transactions.new(client: client) @balance = Privy::Resources::Wallets::Balance.new(client: client) end |
Instance Attribute Details
#balance ⇒ Privy::Resources::Wallets::Balance (readonly)
Operations related to wallets
15 16 17 |
# File 'lib/privy/resources/wallets.rb', line 15 def balance @balance end |
#earn ⇒ Privy::Resources::Wallets::Earn (readonly)
7 8 9 |
# File 'lib/privy/resources/wallets.rb', line 7 def earn @earn end |
#transactions ⇒ Privy::Resources::Wallets::Transactions (readonly)
Operations related to wallets
11 12 13 |
# File 'lib/privy/resources/wallets.rb', line 11 def transactions @transactions end |
Instance Method Details
#_init_import(body:, request_options: {}) ⇒ Privy::Models::WalletInitImportResponse
Initialize a wallet import. Complete by submitting the import.
151 152 153 154 155 156 157 158 159 160 |
# File 'lib/privy/resources/wallets.rb', line 151 def _init_import(params) parsed, = Privy::WalletInitImportParams.dump_request(params) @client.request( method: :post, path: "v1/wallets/import/init", body: parsed[:body], model: Privy::Models::WalletInitImportResponse, options: ) end |
#_submit_import(wallet:, additional_signers: nil, display_name: nil, external_id: nil, owner: nil, owner_id: nil, policy_ids: nil, request_options: {}) ⇒ Privy::Models::Wallet
Some parameter documentations has been truncated, see Models::WalletSubmitImportParams for more details.
Submit a wallet import request.
188 189 190 191 192 193 194 195 196 197 |
# File 'lib/privy/resources/wallets.rb', line 188 def _submit_import(params) parsed, = Privy::WalletSubmitImportParams.dump_request(params) @client.request( method: :post, path: "v1/wallets/import/submit", body: parsed, model: Privy::Wallet, options: ) end |
#_transfer(wallet_id, destination:, source:, amount_type: nil, fee_configuration: nil, slippage_bps: nil, privy_authorization_signature: nil, privy_idempotency_key: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::TransferActionResponse
Some parameter documentations has been truncated, see Models::WalletTransferParams for more details.
Transfer tokens from a wallet to a destination address.
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/privy/resources/wallets.rb', line 229 def _transfer(wallet_id, params) parsed, = Privy::WalletTransferParams.dump_request(params) header_params = { privy_authorization_signature: "privy-authorization-signature", privy_idempotency_key: "privy-idempotency-key", privy_request_expiry: "privy-request-expiry" } @client.request( method: :post, path: ["v1/wallets/%1$s/transfer", wallet_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Privy::TransferActionResponse, options: ) end |
#authenticate_with_jwt(encryption_type:, recipient_public_key:, user_jwt:, request_options: {}) ⇒ Privy::Models::WalletAuthenticateWithJwtResponse::WithEncryption, Privy::Models::WalletAuthenticateWithJwtResponse::WithoutEncryption
Some parameter documentations has been truncated, see Models::WalletAuthenticateWithJwtParams for more details.
Obtain a session key to enable wallet access.
265 266 267 268 269 270 271 272 273 274 |
# File 'lib/privy/resources/wallets.rb', line 265 def authenticate_with_jwt(params) parsed, = Privy::WalletAuthenticateWithJwtParams.dump_request(params) @client.request( method: :post, path: "v1/wallets/authenticate", body: parsed, model: Privy::WalletAuthenticateWithJwtResponse, options: ) end |
#create(chain_type:, additional_signers: nil, display_name: nil, external_id: nil, owner: nil, owner_id: nil, policy_ids: nil, privy_idempotency_key: nil, request_options: {}) ⇒ Privy::Models::Wallet
Some parameter documentations has been truncated, see Models::WalletCreateParams for more details.
Creates a new wallet on the requested chain and for the requested owner.
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/privy/resources/wallets.rb', line 45 def create(params) parsed, = Privy::WalletCreateParams.dump_request(params) header_params = {privy_idempotency_key: "privy-idempotency-key"} @client.request( method: :post, path: "v1/wallets", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Privy::Wallet, options: ) end |
#create_wallets_with_recovery(primary_signer:, recovery_user:, wallets:, request_options: {}) ⇒ Privy::Models::WalletCreateWalletsWithRecoveryResponse
Create wallets with an associated recovery user.
290 291 292 293 294 295 296 297 298 299 |
# File 'lib/privy/resources/wallets.rb', line 290 def create_wallets_with_recovery(params) parsed, = Privy::WalletCreateWalletsWithRecoveryParams.dump_request(params) @client.request( method: :post, path: "v1/wallets_with_recovery", body: parsed, model: Privy::WalletCreateWalletsWithRecoveryResponse, options: ) end |
#export(wallet_id, encryption_type:, recipient_public_key:, export_seed_phrase: nil, privy_authorization_signature: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::WalletExportResponseBody
Some parameter documentations has been truncated, see Models::WalletExportParams for more details.
Export a wallet’s private key
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
# File 'lib/privy/resources/wallets.rb', line 325 def export(wallet_id, params) parsed, = Privy::WalletExportParams.dump_request(params) header_params = { privy_authorization_signature: "privy-authorization-signature", privy_request_expiry: "privy-request-expiry" } @client.request( method: :post, path: ["v1/wallets/%1$s/export", wallet_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Privy::WalletExportResponseBody, options: ) end |
#get(wallet_id, request_options: {}) ⇒ Privy::Models::Wallet
Get a wallet by wallet ID.
353 354 355 356 357 358 359 360 |
# File 'lib/privy/resources/wallets.rb', line 353 def get(wallet_id, params = {}) @client.request( method: :get, path: ["v1/wallets/%1$s", wallet_id], model: Privy::Wallet, options: params[:request_options] ) end |
#get_wallet_by_address(address:, request_options: {}) ⇒ Privy::Models::Wallet
Look up a wallet by its blockchain address. Returns the wallet object if found.
373 374 375 376 377 378 379 380 381 382 |
# File 'lib/privy/resources/wallets.rb', line 373 def get_wallet_by_address(params) parsed, = Privy::WalletGetWalletByAddressParams.dump_request(params) @client.request( method: :post, path: "v1/wallets/address", body: parsed, model: Privy::Wallet, options: ) end |
#list(authorization_key: nil, chain_type: nil, cursor: nil, external_id: nil, limit: nil, user_id: nil, request_options: {}) ⇒ Privy::Internal::Cursor<Privy::Models::Wallet>
Some parameter documentations has been truncated, see Models::WalletListParams for more details.
Get all wallets in your app.
127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/privy/resources/wallets.rb', line 127 def list(params = {}) parsed, = Privy::WalletListParams.dump_request(params) query = Privy::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v1/wallets", query: query, page: Privy::Internal::Cursor, model: Privy::Wallet, options: ) end |
#raw_sign(wallet_id, params:, privy_authorization_signature: nil, privy_idempotency_key: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::RawSignResponse
Some parameter documentations has been truncated, see Models::WalletRawSignParams for more details.
Sign a message with a wallet by wallet ID.
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
# File 'lib/privy/resources/wallets.rb', line 406 def raw_sign(wallet_id, params) parsed, = Privy::WalletRawSignParams.dump_request(params) header_params = { privy_authorization_signature: "privy-authorization-signature", privy_idempotency_key: "privy-idempotency-key", privy_request_expiry: "privy-request-expiry" } @client.request( method: :post, path: ["v1/wallets/%1$s/raw_sign", wallet_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Privy::RawSignResponse, options: ) end |
#rpc(wallet_id, wallet_rpc_request_body:, privy_authorization_signature: nil, privy_idempotency_key: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::EthereumPersonalSignRpcResponse, ...
Some parameter documentations has been truncated, see Models::WalletRpcParams for more details.
Sign a message or transaction with a wallet by wallet ID.
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
# File 'lib/privy/resources/wallets.rb', line 446 def rpc(wallet_id, params) parsed, = Privy::WalletRpcParams.dump_request(params) @client.request( method: :post, path: ["v1/wallets/%1$s/rpc", wallet_id], headers: parsed.except(:wallet_rpc_request_body).transform_keys( privy_authorization_signature: "privy-authorization-signature", privy_idempotency_key: "privy-idempotency-key", privy_request_expiry: "privy-request-expiry" ), body: parsed[:wallet_rpc_request_body], model: Privy::WalletRpcResponse, options: ) end |
#update(wallet_id, additional_signers: nil, display_name: nil, owner: nil, owner_id: nil, policy_ids: nil, privy_authorization_signature: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::Wallet
Some parameter documentations has been truncated, see Models::WalletUpdateParams for more details.
Update a wallet’s policies or authorization key configuration.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/privy/resources/wallets.rb', line 86 def update(wallet_id, params = {}) parsed, = Privy::WalletUpdateParams.dump_request(params) header_params = { privy_authorization_signature: "privy-authorization-signature", privy_request_expiry: "privy-request-expiry" } @client.request( method: :patch, path: ["v1/wallets/%1$s", wallet_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Privy::Wallet, options: ) end |