btcwalletextcmds.go raw

   1  package btcjson
   2  
   3  // CreateNewAccountCmd defines the createnewaccount JSON-RPC command.
   4  type CreateNewAccountCmd struct {
   5  	Account string
   6  }
   7  
   8  // NewCreateNewAccountCmd returns a new instance which can be used to issue a createnewaccount JSON-RPC command.
   9  func NewCreateNewAccountCmd(account string) *CreateNewAccountCmd {
  10  	return &CreateNewAccountCmd{
  11  		Account: account,
  12  	}
  13  }
  14  
  15  // DumpWalletCmd defines the dumpwallet JSON-RPC command.
  16  type DumpWalletCmd struct {
  17  	Filename string
  18  }
  19  
  20  // NewDumpWalletCmd returns a new instance which can be used to issue a dumpwallet JSON-RPC command.
  21  func NewDumpWalletCmd(filename string) *DumpWalletCmd {
  22  	return &DumpWalletCmd{
  23  		Filename: filename,
  24  	}
  25  }
  26  
  27  // ImportAddressCmd defines the importaddress JSON-RPC command.
  28  type ImportAddressCmd struct {
  29  	Address string
  30  	Account string
  31  	Rescan  *bool `jsonrpcdefault:"true"`
  32  }
  33  
  34  // NewImportAddressCmd returns a new instance which can be used to issue an importaddress JSON-RPC command.
  35  func NewImportAddressCmd(address string, account string, rescan *bool) *ImportAddressCmd {
  36  	return &ImportAddressCmd{
  37  		Address: address,
  38  		Account: account,
  39  		Rescan:  rescan,
  40  	}
  41  }
  42  
  43  // ImportPubKeyCmd defines the importpubkey JSON-RPC command.
  44  type ImportPubKeyCmd struct {
  45  	PubKey string
  46  	Rescan *bool `jsonrpcdefault:"true"`
  47  }
  48  
  49  // NewImportPubKeyCmd returns a new instance which can be used to issue an importpubkey JSON-RPC command.
  50  func NewImportPubKeyCmd(pubKey string, rescan *bool) *ImportPubKeyCmd {
  51  	return &ImportPubKeyCmd{
  52  		PubKey: pubKey,
  53  		Rescan: rescan,
  54  	}
  55  }
  56  
  57  // ImportWalletCmd defines the importwallet JSON-RPC command.
  58  type ImportWalletCmd struct {
  59  	Filename string
  60  }
  61  
  62  // NewImportWalletCmd returns a new instance which can be used to issue a importwallet JSON-RPC command.
  63  func NewImportWalletCmd(filename string) *ImportWalletCmd {
  64  	return &ImportWalletCmd{
  65  		Filename: filename,
  66  	}
  67  }
  68  
  69  // RenameAccountCmd defines the renameaccount JSON-RPC command.
  70  type RenameAccountCmd struct {
  71  	OldAccount string
  72  	NewAccount string
  73  }
  74  
  75  // NewRenameAccountCmd returns a new instance which can be used to issue a renameaccount JSON-RPC command.
  76  func NewRenameAccountCmd(oldAccount, newAccount string) *RenameAccountCmd {
  77  	return &RenameAccountCmd{
  78  		OldAccount: oldAccount,
  79  		NewAccount: newAccount,
  80  	}
  81  }
  82  func init() {
  83  	
  84  	// The commands in this file are only usable with a wallet server.
  85  	flags := UFWalletOnly
  86  	MustRegisterCmd("createnewaccount", (*CreateNewAccountCmd)(nil), flags)
  87  	MustRegisterCmd("dumpwallet", (*DumpWalletCmd)(nil), flags)
  88  	MustRegisterCmd("importaddress", (*ImportAddressCmd)(nil), flags)
  89  	MustRegisterCmd("importpubkey", (*ImportPubKeyCmd)(nil), flags)
  90  	MustRegisterCmd("importwallet", (*ImportWalletCmd)(nil), flags)
  91  	MustRegisterCmd("renameaccount", (*RenameAccountCmd)(nil), flags)
  92  	
  93  }
  94