1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591
|
package api
import (
"encoding/json"
"net/http"
"path/filepath"
"strconv"
"strings"
"github.com/NebulousLabs/Sia/crypto"
"github.com/NebulousLabs/Sia/modules"
"github.com/NebulousLabs/Sia/types"
"github.com/NebulousLabs/entropy-mnemonics"
"github.com/julienschmidt/httprouter"
)
type (
// WalletGET contains general information about the wallet.
WalletGET struct {
Encrypted bool `json:"encrypted"`
Unlocked bool `json:"unlocked"`
Rescanning bool `json:"rescanning"`
ConfirmedSiacoinBalance types.Currency `json:"confirmedsiacoinbalance"`
UnconfirmedOutgoingSiacoins types.Currency `json:"unconfirmedoutgoingsiacoins"`
UnconfirmedIncomingSiacoins types.Currency `json:"unconfirmedincomingsiacoins"`
SiafundBalance types.Currency `json:"siafundbalance"`
SiacoinClaimBalance types.Currency `json:"siacoinclaimbalance"`
}
// WalletAddressGET contains an address returned by a GET call to
// /wallet/address.
WalletAddressGET struct {
Address types.UnlockHash `json:"address"`
}
// WalletAddressesGET contains the list of wallet addresses returned by a
// GET call to /wallet/addresses.
WalletAddressesGET struct {
Addresses []types.UnlockHash `json:"addresses"`
}
// WalletInitPOST contains the primary seed that gets generated during a
// POST call to /wallet/init.
WalletInitPOST struct {
PrimarySeed string `json:"primaryseed"`
}
// WalletSiacoinsPOST contains the transaction sent in the POST call to
// /wallet/siacoins.
WalletSiacoinsPOST struct {
TransactionIDs []types.TransactionID `json:"transactionids"`
}
// WalletSiafundsPOST contains the transaction sent in the POST call to
// /wallet/siafunds.
WalletSiafundsPOST struct {
TransactionIDs []types.TransactionID `json:"transactionids"`
}
// WalletSeedsGET contains the seeds used by the wallet.
WalletSeedsGET struct {
PrimarySeed string `json:"primaryseed"`
AddressesRemaining int `json:"addressesremaining"`
AllSeeds []string `json:"allseeds"`
}
// WalletSweepPOST contains the coins and funds returned by a call to
// /wallet/sweep.
WalletSweepPOST struct {
Coins types.Currency `json:"coins"`
Funds types.Currency `json:"funds"`
}
// WalletTransactionGETid contains the transaction returned by a call to
// /wallet/transaction/:id
WalletTransactionGETid struct {
Transaction modules.ProcessedTransaction `json:"transaction"`
}
// WalletTransactionsGET contains the specified set of confirmed and
// unconfirmed transactions.
WalletTransactionsGET struct {
ConfirmedTransactions []modules.ProcessedTransaction `json:"confirmedtransactions"`
UnconfirmedTransactions []modules.ProcessedTransaction `json:"unconfirmedtransactions"`
}
// WalletTransactionsGETaddr contains the set of wallet transactions
// relevant to the input address provided in the call to
// /wallet/transaction/:addr
WalletTransactionsGETaddr struct {
ConfirmedTransactions []modules.ProcessedTransaction `json:"confirmedtransactions"`
UnconfirmedTransactions []modules.ProcessedTransaction `json:"unconfirmedtransactions"`
}
// WalletVerifyAddressGET contains a bool indicating if the address passed to
// /wallet/verify/address/:addr is a valid address.
WalletVerifyAddressGET struct {
Valid bool
}
)
// encryptionKeys enumerates the possible encryption keys that can be derived
// from an input string.
func encryptionKeys(seedStr string) (validKeys []crypto.TwofishKey) {
dicts := []mnemonics.DictionaryID{"english", "german", "japanese"}
for _, dict := range dicts {
seed, err := modules.StringToSeed(seedStr, dict)
if err != nil {
continue
}
validKeys = append(validKeys, crypto.TwofishKey(crypto.HashObject(seed)))
}
validKeys = append(validKeys, crypto.TwofishKey(crypto.HashObject(seedStr)))
return validKeys
}
// walletHander handles API calls to /wallet.
func (api *API) walletHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {
siacoinBal, siafundBal, siaclaimBal := api.wallet.ConfirmedBalance()
siacoinsOut, siacoinsIn := api.wallet.UnconfirmedBalance()
WriteJSON(w, WalletGET{
Encrypted: api.wallet.Encrypted(),
Unlocked: api.wallet.Unlocked(),
Rescanning: api.wallet.Rescanning(),
ConfirmedSiacoinBalance: siacoinBal,
UnconfirmedOutgoingSiacoins: siacoinsOut,
UnconfirmedIncomingSiacoins: siacoinsIn,
SiafundBalance: siafundBal,
SiacoinClaimBalance: siaclaimBal,
})
}
// wallet033xHandler handles API calls to /wallet/033x.
func (api *API) wallet033xHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {
source := req.FormValue("source")
// Check that source is an absolute paths.
if !filepath.IsAbs(source) {
WriteError(w, Error{"error when calling /wallet/033x: source must be an absolute path"}, http.StatusBadRequest)
return
}
potentialKeys := encryptionKeys(req.FormValue("encryptionpassword"))
for _, key := range potentialKeys {
err := api.wallet.Load033xWallet(key, source)
if err == nil {
WriteSuccess(w)
return
}
if err != nil && err != modules.ErrBadEncryptionKey {
WriteError(w, Error{"error when calling /wallet/033x: " + err.Error()}, http.StatusBadRequest)
return
}
}
WriteError(w, Error{modules.ErrBadEncryptionKey.Error()}, http.StatusBadRequest)
}
// walletAddressHandler handles API calls to /wallet/address.
func (api *API) walletAddressHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {
unlockConditions, err := api.wallet.NextAddress()
if err != nil {
WriteError(w, Error{"error when calling /wallet/addresses: " + err.Error()}, http.StatusBadRequest)
return
}
WriteJSON(w, WalletAddressGET{
Address: unlockConditions.UnlockHash(),
})
}
// walletAddressHandler handles API calls to /wallet/addresses.
func (api *API) walletAddressesHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {
WriteJSON(w, WalletAddressesGET{
Addresses: api.wallet.AllAddresses(),
})
}
// walletBackupHandler handles API calls to /wallet/backup.
func (api *API) walletBackupHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {
destination := req.FormValue("destination")
// Check that the destination is absolute.
if !filepath.IsAbs(destination) {
WriteError(w, Error{"error when calling /wallet/backup: destination must be an absolute path"}, http.StatusBadRequest)
return
}
err := api.wallet.CreateBackup(destination)
if err != nil {
WriteError(w, Error{"error when calling /wallet/backup: " + err.Error()}, http.StatusBadRequest)
return
}
WriteSuccess(w)
}
// walletInitHandler handles API calls to /wallet/init.
func (api *API) walletInitHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {
var encryptionKey crypto.TwofishKey
if req.FormValue("encryptionpassword") != "" {
encryptionKey = crypto.TwofishKey(crypto.HashObject(req.FormValue("encryptionpassword")))
}
if req.FormValue("force") == "true" {
err := api.wallet.Reset()
if err != nil {
WriteError(w, Error{"error when calling /wallet/init: " + err.Error()}, http.StatusBadRequest)
return
}
}
seed, err := api.wallet.Encrypt(encryptionKey)
if err != nil {
WriteError(w, Error{"error when calling /wallet/init: " + err.Error()}, http.StatusBadRequest)
return
}
dictID := mnemonics.DictionaryID(req.FormValue("dictionary"))
if dictID == "" {
dictID = "english"
}
seedStr, err := modules.SeedToString(seed, dictID)
if err != nil {
WriteError(w, Error{"error when calling /wallet/init: " + err.Error()}, http.StatusBadRequest)
return
}
WriteJSON(w, WalletInitPOST{
PrimarySeed: seedStr,
})
}
// walletInitSeedHandler handles API calls to /wallet/init/seed.
func (api *API) walletInitSeedHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {
var encryptionKey crypto.TwofishKey
if req.FormValue("encryptionpassword") != "" {
encryptionKey = crypto.TwofishKey(crypto.HashObject(req.FormValue("encryptionpassword")))
}
dictID := mnemonics.DictionaryID(req.FormValue("dictionary"))
if dictID == "" {
dictID = "english"
}
seed, err := modules.StringToSeed(req.FormValue("seed"), dictID)
if err != nil {
WriteError(w, Error{"error when calling /wallet/init/seed: " + err.Error()}, http.StatusBadRequest)
return
}
if req.FormValue("force") == "true" {
err = api.wallet.Reset()
if err != nil {
WriteError(w, Error{"error when calling /wallet/init/seed: " + err.Error()}, http.StatusBadRequest)
return
}
}
err = api.wallet.InitFromSeed(encryptionKey, seed)
if err != nil {
WriteError(w, Error{"error when calling /wallet/init/seed: " + err.Error()}, http.StatusBadRequest)
return
}
WriteSuccess(w)
}
// walletSeedHandler handles API calls to /wallet/seed.
func (api *API) walletSeedHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {
// Get the seed using the ditionary + phrase
dictID := mnemonics.DictionaryID(req.FormValue("dictionary"))
if dictID == "" {
dictID = "english"
}
seed, err := modules.StringToSeed(req.FormValue("seed"), dictID)
if err != nil {
WriteError(w, Error{"error when calling /wallet/seed: " + err.Error()}, http.StatusBadRequest)
return
}
potentialKeys := encryptionKeys(req.FormValue("encryptionpassword"))
for _, key := range potentialKeys {
err := api.wallet.LoadSeed(key, seed)
if err == nil {
WriteSuccess(w)
return
}
if err != nil && err != modules.ErrBadEncryptionKey {
WriteError(w, Error{"error when calling /wallet/seed: " + err.Error()}, http.StatusBadRequest)
return
}
}
WriteError(w, Error{"error when calling /wallet/seed: " + modules.ErrBadEncryptionKey.Error()}, http.StatusBadRequest)
}
// walletSiagkeyHandler handles API calls to /wallet/siagkey.
func (api *API) walletSiagkeyHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {
// Fetch the list of keyfiles from the post body.
keyfiles := strings.Split(req.FormValue("keyfiles"), ",")
potentialKeys := encryptionKeys(req.FormValue("encryptionpassword"))
for _, keypath := range keyfiles {
// Check that all key paths are absolute paths.
if !filepath.IsAbs(keypath) {
WriteError(w, Error{"error when calling /wallet/siagkey: keyfiles contains a non-absolute path"}, http.StatusBadRequest)
return
}
}
for _, key := range potentialKeys {
err := api.wallet.LoadSiagKeys(key, keyfiles)
if err == nil {
WriteSuccess(w)
return
}
if err != nil && err != modules.ErrBadEncryptionKey {
WriteError(w, Error{"error when calling /wallet/siagkey: " + err.Error()}, http.StatusBadRequest)
return
}
}
WriteError(w, Error{"error when calling /wallet/siagkey: " + modules.ErrBadEncryptionKey.Error()}, http.StatusBadRequest)
}
// walletLockHanlder handles API calls to /wallet/lock.
func (api *API) walletLockHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {
err := api.wallet.Lock()
if err != nil {
WriteError(w, Error{err.Error()}, http.StatusBadRequest)
return
}
WriteSuccess(w)
}
// walletSeedsHandler handles API calls to /wallet/seeds.
func (api *API) walletSeedsHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {
dictionary := mnemonics.DictionaryID(req.FormValue("dictionary"))
if dictionary == "" {
dictionary = mnemonics.English
}
// Get the primary seed information.
primarySeed, addrsRemaining, err := api.wallet.PrimarySeed()
if err != nil {
WriteError(w, Error{"error when calling /wallet/seeds: " + err.Error()}, http.StatusBadRequest)
return
}
primarySeedStr, err := modules.SeedToString(primarySeed, dictionary)
if err != nil {
WriteError(w, Error{"error when calling /wallet/seeds: " + err.Error()}, http.StatusBadRequest)
return
}
// Get the list of seeds known to the wallet.
allSeeds, err := api.wallet.AllSeeds()
if err != nil {
WriteError(w, Error{"error when calling /wallet/seeds: " + err.Error()}, http.StatusBadRequest)
return
}
var allSeedsStrs []string
for _, seed := range allSeeds {
str, err := modules.SeedToString(seed, dictionary)
if err != nil {
WriteError(w, Error{"error when calling /wallet/seeds: " + err.Error()}, http.StatusBadRequest)
return
}
allSeedsStrs = append(allSeedsStrs, str)
}
WriteJSON(w, WalletSeedsGET{
PrimarySeed: primarySeedStr,
AddressesRemaining: int(addrsRemaining),
AllSeeds: allSeedsStrs,
})
}
// walletSiacoinsHandler handles API calls to /wallet/siacoins.
func (api *API) walletSiacoinsHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {
var txns []types.Transaction
if req.FormValue("outputs") != "" {
// multiple amounts + destinations
if req.FormValue("amount") != "" || req.FormValue("destination") != "" {
WriteError(w, Error{"cannot supply both 'outputs' and single amount+destination pair"}, http.StatusInternalServerError)
return
}
var outputs []types.SiacoinOutput
err := json.Unmarshal([]byte(req.FormValue("outputs")), &outputs)
if err != nil {
WriteError(w, Error{"could not decode outputs: " + err.Error()}, http.StatusInternalServerError)
return
}
txns, err = api.wallet.SendSiacoinsMulti(outputs)
if err != nil {
WriteError(w, Error{"error when calling /wallet/siacoins: " + err.Error()}, http.StatusInternalServerError)
return
}
} else {
// single amount + destination
amount, ok := scanAmount(req.FormValue("amount"))
if !ok {
WriteError(w, Error{"could not read amount from POST call to /wallet/siacoins"}, http.StatusBadRequest)
return
}
dest, err := scanAddress(req.FormValue("destination"))
if err != nil {
WriteError(w, Error{"could not read address from POST call to /wallet/siacoins"}, http.StatusBadRequest)
return
}
txns, err = api.wallet.SendSiacoins(amount, dest)
if err != nil {
WriteError(w, Error{"error when calling /wallet/siacoins: " + err.Error()}, http.StatusInternalServerError)
return
}
}
var txids []types.TransactionID
for _, txn := range txns {
txids = append(txids, txn.ID())
}
WriteJSON(w, WalletSiacoinsPOST{
TransactionIDs: txids,
})
}
// walletSiafundsHandler handles API calls to /wallet/siafunds.
func (api *API) walletSiafundsHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {
amount, ok := scanAmount(req.FormValue("amount"))
if !ok {
WriteError(w, Error{"could not read 'amount' from POST call to /wallet/siafunds"}, http.StatusBadRequest)
return
}
dest, err := scanAddress(req.FormValue("destination"))
if err != nil {
WriteError(w, Error{"error when calling /wallet/siafunds: " + err.Error()}, http.StatusBadRequest)
return
}
txns, err := api.wallet.SendSiafunds(amount, dest)
if err != nil {
WriteError(w, Error{"error when calling /wallet/siafunds: " + err.Error()}, http.StatusInternalServerError)
return
}
var txids []types.TransactionID
for _, txn := range txns {
txids = append(txids, txn.ID())
}
WriteJSON(w, WalletSiafundsPOST{
TransactionIDs: txids,
})
}
// walletSweepSeedHandler handles API calls to /wallet/sweep/seed.
func (api *API) walletSweepSeedHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {
// Get the seed using the ditionary + phrase
dictID := mnemonics.DictionaryID(req.FormValue("dictionary"))
if dictID == "" {
dictID = "english"
}
seed, err := modules.StringToSeed(req.FormValue("seed"), dictID)
if err != nil {
WriteError(w, Error{"error when calling /wallet/sweep/seed: " + err.Error()}, http.StatusBadRequest)
return
}
coins, funds, err := api.wallet.SweepSeed(seed)
if err != nil {
WriteError(w, Error{"error when calling /wallet/sweep/seed: " + err.Error()}, http.StatusBadRequest)
return
}
WriteJSON(w, WalletSweepPOST{
Coins: coins,
Funds: funds,
})
}
// walletTransactionHandler handles API calls to /wallet/transaction/:id.
func (api *API) walletTransactionHandler(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
// Parse the id from the url.
var id types.TransactionID
jsonID := "\"" + ps.ByName("id") + "\""
err := id.UnmarshalJSON([]byte(jsonID))
if err != nil {
WriteError(w, Error{"error when calling /wallet/history: " + err.Error()}, http.StatusBadRequest)
return
}
txn, ok := api.wallet.Transaction(id)
if !ok {
WriteError(w, Error{"error when calling /wallet/transaction/:id : transaction not found"}, http.StatusBadRequest)
return
}
WriteJSON(w, WalletTransactionGETid{
Transaction: txn,
})
}
// walletTransactionsHandler handles API calls to /wallet/transactions.
func (api *API) walletTransactionsHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {
startheightStr, endheightStr := req.FormValue("startheight"), req.FormValue("endheight")
if startheightStr == "" || endheightStr == "" {
WriteError(w, Error{"startheight and endheight must be provided to a /wallet/transactions call."}, http.StatusBadRequest)
return
}
// Get the start and end blocks.
start, err := strconv.Atoi(startheightStr)
if err != nil {
WriteError(w, Error{"parsing integer value for parameter `startheight` failed: " + err.Error()}, http.StatusBadRequest)
return
}
end, err := strconv.Atoi(endheightStr)
if err != nil {
WriteError(w, Error{"parsing integer value for parameter `endheight` failed: " + err.Error()}, http.StatusBadRequest)
return
}
confirmedTxns, err := api.wallet.Transactions(types.BlockHeight(start), types.BlockHeight(end))
if err != nil {
WriteError(w, Error{"error when calling /wallet/transactions: " + err.Error()}, http.StatusBadRequest)
return
}
unconfirmedTxns := api.wallet.UnconfirmedTransactions()
WriteJSON(w, WalletTransactionsGET{
ConfirmedTransactions: confirmedTxns,
UnconfirmedTransactions: unconfirmedTxns,
})
}
// walletTransactionsAddrHandler handles API calls to
// /wallet/transactions/:addr.
func (api *API) walletTransactionsAddrHandler(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
// Parse the address being input.
jsonAddr := "\"" + ps.ByName("addr") + "\""
var addr types.UnlockHash
err := addr.UnmarshalJSON([]byte(jsonAddr))
if err != nil {
WriteError(w, Error{"error when calling /wallet/transactions: " + err.Error()}, http.StatusBadRequest)
return
}
confirmedATs := api.wallet.AddressTransactions(addr)
unconfirmedATs := api.wallet.AddressUnconfirmedTransactions(addr)
WriteJSON(w, WalletTransactionsGETaddr{
ConfirmedTransactions: confirmedATs,
UnconfirmedTransactions: unconfirmedATs,
})
}
// walletUnlockHandler handles API calls to /wallet/unlock.
func (api *API) walletUnlockHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {
potentialKeys := encryptionKeys(req.FormValue("encryptionpassword"))
for _, key := range potentialKeys {
err := api.wallet.Unlock(key)
if err == nil {
WriteSuccess(w)
return
}
if err != nil && err != modules.ErrBadEncryptionKey {
WriteError(w, Error{"error when calling /wallet/unlock: " + err.Error()}, http.StatusBadRequest)
return
}
}
WriteError(w, Error{"error when calling /wallet/unlock: " + modules.ErrBadEncryptionKey.Error()}, http.StatusBadRequest)
}
// walletChangePasswordHandler handles API calls to /wallet/changepassword
func (api *API) walletChangePasswordHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {
var newKey crypto.TwofishKey
newPassword := req.FormValue("newpassword")
if newPassword == "" {
WriteError(w, Error{"a password must be provided to newpassword"}, http.StatusBadRequest)
return
}
newKey = crypto.TwofishKey(crypto.HashObject(newPassword))
originalKeys := encryptionKeys(req.FormValue("encryptionpassword"))
for _, key := range originalKeys {
err := api.wallet.ChangeKey(key, newKey)
if err == nil {
WriteSuccess(w)
return
}
if err != nil && err != modules.ErrBadEncryptionKey {
WriteError(w, Error{"error when calling /wallet/changepassword: " + err.Error()}, http.StatusBadRequest)
return
}
}
WriteError(w, Error{"error when calling /wallet/changepassword: " + modules.ErrBadEncryptionKey.Error()}, http.StatusBadRequest)
}
// walletVerifyAddressHandler handles API calls to /wallet/verify/address/:addr.
func (api *API) walletVerifyAddressHandler(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
addrString := ps.ByName("addr")
err := new(types.UnlockHash).LoadString(addrString)
WriteJSON(w, WalletVerifyAddressGET{Valid: err == nil})
}
|