diff --git a/lbry/service/api.py b/lbry/service/api.py index ff25e9010..b6a9cfe7c 100644 --- a/lbry/service/api.py +++ b/lbry/service/api.py @@ -1669,6 +1669,7 @@ class API: name: str, # name of the channel prefixed with '@' bid: str, # amount to back the channel allow_duplicate_name=False, # create new channel even if one already exists with given name + wallet_id: str = None, # restrict operation to specific wallet **channel_and_tx_kwargs ) -> Transaction: # new channel transaction """ @@ -1683,7 +1684,7 @@ class API: tx_dict, kwargs = pop_kwargs('tx', tx_kwargs(**kwargs)) assert_consumed_kwargs(kwargs) self.ledger.valid_channel_name_or_error(name) - wallet = self.wallets.get_or_default_for_spending(tx_dict.pop('wallet_id')) + wallet = self.wallets.get_or_default_for_spending(wallet_id) amount = self.ledger.get_dewies_or_error('bid', bid, positive_value=True) holding_account = wallet.accounts.get_or_default(channel_dict.pop('account_id')) funding_accounts = wallet.accounts.get_or_all(tx_dict.pop('fund_account_id')) @@ -2760,8 +2761,8 @@ class API: """ txo_dict, kwargs = pop_kwargs('txo_filter', txo_filter_kwargs(**txo_filter_and_pagination_kwargs)) pagination, kwargs = pop_kwargs('pagination', pagination_kwargs(**kwargs)) + wallet = self.wallets.get_or_default(kwargs.pop('wallet_id')) assert_consumed_kwargs(kwargs) - wallet = self.wallets.get_or_default(txo_dict.pop('wallet_id')) accounts = wallet.accounts.get_or_all(txo_dict.pop('account_id')) constraints = { 'resolve': resolve, diff --git a/lbry/service/metadata.py b/lbry/service/metadata.py index 199830432..0e4a26e67 100644 --- a/lbry/service/metadata.py +++ b/lbry/service/metadata.py @@ -1256,6 +1256,13 @@ interface = { "default": False, "type": "bool" }, + { + "name": "wallet_id", + "desc": [ + "restrict operation to specific wallet" + ], + "type": "str" + }, { "name": "email", "desc": [ @@ -1603,7 +1610,7 @@ interface = { ], "group": "channel", "cli": "channel create", - "help": "Create a new channel by generating a channel private key and establishing an '@' prefixed claim.\n\nUsage:\n channel create () ( | --bid=) [--allow_duplicate_name]\n [--email=] [--website_url=]\n [--cover_url=] [--featured=...] [--title=]\n [--description=<description>] [--thumbnail_url=<thumbnail_url>]\n [--tag=<tag>...] [--language=<language>...] [--location=<location>...]\n [--account_id=<account_id>] [--claim_address=<claim_address>]\n [--channel_id=<channel_id>] [--channel_name=<channel_name>]\n [--change_account_id=<change_account_id>]\n [--fund_account_id=<fund_account_id>...] [--preview] [--no_wait]\n\nOptions:\n --name=<name> : (str) name of the channel prefixed with '@'\n --bid=<bid> : (str) amount to back the channel\n --allow_duplicate_name : (bool) create new channel even if one\n already exists with given name\n --email=<email> : (str) email of channel owner\n --website_url=<website_url> : (str) website url\n --cover_url=<cover_url> : (str) url to cover image\n --featured=<featured> : (str, list) claim_id(s) of featured content\n in channel\n --title=<title> : (str)\n --description=<description> : (str)\n --thumbnail_url=<thumbnail_url> : (str) url to thumbnail image\n --tag=<tag> : (str, list)\n --language=<language> : (str, list) languages used by the channel,\n using RFC 5646 format, eg: for English\n `--language=en` for Spanish (Spain)\n `--language=es-ES` for Spanish (Mexican)\n `--language=es-MX` for Chinese (Simplified)\n `--language=zh-Hans` for Chinese\n (Traditional) `--language=zh-Hant`\n --location=<location> : (str, list) locations of the channel,\n consisting of 2 letter `country` code and a\n `state`, `city` and a postal `code` along\n with a `latitude` and `longitude`. for JSON\n RPC: pass a dictionary with aforementioned\n attributes as keys, eg: ... \"locations\":\n [{'country': 'US', 'state': 'NH'}] ... for\n command line: pass a colon delimited list\n with values in the following order:\n \"COUNTRY:STATE:CITY:CODE:LATITUDE:LONGITUDE\"\n making sure to include colon for blank\n values, for example to provide only the\n city: ...--locations=\"::Manchester\" with\n all values set: ...--\n locations=\"US:NH:Manchester:03101:42.990605:-71.460989\"\n optionally, you can just pass the\n \"LATITUDE:LONGITUDE\": ...--\n locations=\"42.990605:-71.460989\" finally,\n you can also pass JSON string of dictionary\n on the command line as you would via JSON\n RPC ...--locations=\"{'country': 'US',\n 'state': 'NH'}\"\n --account_id=<account_id> : (str) account to hold the claim\n --claim_address=<claim_address> : (str) specific address where the claim is\n held, if not specified it will be\n determined automatically from the account\n --channel_id=<channel_id> : (str) claim id of the publishing channel\n --channel_name=<channel_name> : (str) name of publishing channel\n --change_account_id=<change_account_id> : (str) account to send excess change (LBC)\n --fund_account_id=<fund_account_id> : (str, list) accounts to fund the\n transaction\n --preview : (bool) do not broadcast the transaction\n --no_wait : (bool) do not wait for mempool confirmation\n\nReturns:\n (Transaction) new channel transaction\n {\n \"txid\": \"hash of transaction in hex\",\n \"height\": \"block where transaction was recorded\",\n \"inputs\": [\n \"spent outputs...\"\n ],\n \"outputs\": [\n {\n \"txid\": \"hash of transaction in hex\",\n \"nout\": \"position in the transaction\",\n \"height\": \"block where transaction was recorded\",\n \"amount\": \"value of the txo as a decimal\",\n \"address\": \"address of who can spend the txo\",\n \"confirmations\": \"number of confirmed blocks\",\n \"is_change\": \"payment to change address, only available when it can be determined\",\n \"is_received\": \"true if txo was sent from external account to this account\",\n \"is_spent\": \"true if txo is spent\",\n \"is_mine\": \"payment to one of your accounts, only available when it can be determined\",\n \"type\": \"one of 'claim', 'support' or 'purchase'\",\n \"name\": \"when type is 'claim' or 'support', this is the claim name\",\n \"claim_id\": \"when type is 'claim', 'support' or 'purchase', this is the claim id\",\n \"claim_op\": \"when type is 'claim', this determines if it is 'create' or 'update'\",\n \"value\": \"when type is 'claim' or 'support' with payload, this is the decoded protobuf payload\",\n \"value_type\": \"determines the type of the 'value' field: 'channel', 'stream', etc\",\n \"protobuf\": \"hex encoded raw protobuf version of 'value' field\",\n \"permanent_url\": \"when type is 'claim' or 'support', this is the long permanent claim URL\",\n \"claim\": \"for purchase outputs only, metadata of purchased claim\",\n \"reposted_claim\": \"for repost claims only, metadata of claim being reposted\",\n \"signing_channel\": \"for signed claims only, metadata of signing channel\",\n \"is_channel_signature_valid\": \"for signed claims only, whether signature is valid\",\n \"purchase_receipt\": \"metadata for the purchase transaction associated with this claim\"\n }\n ],\n \"total_input\": \"sum of inputs as a decimal\",\n \"total_output\": \"sum of outputs, sans fee, as a decimal\",\n \"total_fee\": \"fee amount\",\n \"hex\": \"entire transaction encoded in hex\"\n }" + "help": "Create a new channel by generating a channel private key and establishing an '@' prefixed claim.\n\nUsage:\n channel create (<name>) (<bid> | --bid=<bid>) [--allow_duplicate_name]\n [--email=<email>] [--website_url=<website_url>]\n [--cover_url=<cover_url>] [--featured=<featured>...] [--title=<title>]\n [--description=<description>] [--thumbnail_url=<thumbnail_url>]\n [--tag=<tag>...] [--language=<language>...] [--location=<location>...]\n [--account_id=<account_id>] [--claim_address=<claim_address>]\n [--channel_id=<channel_id>] [--channel_name=<channel_name>]\n [--change_account_id=<change_account_id>]\n [--fund_account_id=<fund_account_id>...] [--preview] [--no_wait]\n\nOptions:\n --name=<name> : (str) name of the channel prefixed with '@'\n --bid=<bid> : (str) amount to back the channel\n --allow_duplicate_name : (bool) create new channel even if one\n already exists with given name\n --wallet_id=<wallet_id> : (str) restrict operation to specific wallet\n --email=<email> : (str) email of channel owner\n --website_url=<website_url> : (str) website url\n --cover_url=<cover_url> : (str) url to cover image\n --featured=<featured> : (str, list) claim_id(s) of featured content\n in channel\n --title=<title> : (str)\n --description=<description> : (str)\n --thumbnail_url=<thumbnail_url> : (str) url to thumbnail image\n --tag=<tag> : (str, list)\n --language=<language> : (str, list) languages used by the channel,\n using RFC 5646 format, eg: for English\n `--language=en` for Spanish (Spain)\n `--language=es-ES` for Spanish (Mexican)\n `--language=es-MX` for Chinese (Simplified)\n `--language=zh-Hans` for Chinese\n (Traditional) `--language=zh-Hant`\n --location=<location> : (str, list) locations of the channel,\n consisting of 2 letter `country` code and a\n `state`, `city` and a postal `code` along\n with a `latitude` and `longitude`. for JSON\n RPC: pass a dictionary with aforementioned\n attributes as keys, eg: ... \"locations\":\n [{'country': 'US', 'state': 'NH'}] ... for\n command line: pass a colon delimited list\n with values in the following order:\n \"COUNTRY:STATE:CITY:CODE:LATITUDE:LONGITUDE\"\n making sure to include colon for blank\n values, for example to provide only the\n city: ...--locations=\"::Manchester\" with\n all values set: ...--\n locations=\"US:NH:Manchester:03101:42.990605:-71.460989\"\n optionally, you can just pass the\n \"LATITUDE:LONGITUDE\": ...--\n locations=\"42.990605:-71.460989\" finally,\n you can also pass JSON string of dictionary\n on the command line as you would via JSON\n RPC ...--locations=\"{'country': 'US',\n 'state': 'NH'}\"\n --account_id=<account_id> : (str) account to hold the claim\n --claim_address=<claim_address> : (str) specific address where the claim is\n held, if not specified it will be\n determined automatically from the account\n --channel_id=<channel_id> : (str) claim id of the publishing channel\n --channel_name=<channel_name> : (str) name of publishing channel\n --change_account_id=<change_account_id> : (str) account to send excess change (LBC)\n --fund_account_id=<fund_account_id> : (str, list) accounts to fund the\n transaction\n --preview : (bool) do not broadcast the transaction\n --no_wait : (bool) do not wait for mempool confirmation\n\nReturns:\n (Transaction) new channel transaction\n {\n \"txid\": \"hash of transaction in hex\",\n \"height\": \"block where transaction was recorded\",\n \"inputs\": [\n \"spent outputs...\"\n ],\n \"outputs\": [\n {\n \"txid\": \"hash of transaction in hex\",\n \"nout\": \"position in the transaction\",\n \"height\": \"block where transaction was recorded\",\n \"amount\": \"value of the txo as a decimal\",\n \"address\": \"address of who can spend the txo\",\n \"confirmations\": \"number of confirmed blocks\",\n \"is_change\": \"payment to change address, only available when it can be determined\",\n \"is_received\": \"true if txo was sent from external account to this account\",\n \"is_spent\": \"true if txo is spent\",\n \"is_mine\": \"payment to one of your accounts, only available when it can be determined\",\n \"type\": \"one of 'claim', 'support' or 'purchase'\",\n \"name\": \"when type is 'claim' or 'support', this is the claim name\",\n \"claim_id\": \"when type is 'claim', 'support' or 'purchase', this is the claim id\",\n \"claim_op\": \"when type is 'claim', this determines if it is 'create' or 'update'\",\n \"value\": \"when type is 'claim' or 'support' with payload, this is the decoded protobuf payload\",\n \"value_type\": \"determines the type of the 'value' field: 'channel', 'stream', etc\",\n \"protobuf\": \"hex encoded raw protobuf version of 'value' field\",\n \"permanent_url\": \"when type is 'claim' or 'support', this is the long permanent claim URL\",\n \"claim\": \"for purchase outputs only, metadata of purchased claim\",\n \"reposted_claim\": \"for repost claims only, metadata of claim being reposted\",\n \"signing_channel\": \"for signed claims only, metadata of signing channel\",\n \"is_channel_signature_valid\": \"for signed claims only, whether signature is valid\",\n \"purchase_receipt\": \"metadata for the purchase transaction associated with this claim\"\n }\n ],\n \"total_input\": \"sum of inputs as a decimal\",\n \"total_output\": \"sum of outputs, sans fee, as a decimal\",\n \"total_fee\": \"fee amount\",\n \"hex\": \"entire transaction encoded in hex\"\n }" }, "channel_export": { "name": "export",