repo
stringlengths 5
54
| path
stringlengths 4
155
| func_name
stringlengths 1
118
| original_string
stringlengths 52
85.5k
| language
stringclasses 1
value | code
stringlengths 52
85.5k
| code_tokens
sequence | docstring
stringlengths 6
2.61k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 85
252
| partition
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
btcsuite/btcd | rpcserver.go | newRPCServer | func newRPCServer(config *rpcserverConfig) (*rpcServer, error) {
rpc := rpcServer{
cfg: *config,
statusLines: make(map[int]string),
gbtWorkState: newGbtWorkState(config.TimeSource),
helpCacher: newHelpCacher(),
requestProcessShutdown: make(chan struct{}),
quit: make(chan int),
}
if cfg.RPCUser != "" && cfg.RPCPass != "" {
login := cfg.RPCUser + ":" + cfg.RPCPass
auth := "Basic " + base64.StdEncoding.EncodeToString([]byte(login))
rpc.authsha = sha256.Sum256([]byte(auth))
}
if cfg.RPCLimitUser != "" && cfg.RPCLimitPass != "" {
login := cfg.RPCLimitUser + ":" + cfg.RPCLimitPass
auth := "Basic " + base64.StdEncoding.EncodeToString([]byte(login))
rpc.limitauthsha = sha256.Sum256([]byte(auth))
}
rpc.ntfnMgr = newWsNotificationManager(&rpc)
rpc.cfg.Chain.Subscribe(rpc.handleBlockchainNotification)
return &rpc, nil
} | go | func newRPCServer(config *rpcserverConfig) (*rpcServer, error) {
rpc := rpcServer{
cfg: *config,
statusLines: make(map[int]string),
gbtWorkState: newGbtWorkState(config.TimeSource),
helpCacher: newHelpCacher(),
requestProcessShutdown: make(chan struct{}),
quit: make(chan int),
}
if cfg.RPCUser != "" && cfg.RPCPass != "" {
login := cfg.RPCUser + ":" + cfg.RPCPass
auth := "Basic " + base64.StdEncoding.EncodeToString([]byte(login))
rpc.authsha = sha256.Sum256([]byte(auth))
}
if cfg.RPCLimitUser != "" && cfg.RPCLimitPass != "" {
login := cfg.RPCLimitUser + ":" + cfg.RPCLimitPass
auth := "Basic " + base64.StdEncoding.EncodeToString([]byte(login))
rpc.limitauthsha = sha256.Sum256([]byte(auth))
}
rpc.ntfnMgr = newWsNotificationManager(&rpc)
rpc.cfg.Chain.Subscribe(rpc.handleBlockchainNotification)
return &rpc, nil
} | [
"func",
"newRPCServer",
"(",
"config",
"*",
"rpcserverConfig",
")",
"(",
"*",
"rpcServer",
",",
"error",
")",
"{",
"rpc",
":=",
"rpcServer",
"{",
"cfg",
":",
"*",
"config",
",",
"statusLines",
":",
"make",
"(",
"map",
"[",
"int",
"]",
"string",
")",
",",
"gbtWorkState",
":",
"newGbtWorkState",
"(",
"config",
".",
"TimeSource",
")",
",",
"helpCacher",
":",
"newHelpCacher",
"(",
")",
",",
"requestProcessShutdown",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"quit",
":",
"make",
"(",
"chan",
"int",
")",
",",
"}",
"\n",
"if",
"cfg",
".",
"RPCUser",
"!=",
"\"",
"\"",
"&&",
"cfg",
".",
"RPCPass",
"!=",
"\"",
"\"",
"{",
"login",
":=",
"cfg",
".",
"RPCUser",
"+",
"\"",
"\"",
"+",
"cfg",
".",
"RPCPass",
"\n",
"auth",
":=",
"\"",
"\"",
"+",
"base64",
".",
"StdEncoding",
".",
"EncodeToString",
"(",
"[",
"]",
"byte",
"(",
"login",
")",
")",
"\n",
"rpc",
".",
"authsha",
"=",
"sha256",
".",
"Sum256",
"(",
"[",
"]",
"byte",
"(",
"auth",
")",
")",
"\n",
"}",
"\n",
"if",
"cfg",
".",
"RPCLimitUser",
"!=",
"\"",
"\"",
"&&",
"cfg",
".",
"RPCLimitPass",
"!=",
"\"",
"\"",
"{",
"login",
":=",
"cfg",
".",
"RPCLimitUser",
"+",
"\"",
"\"",
"+",
"cfg",
".",
"RPCLimitPass",
"\n",
"auth",
":=",
"\"",
"\"",
"+",
"base64",
".",
"StdEncoding",
".",
"EncodeToString",
"(",
"[",
"]",
"byte",
"(",
"login",
")",
")",
"\n",
"rpc",
".",
"limitauthsha",
"=",
"sha256",
".",
"Sum256",
"(",
"[",
"]",
"byte",
"(",
"auth",
")",
")",
"\n",
"}",
"\n",
"rpc",
".",
"ntfnMgr",
"=",
"newWsNotificationManager",
"(",
"&",
"rpc",
")",
"\n",
"rpc",
".",
"cfg",
".",
"Chain",
".",
"Subscribe",
"(",
"rpc",
".",
"handleBlockchainNotification",
")",
"\n\n",
"return",
"&",
"rpc",
",",
"nil",
"\n",
"}"
] | // newRPCServer returns a new instance of the rpcServer struct. | [
"newRPCServer",
"returns",
"a",
"new",
"instance",
"of",
"the",
"rpcServer",
"struct",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcserver.go#L4277-L4300 | train |
btcsuite/btcd | rpcserver.go | handleBlockchainNotification | func (s *rpcServer) handleBlockchainNotification(notification *blockchain.Notification) {
switch notification.Type {
case blockchain.NTBlockAccepted:
block, ok := notification.Data.(*btcutil.Block)
if !ok {
rpcsLog.Warnf("Chain accepted notification is not a block.")
break
}
// Allow any clients performing long polling via the
// getblocktemplate RPC to be notified when the new block causes
// their old block template to become stale.
s.gbtWorkState.NotifyBlockConnected(block.Hash())
case blockchain.NTBlockConnected:
block, ok := notification.Data.(*btcutil.Block)
if !ok {
rpcsLog.Warnf("Chain connected notification is not a block.")
break
}
// Notify registered websocket clients of incoming block.
s.ntfnMgr.NotifyBlockConnected(block)
case blockchain.NTBlockDisconnected:
block, ok := notification.Data.(*btcutil.Block)
if !ok {
rpcsLog.Warnf("Chain disconnected notification is not a block.")
break
}
// Notify registered websocket clients.
s.ntfnMgr.NotifyBlockDisconnected(block)
}
} | go | func (s *rpcServer) handleBlockchainNotification(notification *blockchain.Notification) {
switch notification.Type {
case blockchain.NTBlockAccepted:
block, ok := notification.Data.(*btcutil.Block)
if !ok {
rpcsLog.Warnf("Chain accepted notification is not a block.")
break
}
// Allow any clients performing long polling via the
// getblocktemplate RPC to be notified when the new block causes
// their old block template to become stale.
s.gbtWorkState.NotifyBlockConnected(block.Hash())
case blockchain.NTBlockConnected:
block, ok := notification.Data.(*btcutil.Block)
if !ok {
rpcsLog.Warnf("Chain connected notification is not a block.")
break
}
// Notify registered websocket clients of incoming block.
s.ntfnMgr.NotifyBlockConnected(block)
case blockchain.NTBlockDisconnected:
block, ok := notification.Data.(*btcutil.Block)
if !ok {
rpcsLog.Warnf("Chain disconnected notification is not a block.")
break
}
// Notify registered websocket clients.
s.ntfnMgr.NotifyBlockDisconnected(block)
}
} | [
"func",
"(",
"s",
"*",
"rpcServer",
")",
"handleBlockchainNotification",
"(",
"notification",
"*",
"blockchain",
".",
"Notification",
")",
"{",
"switch",
"notification",
".",
"Type",
"{",
"case",
"blockchain",
".",
"NTBlockAccepted",
":",
"block",
",",
"ok",
":=",
"notification",
".",
"Data",
".",
"(",
"*",
"btcutil",
".",
"Block",
")",
"\n",
"if",
"!",
"ok",
"{",
"rpcsLog",
".",
"Warnf",
"(",
"\"",
"\"",
")",
"\n",
"break",
"\n",
"}",
"\n\n",
"// Allow any clients performing long polling via the",
"// getblocktemplate RPC to be notified when the new block causes",
"// their old block template to become stale.",
"s",
".",
"gbtWorkState",
".",
"NotifyBlockConnected",
"(",
"block",
".",
"Hash",
"(",
")",
")",
"\n\n",
"case",
"blockchain",
".",
"NTBlockConnected",
":",
"block",
",",
"ok",
":=",
"notification",
".",
"Data",
".",
"(",
"*",
"btcutil",
".",
"Block",
")",
"\n",
"if",
"!",
"ok",
"{",
"rpcsLog",
".",
"Warnf",
"(",
"\"",
"\"",
")",
"\n",
"break",
"\n",
"}",
"\n\n",
"// Notify registered websocket clients of incoming block.",
"s",
".",
"ntfnMgr",
".",
"NotifyBlockConnected",
"(",
"block",
")",
"\n\n",
"case",
"blockchain",
".",
"NTBlockDisconnected",
":",
"block",
",",
"ok",
":=",
"notification",
".",
"Data",
".",
"(",
"*",
"btcutil",
".",
"Block",
")",
"\n",
"if",
"!",
"ok",
"{",
"rpcsLog",
".",
"Warnf",
"(",
"\"",
"\"",
")",
"\n",
"break",
"\n",
"}",
"\n\n",
"// Notify registered websocket clients.",
"s",
".",
"ntfnMgr",
".",
"NotifyBlockDisconnected",
"(",
"block",
")",
"\n",
"}",
"\n",
"}"
] | // Callback for notifications from blockchain. It notifies clients that are
// long polling for changes or subscribed to websockets notifications. | [
"Callback",
"for",
"notifications",
"from",
"blockchain",
".",
"It",
"notifies",
"clients",
"that",
"are",
"long",
"polling",
"for",
"changes",
"or",
"subscribed",
"to",
"websockets",
"notifications",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcserver.go#L4304-L4338 | train |
btcsuite/btcd | database/ffldb/reconcile.go | deserializeWriteRow | func deserializeWriteRow(writeRow []byte) (uint32, uint32, error) {
// Ensure the checksum matches. The checksum is at the end.
gotChecksum := crc32.Checksum(writeRow[:8], castagnoli)
wantChecksumBytes := writeRow[8:12]
wantChecksum := byteOrder.Uint32(wantChecksumBytes)
if gotChecksum != wantChecksum {
str := fmt.Sprintf("metadata for write cursor does not match "+
"the expected checksum - got %d, want %d", gotChecksum,
wantChecksum)
return 0, 0, makeDbErr(database.ErrCorruption, str, nil)
}
fileNum := byteOrder.Uint32(writeRow[0:4])
fileOffset := byteOrder.Uint32(writeRow[4:8])
return fileNum, fileOffset, nil
} | go | func deserializeWriteRow(writeRow []byte) (uint32, uint32, error) {
// Ensure the checksum matches. The checksum is at the end.
gotChecksum := crc32.Checksum(writeRow[:8], castagnoli)
wantChecksumBytes := writeRow[8:12]
wantChecksum := byteOrder.Uint32(wantChecksumBytes)
if gotChecksum != wantChecksum {
str := fmt.Sprintf("metadata for write cursor does not match "+
"the expected checksum - got %d, want %d", gotChecksum,
wantChecksum)
return 0, 0, makeDbErr(database.ErrCorruption, str, nil)
}
fileNum := byteOrder.Uint32(writeRow[0:4])
fileOffset := byteOrder.Uint32(writeRow[4:8])
return fileNum, fileOffset, nil
} | [
"func",
"deserializeWriteRow",
"(",
"writeRow",
"[",
"]",
"byte",
")",
"(",
"uint32",
",",
"uint32",
",",
"error",
")",
"{",
"// Ensure the checksum matches. The checksum is at the end.",
"gotChecksum",
":=",
"crc32",
".",
"Checksum",
"(",
"writeRow",
"[",
":",
"8",
"]",
",",
"castagnoli",
")",
"\n",
"wantChecksumBytes",
":=",
"writeRow",
"[",
"8",
":",
"12",
"]",
"\n",
"wantChecksum",
":=",
"byteOrder",
".",
"Uint32",
"(",
"wantChecksumBytes",
")",
"\n",
"if",
"gotChecksum",
"!=",
"wantChecksum",
"{",
"str",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"gotChecksum",
",",
"wantChecksum",
")",
"\n",
"return",
"0",
",",
"0",
",",
"makeDbErr",
"(",
"database",
".",
"ErrCorruption",
",",
"str",
",",
"nil",
")",
"\n",
"}",
"\n\n",
"fileNum",
":=",
"byteOrder",
".",
"Uint32",
"(",
"writeRow",
"[",
"0",
":",
"4",
"]",
")",
"\n",
"fileOffset",
":=",
"byteOrder",
".",
"Uint32",
"(",
"writeRow",
"[",
"4",
":",
"8",
"]",
")",
"\n",
"return",
"fileNum",
",",
"fileOffset",
",",
"nil",
"\n",
"}"
] | // deserializeWriteRow deserializes the write cursor location stored in the
// metadata. Returns ErrCorruption if the checksum of the entry doesn't match. | [
"deserializeWriteRow",
"deserializes",
"the",
"write",
"cursor",
"location",
"stored",
"in",
"the",
"metadata",
".",
"Returns",
"ErrCorruption",
"if",
"the",
"checksum",
"of",
"the",
"entry",
"doesn",
"t",
"match",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/database/ffldb/reconcile.go#L33-L48 | train |
btcsuite/btcd | database/ffldb/reconcile.go | reconcileDB | func reconcileDB(pdb *db, create bool) (database.DB, error) {
// Perform initial internal bucket and value creation during database
// creation.
if create {
if err := initDB(pdb.cache.ldb); err != nil {
return nil, err
}
}
// Load the current write cursor position from the metadata.
var curFileNum, curOffset uint32
err := pdb.View(func(tx database.Tx) error {
writeRow := tx.Metadata().Get(writeLocKeyName)
if writeRow == nil {
str := "write cursor does not exist"
return makeDbErr(database.ErrCorruption, str, nil)
}
var err error
curFileNum, curOffset, err = deserializeWriteRow(writeRow)
return err
})
if err != nil {
return nil, err
}
// When the write cursor position found by scanning the block files on
// disk is AFTER the position the metadata believes to be true, truncate
// the files on disk to match the metadata. This can be a fairly common
// occurrence in unclean shutdown scenarios while the block files are in
// the middle of being written. Since the metadata isn't updated until
// after the block data is written, this is effectively just a rollback
// to the known good point before the unclean shutdown.
wc := pdb.store.writeCursor
if wc.curFileNum > curFileNum || (wc.curFileNum == curFileNum &&
wc.curOffset > curOffset) {
log.Info("Detected unclean shutdown - Repairing...")
log.Debugf("Metadata claims file %d, offset %d. Block data is "+
"at file %d, offset %d", curFileNum, curOffset,
wc.curFileNum, wc.curOffset)
pdb.store.handleRollback(curFileNum, curOffset)
log.Infof("Database sync complete")
}
// When the write cursor position found by scanning the block files on
// disk is BEFORE the position the metadata believes to be true, return
// a corruption error. Since sync is called after each block is written
// and before the metadata is updated, this should only happen in the
// case of missing, deleted, or truncated block files, which generally
// is not an easily recoverable scenario. In the future, it might be
// possible to rescan and rebuild the metadata from the block files,
// however, that would need to happen with coordination from a higher
// layer since it could invalidate other metadata.
if wc.curFileNum < curFileNum || (wc.curFileNum == curFileNum &&
wc.curOffset < curOffset) {
str := fmt.Sprintf("metadata claims file %d, offset %d, but "+
"block data is at file %d, offset %d", curFileNum,
curOffset, wc.curFileNum, wc.curOffset)
log.Warnf("***Database corruption detected***: %v", str)
return nil, makeDbErr(database.ErrCorruption, str, nil)
}
return pdb, nil
} | go | func reconcileDB(pdb *db, create bool) (database.DB, error) {
// Perform initial internal bucket and value creation during database
// creation.
if create {
if err := initDB(pdb.cache.ldb); err != nil {
return nil, err
}
}
// Load the current write cursor position from the metadata.
var curFileNum, curOffset uint32
err := pdb.View(func(tx database.Tx) error {
writeRow := tx.Metadata().Get(writeLocKeyName)
if writeRow == nil {
str := "write cursor does not exist"
return makeDbErr(database.ErrCorruption, str, nil)
}
var err error
curFileNum, curOffset, err = deserializeWriteRow(writeRow)
return err
})
if err != nil {
return nil, err
}
// When the write cursor position found by scanning the block files on
// disk is AFTER the position the metadata believes to be true, truncate
// the files on disk to match the metadata. This can be a fairly common
// occurrence in unclean shutdown scenarios while the block files are in
// the middle of being written. Since the metadata isn't updated until
// after the block data is written, this is effectively just a rollback
// to the known good point before the unclean shutdown.
wc := pdb.store.writeCursor
if wc.curFileNum > curFileNum || (wc.curFileNum == curFileNum &&
wc.curOffset > curOffset) {
log.Info("Detected unclean shutdown - Repairing...")
log.Debugf("Metadata claims file %d, offset %d. Block data is "+
"at file %d, offset %d", curFileNum, curOffset,
wc.curFileNum, wc.curOffset)
pdb.store.handleRollback(curFileNum, curOffset)
log.Infof("Database sync complete")
}
// When the write cursor position found by scanning the block files on
// disk is BEFORE the position the metadata believes to be true, return
// a corruption error. Since sync is called after each block is written
// and before the metadata is updated, this should only happen in the
// case of missing, deleted, or truncated block files, which generally
// is not an easily recoverable scenario. In the future, it might be
// possible to rescan and rebuild the metadata from the block files,
// however, that would need to happen with coordination from a higher
// layer since it could invalidate other metadata.
if wc.curFileNum < curFileNum || (wc.curFileNum == curFileNum &&
wc.curOffset < curOffset) {
str := fmt.Sprintf("metadata claims file %d, offset %d, but "+
"block data is at file %d, offset %d", curFileNum,
curOffset, wc.curFileNum, wc.curOffset)
log.Warnf("***Database corruption detected***: %v", str)
return nil, makeDbErr(database.ErrCorruption, str, nil)
}
return pdb, nil
} | [
"func",
"reconcileDB",
"(",
"pdb",
"*",
"db",
",",
"create",
"bool",
")",
"(",
"database",
".",
"DB",
",",
"error",
")",
"{",
"// Perform initial internal bucket and value creation during database",
"// creation.",
"if",
"create",
"{",
"if",
"err",
":=",
"initDB",
"(",
"pdb",
".",
"cache",
".",
"ldb",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Load the current write cursor position from the metadata.",
"var",
"curFileNum",
",",
"curOffset",
"uint32",
"\n",
"err",
":=",
"pdb",
".",
"View",
"(",
"func",
"(",
"tx",
"database",
".",
"Tx",
")",
"error",
"{",
"writeRow",
":=",
"tx",
".",
"Metadata",
"(",
")",
".",
"Get",
"(",
"writeLocKeyName",
")",
"\n",
"if",
"writeRow",
"==",
"nil",
"{",
"str",
":=",
"\"",
"\"",
"\n",
"return",
"makeDbErr",
"(",
"database",
".",
"ErrCorruption",
",",
"str",
",",
"nil",
")",
"\n",
"}",
"\n\n",
"var",
"err",
"error",
"\n",
"curFileNum",
",",
"curOffset",
",",
"err",
"=",
"deserializeWriteRow",
"(",
"writeRow",
")",
"\n",
"return",
"err",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// When the write cursor position found by scanning the block files on",
"// disk is AFTER the position the metadata believes to be true, truncate",
"// the files on disk to match the metadata. This can be a fairly common",
"// occurrence in unclean shutdown scenarios while the block files are in",
"// the middle of being written. Since the metadata isn't updated until",
"// after the block data is written, this is effectively just a rollback",
"// to the known good point before the unclean shutdown.",
"wc",
":=",
"pdb",
".",
"store",
".",
"writeCursor",
"\n",
"if",
"wc",
".",
"curFileNum",
">",
"curFileNum",
"||",
"(",
"wc",
".",
"curFileNum",
"==",
"curFileNum",
"&&",
"wc",
".",
"curOffset",
">",
"curOffset",
")",
"{",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"curFileNum",
",",
"curOffset",
",",
"wc",
".",
"curFileNum",
",",
"wc",
".",
"curOffset",
")",
"\n",
"pdb",
".",
"store",
".",
"handleRollback",
"(",
"curFileNum",
",",
"curOffset",
")",
"\n",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// When the write cursor position found by scanning the block files on",
"// disk is BEFORE the position the metadata believes to be true, return",
"// a corruption error. Since sync is called after each block is written",
"// and before the metadata is updated, this should only happen in the",
"// case of missing, deleted, or truncated block files, which generally",
"// is not an easily recoverable scenario. In the future, it might be",
"// possible to rescan and rebuild the metadata from the block files,",
"// however, that would need to happen with coordination from a higher",
"// layer since it could invalidate other metadata.",
"if",
"wc",
".",
"curFileNum",
"<",
"curFileNum",
"||",
"(",
"wc",
".",
"curFileNum",
"==",
"curFileNum",
"&&",
"wc",
".",
"curOffset",
"<",
"curOffset",
")",
"{",
"str",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"curFileNum",
",",
"curOffset",
",",
"wc",
".",
"curFileNum",
",",
"wc",
".",
"curOffset",
")",
"\n",
"log",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"str",
")",
"\n",
"return",
"nil",
",",
"makeDbErr",
"(",
"database",
".",
"ErrCorruption",
",",
"str",
",",
"nil",
")",
"\n",
"}",
"\n\n",
"return",
"pdb",
",",
"nil",
"\n",
"}"
] | // reconcileDB reconciles the metadata with the flat block files on disk. It
// will also initialize the underlying database if the create flag is set. | [
"reconcileDB",
"reconciles",
"the",
"metadata",
"with",
"the",
"flat",
"block",
"files",
"on",
"disk",
".",
"It",
"will",
"also",
"initialize",
"the",
"underlying",
"database",
"if",
"the",
"create",
"flag",
"is",
"set",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/database/ffldb/reconcile.go#L52-L117 | train |
btcsuite/btcd | txscript/pkscript.go | ParsePkScript | func ParsePkScript(pkScript []byte) (PkScript, error) {
var outputScript PkScript
scriptClass, _, _, err := ExtractPkScriptAddrs(
pkScript, &chaincfg.MainNetParams,
)
if err != nil {
return outputScript, fmt.Errorf("unable to parse script type: "+
"%v", err)
}
if !isSupportedScriptType(scriptClass) {
return outputScript, ErrUnsupportedScriptType
}
outputScript.class = scriptClass
copy(outputScript.script[:], pkScript)
return outputScript, nil
} | go | func ParsePkScript(pkScript []byte) (PkScript, error) {
var outputScript PkScript
scriptClass, _, _, err := ExtractPkScriptAddrs(
pkScript, &chaincfg.MainNetParams,
)
if err != nil {
return outputScript, fmt.Errorf("unable to parse script type: "+
"%v", err)
}
if !isSupportedScriptType(scriptClass) {
return outputScript, ErrUnsupportedScriptType
}
outputScript.class = scriptClass
copy(outputScript.script[:], pkScript)
return outputScript, nil
} | [
"func",
"ParsePkScript",
"(",
"pkScript",
"[",
"]",
"byte",
")",
"(",
"PkScript",
",",
"error",
")",
"{",
"var",
"outputScript",
"PkScript",
"\n",
"scriptClass",
",",
"_",
",",
"_",
",",
"err",
":=",
"ExtractPkScriptAddrs",
"(",
"pkScript",
",",
"&",
"chaincfg",
".",
"MainNetParams",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"outputScript",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"isSupportedScriptType",
"(",
"scriptClass",
")",
"{",
"return",
"outputScript",
",",
"ErrUnsupportedScriptType",
"\n",
"}",
"\n\n",
"outputScript",
".",
"class",
"=",
"scriptClass",
"\n",
"copy",
"(",
"outputScript",
".",
"script",
"[",
":",
"]",
",",
"pkScript",
")",
"\n\n",
"return",
"outputScript",
",",
"nil",
"\n",
"}"
] | // ParsePkScript parses an output script into the PkScript struct.
// ErrUnsupportedScriptType is returned when attempting to parse an unsupported
// script type. | [
"ParsePkScript",
"parses",
"an",
"output",
"script",
"into",
"the",
"PkScript",
"struct",
".",
"ErrUnsupportedScriptType",
"is",
"returned",
"when",
"attempting",
"to",
"parse",
"an",
"unsupported",
"script",
"type",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/pkscript.go#L67-L85 | train |
btcsuite/btcd | txscript/pkscript.go | isSupportedScriptType | func isSupportedScriptType(class ScriptClass) bool {
switch class {
case PubKeyHashTy, WitnessV0PubKeyHashTy, ScriptHashTy,
WitnessV0ScriptHashTy:
return true
default:
return false
}
} | go | func isSupportedScriptType(class ScriptClass) bool {
switch class {
case PubKeyHashTy, WitnessV0PubKeyHashTy, ScriptHashTy,
WitnessV0ScriptHashTy:
return true
default:
return false
}
} | [
"func",
"isSupportedScriptType",
"(",
"class",
"ScriptClass",
")",
"bool",
"{",
"switch",
"class",
"{",
"case",
"PubKeyHashTy",
",",
"WitnessV0PubKeyHashTy",
",",
"ScriptHashTy",
",",
"WitnessV0ScriptHashTy",
":",
"return",
"true",
"\n",
"default",
":",
"return",
"false",
"\n",
"}",
"\n",
"}"
] | // isSupportedScriptType determines whether the script type is supported by the
// PkScript struct. | [
"isSupportedScriptType",
"determines",
"whether",
"the",
"script",
"type",
"is",
"supported",
"by",
"the",
"PkScript",
"struct",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/pkscript.go#L89-L97 | train |
btcsuite/btcd | txscript/pkscript.go | Script | func (s PkScript) Script() []byte {
var script []byte
switch s.class {
case PubKeyHashTy:
script = make([]byte, pubKeyHashLen)
copy(script, s.script[:pubKeyHashLen])
case WitnessV0PubKeyHashTy:
script = make([]byte, witnessV0PubKeyHashLen)
copy(script, s.script[:witnessV0PubKeyHashLen])
case ScriptHashTy:
script = make([]byte, scriptHashLen)
copy(script, s.script[:scriptHashLen])
case WitnessV0ScriptHashTy:
script = make([]byte, witnessV0ScriptHashLen)
copy(script, s.script[:witnessV0ScriptHashLen])
default:
// Unsupported script type.
return nil
}
return script
} | go | func (s PkScript) Script() []byte {
var script []byte
switch s.class {
case PubKeyHashTy:
script = make([]byte, pubKeyHashLen)
copy(script, s.script[:pubKeyHashLen])
case WitnessV0PubKeyHashTy:
script = make([]byte, witnessV0PubKeyHashLen)
copy(script, s.script[:witnessV0PubKeyHashLen])
case ScriptHashTy:
script = make([]byte, scriptHashLen)
copy(script, s.script[:scriptHashLen])
case WitnessV0ScriptHashTy:
script = make([]byte, witnessV0ScriptHashLen)
copy(script, s.script[:witnessV0ScriptHashLen])
default:
// Unsupported script type.
return nil
}
return script
} | [
"func",
"(",
"s",
"PkScript",
")",
"Script",
"(",
")",
"[",
"]",
"byte",
"{",
"var",
"script",
"[",
"]",
"byte",
"\n\n",
"switch",
"s",
".",
"class",
"{",
"case",
"PubKeyHashTy",
":",
"script",
"=",
"make",
"(",
"[",
"]",
"byte",
",",
"pubKeyHashLen",
")",
"\n",
"copy",
"(",
"script",
",",
"s",
".",
"script",
"[",
":",
"pubKeyHashLen",
"]",
")",
"\n\n",
"case",
"WitnessV0PubKeyHashTy",
":",
"script",
"=",
"make",
"(",
"[",
"]",
"byte",
",",
"witnessV0PubKeyHashLen",
")",
"\n",
"copy",
"(",
"script",
",",
"s",
".",
"script",
"[",
":",
"witnessV0PubKeyHashLen",
"]",
")",
"\n\n",
"case",
"ScriptHashTy",
":",
"script",
"=",
"make",
"(",
"[",
"]",
"byte",
",",
"scriptHashLen",
")",
"\n",
"copy",
"(",
"script",
",",
"s",
".",
"script",
"[",
":",
"scriptHashLen",
"]",
")",
"\n\n",
"case",
"WitnessV0ScriptHashTy",
":",
"script",
"=",
"make",
"(",
"[",
"]",
"byte",
",",
"witnessV0ScriptHashLen",
")",
"\n",
"copy",
"(",
"script",
",",
"s",
".",
"script",
"[",
":",
"witnessV0ScriptHashLen",
"]",
")",
"\n\n",
"default",
":",
"// Unsupported script type.",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"script",
"\n",
"}"
] | // Script returns the script as a byte slice without any padding. | [
"Script",
"returns",
"the",
"script",
"as",
"a",
"byte",
"slice",
"without",
"any",
"padding",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/pkscript.go#L105-L131 | train |
btcsuite/btcd | txscript/pkscript.go | Address | func (s PkScript) Address(chainParams *chaincfg.Params) (btcutil.Address, error) {
_, addrs, _, err := ExtractPkScriptAddrs(s.Script(), chainParams)
if err != nil {
return nil, fmt.Errorf("unable to parse address: %v", err)
}
return addrs[0], nil
} | go | func (s PkScript) Address(chainParams *chaincfg.Params) (btcutil.Address, error) {
_, addrs, _, err := ExtractPkScriptAddrs(s.Script(), chainParams)
if err != nil {
return nil, fmt.Errorf("unable to parse address: %v", err)
}
return addrs[0], nil
} | [
"func",
"(",
"s",
"PkScript",
")",
"Address",
"(",
"chainParams",
"*",
"chaincfg",
".",
"Params",
")",
"(",
"btcutil",
".",
"Address",
",",
"error",
")",
"{",
"_",
",",
"addrs",
",",
"_",
",",
"err",
":=",
"ExtractPkScriptAddrs",
"(",
"s",
".",
"Script",
"(",
")",
",",
"chainParams",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"addrs",
"[",
"0",
"]",
",",
"nil",
"\n",
"}"
] | // Address encodes the script into an address for the given chain. | [
"Address",
"encodes",
"the",
"script",
"into",
"an",
"address",
"for",
"the",
"given",
"chain",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/pkscript.go#L134-L141 | train |
btcsuite/btcd | txscript/pkscript.go | String | func (s PkScript) String() string {
str, _ := DisasmString(s.Script())
return str
} | go | func (s PkScript) String() string {
str, _ := DisasmString(s.Script())
return str
} | [
"func",
"(",
"s",
"PkScript",
")",
"String",
"(",
")",
"string",
"{",
"str",
",",
"_",
":=",
"DisasmString",
"(",
"s",
".",
"Script",
"(",
")",
")",
"\n",
"return",
"str",
"\n",
"}"
] | // String returns a hex-encoded string representation of the script. | [
"String",
"returns",
"a",
"hex",
"-",
"encoded",
"string",
"representation",
"of",
"the",
"script",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/pkscript.go#L144-L147 | train |
btcsuite/btcd | txscript/pkscript.go | hash160 | func hash160(data []byte) []byte {
h := sha256.Sum256(data)
return ripemd160h(h[:])
} | go | func hash160(data []byte) []byte {
h := sha256.Sum256(data)
return ripemd160h(h[:])
} | [
"func",
"hash160",
"(",
"data",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"h",
":=",
"sha256",
".",
"Sum256",
"(",
"data",
")",
"\n",
"return",
"ripemd160h",
"(",
"h",
"[",
":",
"]",
")",
"\n",
"}"
] | // hash160 returns the RIPEMD160 hash of the SHA-256 HASH of the given data. | [
"hash160",
"returns",
"the",
"RIPEMD160",
"hash",
"of",
"the",
"SHA",
"-",
"256",
"HASH",
"of",
"the",
"given",
"data",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/pkscript.go#L250-L253 | train |
btcsuite/btcd | txscript/pkscript.go | ripemd160h | func ripemd160h(data []byte) []byte {
h := ripemd160.New()
h.Write(data)
return h.Sum(nil)
} | go | func ripemd160h(data []byte) []byte {
h := ripemd160.New()
h.Write(data)
return h.Sum(nil)
} | [
"func",
"ripemd160h",
"(",
"data",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"h",
":=",
"ripemd160",
".",
"New",
"(",
")",
"\n",
"h",
".",
"Write",
"(",
"data",
")",
"\n",
"return",
"h",
".",
"Sum",
"(",
"nil",
")",
"\n",
"}"
] | // ripemd160h returns the RIPEMD160 hash of the given data. | [
"ripemd160h",
"returns",
"the",
"RIPEMD160",
"hash",
"of",
"the",
"given",
"data",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/pkscript.go#L256-L260 | train |
btcsuite/btcd | txscript/stack.go | asBool | func asBool(t []byte) bool {
for i := range t {
if t[i] != 0 {
// Negative 0 is also considered false.
if i == len(t)-1 && t[i] == 0x80 {
return false
}
return true
}
}
return false
} | go | func asBool(t []byte) bool {
for i := range t {
if t[i] != 0 {
// Negative 0 is also considered false.
if i == len(t)-1 && t[i] == 0x80 {
return false
}
return true
}
}
return false
} | [
"func",
"asBool",
"(",
"t",
"[",
"]",
"byte",
")",
"bool",
"{",
"for",
"i",
":=",
"range",
"t",
"{",
"if",
"t",
"[",
"i",
"]",
"!=",
"0",
"{",
"// Negative 0 is also considered false.",
"if",
"i",
"==",
"len",
"(",
"t",
")",
"-",
"1",
"&&",
"t",
"[",
"i",
"]",
"==",
"0x80",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // asBool gets the boolean value of the byte array. | [
"asBool",
"gets",
"the",
"boolean",
"value",
"of",
"the",
"byte",
"array",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/stack.go#L13-L24 | train |
btcsuite/btcd | txscript/stack.go | PeekByteArray | func (s *stack) PeekByteArray(idx int32) ([]byte, error) {
sz := int32(len(s.stk))
if idx < 0 || idx >= sz {
str := fmt.Sprintf("index %d is invalid for stack size %d", idx,
sz)
return nil, scriptError(ErrInvalidStackOperation, str)
}
return s.stk[sz-idx-1], nil
} | go | func (s *stack) PeekByteArray(idx int32) ([]byte, error) {
sz := int32(len(s.stk))
if idx < 0 || idx >= sz {
str := fmt.Sprintf("index %d is invalid for stack size %d", idx,
sz)
return nil, scriptError(ErrInvalidStackOperation, str)
}
return s.stk[sz-idx-1], nil
} | [
"func",
"(",
"s",
"*",
"stack",
")",
"PeekByteArray",
"(",
"idx",
"int32",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"sz",
":=",
"int32",
"(",
"len",
"(",
"s",
".",
"stk",
")",
")",
"\n",
"if",
"idx",
"<",
"0",
"||",
"idx",
">=",
"sz",
"{",
"str",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"idx",
",",
"sz",
")",
"\n",
"return",
"nil",
",",
"scriptError",
"(",
"ErrInvalidStackOperation",
",",
"str",
")",
"\n",
"}",
"\n\n",
"return",
"s",
".",
"stk",
"[",
"sz",
"-",
"idx",
"-",
"1",
"]",
",",
"nil",
"\n",
"}"
] | // PeekByteArray returns the Nth item on the stack without removing it. | [
"PeekByteArray",
"returns",
"the",
"Nth",
"item",
"on",
"the",
"stack",
"without",
"removing",
"it",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/stack.go#L106-L115 | train |
btcsuite/btcd | txscript/stack.go | PeekInt | func (s *stack) PeekInt(idx int32) (scriptNum, error) {
so, err := s.PeekByteArray(idx)
if err != nil {
return 0, err
}
return makeScriptNum(so, s.verifyMinimalData, defaultScriptNumLen)
} | go | func (s *stack) PeekInt(idx int32) (scriptNum, error) {
so, err := s.PeekByteArray(idx)
if err != nil {
return 0, err
}
return makeScriptNum(so, s.verifyMinimalData, defaultScriptNumLen)
} | [
"func",
"(",
"s",
"*",
"stack",
")",
"PeekInt",
"(",
"idx",
"int32",
")",
"(",
"scriptNum",
",",
"error",
")",
"{",
"so",
",",
"err",
":=",
"s",
".",
"PeekByteArray",
"(",
"idx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"makeScriptNum",
"(",
"so",
",",
"s",
".",
"verifyMinimalData",
",",
"defaultScriptNumLen",
")",
"\n",
"}"
] | // PeekInt returns the Nth item on the stack as a script num without removing
// it. The act of converting to a script num enforces the consensus rules
// imposed on data interpreted as numbers. | [
"PeekInt",
"returns",
"the",
"Nth",
"item",
"on",
"the",
"stack",
"as",
"a",
"script",
"num",
"without",
"removing",
"it",
".",
"The",
"act",
"of",
"converting",
"to",
"a",
"script",
"num",
"enforces",
"the",
"consensus",
"rules",
"imposed",
"on",
"data",
"interpreted",
"as",
"numbers",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/stack.go#L120-L127 | train |
btcsuite/btcd | txscript/stack.go | PeekBool | func (s *stack) PeekBool(idx int32) (bool, error) {
so, err := s.PeekByteArray(idx)
if err != nil {
return false, err
}
return asBool(so), nil
} | go | func (s *stack) PeekBool(idx int32) (bool, error) {
so, err := s.PeekByteArray(idx)
if err != nil {
return false, err
}
return asBool(so), nil
} | [
"func",
"(",
"s",
"*",
"stack",
")",
"PeekBool",
"(",
"idx",
"int32",
")",
"(",
"bool",
",",
"error",
")",
"{",
"so",
",",
"err",
":=",
"s",
".",
"PeekByteArray",
"(",
"idx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"asBool",
"(",
"so",
")",
",",
"nil",
"\n",
"}"
] | // PeekBool returns the Nth item on the stack as a bool without removing it. | [
"PeekBool",
"returns",
"the",
"Nth",
"item",
"on",
"the",
"stack",
"as",
"a",
"bool",
"without",
"removing",
"it",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/stack.go#L130-L137 | train |
btcsuite/btcd | txscript/stack.go | String | func (s *stack) String() string {
var result string
for _, stack := range s.stk {
if len(stack) == 0 {
result += "00000000 <empty>\n"
}
result += hex.Dump(stack)
}
return result
} | go | func (s *stack) String() string {
var result string
for _, stack := range s.stk {
if len(stack) == 0 {
result += "00000000 <empty>\n"
}
result += hex.Dump(stack)
}
return result
} | [
"func",
"(",
"s",
"*",
"stack",
")",
"String",
"(",
")",
"string",
"{",
"var",
"result",
"string",
"\n",
"for",
"_",
",",
"stack",
":=",
"range",
"s",
".",
"stk",
"{",
"if",
"len",
"(",
"stack",
")",
"==",
"0",
"{",
"result",
"+=",
"\"",
"\\n",
"\"",
"\n",
"}",
"\n",
"result",
"+=",
"hex",
".",
"Dump",
"(",
"stack",
")",
"\n",
"}",
"\n\n",
"return",
"result",
"\n",
"}"
] | // String returns the stack in a readable format. | [
"String",
"returns",
"the",
"stack",
"in",
"a",
"readable",
"format",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/txscript/stack.go#L351-L361 | train |
btcsuite/btcd | wire/msgreject.go | String | func (code RejectCode) String() string {
if s, ok := rejectCodeStrings[code]; ok {
return s
}
return fmt.Sprintf("Unknown RejectCode (%d)", uint8(code))
} | go | func (code RejectCode) String() string {
if s, ok := rejectCodeStrings[code]; ok {
return s
}
return fmt.Sprintf("Unknown RejectCode (%d)", uint8(code))
} | [
"func",
"(",
"code",
"RejectCode",
")",
"String",
"(",
")",
"string",
"{",
"if",
"s",
",",
"ok",
":=",
"rejectCodeStrings",
"[",
"code",
"]",
";",
"ok",
"{",
"return",
"s",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"uint8",
"(",
"code",
")",
")",
"\n",
"}"
] | // String returns the RejectCode in human-readable form. | [
"String",
"returns",
"the",
"RejectCode",
"in",
"human",
"-",
"readable",
"form",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/wire/msgreject.go#L43-L49 | train |
btcsuite/btcd | wire/msgreject.go | NewMsgReject | func NewMsgReject(command string, code RejectCode, reason string) *MsgReject {
return &MsgReject{
Cmd: command,
Code: code,
Reason: reason,
}
} | go | func NewMsgReject(command string, code RejectCode, reason string) *MsgReject {
return &MsgReject{
Cmd: command,
Code: code,
Reason: reason,
}
} | [
"func",
"NewMsgReject",
"(",
"command",
"string",
",",
"code",
"RejectCode",
",",
"reason",
"string",
")",
"*",
"MsgReject",
"{",
"return",
"&",
"MsgReject",
"{",
"Cmd",
":",
"command",
",",
"Code",
":",
"code",
",",
"Reason",
":",
"reason",
",",
"}",
"\n",
"}"
] | // NewMsgReject returns a new bitcoin reject message that conforms to the
// Message interface. See MsgReject for details. | [
"NewMsgReject",
"returns",
"a",
"new",
"bitcoin",
"reject",
"message",
"that",
"conforms",
"to",
"the",
"Message",
"interface",
".",
"See",
"MsgReject",
"for",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/wire/msgreject.go#L180-L186 | train |
btcsuite/btcd | rpcclient/wallet.go | Receive | func (r FutureGetTransactionResult) Receive() (*btcjson.GetTransactionResult, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as a gettransaction result object
var getTx btcjson.GetTransactionResult
err = json.Unmarshal(res, &getTx)
if err != nil {
return nil, err
}
return &getTx, nil
} | go | func (r FutureGetTransactionResult) Receive() (*btcjson.GetTransactionResult, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as a gettransaction result object
var getTx btcjson.GetTransactionResult
err = json.Unmarshal(res, &getTx)
if err != nil {
return nil, err
}
return &getTx, nil
} | [
"func",
"(",
"r",
"FutureGetTransactionResult",
")",
"Receive",
"(",
")",
"(",
"*",
"btcjson",
".",
"GetTransactionResult",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Unmarshal result as a gettransaction result object",
"var",
"getTx",
"btcjson",
".",
"GetTransactionResult",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"res",
",",
"&",
"getTx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"getTx",
",",
"nil",
"\n",
"}"
] | // Receive waits for the response promised by the future and returns detailed
// information about a wallet transaction. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"detailed",
"information",
"about",
"a",
"wallet",
"transaction",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L28-L42 | train |
btcsuite/btcd | rpcclient/wallet.go | GetTransactionAsync | func (c *Client) GetTransactionAsync(txHash *chainhash.Hash) FutureGetTransactionResult {
hash := ""
if txHash != nil {
hash = txHash.String()
}
cmd := btcjson.NewGetTransactionCmd(hash, nil)
return c.sendCmd(cmd)
} | go | func (c *Client) GetTransactionAsync(txHash *chainhash.Hash) FutureGetTransactionResult {
hash := ""
if txHash != nil {
hash = txHash.String()
}
cmd := btcjson.NewGetTransactionCmd(hash, nil)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetTransactionAsync",
"(",
"txHash",
"*",
"chainhash",
".",
"Hash",
")",
"FutureGetTransactionResult",
"{",
"hash",
":=",
"\"",
"\"",
"\n",
"if",
"txHash",
"!=",
"nil",
"{",
"hash",
"=",
"txHash",
".",
"String",
"(",
")",
"\n",
"}",
"\n\n",
"cmd",
":=",
"btcjson",
".",
"NewGetTransactionCmd",
"(",
"hash",
",",
"nil",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // GetTransactionAsync returns an instance of a type that can be used to get the
// result of the RPC at some future time by invoking the Receive function on
// the returned instance.
//
// See GetTransaction for the blocking version and more details. | [
"GetTransactionAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"GetTransaction",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L49-L57 | train |
btcsuite/btcd | rpcclient/wallet.go | GetTransaction | func (c *Client) GetTransaction(txHash *chainhash.Hash) (*btcjson.GetTransactionResult, error) {
return c.GetTransactionAsync(txHash).Receive()
} | go | func (c *Client) GetTransaction(txHash *chainhash.Hash) (*btcjson.GetTransactionResult, error) {
return c.GetTransactionAsync(txHash).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetTransaction",
"(",
"txHash",
"*",
"chainhash",
".",
"Hash",
")",
"(",
"*",
"btcjson",
".",
"GetTransactionResult",
",",
"error",
")",
"{",
"return",
"c",
".",
"GetTransactionAsync",
"(",
"txHash",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // GetTransaction returns detailed information about a wallet transaction.
//
// See GetRawTransaction to return the raw transaction instead. | [
"GetTransaction",
"returns",
"detailed",
"information",
"about",
"a",
"wallet",
"transaction",
".",
"See",
"GetRawTransaction",
"to",
"return",
"the",
"raw",
"transaction",
"instead",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L62-L64 | train |
btcsuite/btcd | rpcclient/wallet.go | Receive | func (r FutureListTransactionsResult) Receive() ([]btcjson.ListTransactionsResult, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as an array of listtransaction result objects.
var transactions []btcjson.ListTransactionsResult
err = json.Unmarshal(res, &transactions)
if err != nil {
return nil, err
}
return transactions, nil
} | go | func (r FutureListTransactionsResult) Receive() ([]btcjson.ListTransactionsResult, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as an array of listtransaction result objects.
var transactions []btcjson.ListTransactionsResult
err = json.Unmarshal(res, &transactions)
if err != nil {
return nil, err
}
return transactions, nil
} | [
"func",
"(",
"r",
"FutureListTransactionsResult",
")",
"Receive",
"(",
")",
"(",
"[",
"]",
"btcjson",
".",
"ListTransactionsResult",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Unmarshal result as an array of listtransaction result objects.",
"var",
"transactions",
"[",
"]",
"btcjson",
".",
"ListTransactionsResult",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"res",
",",
"&",
"transactions",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"transactions",
",",
"nil",
"\n",
"}"
] | // Receive waits for the response promised by the future and returns a list of
// the most recent transactions. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"a",
"list",
"of",
"the",
"most",
"recent",
"transactions",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L73-L87 | train |
btcsuite/btcd | rpcclient/wallet.go | ListTransactionsAsync | func (c *Client) ListTransactionsAsync(account string) FutureListTransactionsResult {
cmd := btcjson.NewListTransactionsCmd(&account, nil, nil, nil)
return c.sendCmd(cmd)
} | go | func (c *Client) ListTransactionsAsync(account string) FutureListTransactionsResult {
cmd := btcjson.NewListTransactionsCmd(&account, nil, nil, nil)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListTransactionsAsync",
"(",
"account",
"string",
")",
"FutureListTransactionsResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewListTransactionsCmd",
"(",
"&",
"account",
",",
"nil",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // ListTransactionsAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function on
// the returned instance.
//
// See ListTransactions for the blocking version and more details. | [
"ListTransactionsAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"ListTransactions",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L94-L97 | train |
btcsuite/btcd | rpcclient/wallet.go | ListTransactions | func (c *Client) ListTransactions(account string) ([]btcjson.ListTransactionsResult, error) {
return c.ListTransactionsAsync(account).Receive()
} | go | func (c *Client) ListTransactions(account string) ([]btcjson.ListTransactionsResult, error) {
return c.ListTransactionsAsync(account).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListTransactions",
"(",
"account",
"string",
")",
"(",
"[",
"]",
"btcjson",
".",
"ListTransactionsResult",
",",
"error",
")",
"{",
"return",
"c",
".",
"ListTransactionsAsync",
"(",
"account",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // ListTransactions returns a list of the most recent transactions.
//
// See the ListTransactionsCount and ListTransactionsCountFrom to control the
// number of transactions returned and starting point, respectively. | [
"ListTransactions",
"returns",
"a",
"list",
"of",
"the",
"most",
"recent",
"transactions",
".",
"See",
"the",
"ListTransactionsCount",
"and",
"ListTransactionsCountFrom",
"to",
"control",
"the",
"number",
"of",
"transactions",
"returned",
"and",
"starting",
"point",
"respectively",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L103-L105 | train |
btcsuite/btcd | rpcclient/wallet.go | ListTransactionsCountAsync | func (c *Client) ListTransactionsCountAsync(account string, count int) FutureListTransactionsResult {
cmd := btcjson.NewListTransactionsCmd(&account, &count, nil, nil)
return c.sendCmd(cmd)
} | go | func (c *Client) ListTransactionsCountAsync(account string, count int) FutureListTransactionsResult {
cmd := btcjson.NewListTransactionsCmd(&account, &count, nil, nil)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListTransactionsCountAsync",
"(",
"account",
"string",
",",
"count",
"int",
")",
"FutureListTransactionsResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewListTransactionsCmd",
"(",
"&",
"account",
",",
"&",
"count",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // ListTransactionsCountAsync returns an instance of a type that can be used to
// get the result of the RPC at some future time by invoking the Receive
// function on the returned instance.
//
// See ListTransactionsCount for the blocking version and more details. | [
"ListTransactionsCountAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"ListTransactionsCount",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L112-L115 | train |
btcsuite/btcd | rpcclient/wallet.go | ListTransactionsCount | func (c *Client) ListTransactionsCount(account string, count int) ([]btcjson.ListTransactionsResult, error) {
return c.ListTransactionsCountAsync(account, count).Receive()
} | go | func (c *Client) ListTransactionsCount(account string, count int) ([]btcjson.ListTransactionsResult, error) {
return c.ListTransactionsCountAsync(account, count).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListTransactionsCount",
"(",
"account",
"string",
",",
"count",
"int",
")",
"(",
"[",
"]",
"btcjson",
".",
"ListTransactionsResult",
",",
"error",
")",
"{",
"return",
"c",
".",
"ListTransactionsCountAsync",
"(",
"account",
",",
"count",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // ListTransactionsCount returns a list of the most recent transactions up
// to the passed count.
//
// See the ListTransactions and ListTransactionsCountFrom functions for
// different options. | [
"ListTransactionsCount",
"returns",
"a",
"list",
"of",
"the",
"most",
"recent",
"transactions",
"up",
"to",
"the",
"passed",
"count",
".",
"See",
"the",
"ListTransactions",
"and",
"ListTransactionsCountFrom",
"functions",
"for",
"different",
"options",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L122-L124 | train |
btcsuite/btcd | rpcclient/wallet.go | ListTransactionsCountFrom | func (c *Client) ListTransactionsCountFrom(account string, count, from int) ([]btcjson.ListTransactionsResult, error) {
return c.ListTransactionsCountFromAsync(account, count, from).Receive()
} | go | func (c *Client) ListTransactionsCountFrom(account string, count, from int) ([]btcjson.ListTransactionsResult, error) {
return c.ListTransactionsCountFromAsync(account, count, from).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListTransactionsCountFrom",
"(",
"account",
"string",
",",
"count",
",",
"from",
"int",
")",
"(",
"[",
"]",
"btcjson",
".",
"ListTransactionsResult",
",",
"error",
")",
"{",
"return",
"c",
".",
"ListTransactionsCountFromAsync",
"(",
"account",
",",
"count",
",",
"from",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // ListTransactionsCountFrom returns a list of the most recent transactions up
// to the passed count while skipping the first 'from' transactions.
//
// See the ListTransactions and ListTransactionsCount functions to use defaults. | [
"ListTransactionsCountFrom",
"returns",
"a",
"list",
"of",
"the",
"most",
"recent",
"transactions",
"up",
"to",
"the",
"passed",
"count",
"while",
"skipping",
"the",
"first",
"from",
"transactions",
".",
"See",
"the",
"ListTransactions",
"and",
"ListTransactionsCount",
"functions",
"to",
"use",
"defaults",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L140-L142 | train |
btcsuite/btcd | rpcclient/wallet.go | Receive | func (r FutureListUnspentResult) Receive() ([]btcjson.ListUnspentResult, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as an array of listunspent results.
var unspent []btcjson.ListUnspentResult
err = json.Unmarshal(res, &unspent)
if err != nil {
return nil, err
}
return unspent, nil
} | go | func (r FutureListUnspentResult) Receive() ([]btcjson.ListUnspentResult, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as an array of listunspent results.
var unspent []btcjson.ListUnspentResult
err = json.Unmarshal(res, &unspent)
if err != nil {
return nil, err
}
return unspent, nil
} | [
"func",
"(",
"r",
"FutureListUnspentResult",
")",
"Receive",
"(",
")",
"(",
"[",
"]",
"btcjson",
".",
"ListUnspentResult",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Unmarshal result as an array of listunspent results.",
"var",
"unspent",
"[",
"]",
"btcjson",
".",
"ListUnspentResult",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"res",
",",
"&",
"unspent",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"unspent",
",",
"nil",
"\n",
"}"
] | // Receive waits for the response promised by the future and returns all
// unspent wallet transaction outputs returned by the RPC call. If the
// future wac returned by a call to ListUnspentMinAsync, ListUnspentMinMaxAsync,
// or ListUnspentMinMaxAddressesAsync, the range may be limited by the
// parameters of the RPC invocation. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"all",
"unspent",
"wallet",
"transaction",
"outputs",
"returned",
"by",
"the",
"RPC",
"call",
".",
"If",
"the",
"future",
"wac",
"returned",
"by",
"a",
"call",
"to",
"ListUnspentMinAsync",
"ListUnspentMinMaxAsync",
"or",
"ListUnspentMinMaxAddressesAsync",
"the",
"range",
"may",
"be",
"limited",
"by",
"the",
"parameters",
"of",
"the",
"RPC",
"invocation",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L154-L168 | train |
btcsuite/btcd | rpcclient/wallet.go | ListUnspentAsync | func (c *Client) ListUnspentAsync() FutureListUnspentResult {
cmd := btcjson.NewListUnspentCmd(nil, nil, nil)
return c.sendCmd(cmd)
} | go | func (c *Client) ListUnspentAsync() FutureListUnspentResult {
cmd := btcjson.NewListUnspentCmd(nil, nil, nil)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListUnspentAsync",
"(",
")",
"FutureListUnspentResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewListUnspentCmd",
"(",
"nil",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // ListUnspentAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function
// on the returned instance.
//
// See ListUnspent for the blocking version and more details. | [
"ListUnspentAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"ListUnspent",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L175-L178 | train |
btcsuite/btcd | rpcclient/wallet.go | ListUnspentMinAsync | func (c *Client) ListUnspentMinAsync(minConf int) FutureListUnspentResult {
cmd := btcjson.NewListUnspentCmd(&minConf, nil, nil)
return c.sendCmd(cmd)
} | go | func (c *Client) ListUnspentMinAsync(minConf int) FutureListUnspentResult {
cmd := btcjson.NewListUnspentCmd(&minConf, nil, nil)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListUnspentMinAsync",
"(",
"minConf",
"int",
")",
"FutureListUnspentResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewListUnspentCmd",
"(",
"&",
"minConf",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // ListUnspentMinAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function
// on the returned instance.
//
// See ListUnspentMin for the blocking version and more details. | [
"ListUnspentMinAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"ListUnspentMin",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L185-L188 | train |
btcsuite/btcd | rpcclient/wallet.go | ListUnspentMinMaxAsync | func (c *Client) ListUnspentMinMaxAsync(minConf, maxConf int) FutureListUnspentResult {
cmd := btcjson.NewListUnspentCmd(&minConf, &maxConf, nil)
return c.sendCmd(cmd)
} | go | func (c *Client) ListUnspentMinMaxAsync(minConf, maxConf int) FutureListUnspentResult {
cmd := btcjson.NewListUnspentCmd(&minConf, &maxConf, nil)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListUnspentMinMaxAsync",
"(",
"minConf",
",",
"maxConf",
"int",
")",
"FutureListUnspentResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewListUnspentCmd",
"(",
"&",
"minConf",
",",
"&",
"maxConf",
",",
"nil",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // ListUnspentMinMaxAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function
// on the returned instance.
//
// See ListUnspentMinMax for the blocking version and more details. | [
"ListUnspentMinMaxAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"ListUnspentMinMax",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L195-L198 | train |
btcsuite/btcd | rpcclient/wallet.go | ListUnspentMinMaxAddressesAsync | func (c *Client) ListUnspentMinMaxAddressesAsync(minConf, maxConf int, addrs []btcutil.Address) FutureListUnspentResult {
addrStrs := make([]string, 0, len(addrs))
for _, a := range addrs {
addrStrs = append(addrStrs, a.EncodeAddress())
}
cmd := btcjson.NewListUnspentCmd(&minConf, &maxConf, &addrStrs)
return c.sendCmd(cmd)
} | go | func (c *Client) ListUnspentMinMaxAddressesAsync(minConf, maxConf int, addrs []btcutil.Address) FutureListUnspentResult {
addrStrs := make([]string, 0, len(addrs))
for _, a := range addrs {
addrStrs = append(addrStrs, a.EncodeAddress())
}
cmd := btcjson.NewListUnspentCmd(&minConf, &maxConf, &addrStrs)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListUnspentMinMaxAddressesAsync",
"(",
"minConf",
",",
"maxConf",
"int",
",",
"addrs",
"[",
"]",
"btcutil",
".",
"Address",
")",
"FutureListUnspentResult",
"{",
"addrStrs",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"addrs",
")",
")",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"addrs",
"{",
"addrStrs",
"=",
"append",
"(",
"addrStrs",
",",
"a",
".",
"EncodeAddress",
"(",
")",
")",
"\n",
"}",
"\n\n",
"cmd",
":=",
"btcjson",
".",
"NewListUnspentCmd",
"(",
"&",
"minConf",
",",
"&",
"maxConf",
",",
"&",
"addrStrs",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // ListUnspentMinMaxAddressesAsync returns an instance of a type that can be
// used to get the result of the RPC at some future time by invoking the Receive
// function on the returned instance.
//
// See ListUnspentMinMaxAddresses for the blocking version and more details. | [
"ListUnspentMinMaxAddressesAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"ListUnspentMinMaxAddresses",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L205-L213 | train |
btcsuite/btcd | rpcclient/wallet.go | ListUnspentMinMax | func (c *Client) ListUnspentMinMax(minConf, maxConf int) ([]btcjson.ListUnspentResult, error) {
return c.ListUnspentMinMaxAsync(minConf, maxConf).Receive()
} | go | func (c *Client) ListUnspentMinMax(minConf, maxConf int) ([]btcjson.ListUnspentResult, error) {
return c.ListUnspentMinMaxAsync(minConf, maxConf).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListUnspentMinMax",
"(",
"minConf",
",",
"maxConf",
"int",
")",
"(",
"[",
"]",
"btcjson",
".",
"ListUnspentResult",
",",
"error",
")",
"{",
"return",
"c",
".",
"ListUnspentMinMaxAsync",
"(",
"minConf",
",",
"maxConf",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // ListUnspentMinMax returns all unspent transaction outputs known to a wallet,
// using the specified number of minimum and maximum number of confirmations as
// a filter. | [
"ListUnspentMinMax",
"returns",
"all",
"unspent",
"transaction",
"outputs",
"known",
"to",
"a",
"wallet",
"using",
"the",
"specified",
"number",
"of",
"minimum",
"and",
"maximum",
"number",
"of",
"confirmations",
"as",
"a",
"filter",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L232-L234 | train |
btcsuite/btcd | rpcclient/wallet.go | ListUnspentMinMaxAddresses | func (c *Client) ListUnspentMinMaxAddresses(minConf, maxConf int, addrs []btcutil.Address) ([]btcjson.ListUnspentResult, error) {
return c.ListUnspentMinMaxAddressesAsync(minConf, maxConf, addrs).Receive()
} | go | func (c *Client) ListUnspentMinMaxAddresses(minConf, maxConf int, addrs []btcutil.Address) ([]btcjson.ListUnspentResult, error) {
return c.ListUnspentMinMaxAddressesAsync(minConf, maxConf, addrs).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListUnspentMinMaxAddresses",
"(",
"minConf",
",",
"maxConf",
"int",
",",
"addrs",
"[",
"]",
"btcutil",
".",
"Address",
")",
"(",
"[",
"]",
"btcjson",
".",
"ListUnspentResult",
",",
"error",
")",
"{",
"return",
"c",
".",
"ListUnspentMinMaxAddressesAsync",
"(",
"minConf",
",",
"maxConf",
",",
"addrs",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // ListUnspentMinMaxAddresses returns all unspent transaction outputs that pay
// to any of specified addresses in a wallet using the specified number of
// minimum and maximum number of confirmations as a filter. | [
"ListUnspentMinMaxAddresses",
"returns",
"all",
"unspent",
"transaction",
"outputs",
"that",
"pay",
"to",
"any",
"of",
"specified",
"addresses",
"in",
"a",
"wallet",
"using",
"the",
"specified",
"number",
"of",
"minimum",
"and",
"maximum",
"number",
"of",
"confirmations",
"as",
"a",
"filter",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L239-L241 | train |
btcsuite/btcd | rpcclient/wallet.go | Receive | func (r FutureListSinceBlockResult) Receive() (*btcjson.ListSinceBlockResult, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as a listsinceblock result object.
var listResult btcjson.ListSinceBlockResult
err = json.Unmarshal(res, &listResult)
if err != nil {
return nil, err
}
return &listResult, nil
} | go | func (r FutureListSinceBlockResult) Receive() (*btcjson.ListSinceBlockResult, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as a listsinceblock result object.
var listResult btcjson.ListSinceBlockResult
err = json.Unmarshal(res, &listResult)
if err != nil {
return nil, err
}
return &listResult, nil
} | [
"func",
"(",
"r",
"FutureListSinceBlockResult",
")",
"Receive",
"(",
")",
"(",
"*",
"btcjson",
".",
"ListSinceBlockResult",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Unmarshal result as a listsinceblock result object.",
"var",
"listResult",
"btcjson",
".",
"ListSinceBlockResult",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"res",
",",
"&",
"listResult",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"listResult",
",",
"nil",
"\n",
"}"
] | // Receive waits for the response promised by the future and returns all
// transactions added in blocks since the specified block hash, or all
// transactions if it is nil. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"all",
"transactions",
"added",
"in",
"blocks",
"since",
"the",
"specified",
"block",
"hash",
"or",
"all",
"transactions",
"if",
"it",
"is",
"nil",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L251-L265 | train |
btcsuite/btcd | rpcclient/wallet.go | ListSinceBlockAsync | func (c *Client) ListSinceBlockAsync(blockHash *chainhash.Hash) FutureListSinceBlockResult {
var hash *string
if blockHash != nil {
hash = btcjson.String(blockHash.String())
}
cmd := btcjson.NewListSinceBlockCmd(hash, nil, nil)
return c.sendCmd(cmd)
} | go | func (c *Client) ListSinceBlockAsync(blockHash *chainhash.Hash) FutureListSinceBlockResult {
var hash *string
if blockHash != nil {
hash = btcjson.String(blockHash.String())
}
cmd := btcjson.NewListSinceBlockCmd(hash, nil, nil)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListSinceBlockAsync",
"(",
"blockHash",
"*",
"chainhash",
".",
"Hash",
")",
"FutureListSinceBlockResult",
"{",
"var",
"hash",
"*",
"string",
"\n",
"if",
"blockHash",
"!=",
"nil",
"{",
"hash",
"=",
"btcjson",
".",
"String",
"(",
"blockHash",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"cmd",
":=",
"btcjson",
".",
"NewListSinceBlockCmd",
"(",
"hash",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // ListSinceBlockAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function on
// the returned instance.
//
// See ListSinceBlock for the blocking version and more details. | [
"ListSinceBlockAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"ListSinceBlock",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L272-L280 | train |
btcsuite/btcd | rpcclient/wallet.go | ListSinceBlock | func (c *Client) ListSinceBlock(blockHash *chainhash.Hash) (*btcjson.ListSinceBlockResult, error) {
return c.ListSinceBlockAsync(blockHash).Receive()
} | go | func (c *Client) ListSinceBlock(blockHash *chainhash.Hash) (*btcjson.ListSinceBlockResult, error) {
return c.ListSinceBlockAsync(blockHash).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListSinceBlock",
"(",
"blockHash",
"*",
"chainhash",
".",
"Hash",
")",
"(",
"*",
"btcjson",
".",
"ListSinceBlockResult",
",",
"error",
")",
"{",
"return",
"c",
".",
"ListSinceBlockAsync",
"(",
"blockHash",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // ListSinceBlock returns all transactions added in blocks since the specified
// block hash, or all transactions if it is nil, using the default number of
// minimum confirmations as a filter.
//
// See ListSinceBlockMinConf to override the minimum number of confirmations. | [
"ListSinceBlock",
"returns",
"all",
"transactions",
"added",
"in",
"blocks",
"since",
"the",
"specified",
"block",
"hash",
"or",
"all",
"transactions",
"if",
"it",
"is",
"nil",
"using",
"the",
"default",
"number",
"of",
"minimum",
"confirmations",
"as",
"a",
"filter",
".",
"See",
"ListSinceBlockMinConf",
"to",
"override",
"the",
"minimum",
"number",
"of",
"confirmations",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L287-L289 | train |
btcsuite/btcd | rpcclient/wallet.go | ListSinceBlockMinConfAsync | func (c *Client) ListSinceBlockMinConfAsync(blockHash *chainhash.Hash, minConfirms int) FutureListSinceBlockResult {
var hash *string
if blockHash != nil {
hash = btcjson.String(blockHash.String())
}
cmd := btcjson.NewListSinceBlockCmd(hash, &minConfirms, nil)
return c.sendCmd(cmd)
} | go | func (c *Client) ListSinceBlockMinConfAsync(blockHash *chainhash.Hash, minConfirms int) FutureListSinceBlockResult {
var hash *string
if blockHash != nil {
hash = btcjson.String(blockHash.String())
}
cmd := btcjson.NewListSinceBlockCmd(hash, &minConfirms, nil)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListSinceBlockMinConfAsync",
"(",
"blockHash",
"*",
"chainhash",
".",
"Hash",
",",
"minConfirms",
"int",
")",
"FutureListSinceBlockResult",
"{",
"var",
"hash",
"*",
"string",
"\n",
"if",
"blockHash",
"!=",
"nil",
"{",
"hash",
"=",
"btcjson",
".",
"String",
"(",
"blockHash",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"cmd",
":=",
"btcjson",
".",
"NewListSinceBlockCmd",
"(",
"hash",
",",
"&",
"minConfirms",
",",
"nil",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // ListSinceBlockMinConfAsync returns an instance of a type that can be used to
// get the result of the RPC at some future time by invoking the Receive
// function on the returned instance.
//
// See ListSinceBlockMinConf for the blocking version and more details. | [
"ListSinceBlockMinConfAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"ListSinceBlockMinConf",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L296-L304 | train |
btcsuite/btcd | rpcclient/wallet.go | ListSinceBlockMinConf | func (c *Client) ListSinceBlockMinConf(blockHash *chainhash.Hash, minConfirms int) (*btcjson.ListSinceBlockResult, error) {
return c.ListSinceBlockMinConfAsync(blockHash, minConfirms).Receive()
} | go | func (c *Client) ListSinceBlockMinConf(blockHash *chainhash.Hash, minConfirms int) (*btcjson.ListSinceBlockResult, error) {
return c.ListSinceBlockMinConfAsync(blockHash, minConfirms).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListSinceBlockMinConf",
"(",
"blockHash",
"*",
"chainhash",
".",
"Hash",
",",
"minConfirms",
"int",
")",
"(",
"*",
"btcjson",
".",
"ListSinceBlockResult",
",",
"error",
")",
"{",
"return",
"c",
".",
"ListSinceBlockMinConfAsync",
"(",
"blockHash",
",",
"minConfirms",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // ListSinceBlockMinConf returns all transactions added in blocks since the
// specified block hash, or all transactions if it is nil, using the specified
// number of minimum confirmations as a filter.
//
// See ListSinceBlock to use the default minimum number of confirmations. | [
"ListSinceBlockMinConf",
"returns",
"all",
"transactions",
"added",
"in",
"blocks",
"since",
"the",
"specified",
"block",
"hash",
"or",
"all",
"transactions",
"if",
"it",
"is",
"nil",
"using",
"the",
"specified",
"number",
"of",
"minimum",
"confirmations",
"as",
"a",
"filter",
".",
"See",
"ListSinceBlock",
"to",
"use",
"the",
"default",
"minimum",
"number",
"of",
"confirmations",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L311-L313 | train |
btcsuite/btcd | rpcclient/wallet.go | LockUnspentAsync | func (c *Client) LockUnspentAsync(unlock bool, ops []*wire.OutPoint) FutureLockUnspentResult {
outputs := make([]btcjson.TransactionInput, len(ops))
for i, op := range ops {
outputs[i] = btcjson.TransactionInput{
Txid: op.Hash.String(),
Vout: op.Index,
}
}
cmd := btcjson.NewLockUnspentCmd(unlock, outputs)
return c.sendCmd(cmd)
} | go | func (c *Client) LockUnspentAsync(unlock bool, ops []*wire.OutPoint) FutureLockUnspentResult {
outputs := make([]btcjson.TransactionInput, len(ops))
for i, op := range ops {
outputs[i] = btcjson.TransactionInput{
Txid: op.Hash.String(),
Vout: op.Index,
}
}
cmd := btcjson.NewLockUnspentCmd(unlock, outputs)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"LockUnspentAsync",
"(",
"unlock",
"bool",
",",
"ops",
"[",
"]",
"*",
"wire",
".",
"OutPoint",
")",
"FutureLockUnspentResult",
"{",
"outputs",
":=",
"make",
"(",
"[",
"]",
"btcjson",
".",
"TransactionInput",
",",
"len",
"(",
"ops",
")",
")",
"\n",
"for",
"i",
",",
"op",
":=",
"range",
"ops",
"{",
"outputs",
"[",
"i",
"]",
"=",
"btcjson",
".",
"TransactionInput",
"{",
"Txid",
":",
"op",
".",
"Hash",
".",
"String",
"(",
")",
",",
"Vout",
":",
"op",
".",
"Index",
",",
"}",
"\n",
"}",
"\n",
"cmd",
":=",
"btcjson",
".",
"NewLockUnspentCmd",
"(",
"unlock",
",",
"outputs",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // LockUnspentAsync returns an instance of a type that can be used to get the
// result of the RPC at some future time by invoking the Receive function on the
// returned instance.
//
// See LockUnspent for the blocking version and more details. | [
"LockUnspentAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"LockUnspent",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L335-L345 | train |
btcsuite/btcd | rpcclient/wallet.go | Receive | func (r FutureListLockUnspentResult) Receive() ([]*wire.OutPoint, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal as an array of transaction inputs.
var inputs []btcjson.TransactionInput
err = json.Unmarshal(res, &inputs)
if err != nil {
return nil, err
}
// Create a slice of outpoints from the transaction input structs.
ops := make([]*wire.OutPoint, len(inputs))
for i, input := range inputs {
sha, err := chainhash.NewHashFromStr(input.Txid)
if err != nil {
return nil, err
}
ops[i] = wire.NewOutPoint(sha, input.Vout)
}
return ops, nil
} | go | func (r FutureListLockUnspentResult) Receive() ([]*wire.OutPoint, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal as an array of transaction inputs.
var inputs []btcjson.TransactionInput
err = json.Unmarshal(res, &inputs)
if err != nil {
return nil, err
}
// Create a slice of outpoints from the transaction input structs.
ops := make([]*wire.OutPoint, len(inputs))
for i, input := range inputs {
sha, err := chainhash.NewHashFromStr(input.Txid)
if err != nil {
return nil, err
}
ops[i] = wire.NewOutPoint(sha, input.Vout)
}
return ops, nil
} | [
"func",
"(",
"r",
"FutureListLockUnspentResult",
")",
"Receive",
"(",
")",
"(",
"[",
"]",
"*",
"wire",
".",
"OutPoint",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Unmarshal as an array of transaction inputs.",
"var",
"inputs",
"[",
"]",
"btcjson",
".",
"TransactionInput",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"res",
",",
"&",
"inputs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Create a slice of outpoints from the transaction input structs.",
"ops",
":=",
"make",
"(",
"[",
"]",
"*",
"wire",
".",
"OutPoint",
",",
"len",
"(",
"inputs",
")",
")",
"\n",
"for",
"i",
",",
"input",
":=",
"range",
"inputs",
"{",
"sha",
",",
"err",
":=",
"chainhash",
".",
"NewHashFromStr",
"(",
"input",
".",
"Txid",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"ops",
"[",
"i",
"]",
"=",
"wire",
".",
"NewOutPoint",
"(",
"sha",
",",
"input",
".",
"Vout",
")",
"\n",
"}",
"\n\n",
"return",
"ops",
",",
"nil",
"\n",
"}"
] | // Receive waits for the response promised by the future and returns the result
// of all currently locked unspent outputs. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"the",
"result",
"of",
"all",
"currently",
"locked",
"unspent",
"outputs",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L374-L398 | train |
btcsuite/btcd | rpcclient/wallet.go | ListLockUnspentAsync | func (c *Client) ListLockUnspentAsync() FutureListLockUnspentResult {
cmd := btcjson.NewListLockUnspentCmd()
return c.sendCmd(cmd)
} | go | func (c *Client) ListLockUnspentAsync() FutureListLockUnspentResult {
cmd := btcjson.NewListLockUnspentCmd()
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListLockUnspentAsync",
"(",
")",
"FutureListLockUnspentResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewListLockUnspentCmd",
"(",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // ListLockUnspentAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function on
// the returned instance.
//
// See ListLockUnspent for the blocking version and more details. | [
"ListLockUnspentAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"ListLockUnspent",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L405-L408 | train |
btcsuite/btcd | rpcclient/wallet.go | SetTxFeeAsync | func (c *Client) SetTxFeeAsync(fee btcutil.Amount) FutureSetTxFeeResult {
cmd := btcjson.NewSetTxFeeCmd(fee.ToBTC())
return c.sendCmd(cmd)
} | go | func (c *Client) SetTxFeeAsync(fee btcutil.Amount) FutureSetTxFeeResult {
cmd := btcjson.NewSetTxFeeCmd(fee.ToBTC())
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"SetTxFeeAsync",
"(",
"fee",
"btcutil",
".",
"Amount",
")",
"FutureSetTxFeeResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewSetTxFeeCmd",
"(",
"fee",
".",
"ToBTC",
"(",
")",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // SetTxFeeAsync returns an instance of a type that can be used to get the
// result of the RPC at some future time by invoking the Receive function on the
// returned instance.
//
// See SetTxFee for the blocking version and more details. | [
"SetTxFeeAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"SetTxFee",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L434-L437 | train |
btcsuite/btcd | rpcclient/wallet.go | SetTxFee | func (c *Client) SetTxFee(fee btcutil.Amount) error {
return c.SetTxFeeAsync(fee).Receive()
} | go | func (c *Client) SetTxFee(fee btcutil.Amount) error {
return c.SetTxFeeAsync(fee).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"SetTxFee",
"(",
"fee",
"btcutil",
".",
"Amount",
")",
"error",
"{",
"return",
"c",
".",
"SetTxFeeAsync",
"(",
"fee",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // SetTxFee sets an optional transaction fee per KB that helps ensure
// transactions are processed quickly. Most transaction are 1KB. | [
"SetTxFee",
"sets",
"an",
"optional",
"transaction",
"fee",
"per",
"KB",
"that",
"helps",
"ensure",
"transactions",
"are",
"processed",
"quickly",
".",
"Most",
"transaction",
"are",
"1KB",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L441-L443 | train |
btcsuite/btcd | rpcclient/wallet.go | SendToAddressAsync | func (c *Client) SendToAddressAsync(address btcutil.Address, amount btcutil.Amount) FutureSendToAddressResult {
addr := address.EncodeAddress()
cmd := btcjson.NewSendToAddressCmd(addr, amount.ToBTC(), nil, nil)
return c.sendCmd(cmd)
} | go | func (c *Client) SendToAddressAsync(address btcutil.Address, amount btcutil.Amount) FutureSendToAddressResult {
addr := address.EncodeAddress()
cmd := btcjson.NewSendToAddressCmd(addr, amount.ToBTC(), nil, nil)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"SendToAddressAsync",
"(",
"address",
"btcutil",
".",
"Address",
",",
"amount",
"btcutil",
".",
"Amount",
")",
"FutureSendToAddressResult",
"{",
"addr",
":=",
"address",
".",
"EncodeAddress",
"(",
")",
"\n",
"cmd",
":=",
"btcjson",
".",
"NewSendToAddressCmd",
"(",
"addr",
",",
"amount",
".",
"ToBTC",
"(",
")",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // SendToAddressAsync returns an instance of a type that can be used to get the
// result of the RPC at some future time by invoking the Receive function on the
// returned instance.
//
// See SendToAddress for the blocking version and more details. | [
"SendToAddressAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"SendToAddress",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L472-L476 | train |
btcsuite/btcd | rpcclient/wallet.go | SendToAddressCommentAsync | func (c *Client) SendToAddressCommentAsync(address btcutil.Address,
amount btcutil.Amount, comment,
commentTo string) FutureSendToAddressResult {
addr := address.EncodeAddress()
cmd := btcjson.NewSendToAddressCmd(addr, amount.ToBTC(), &comment,
&commentTo)
return c.sendCmd(cmd)
} | go | func (c *Client) SendToAddressCommentAsync(address btcutil.Address,
amount btcutil.Amount, comment,
commentTo string) FutureSendToAddressResult {
addr := address.EncodeAddress()
cmd := btcjson.NewSendToAddressCmd(addr, amount.ToBTC(), &comment,
&commentTo)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"SendToAddressCommentAsync",
"(",
"address",
"btcutil",
".",
"Address",
",",
"amount",
"btcutil",
".",
"Amount",
",",
"comment",
",",
"commentTo",
"string",
")",
"FutureSendToAddressResult",
"{",
"addr",
":=",
"address",
".",
"EncodeAddress",
"(",
")",
"\n",
"cmd",
":=",
"btcjson",
".",
"NewSendToAddressCmd",
"(",
"addr",
",",
"amount",
".",
"ToBTC",
"(",
")",
",",
"&",
"comment",
",",
"&",
"commentTo",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // SendToAddressCommentAsync returns an instance of a type that can be used to
// get the result of the RPC at some future time by invoking the Receive
// function on the returned instance.
//
// See SendToAddressComment for the blocking version and more details. | [
"SendToAddressCommentAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"SendToAddressComment",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L495-L503 | train |
btcsuite/btcd | rpcclient/wallet.go | SendFromAsync | func (c *Client) SendFromAsync(fromAccount string, toAddress btcutil.Address, amount btcutil.Amount) FutureSendFromResult {
addr := toAddress.EncodeAddress()
cmd := btcjson.NewSendFromCmd(fromAccount, addr, amount.ToBTC(), nil,
nil, nil)
return c.sendCmd(cmd)
} | go | func (c *Client) SendFromAsync(fromAccount string, toAddress btcutil.Address, amount btcutil.Amount) FutureSendFromResult {
addr := toAddress.EncodeAddress()
cmd := btcjson.NewSendFromCmd(fromAccount, addr, amount.ToBTC(), nil,
nil, nil)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"SendFromAsync",
"(",
"fromAccount",
"string",
",",
"toAddress",
"btcutil",
".",
"Address",
",",
"amount",
"btcutil",
".",
"Amount",
")",
"FutureSendFromResult",
"{",
"addr",
":=",
"toAddress",
".",
"EncodeAddress",
"(",
")",
"\n",
"cmd",
":=",
"btcjson",
".",
"NewSendFromCmd",
"(",
"fromAccount",
",",
"addr",
",",
"amount",
".",
"ToBTC",
"(",
")",
",",
"nil",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // SendFromAsync returns an instance of a type that can be used to get the
// result of the RPC at some future time by invoking the Receive function on the
// returned instance.
//
// See SendFrom for the blocking version and more details. | [
"SendFromAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"SendFrom",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L551-L556 | train |
btcsuite/btcd | rpcclient/wallet.go | SendFromCommentAsync | func (c *Client) SendFromCommentAsync(fromAccount string,
toAddress btcutil.Address, amount btcutil.Amount, minConfirms int,
comment, commentTo string) FutureSendFromResult {
addr := toAddress.EncodeAddress()
cmd := btcjson.NewSendFromCmd(fromAccount, addr, amount.ToBTC(),
&minConfirms, &comment, &commentTo)
return c.sendCmd(cmd)
} | go | func (c *Client) SendFromCommentAsync(fromAccount string,
toAddress btcutil.Address, amount btcutil.Amount, minConfirms int,
comment, commentTo string) FutureSendFromResult {
addr := toAddress.EncodeAddress()
cmd := btcjson.NewSendFromCmd(fromAccount, addr, amount.ToBTC(),
&minConfirms, &comment, &commentTo)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"SendFromCommentAsync",
"(",
"fromAccount",
"string",
",",
"toAddress",
"btcutil",
".",
"Address",
",",
"amount",
"btcutil",
".",
"Amount",
",",
"minConfirms",
"int",
",",
"comment",
",",
"commentTo",
"string",
")",
"FutureSendFromResult",
"{",
"addr",
":=",
"toAddress",
".",
"EncodeAddress",
"(",
")",
"\n",
"cmd",
":=",
"btcjson",
".",
"NewSendFromCmd",
"(",
"fromAccount",
",",
"addr",
",",
"amount",
".",
"ToBTC",
"(",
")",
",",
"&",
"minConfirms",
",",
"&",
"comment",
",",
"&",
"commentTo",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // SendFromCommentAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function on
// the returned instance.
//
// See SendFromComment for the blocking version and more details. | [
"SendFromCommentAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"SendFromComment",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L601-L609 | train |
btcsuite/btcd | rpcclient/wallet.go | Receive | func (r FutureSendManyResult) Receive() (*chainhash.Hash, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmashal result as a string.
var txHash string
err = json.Unmarshal(res, &txHash)
if err != nil {
return nil, err
}
return chainhash.NewHashFromStr(txHash)
} | go | func (r FutureSendManyResult) Receive() (*chainhash.Hash, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmashal result as a string.
var txHash string
err = json.Unmarshal(res, &txHash)
if err != nil {
return nil, err
}
return chainhash.NewHashFromStr(txHash)
} | [
"func",
"(",
"r",
"FutureSendManyResult",
")",
"Receive",
"(",
")",
"(",
"*",
"chainhash",
".",
"Hash",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Unmashal result as a string.",
"var",
"txHash",
"string",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"res",
",",
"&",
"txHash",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"chainhash",
".",
"NewHashFromStr",
"(",
"txHash",
")",
"\n",
"}"
] | // Receive waits for the response promised by the future and returns the hash
// of the transaction sending multiple amounts to multiple addresses using the
// provided account as a source of funds. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"the",
"hash",
"of",
"the",
"transaction",
"sending",
"multiple",
"amounts",
"to",
"multiple",
"addresses",
"using",
"the",
"provided",
"account",
"as",
"a",
"source",
"of",
"funds",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L638-L652 | train |
btcsuite/btcd | rpcclient/wallet.go | SendManyCommentAsync | func (c *Client) SendManyCommentAsync(fromAccount string,
amounts map[btcutil.Address]btcutil.Amount, minConfirms int,
comment string) FutureSendManyResult {
convertedAmounts := make(map[string]float64, len(amounts))
for addr, amount := range amounts {
convertedAmounts[addr.EncodeAddress()] = amount.ToBTC()
}
cmd := btcjson.NewSendManyCmd(fromAccount, convertedAmounts,
&minConfirms, &comment)
return c.sendCmd(cmd)
} | go | func (c *Client) SendManyCommentAsync(fromAccount string,
amounts map[btcutil.Address]btcutil.Amount, minConfirms int,
comment string) FutureSendManyResult {
convertedAmounts := make(map[string]float64, len(amounts))
for addr, amount := range amounts {
convertedAmounts[addr.EncodeAddress()] = amount.ToBTC()
}
cmd := btcjson.NewSendManyCmd(fromAccount, convertedAmounts,
&minConfirms, &comment)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"SendManyCommentAsync",
"(",
"fromAccount",
"string",
",",
"amounts",
"map",
"[",
"btcutil",
".",
"Address",
"]",
"btcutil",
".",
"Amount",
",",
"minConfirms",
"int",
",",
"comment",
"string",
")",
"FutureSendManyResult",
"{",
"convertedAmounts",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"float64",
",",
"len",
"(",
"amounts",
")",
")",
"\n",
"for",
"addr",
",",
"amount",
":=",
"range",
"amounts",
"{",
"convertedAmounts",
"[",
"addr",
".",
"EncodeAddress",
"(",
")",
"]",
"=",
"amount",
".",
"ToBTC",
"(",
")",
"\n",
"}",
"\n",
"cmd",
":=",
"btcjson",
".",
"NewSendManyCmd",
"(",
"fromAccount",
",",
"convertedAmounts",
",",
"&",
"minConfirms",
",",
"&",
"comment",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // SendManyCommentAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function on
// the returned instance.
//
// See SendManyComment for the blocking version and more details. | [
"SendManyCommentAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"SendManyComment",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L719-L730 | train |
btcsuite/btcd | rpcclient/wallet.go | AddMultisigAddressAsync | func (c *Client) AddMultisigAddressAsync(requiredSigs int, addresses []btcutil.Address, account string) FutureAddMultisigAddressResult {
addrs := make([]string, 0, len(addresses))
for _, addr := range addresses {
addrs = append(addrs, addr.String())
}
cmd := btcjson.NewAddMultisigAddressCmd(requiredSigs, addrs, &account)
return c.sendCmd(cmd)
} | go | func (c *Client) AddMultisigAddressAsync(requiredSigs int, addresses []btcutil.Address, account string) FutureAddMultisigAddressResult {
addrs := make([]string, 0, len(addresses))
for _, addr := range addresses {
addrs = append(addrs, addr.String())
}
cmd := btcjson.NewAddMultisigAddressCmd(requiredSigs, addrs, &account)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"AddMultisigAddressAsync",
"(",
"requiredSigs",
"int",
",",
"addresses",
"[",
"]",
"btcutil",
".",
"Address",
",",
"account",
"string",
")",
"FutureAddMultisigAddressResult",
"{",
"addrs",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"addresses",
")",
")",
"\n",
"for",
"_",
",",
"addr",
":=",
"range",
"addresses",
"{",
"addrs",
"=",
"append",
"(",
"addrs",
",",
"addr",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"cmd",
":=",
"btcjson",
".",
"NewAddMultisigAddressCmd",
"(",
"requiredSigs",
",",
"addrs",
",",
"&",
"account",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // AddMultisigAddressAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function on
// the returned instance.
//
// See AddMultisigAddress for the blocking version and more details. | [
"AddMultisigAddressAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"AddMultisigAddress",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L782-L790 | train |
btcsuite/btcd | rpcclient/wallet.go | AddMultisigAddress | func (c *Client) AddMultisigAddress(requiredSigs int, addresses []btcutil.Address, account string) (btcutil.Address, error) {
return c.AddMultisigAddressAsync(requiredSigs, addresses,
account).Receive()
} | go | func (c *Client) AddMultisigAddress(requiredSigs int, addresses []btcutil.Address, account string) (btcutil.Address, error) {
return c.AddMultisigAddressAsync(requiredSigs, addresses,
account).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"AddMultisigAddress",
"(",
"requiredSigs",
"int",
",",
"addresses",
"[",
"]",
"btcutil",
".",
"Address",
",",
"account",
"string",
")",
"(",
"btcutil",
".",
"Address",
",",
"error",
")",
"{",
"return",
"c",
".",
"AddMultisigAddressAsync",
"(",
"requiredSigs",
",",
"addresses",
",",
"account",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // AddMultisigAddress adds a multisignature address that requires the specified
// number of signatures for the provided addresses to the wallet. | [
"AddMultisigAddress",
"adds",
"a",
"multisignature",
"address",
"that",
"requires",
"the",
"specified",
"number",
"of",
"signatures",
"for",
"the",
"provided",
"addresses",
"to",
"the",
"wallet",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L794-L797 | train |
btcsuite/btcd | rpcclient/wallet.go | Receive | func (r FutureCreateMultisigResult) Receive() (*btcjson.CreateMultiSigResult, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as a createmultisig result object.
var multisigRes btcjson.CreateMultiSigResult
err = json.Unmarshal(res, &multisigRes)
if err != nil {
return nil, err
}
return &multisigRes, nil
} | go | func (r FutureCreateMultisigResult) Receive() (*btcjson.CreateMultiSigResult, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as a createmultisig result object.
var multisigRes btcjson.CreateMultiSigResult
err = json.Unmarshal(res, &multisigRes)
if err != nil {
return nil, err
}
return &multisigRes, nil
} | [
"func",
"(",
"r",
"FutureCreateMultisigResult",
")",
"Receive",
"(",
")",
"(",
"*",
"btcjson",
".",
"CreateMultiSigResult",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Unmarshal result as a createmultisig result object.",
"var",
"multisigRes",
"btcjson",
".",
"CreateMultiSigResult",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"res",
",",
"&",
"multisigRes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"multisigRes",
",",
"nil",
"\n",
"}"
] | // Receive waits for the response promised by the future and returns the
// multisignature address and script needed to redeem it. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"the",
"multisignature",
"address",
"and",
"script",
"needed",
"to",
"redeem",
"it",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L805-L819 | train |
btcsuite/btcd | rpcclient/wallet.go | CreateMultisigAsync | func (c *Client) CreateMultisigAsync(requiredSigs int, addresses []btcutil.Address) FutureCreateMultisigResult {
addrs := make([]string, 0, len(addresses))
for _, addr := range addresses {
addrs = append(addrs, addr.String())
}
cmd := btcjson.NewCreateMultisigCmd(requiredSigs, addrs)
return c.sendCmd(cmd)
} | go | func (c *Client) CreateMultisigAsync(requiredSigs int, addresses []btcutil.Address) FutureCreateMultisigResult {
addrs := make([]string, 0, len(addresses))
for _, addr := range addresses {
addrs = append(addrs, addr.String())
}
cmd := btcjson.NewCreateMultisigCmd(requiredSigs, addrs)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateMultisigAsync",
"(",
"requiredSigs",
"int",
",",
"addresses",
"[",
"]",
"btcutil",
".",
"Address",
")",
"FutureCreateMultisigResult",
"{",
"addrs",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"addresses",
")",
")",
"\n",
"for",
"_",
",",
"addr",
":=",
"range",
"addresses",
"{",
"addrs",
"=",
"append",
"(",
"addrs",
",",
"addr",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"cmd",
":=",
"btcjson",
".",
"NewCreateMultisigCmd",
"(",
"requiredSigs",
",",
"addrs",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // CreateMultisigAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function on
// the returned instance.
//
// See CreateMultisig for the blocking version and more details. | [
"CreateMultisigAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"CreateMultisig",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L826-L834 | train |
btcsuite/btcd | rpcclient/wallet.go | CreateMultisig | func (c *Client) CreateMultisig(requiredSigs int, addresses []btcutil.Address) (*btcjson.CreateMultiSigResult, error) {
return c.CreateMultisigAsync(requiredSigs, addresses).Receive()
} | go | func (c *Client) CreateMultisig(requiredSigs int, addresses []btcutil.Address) (*btcjson.CreateMultiSigResult, error) {
return c.CreateMultisigAsync(requiredSigs, addresses).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateMultisig",
"(",
"requiredSigs",
"int",
",",
"addresses",
"[",
"]",
"btcutil",
".",
"Address",
")",
"(",
"*",
"btcjson",
".",
"CreateMultiSigResult",
",",
"error",
")",
"{",
"return",
"c",
".",
"CreateMultisigAsync",
"(",
"requiredSigs",
",",
"addresses",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // CreateMultisig creates a multisignature address that requires the specified
// number of signatures for the provided addresses and returns the
// multisignature address and script needed to redeem it. | [
"CreateMultisig",
"creates",
"a",
"multisignature",
"address",
"that",
"requires",
"the",
"specified",
"number",
"of",
"signatures",
"for",
"the",
"provided",
"addresses",
"and",
"returns",
"the",
"multisignature",
"address",
"and",
"script",
"needed",
"to",
"redeem",
"it",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L839-L841 | train |
btcsuite/btcd | rpcclient/wallet.go | CreateNewAccountAsync | func (c *Client) CreateNewAccountAsync(account string) FutureCreateNewAccountResult {
cmd := btcjson.NewCreateNewAccountCmd(account)
return c.sendCmd(cmd)
} | go | func (c *Client) CreateNewAccountAsync(account string) FutureCreateNewAccountResult {
cmd := btcjson.NewCreateNewAccountCmd(account)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateNewAccountAsync",
"(",
"account",
"string",
")",
"FutureCreateNewAccountResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewCreateNewAccountCmd",
"(",
"account",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // CreateNewAccountAsync returns an instance of a type that can be used to get the
// result of the RPC at some future time by invoking the Receive function on the
// returned instance.
//
// See CreateNewAccount for the blocking version and more details. | [
"CreateNewAccountAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"CreateNewAccount",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L859-L862 | train |
btcsuite/btcd | rpcclient/wallet.go | CreateNewAccount | func (c *Client) CreateNewAccount(account string) error {
return c.CreateNewAccountAsync(account).Receive()
} | go | func (c *Client) CreateNewAccount(account string) error {
return c.CreateNewAccountAsync(account).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateNewAccount",
"(",
"account",
"string",
")",
"error",
"{",
"return",
"c",
".",
"CreateNewAccountAsync",
"(",
"account",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // CreateNewAccount creates a new wallet account. | [
"CreateNewAccount",
"creates",
"a",
"new",
"wallet",
"account",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L865-L867 | train |
btcsuite/btcd | rpcclient/wallet.go | Receive | func (r FutureGetNewAddressResult) Receive() (btcutil.Address, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as a string.
var addr string
err = json.Unmarshal(res, &addr)
if err != nil {
return nil, err
}
return btcutil.DecodeAddress(addr, &chaincfg.MainNetParams)
} | go | func (r FutureGetNewAddressResult) Receive() (btcutil.Address, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as a string.
var addr string
err = json.Unmarshal(res, &addr)
if err != nil {
return nil, err
}
return btcutil.DecodeAddress(addr, &chaincfg.MainNetParams)
} | [
"func",
"(",
"r",
"FutureGetNewAddressResult",
")",
"Receive",
"(",
")",
"(",
"btcutil",
".",
"Address",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Unmarshal result as a string.",
"var",
"addr",
"string",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"res",
",",
"&",
"addr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"btcutil",
".",
"DecodeAddress",
"(",
"addr",
",",
"&",
"chaincfg",
".",
"MainNetParams",
")",
"\n",
"}"
] | // Receive waits for the response promised by the future and returns a new
// address. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"a",
"new",
"address",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L875-L889 | train |
btcsuite/btcd | rpcclient/wallet.go | GetNewAddressAsync | func (c *Client) GetNewAddressAsync(account string) FutureGetNewAddressResult {
cmd := btcjson.NewGetNewAddressCmd(&account)
return c.sendCmd(cmd)
} | go | func (c *Client) GetNewAddressAsync(account string) FutureGetNewAddressResult {
cmd := btcjson.NewGetNewAddressCmd(&account)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetNewAddressAsync",
"(",
"account",
"string",
")",
"FutureGetNewAddressResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewGetNewAddressCmd",
"(",
"&",
"account",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // GetNewAddressAsync returns an instance of a type that can be used to get the
// result of the RPC at some future time by invoking the Receive function on the
// returned instance.
//
// See GetNewAddress for the blocking version and more details. | [
"GetNewAddressAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"GetNewAddress",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L896-L899 | train |
btcsuite/btcd | rpcclient/wallet.go | GetNewAddress | func (c *Client) GetNewAddress(account string) (btcutil.Address, error) {
return c.GetNewAddressAsync(account).Receive()
} | go | func (c *Client) GetNewAddress(account string) (btcutil.Address, error) {
return c.GetNewAddressAsync(account).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetNewAddress",
"(",
"account",
"string",
")",
"(",
"btcutil",
".",
"Address",
",",
"error",
")",
"{",
"return",
"c",
".",
"GetNewAddressAsync",
"(",
"account",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // GetNewAddress returns a new address. | [
"GetNewAddress",
"returns",
"a",
"new",
"address",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L902-L904 | train |
btcsuite/btcd | rpcclient/wallet.go | GetRawChangeAddressAsync | func (c *Client) GetRawChangeAddressAsync(account string) FutureGetRawChangeAddressResult {
cmd := btcjson.NewGetRawChangeAddressCmd(&account)
return c.sendCmd(cmd)
} | go | func (c *Client) GetRawChangeAddressAsync(account string) FutureGetRawChangeAddressResult {
cmd := btcjson.NewGetRawChangeAddressCmd(&account)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetRawChangeAddressAsync",
"(",
"account",
"string",
")",
"FutureGetRawChangeAddressResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewGetRawChangeAddressCmd",
"(",
"&",
"account",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // GetRawChangeAddressAsync returns an instance of a type that can be used to
// get the result of the RPC at some future time by invoking the Receive
// function on the returned instance.
//
// See GetRawChangeAddress for the blocking version and more details. | [
"GetRawChangeAddressAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"GetRawChangeAddress",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L934-L937 | train |
btcsuite/btcd | rpcclient/wallet.go | GetRawChangeAddress | func (c *Client) GetRawChangeAddress(account string) (btcutil.Address, error) {
return c.GetRawChangeAddressAsync(account).Receive()
} | go | func (c *Client) GetRawChangeAddress(account string) (btcutil.Address, error) {
return c.GetRawChangeAddressAsync(account).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetRawChangeAddress",
"(",
"account",
"string",
")",
"(",
"btcutil",
".",
"Address",
",",
"error",
")",
"{",
"return",
"c",
".",
"GetRawChangeAddressAsync",
"(",
"account",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // GetRawChangeAddress returns a new address for receiving change that will be
// associated with the provided account. Note that this is only for raw
// transactions and NOT for normal use. | [
"GetRawChangeAddress",
"returns",
"a",
"new",
"address",
"for",
"receiving",
"change",
"that",
"will",
"be",
"associated",
"with",
"the",
"provided",
"account",
".",
"Note",
"that",
"this",
"is",
"only",
"for",
"raw",
"transactions",
"and",
"NOT",
"for",
"normal",
"use",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L942-L944 | train |
btcsuite/btcd | rpcclient/wallet.go | AddWitnessAddressAsync | func (c *Client) AddWitnessAddressAsync(address string) FutureAddWitnessAddressResult {
cmd := btcjson.NewAddWitnessAddressCmd(address)
return c.sendCmd(cmd)
} | go | func (c *Client) AddWitnessAddressAsync(address string) FutureAddWitnessAddressResult {
cmd := btcjson.NewAddWitnessAddressCmd(address)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"AddWitnessAddressAsync",
"(",
"address",
"string",
")",
"FutureAddWitnessAddressResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewAddWitnessAddressCmd",
"(",
"address",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // AddWitnessAddressAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function on
// the returned instance.
//
// See AddWitnessAddress for the blocking version and more details. | [
"AddWitnessAddressAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"AddWitnessAddress",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L973-L976 | train |
btcsuite/btcd | rpcclient/wallet.go | GetAccountAddressAsync | func (c *Client) GetAccountAddressAsync(account string) FutureGetAccountAddressResult {
cmd := btcjson.NewGetAccountAddressCmd(account)
return c.sendCmd(cmd)
} | go | func (c *Client) GetAccountAddressAsync(account string) FutureGetAccountAddressResult {
cmd := btcjson.NewGetAccountAddressCmd(account)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetAccountAddressAsync",
"(",
"account",
"string",
")",
"FutureGetAccountAddressResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewGetAccountAddressCmd",
"(",
"account",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // GetAccountAddressAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function on
// the returned instance.
//
// See GetAccountAddress for the blocking version and more details. | [
"GetAccountAddressAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"GetAccountAddress",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1011-L1014 | train |
btcsuite/btcd | rpcclient/wallet.go | GetAccountAddress | func (c *Client) GetAccountAddress(account string) (btcutil.Address, error) {
return c.GetAccountAddressAsync(account).Receive()
} | go | func (c *Client) GetAccountAddress(account string) (btcutil.Address, error) {
return c.GetAccountAddressAsync(account).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetAccountAddress",
"(",
"account",
"string",
")",
"(",
"btcutil",
".",
"Address",
",",
"error",
")",
"{",
"return",
"c",
".",
"GetAccountAddressAsync",
"(",
"account",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // GetAccountAddress returns the current Bitcoin address for receiving payments
// to the specified account. | [
"GetAccountAddress",
"returns",
"the",
"current",
"Bitcoin",
"address",
"for",
"receiving",
"payments",
"to",
"the",
"specified",
"account",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1018-L1020 | train |
btcsuite/btcd | rpcclient/wallet.go | Receive | func (r FutureGetAccountResult) Receive() (string, error) {
res, err := receiveFuture(r)
if err != nil {
return "", err
}
// Unmarshal result as a string.
var account string
err = json.Unmarshal(res, &account)
if err != nil {
return "", err
}
return account, nil
} | go | func (r FutureGetAccountResult) Receive() (string, error) {
res, err := receiveFuture(r)
if err != nil {
return "", err
}
// Unmarshal result as a string.
var account string
err = json.Unmarshal(res, &account)
if err != nil {
return "", err
}
return account, nil
} | [
"func",
"(",
"r",
"FutureGetAccountResult",
")",
"Receive",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"// Unmarshal result as a string.",
"var",
"account",
"string",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"res",
",",
"&",
"account",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"account",
",",
"nil",
"\n",
"}"
] | // Receive waits for the response promised by the future and returns the account
// associated with the passed address. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"the",
"account",
"associated",
"with",
"the",
"passed",
"address",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1028-L1042 | train |
btcsuite/btcd | rpcclient/wallet.go | GetAccountAsync | func (c *Client) GetAccountAsync(address btcutil.Address) FutureGetAccountResult {
addr := address.EncodeAddress()
cmd := btcjson.NewGetAccountCmd(addr)
return c.sendCmd(cmd)
} | go | func (c *Client) GetAccountAsync(address btcutil.Address) FutureGetAccountResult {
addr := address.EncodeAddress()
cmd := btcjson.NewGetAccountCmd(addr)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetAccountAsync",
"(",
"address",
"btcutil",
".",
"Address",
")",
"FutureGetAccountResult",
"{",
"addr",
":=",
"address",
".",
"EncodeAddress",
"(",
")",
"\n",
"cmd",
":=",
"btcjson",
".",
"NewGetAccountCmd",
"(",
"addr",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // GetAccountAsync returns an instance of a type that can be used to get the
// result of the RPC at some future time by invoking the Receive function on the
// returned instance.
//
// See GetAccount for the blocking version and more details. | [
"GetAccountAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"GetAccount",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1049-L1053 | train |
btcsuite/btcd | rpcclient/wallet.go | GetAccount | func (c *Client) GetAccount(address btcutil.Address) (string, error) {
return c.GetAccountAsync(address).Receive()
} | go | func (c *Client) GetAccount(address btcutil.Address) (string, error) {
return c.GetAccountAsync(address).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetAccount",
"(",
"address",
"btcutil",
".",
"Address",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"c",
".",
"GetAccountAsync",
"(",
"address",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // GetAccount returns the account associated with the passed address. | [
"GetAccount",
"returns",
"the",
"account",
"associated",
"with",
"the",
"passed",
"address",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1056-L1058 | train |
btcsuite/btcd | rpcclient/wallet.go | SetAccountAsync | func (c *Client) SetAccountAsync(address btcutil.Address, account string) FutureSetAccountResult {
addr := address.EncodeAddress()
cmd := btcjson.NewSetAccountCmd(addr, account)
return c.sendCmd(cmd)
} | go | func (c *Client) SetAccountAsync(address btcutil.Address, account string) FutureSetAccountResult {
addr := address.EncodeAddress()
cmd := btcjson.NewSetAccountCmd(addr, account)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"SetAccountAsync",
"(",
"address",
"btcutil",
".",
"Address",
",",
"account",
"string",
")",
"FutureSetAccountResult",
"{",
"addr",
":=",
"address",
".",
"EncodeAddress",
"(",
")",
"\n",
"cmd",
":=",
"btcjson",
".",
"NewSetAccountCmd",
"(",
"addr",
",",
"account",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // SetAccountAsync returns an instance of a type that can be used to get the
// result of the RPC at some future time by invoking the Receive function on the
// returned instance.
//
// See SetAccount for the blocking version and more details. | [
"SetAccountAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"SetAccount",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1076-L1080 | train |
btcsuite/btcd | rpcclient/wallet.go | SetAccount | func (c *Client) SetAccount(address btcutil.Address, account string) error {
return c.SetAccountAsync(address, account).Receive()
} | go | func (c *Client) SetAccount(address btcutil.Address, account string) error {
return c.SetAccountAsync(address, account).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"SetAccount",
"(",
"address",
"btcutil",
".",
"Address",
",",
"account",
"string",
")",
"error",
"{",
"return",
"c",
".",
"SetAccountAsync",
"(",
"address",
",",
"account",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // SetAccount sets the account associated with the passed address. | [
"SetAccount",
"sets",
"the",
"account",
"associated",
"with",
"the",
"passed",
"address",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1083-L1085 | train |
btcsuite/btcd | rpcclient/wallet.go | Receive | func (r FutureGetAddressesByAccountResult) Receive() ([]btcutil.Address, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmashal result as an array of string.
var addrStrings []string
err = json.Unmarshal(res, &addrStrings)
if err != nil {
return nil, err
}
addrs := make([]btcutil.Address, 0, len(addrStrings))
for _, addrStr := range addrStrings {
addr, err := btcutil.DecodeAddress(addrStr,
&chaincfg.MainNetParams)
if err != nil {
return nil, err
}
addrs = append(addrs, addr)
}
return addrs, nil
} | go | func (r FutureGetAddressesByAccountResult) Receive() ([]btcutil.Address, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmashal result as an array of string.
var addrStrings []string
err = json.Unmarshal(res, &addrStrings)
if err != nil {
return nil, err
}
addrs := make([]btcutil.Address, 0, len(addrStrings))
for _, addrStr := range addrStrings {
addr, err := btcutil.DecodeAddress(addrStr,
&chaincfg.MainNetParams)
if err != nil {
return nil, err
}
addrs = append(addrs, addr)
}
return addrs, nil
} | [
"func",
"(",
"r",
"FutureGetAddressesByAccountResult",
")",
"Receive",
"(",
")",
"(",
"[",
"]",
"btcutil",
".",
"Address",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Unmashal result as an array of string.",
"var",
"addrStrings",
"[",
"]",
"string",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"res",
",",
"&",
"addrStrings",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"addrs",
":=",
"make",
"(",
"[",
"]",
"btcutil",
".",
"Address",
",",
"0",
",",
"len",
"(",
"addrStrings",
")",
")",
"\n",
"for",
"_",
",",
"addrStr",
":=",
"range",
"addrStrings",
"{",
"addr",
",",
"err",
":=",
"btcutil",
".",
"DecodeAddress",
"(",
"addrStr",
",",
"&",
"chaincfg",
".",
"MainNetParams",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"addrs",
"=",
"append",
"(",
"addrs",
",",
"addr",
")",
"\n",
"}",
"\n\n",
"return",
"addrs",
",",
"nil",
"\n",
"}"
] | // Receive waits for the response promised by the future and returns the list of
// addresses associated with the passed account. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"the",
"list",
"of",
"addresses",
"associated",
"with",
"the",
"passed",
"account",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1093-L1117 | train |
btcsuite/btcd | rpcclient/wallet.go | GetAddressesByAccountAsync | func (c *Client) GetAddressesByAccountAsync(account string) FutureGetAddressesByAccountResult {
cmd := btcjson.NewGetAddressesByAccountCmd(account)
return c.sendCmd(cmd)
} | go | func (c *Client) GetAddressesByAccountAsync(account string) FutureGetAddressesByAccountResult {
cmd := btcjson.NewGetAddressesByAccountCmd(account)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetAddressesByAccountAsync",
"(",
"account",
"string",
")",
"FutureGetAddressesByAccountResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewGetAddressesByAccountCmd",
"(",
"account",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // GetAddressesByAccountAsync returns an instance of a type that can be used to
// get the result of the RPC at some future time by invoking the Receive
// function on the returned instance.
//
// See GetAddressesByAccount for the blocking version and more details. | [
"GetAddressesByAccountAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"GetAddressesByAccount",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1124-L1127 | train |
btcsuite/btcd | rpcclient/wallet.go | GetAddressesByAccount | func (c *Client) GetAddressesByAccount(account string) ([]btcutil.Address, error) {
return c.GetAddressesByAccountAsync(account).Receive()
} | go | func (c *Client) GetAddressesByAccount(account string) ([]btcutil.Address, error) {
return c.GetAddressesByAccountAsync(account).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetAddressesByAccount",
"(",
"account",
"string",
")",
"(",
"[",
"]",
"btcutil",
".",
"Address",
",",
"error",
")",
"{",
"return",
"c",
".",
"GetAddressesByAccountAsync",
"(",
"account",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // GetAddressesByAccount returns the list of addresses associated with the
// passed account. | [
"GetAddressesByAccount",
"returns",
"the",
"list",
"of",
"addresses",
"associated",
"with",
"the",
"passed",
"account",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1131-L1133 | train |
btcsuite/btcd | rpcclient/wallet.go | Receive | func (r FutureMoveResult) Receive() (bool, error) {
res, err := receiveFuture(r)
if err != nil {
return false, err
}
// Unmarshal result as a boolean.
var moveResult bool
err = json.Unmarshal(res, &moveResult)
if err != nil {
return false, err
}
return moveResult, nil
} | go | func (r FutureMoveResult) Receive() (bool, error) {
res, err := receiveFuture(r)
if err != nil {
return false, err
}
// Unmarshal result as a boolean.
var moveResult bool
err = json.Unmarshal(res, &moveResult)
if err != nil {
return false, err
}
return moveResult, nil
} | [
"func",
"(",
"r",
"FutureMoveResult",
")",
"Receive",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"// Unmarshal result as a boolean.",
"var",
"moveResult",
"bool",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"res",
",",
"&",
"moveResult",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"moveResult",
",",
"nil",
"\n",
"}"
] | // Receive waits for the response promised by the future and returns the result
// of the move operation. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"the",
"result",
"of",
"the",
"move",
"operation",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1142-L1156 | train |
btcsuite/btcd | rpcclient/wallet.go | MoveAsync | func (c *Client) MoveAsync(fromAccount, toAccount string, amount btcutil.Amount) FutureMoveResult {
cmd := btcjson.NewMoveCmd(fromAccount, toAccount, amount.ToBTC(), nil,
nil)
return c.sendCmd(cmd)
} | go | func (c *Client) MoveAsync(fromAccount, toAccount string, amount btcutil.Amount) FutureMoveResult {
cmd := btcjson.NewMoveCmd(fromAccount, toAccount, amount.ToBTC(), nil,
nil)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"MoveAsync",
"(",
"fromAccount",
",",
"toAccount",
"string",
",",
"amount",
"btcutil",
".",
"Amount",
")",
"FutureMoveResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewMoveCmd",
"(",
"fromAccount",
",",
"toAccount",
",",
"amount",
".",
"ToBTC",
"(",
")",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // MoveAsync returns an instance of a type that can be used to get the result of
// the RPC at some future time by invoking the Receive function on the returned
// instance.
//
// See Move for the blocking version and more details. | [
"MoveAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"Move",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1163-L1167 | train |
btcsuite/btcd | rpcclient/wallet.go | Move | func (c *Client) Move(fromAccount, toAccount string, amount btcutil.Amount) (bool, error) {
return c.MoveAsync(fromAccount, toAccount, amount).Receive()
} | go | func (c *Client) Move(fromAccount, toAccount string, amount btcutil.Amount) (bool, error) {
return c.MoveAsync(fromAccount, toAccount, amount).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"Move",
"(",
"fromAccount",
",",
"toAccount",
"string",
",",
"amount",
"btcutil",
".",
"Amount",
")",
"(",
"bool",
",",
"error",
")",
"{",
"return",
"c",
".",
"MoveAsync",
"(",
"fromAccount",
",",
"toAccount",
",",
"amount",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // Move moves specified amount from one account in your wallet to another. Only
// funds with the default number of minimum confirmations will be used.
//
// See MoveMinConf and MoveComment for different options. | [
"Move",
"moves",
"specified",
"amount",
"from",
"one",
"account",
"in",
"your",
"wallet",
"to",
"another",
".",
"Only",
"funds",
"with",
"the",
"default",
"number",
"of",
"minimum",
"confirmations",
"will",
"be",
"used",
".",
"See",
"MoveMinConf",
"and",
"MoveComment",
"for",
"different",
"options",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1173-L1175 | train |
btcsuite/btcd | rpcclient/wallet.go | MoveMinConfAsync | func (c *Client) MoveMinConfAsync(fromAccount, toAccount string,
amount btcutil.Amount, minConfirms int) FutureMoveResult {
cmd := btcjson.NewMoveCmd(fromAccount, toAccount, amount.ToBTC(),
&minConfirms, nil)
return c.sendCmd(cmd)
} | go | func (c *Client) MoveMinConfAsync(fromAccount, toAccount string,
amount btcutil.Amount, minConfirms int) FutureMoveResult {
cmd := btcjson.NewMoveCmd(fromAccount, toAccount, amount.ToBTC(),
&minConfirms, nil)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"MoveMinConfAsync",
"(",
"fromAccount",
",",
"toAccount",
"string",
",",
"amount",
"btcutil",
".",
"Amount",
",",
"minConfirms",
"int",
")",
"FutureMoveResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewMoveCmd",
"(",
"fromAccount",
",",
"toAccount",
",",
"amount",
".",
"ToBTC",
"(",
")",
",",
"&",
"minConfirms",
",",
"nil",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // MoveMinConfAsync returns an instance of a type that can be used to get the
// result of the RPC at some future time by invoking the Receive function on the
// returned instance.
//
// See MoveMinConf for the blocking version and more details. | [
"MoveMinConfAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"MoveMinConf",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1182-L1188 | train |
btcsuite/btcd | rpcclient/wallet.go | MoveMinConf | func (c *Client) MoveMinConf(fromAccount, toAccount string, amount btcutil.Amount, minConf int) (bool, error) {
return c.MoveMinConfAsync(fromAccount, toAccount, amount, minConf).Receive()
} | go | func (c *Client) MoveMinConf(fromAccount, toAccount string, amount btcutil.Amount, minConf int) (bool, error) {
return c.MoveMinConfAsync(fromAccount, toAccount, amount, minConf).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"MoveMinConf",
"(",
"fromAccount",
",",
"toAccount",
"string",
",",
"amount",
"btcutil",
".",
"Amount",
",",
"minConf",
"int",
")",
"(",
"bool",
",",
"error",
")",
"{",
"return",
"c",
".",
"MoveMinConfAsync",
"(",
"fromAccount",
",",
"toAccount",
",",
"amount",
",",
"minConf",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // MoveMinConf moves specified amount from one account in your wallet to
// another. Only funds with the passed number of minimum confirmations will be
// used.
//
// See Move to use the default number of minimum confirmations and MoveComment
// for additional options. | [
"MoveMinConf",
"moves",
"specified",
"amount",
"from",
"one",
"account",
"in",
"your",
"wallet",
"to",
"another",
".",
"Only",
"funds",
"with",
"the",
"passed",
"number",
"of",
"minimum",
"confirmations",
"will",
"be",
"used",
".",
"See",
"Move",
"to",
"use",
"the",
"default",
"number",
"of",
"minimum",
"confirmations",
"and",
"MoveComment",
"for",
"additional",
"options",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1196-L1198 | train |
btcsuite/btcd | rpcclient/wallet.go | MoveComment | func (c *Client) MoveComment(fromAccount, toAccount string, amount btcutil.Amount,
minConf int, comment string) (bool, error) {
return c.MoveCommentAsync(fromAccount, toAccount, amount, minConf,
comment).Receive()
} | go | func (c *Client) MoveComment(fromAccount, toAccount string, amount btcutil.Amount,
minConf int, comment string) (bool, error) {
return c.MoveCommentAsync(fromAccount, toAccount, amount, minConf,
comment).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"MoveComment",
"(",
"fromAccount",
",",
"toAccount",
"string",
",",
"amount",
"btcutil",
".",
"Amount",
",",
"minConf",
"int",
",",
"comment",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"return",
"c",
".",
"MoveCommentAsync",
"(",
"fromAccount",
",",
"toAccount",
",",
"amount",
",",
"minConf",
",",
"comment",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // MoveComment moves specified amount from one account in your wallet to
// another and stores the provided comment in the wallet. The comment
// parameter is only available in the wallet. Only funds with the passed number
// of minimum confirmations will be used.
//
// See Move and MoveMinConf to use defaults. | [
"MoveComment",
"moves",
"specified",
"amount",
"from",
"one",
"account",
"in",
"your",
"wallet",
"to",
"another",
"and",
"stores",
"the",
"provided",
"comment",
"in",
"the",
"wallet",
".",
"The",
"comment",
"parameter",
"is",
"only",
"available",
"in",
"the",
"wallet",
".",
"Only",
"funds",
"with",
"the",
"passed",
"number",
"of",
"minimum",
"confirmations",
"will",
"be",
"used",
".",
"See",
"Move",
"and",
"MoveMinConf",
"to",
"use",
"defaults",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1219-L1224 | train |
btcsuite/btcd | rpcclient/wallet.go | RenameAccountAsync | func (c *Client) RenameAccountAsync(oldAccount, newAccount string) FutureRenameAccountResult {
cmd := btcjson.NewRenameAccountCmd(oldAccount, newAccount)
return c.sendCmd(cmd)
} | go | func (c *Client) RenameAccountAsync(oldAccount, newAccount string) FutureRenameAccountResult {
cmd := btcjson.NewRenameAccountCmd(oldAccount, newAccount)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"RenameAccountAsync",
"(",
"oldAccount",
",",
"newAccount",
"string",
")",
"FutureRenameAccountResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewRenameAccountCmd",
"(",
"oldAccount",
",",
"newAccount",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // RenameAccountAsync returns an instance of a type that can be used to get the
// result of the RPC at some future time by invoking the Receive function on the
// returned instance.
//
// See RenameAccount for the blocking version and more details. | [
"RenameAccountAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"RenameAccount",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1242-L1245 | train |
btcsuite/btcd | rpcclient/wallet.go | RenameAccount | func (c *Client) RenameAccount(oldAccount, newAccount string) error {
return c.RenameAccountAsync(oldAccount, newAccount).Receive()
} | go | func (c *Client) RenameAccount(oldAccount, newAccount string) error {
return c.RenameAccountAsync(oldAccount, newAccount).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"RenameAccount",
"(",
"oldAccount",
",",
"newAccount",
"string",
")",
"error",
"{",
"return",
"c",
".",
"RenameAccountAsync",
"(",
"oldAccount",
",",
"newAccount",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // RenameAccount creates a new wallet account. | [
"RenameAccount",
"creates",
"a",
"new",
"wallet",
"account",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1248-L1250 | train |
btcsuite/btcd | rpcclient/wallet.go | Receive | func (r FutureValidateAddressResult) Receive() (*btcjson.ValidateAddressWalletResult, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as a validateaddress result object.
var addrResult btcjson.ValidateAddressWalletResult
err = json.Unmarshal(res, &addrResult)
if err != nil {
return nil, err
}
return &addrResult, nil
} | go | func (r FutureValidateAddressResult) Receive() (*btcjson.ValidateAddressWalletResult, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as a validateaddress result object.
var addrResult btcjson.ValidateAddressWalletResult
err = json.Unmarshal(res, &addrResult)
if err != nil {
return nil, err
}
return &addrResult, nil
} | [
"func",
"(",
"r",
"FutureValidateAddressResult",
")",
"Receive",
"(",
")",
"(",
"*",
"btcjson",
".",
"ValidateAddressWalletResult",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Unmarshal result as a validateaddress result object.",
"var",
"addrResult",
"btcjson",
".",
"ValidateAddressWalletResult",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"res",
",",
"&",
"addrResult",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"addrResult",
",",
"nil",
"\n",
"}"
] | // Receive waits for the response promised by the future and returns information
// about the given bitcoin address. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"information",
"about",
"the",
"given",
"bitcoin",
"address",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1258-L1272 | train |
btcsuite/btcd | rpcclient/wallet.go | ValidateAddressAsync | func (c *Client) ValidateAddressAsync(address btcutil.Address) FutureValidateAddressResult {
addr := address.EncodeAddress()
cmd := btcjson.NewValidateAddressCmd(addr)
return c.sendCmd(cmd)
} | go | func (c *Client) ValidateAddressAsync(address btcutil.Address) FutureValidateAddressResult {
addr := address.EncodeAddress()
cmd := btcjson.NewValidateAddressCmd(addr)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ValidateAddressAsync",
"(",
"address",
"btcutil",
".",
"Address",
")",
"FutureValidateAddressResult",
"{",
"addr",
":=",
"address",
".",
"EncodeAddress",
"(",
")",
"\n",
"cmd",
":=",
"btcjson",
".",
"NewValidateAddressCmd",
"(",
"addr",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // ValidateAddressAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function on
// the returned instance.
//
// See ValidateAddress for the blocking version and more details. | [
"ValidateAddressAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"ValidateAddress",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1279-L1283 | train |
btcsuite/btcd | rpcclient/wallet.go | ValidateAddress | func (c *Client) ValidateAddress(address btcutil.Address) (*btcjson.ValidateAddressWalletResult, error) {
return c.ValidateAddressAsync(address).Receive()
} | go | func (c *Client) ValidateAddress(address btcutil.Address) (*btcjson.ValidateAddressWalletResult, error) {
return c.ValidateAddressAsync(address).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ValidateAddress",
"(",
"address",
"btcutil",
".",
"Address",
")",
"(",
"*",
"btcjson",
".",
"ValidateAddressWalletResult",
",",
"error",
")",
"{",
"return",
"c",
".",
"ValidateAddressAsync",
"(",
"address",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // ValidateAddress returns information about the given bitcoin address. | [
"ValidateAddress",
"returns",
"information",
"about",
"the",
"given",
"bitcoin",
"address",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1286-L1288 | train |
btcsuite/btcd | rpcclient/wallet.go | KeyPoolRefillAsync | func (c *Client) KeyPoolRefillAsync() FutureKeyPoolRefillResult {
cmd := btcjson.NewKeyPoolRefillCmd(nil)
return c.sendCmd(cmd)
} | go | func (c *Client) KeyPoolRefillAsync() FutureKeyPoolRefillResult {
cmd := btcjson.NewKeyPoolRefillCmd(nil)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"KeyPoolRefillAsync",
"(",
")",
"FutureKeyPoolRefillResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewKeyPoolRefillCmd",
"(",
"nil",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // KeyPoolRefillAsync returns an instance of a type that can be used to get the
// result of the RPC at some future time by invoking the Receive function on the
// returned instance.
//
// See KeyPoolRefill for the blocking version and more details. | [
"KeyPoolRefillAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"KeyPoolRefill",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1306-L1309 | train |
btcsuite/btcd | rpcclient/wallet.go | KeyPoolRefillSizeAsync | func (c *Client) KeyPoolRefillSizeAsync(newSize uint) FutureKeyPoolRefillResult {
cmd := btcjson.NewKeyPoolRefillCmd(&newSize)
return c.sendCmd(cmd)
} | go | func (c *Client) KeyPoolRefillSizeAsync(newSize uint) FutureKeyPoolRefillResult {
cmd := btcjson.NewKeyPoolRefillCmd(&newSize)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"KeyPoolRefillSizeAsync",
"(",
"newSize",
"uint",
")",
"FutureKeyPoolRefillResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewKeyPoolRefillCmd",
"(",
"&",
"newSize",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // KeyPoolRefillSizeAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function on
// the returned instance.
//
// See KeyPoolRefillSize for the blocking version and more details. | [
"KeyPoolRefillSizeAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"KeyPoolRefillSize",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1323-L1326 | train |
btcsuite/btcd | rpcclient/wallet.go | KeyPoolRefillSize | func (c *Client) KeyPoolRefillSize(newSize uint) error {
return c.KeyPoolRefillSizeAsync(newSize).Receive()
} | go | func (c *Client) KeyPoolRefillSize(newSize uint) error {
return c.KeyPoolRefillSizeAsync(newSize).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"KeyPoolRefillSize",
"(",
"newSize",
"uint",
")",
"error",
"{",
"return",
"c",
".",
"KeyPoolRefillSizeAsync",
"(",
"newSize",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // KeyPoolRefillSize fills the key pool as necessary to reach the specified
// size. | [
"KeyPoolRefillSize",
"fills",
"the",
"key",
"pool",
"as",
"necessary",
"to",
"reach",
"the",
"specified",
"size",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1330-L1332 | train |
btcsuite/btcd | rpcclient/wallet.go | Receive | func (r FutureListAccountsResult) Receive() (map[string]btcutil.Amount, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as a json object.
var accounts map[string]float64
err = json.Unmarshal(res, &accounts)
if err != nil {
return nil, err
}
accountsMap := make(map[string]btcutil.Amount)
for k, v := range accounts {
amount, err := btcutil.NewAmount(v)
if err != nil {
return nil, err
}
accountsMap[k] = amount
}
return accountsMap, nil
} | go | func (r FutureListAccountsResult) Receive() (map[string]btcutil.Amount, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
}
// Unmarshal result as a json object.
var accounts map[string]float64
err = json.Unmarshal(res, &accounts)
if err != nil {
return nil, err
}
accountsMap := make(map[string]btcutil.Amount)
for k, v := range accounts {
amount, err := btcutil.NewAmount(v)
if err != nil {
return nil, err
}
accountsMap[k] = amount
}
return accountsMap, nil
} | [
"func",
"(",
"r",
"FutureListAccountsResult",
")",
"Receive",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"btcutil",
".",
"Amount",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Unmarshal result as a json object.",
"var",
"accounts",
"map",
"[",
"string",
"]",
"float64",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"res",
",",
"&",
"accounts",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"accountsMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"btcutil",
".",
"Amount",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"accounts",
"{",
"amount",
",",
"err",
":=",
"btcutil",
".",
"NewAmount",
"(",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"accountsMap",
"[",
"k",
"]",
"=",
"amount",
"\n",
"}",
"\n\n",
"return",
"accountsMap",
",",
"nil",
"\n",
"}"
] | // Receive waits for the response promised by the future and returns returns a
// map of account names and their associated balances. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"returns",
"a",
"map",
"of",
"account",
"names",
"and",
"their",
"associated",
"balances",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1345-L1369 | train |
btcsuite/btcd | rpcclient/wallet.go | ListAccountsAsync | func (c *Client) ListAccountsAsync() FutureListAccountsResult {
cmd := btcjson.NewListAccountsCmd(nil)
return c.sendCmd(cmd)
} | go | func (c *Client) ListAccountsAsync() FutureListAccountsResult {
cmd := btcjson.NewListAccountsCmd(nil)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListAccountsAsync",
"(",
")",
"FutureListAccountsResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewListAccountsCmd",
"(",
"nil",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // ListAccountsAsync returns an instance of a type that can be used to get the
// result of the RPC at some future time by invoking the Receive function on the
// returned instance.
//
// See ListAccounts for the blocking version and more details. | [
"ListAccountsAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"ListAccounts",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1376-L1379 | train |
btcsuite/btcd | rpcclient/wallet.go | ListAccounts | func (c *Client) ListAccounts() (map[string]btcutil.Amount, error) {
return c.ListAccountsAsync().Receive()
} | go | func (c *Client) ListAccounts() (map[string]btcutil.Amount, error) {
return c.ListAccountsAsync().Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListAccounts",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"btcutil",
".",
"Amount",
",",
"error",
")",
"{",
"return",
"c",
".",
"ListAccountsAsync",
"(",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // ListAccounts returns a map of account names and their associated balances
// using the default number of minimum confirmations.
//
// See ListAccountsMinConf to override the minimum number of confirmations. | [
"ListAccounts",
"returns",
"a",
"map",
"of",
"account",
"names",
"and",
"their",
"associated",
"balances",
"using",
"the",
"default",
"number",
"of",
"minimum",
"confirmations",
".",
"See",
"ListAccountsMinConf",
"to",
"override",
"the",
"minimum",
"number",
"of",
"confirmations",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1385-L1387 | train |
btcsuite/btcd | rpcclient/wallet.go | ListAccountsMinConfAsync | func (c *Client) ListAccountsMinConfAsync(minConfirms int) FutureListAccountsResult {
cmd := btcjson.NewListAccountsCmd(&minConfirms)
return c.sendCmd(cmd)
} | go | func (c *Client) ListAccountsMinConfAsync(minConfirms int) FutureListAccountsResult {
cmd := btcjson.NewListAccountsCmd(&minConfirms)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListAccountsMinConfAsync",
"(",
"minConfirms",
"int",
")",
"FutureListAccountsResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewListAccountsCmd",
"(",
"&",
"minConfirms",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // ListAccountsMinConfAsync returns an instance of a type that can be used to
// get the result of the RPC at some future time by invoking the Receive
// function on the returned instance.
//
// See ListAccountsMinConf for the blocking version and more details. | [
"ListAccountsMinConfAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"ListAccountsMinConf",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1394-L1397 | train |
btcsuite/btcd | rpcclient/wallet.go | ListAccountsMinConf | func (c *Client) ListAccountsMinConf(minConfirms int) (map[string]btcutil.Amount, error) {
return c.ListAccountsMinConfAsync(minConfirms).Receive()
} | go | func (c *Client) ListAccountsMinConf(minConfirms int) (map[string]btcutil.Amount, error) {
return c.ListAccountsMinConfAsync(minConfirms).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListAccountsMinConf",
"(",
"minConfirms",
"int",
")",
"(",
"map",
"[",
"string",
"]",
"btcutil",
".",
"Amount",
",",
"error",
")",
"{",
"return",
"c",
".",
"ListAccountsMinConfAsync",
"(",
"minConfirms",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // ListAccountsMinConf returns a map of account names and their associated
// balances using the specified number of minimum confirmations.
//
// See ListAccounts to use the default minimum number of confirmations. | [
"ListAccountsMinConf",
"returns",
"a",
"map",
"of",
"account",
"names",
"and",
"their",
"associated",
"balances",
"using",
"the",
"specified",
"number",
"of",
"minimum",
"confirmations",
".",
"See",
"ListAccounts",
"to",
"use",
"the",
"default",
"minimum",
"number",
"of",
"confirmations",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1403-L1405 | train |
btcsuite/btcd | rpcclient/wallet.go | Receive | func (r FutureGetBalanceParseResult) Receive() (btcutil.Amount, error) {
res, err := receiveFuture(r)
if err != nil {
return 0, err
}
// Unmarshal result as a string
var balanceString string
err = json.Unmarshal(res, &balanceString)
if err != nil {
return 0, err
}
balance, err := strconv.ParseFloat(balanceString, 64)
if err != nil {
return 0, err
}
amount, err := btcutil.NewAmount(balance)
if err != nil {
return 0, err
}
return amount, nil
} | go | func (r FutureGetBalanceParseResult) Receive() (btcutil.Amount, error) {
res, err := receiveFuture(r)
if err != nil {
return 0, err
}
// Unmarshal result as a string
var balanceString string
err = json.Unmarshal(res, &balanceString)
if err != nil {
return 0, err
}
balance, err := strconv.ParseFloat(balanceString, 64)
if err != nil {
return 0, err
}
amount, err := btcutil.NewAmount(balance)
if err != nil {
return 0, err
}
return amount, nil
} | [
"func",
"(",
"r",
"FutureGetBalanceParseResult",
")",
"Receive",
"(",
")",
"(",
"btcutil",
".",
"Amount",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"// Unmarshal result as a string",
"var",
"balanceString",
"string",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"res",
",",
"&",
"balanceString",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"balance",
",",
"err",
":=",
"strconv",
".",
"ParseFloat",
"(",
"balanceString",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"amount",
",",
"err",
":=",
"btcutil",
".",
"NewAmount",
"(",
"balance",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"amount",
",",
"nil",
"\n",
"}"
] | // Receive waits for the response promised by the future and returns the
// available balance from the server for the specified account. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"the",
"available",
"balance",
"from",
"the",
"server",
"for",
"the",
"specified",
"account",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1443-L1466 | train |
btcsuite/btcd | rpcclient/wallet.go | GetBalanceAsync | func (c *Client) GetBalanceAsync(account string) FutureGetBalanceResult {
cmd := btcjson.NewGetBalanceCmd(&account, nil)
return c.sendCmd(cmd)
} | go | func (c *Client) GetBalanceAsync(account string) FutureGetBalanceResult {
cmd := btcjson.NewGetBalanceCmd(&account, nil)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetBalanceAsync",
"(",
"account",
"string",
")",
"FutureGetBalanceResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewGetBalanceCmd",
"(",
"&",
"account",
",",
"nil",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // GetBalanceAsync returns an instance of a type that can be used to get the
// result of the RPC at some future time by invoking the Receive function on the
// returned instance.
//
// See GetBalance for the blocking version and more details. | [
"GetBalanceAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"GetBalance",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1473-L1476 | train |
btcsuite/btcd | rpcclient/wallet.go | GetBalanceMinConfAsync | func (c *Client) GetBalanceMinConfAsync(account string, minConfirms int) FutureGetBalanceResult {
cmd := btcjson.NewGetBalanceCmd(&account, &minConfirms)
return c.sendCmd(cmd)
} | go | func (c *Client) GetBalanceMinConfAsync(account string, minConfirms int) FutureGetBalanceResult {
cmd := btcjson.NewGetBalanceCmd(&account, &minConfirms)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetBalanceMinConfAsync",
"(",
"account",
"string",
",",
"minConfirms",
"int",
")",
"FutureGetBalanceResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewGetBalanceCmd",
"(",
"&",
"account",
",",
"&",
"minConfirms",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // GetBalanceMinConfAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function on
// the returned instance.
//
// See GetBalanceMinConf for the blocking version and more details. | [
"GetBalanceMinConfAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"GetBalanceMinConf",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1492-L1495 | train |
btcsuite/btcd | rpcclient/wallet.go | GetReceivedByAccountAsync | func (c *Client) GetReceivedByAccountAsync(account string) FutureGetReceivedByAccountResult {
cmd := btcjson.NewGetReceivedByAccountCmd(account, nil)
return c.sendCmd(cmd)
} | go | func (c *Client) GetReceivedByAccountAsync(account string) FutureGetReceivedByAccountResult {
cmd := btcjson.NewGetReceivedByAccountCmd(account, nil)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetReceivedByAccountAsync",
"(",
"account",
"string",
")",
"FutureGetReceivedByAccountResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewGetReceivedByAccountCmd",
"(",
"account",
",",
"nil",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // GetReceivedByAccountAsync returns an instance of a type that can be used to
// get the result of the RPC at some future time by invoking the Receive
// function on the returned instance.
//
// See GetReceivedByAccount for the blocking version and more details. | [
"GetReceivedByAccountAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"GetReceivedByAccount",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1543-L1546 | train |
btcsuite/btcd | rpcclient/wallet.go | GetReceivedByAccount | func (c *Client) GetReceivedByAccount(account string) (btcutil.Amount, error) {
return c.GetReceivedByAccountAsync(account).Receive()
} | go | func (c *Client) GetReceivedByAccount(account string) (btcutil.Amount, error) {
return c.GetReceivedByAccountAsync(account).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetReceivedByAccount",
"(",
"account",
"string",
")",
"(",
"btcutil",
".",
"Amount",
",",
"error",
")",
"{",
"return",
"c",
".",
"GetReceivedByAccountAsync",
"(",
"account",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // GetReceivedByAccount returns the total amount received with the specified
// account with at least the default number of minimum confirmations.
//
// See GetReceivedByAccountMinConf to override the minimum number of
// confirmations. | [
"GetReceivedByAccount",
"returns",
"the",
"total",
"amount",
"received",
"with",
"the",
"specified",
"account",
"with",
"at",
"least",
"the",
"default",
"number",
"of",
"minimum",
"confirmations",
".",
"See",
"GetReceivedByAccountMinConf",
"to",
"override",
"the",
"minimum",
"number",
"of",
"confirmations",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1553-L1555 | train |
btcsuite/btcd | rpcclient/wallet.go | GetReceivedByAccountMinConfAsync | func (c *Client) GetReceivedByAccountMinConfAsync(account string, minConfirms int) FutureGetReceivedByAccountResult {
cmd := btcjson.NewGetReceivedByAccountCmd(account, &minConfirms)
return c.sendCmd(cmd)
} | go | func (c *Client) GetReceivedByAccountMinConfAsync(account string, minConfirms int) FutureGetReceivedByAccountResult {
cmd := btcjson.NewGetReceivedByAccountCmd(account, &minConfirms)
return c.sendCmd(cmd)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetReceivedByAccountMinConfAsync",
"(",
"account",
"string",
",",
"minConfirms",
"int",
")",
"FutureGetReceivedByAccountResult",
"{",
"cmd",
":=",
"btcjson",
".",
"NewGetReceivedByAccountCmd",
"(",
"account",
",",
"&",
"minConfirms",
")",
"\n",
"return",
"c",
".",
"sendCmd",
"(",
"cmd",
")",
"\n",
"}"
] | // GetReceivedByAccountMinConfAsync returns an instance of a type that can be
// used to get the result of the RPC at some future time by invoking the Receive
// function on the returned instance.
//
// See GetReceivedByAccountMinConf for the blocking version and more details. | [
"GetReceivedByAccountMinConfAsync",
"returns",
"an",
"instance",
"of",
"a",
"type",
"that",
"can",
"be",
"used",
"to",
"get",
"the",
"result",
"of",
"the",
"RPC",
"at",
"some",
"future",
"time",
"by",
"invoking",
"the",
"Receive",
"function",
"on",
"the",
"returned",
"instance",
".",
"See",
"GetReceivedByAccountMinConf",
"for",
"the",
"blocking",
"version",
"and",
"more",
"details",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1562-L1565 | train |
btcsuite/btcd | rpcclient/wallet.go | GetReceivedByAccountMinConf | func (c *Client) GetReceivedByAccountMinConf(account string, minConfirms int) (btcutil.Amount, error) {
return c.GetReceivedByAccountMinConfAsync(account, minConfirms).Receive()
} | go | func (c *Client) GetReceivedByAccountMinConf(account string, minConfirms int) (btcutil.Amount, error) {
return c.GetReceivedByAccountMinConfAsync(account, minConfirms).Receive()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetReceivedByAccountMinConf",
"(",
"account",
"string",
",",
"minConfirms",
"int",
")",
"(",
"btcutil",
".",
"Amount",
",",
"error",
")",
"{",
"return",
"c",
".",
"GetReceivedByAccountMinConfAsync",
"(",
"account",
",",
"minConfirms",
")",
".",
"Receive",
"(",
")",
"\n",
"}"
] | // GetReceivedByAccountMinConf returns the total amount received with the
// specified account with at least the specified number of minimum
// confirmations.
//
// See GetReceivedByAccount to use the default minimum number of confirmations. | [
"GetReceivedByAccountMinConf",
"returns",
"the",
"total",
"amount",
"received",
"with",
"the",
"specified",
"account",
"with",
"at",
"least",
"the",
"specified",
"number",
"of",
"minimum",
"confirmations",
".",
"See",
"GetReceivedByAccount",
"to",
"use",
"the",
"default",
"minimum",
"number",
"of",
"confirmations",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1572-L1574 | train |
btcsuite/btcd | rpcclient/wallet.go | Receive | func (r FutureGetUnconfirmedBalanceResult) Receive() (btcutil.Amount, error) {
res, err := receiveFuture(r)
if err != nil {
return 0, err
}
// Unmarshal result as a floating point number.
var balance float64
err = json.Unmarshal(res, &balance)
if err != nil {
return 0, err
}
amount, err := btcutil.NewAmount(balance)
if err != nil {
return 0, err
}
return amount, nil
} | go | func (r FutureGetUnconfirmedBalanceResult) Receive() (btcutil.Amount, error) {
res, err := receiveFuture(r)
if err != nil {
return 0, err
}
// Unmarshal result as a floating point number.
var balance float64
err = json.Unmarshal(res, &balance)
if err != nil {
return 0, err
}
amount, err := btcutil.NewAmount(balance)
if err != nil {
return 0, err
}
return amount, nil
} | [
"func",
"(",
"r",
"FutureGetUnconfirmedBalanceResult",
")",
"Receive",
"(",
")",
"(",
"btcutil",
".",
"Amount",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"receiveFuture",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"// Unmarshal result as a floating point number.",
"var",
"balance",
"float64",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"res",
",",
"&",
"balance",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"amount",
",",
"err",
":=",
"btcutil",
".",
"NewAmount",
"(",
"balance",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"amount",
",",
"nil",
"\n",
"}"
] | // Receive waits for the response promised by the future and returns returns the
// unconfirmed balance from the server for the specified account. | [
"Receive",
"waits",
"for",
"the",
"response",
"promised",
"by",
"the",
"future",
"and",
"returns",
"returns",
"the",
"unconfirmed",
"balance",
"from",
"the",
"server",
"for",
"the",
"specified",
"account",
"."
] | 96897255fd17525dd12426345d279533780bc4e1 | https://github.com/btcsuite/btcd/blob/96897255fd17525dd12426345d279533780bc4e1/rpcclient/wallet.go#L1582-L1601 | train |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.