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/swap.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, Swap, Transactions
Instance Attribute Summary collapse
-
#balance ⇒ Privy::Resources::Wallets::Balance
readonly
Operations related to wallets.
- #earn ⇒ Privy::Resources::Wallets::Earn readonly
-
#swap ⇒ Privy::Resources::Wallets::Swap
readonly
Operations for swapping tokens within wallets.
-
#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_batch(wallets:, request_options: {}) ⇒ Privy::Models::WalletBatchCreateResponse
Creates multiple wallets in a single request.
- #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.
496 497 498 499 500 501 502 |
# File 'lib/privy/resources/wallets.rb', line 496 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) @swap = Privy::Resources::Wallets::Swap.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 |
#swap ⇒ Privy::Resources::Wallets::Swap (readonly)
Operations for swapping tokens within wallets
19 20 21 |
# File 'lib/privy/resources/wallets.rb', line 19 def swap @swap 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.
155 156 157 158 159 160 161 162 163 164 |
# File 'lib/privy/resources/wallets.rb', line 155 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.
192 193 194 195 196 197 198 199 200 201 |
# File 'lib/privy/resources/wallets.rb', line 192 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.
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/privy/resources/wallets.rb', line 233 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.
Exchange a user JWT for a session key authorized to act on the user’s wallets. Returns the encrypted authorization key and the list of wallets it can access.
270 271 272 273 274 275 276 277 278 279 |
# File 'lib/privy/resources/wallets.rb', line 270 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.
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/privy/resources/wallets.rb', line 49 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_batch(wallets:, request_options: {}) ⇒ Privy::Models::WalletBatchCreateResponse
Creates multiple wallets in a single request. Each wallet creation is independent; failures for one wallet do not affect others. Maximum batch size is 100 wallets.
294 295 296 297 298 299 300 301 302 303 |
# File 'lib/privy/resources/wallets.rb', line 294 def create_batch(params) parsed, = Privy::WalletCreateBatchParams.dump_request(params) @client.request( method: :post, path: "v1/wallets/batch", body: parsed, model: Privy::WalletBatchCreateResponse, options: ) end |
#create_wallets_with_recovery(primary_signer:, recovery_user:, wallets:, request_options: {}) ⇒ Privy::Models::WalletCreateWalletsWithRecoveryResponse
Create one or more wallets associated with a recovery user, so the user can later regain wallet access via the linked accounts. Deprecated; prefer the standard wallet creation flow combined with a separate recovery setup.
321 322 323 324 325 326 327 328 329 330 |
# File 'lib/privy/resources/wallets.rb', line 321 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
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
# File 'lib/privy/resources/wallets.rb', line 356 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.
384 385 386 387 388 389 390 391 |
# File 'lib/privy/resources/wallets.rb', line 384 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.
404 405 406 407 408 409 410 411 412 413 |
# File 'lib/privy/resources/wallets.rb', line 404 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.
131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/privy/resources/wallets.rb', line 131 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.
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 |
# File 'lib/privy/resources/wallets.rb', line 437 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.
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 |
# File 'lib/privy/resources/wallets.rb', line 477 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.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/privy/resources/wallets.rb', line 90 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 |