eteu-technologies / near-api-go Goto Github PK
View Code? Open in Web Editor NEWGo library to interact with NEAR Protocol via RPC API (https://docs.near.org/docs/api/rpc)
License: MIT License
Go library to interact with NEAR Protocol via RPC API (https://docs.near.org/docs/api/rpc)
License: MIT License
The pull request to fix:
#24
Project includes scripts to start up the NEAR localnet, but there are no tests to utilize it in automated way.
Hi, how to get list/query transaction with fromBLock-toBlock of the list address.
Thanks!
c, _ := NewClient("https://rpc.testnet.near.org")
var resp AccessKeyView
_, _ = c.doRPC(context.Background(), &resp, "query", block.FinalityFinal(), map[string]interface{}{
"request_type": "view_access_key",
"account_id": "yuhainan.testnet",
"public_key": "ed25519:AWRz5BzmJUbjKgr6Ln2VcwkuEh8QipRjxGt9YdjNeJn",
})
fmt.Println(resp)
Result:
{{91568545000006 {true {<nil> []}}} {0 11111111111111111111111111111111}}
when i use postman everything is ok
how to fix it?
when I get receiptID in tx.receipts is null ?is a bug ?
Something in the lines of:
Some examples on how to use this library would be nice.
when get Block: 65700123
Unmarshal error :invalid base58 digit (':') occured,what happend?
The main network blcok 70249973 already supports secp256k1 algorithm,
but sdk still does not support it, currently chunkView Unmarshal exception。
func WrapRawKey(keyType PublicKeyType, key []byte) (pk PublicKey, err error) {
switch keyType {
case KeyTypeED25519:
if len(key) != ed25519.PublicKeySize {
return pk, ErrInvalidPublicKey
}
pk[0] = RawKeyTypeED25519
copy(pk[1:], key[0:ed25519.PublicKeySize])
return
case KeyTypeSECP256K1:
// TODO!
return pk, fmt.Errorf("SECP256K1 is not supported yet")
}
return pk, ErrInvalidKeyType
}
The error response of near rpc, error.cause.name can distinguish the error type, but near-api-go does not marsh this information to the error struct, because the error struct does not have a cause field, why not add the cause field to the error struct, like
type Cause struct {
Info interface{} `json:"info"`
Name string `json:"name"`
}
type Error struct {
Cause Cause `json:"cause"`
Code int `json:"code"`
Message string `json:"message"`
Data json.RawMessage `json:"data"`
}
type ReceiptView struct {
PredecessorID types.AccountID json:"predecessor_id"
ReceiverID types.AccountID json:"receiver_id"
ReceiptID hash.CryptoHash json:"receipt_id"
Receipt json.RawMessage json:"receipt"
// TODO: needs a type!
}
Now the type of the Receipt field is RawMessage, I have to parse it by gjson.
Of course the better way is use a Receipt Struct.
In nearcore the receipt is a Enum Type, it seems a bit hard to unmarshal it.
Project API is not thoroughly documented right now, which is very likely unwelcoming for newcomers.
{ "AddKey": { "access_key": { "nonce": 0, "permission": "FullAccess" }, "public_key": "ed25519:Gm4dtdpxNhAyZRDNnjFxiU3P7SMhAnPvpK7YVehFdJgh" } }
The prefix of the public_key field is 'ed25519:', the action unmarshal function pass it to base58 decoder, however it can't be recognized.
bugs?
height:65906486
methodName in functioncall of action is null,but mannet db this record is not null .
1.What did you try to do (with code snippet to reproduce)
chunkRsp, err := sw.rpc.ChunkDetails(ctx, chunkHash)
2.What did you expect to see?
sync success
3.What did you see instead?
cannot unmarshal string into Go struct field SignedTransactionView.transactions.actions of type action.AccessKeyPermission
4.Relevant NEAR network & transaction/block/receipt hash to look up
chunk hash 6P3ftNBttmek2Z8nJamXqzmLWkN8yMc4hMHNRDDAfubB
Hi guys, how go generate a new account (wallet address) include: account_id, pub key, private key.
Thank you so muc!
Hi there, since the implementing of secp256k1 keys, our transactions are failing to broadcast although we are only using Ed25519 keys - the following error message is received:
RPC error REQUEST_VALIDATION_ERROR (name=PARSE_ERROR, message=Failed to decode transaction: unknown key type '33')
I don't really have time to look into it right now so thought I'd open an issue :)
Kind regards
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.