Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: v0.0.18 #204

Merged
merged 172 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
172 commits
Select commit Hold shift + click to select a range
4d16a67
Adding sender signature details to block
maneeSHA-256 Apr 30, 2024
a3d8123
Add parts token unpledging & Fix : Pledge token sending
vaishnav-ch May 10, 2024
96455d3
Change passing of tknType varible
vaishnav-ch May 14, 2024
4680091
Change passing of tknType varible
vaishnav-ch May 14, 2024
f0ae2f3
Merge branch 'vaishnav/fix/partsTokenUnpledging' of https://github.co…
vaishnav-ch May 14, 2024
522428e
Remove extra comments
vaishnav-ch May 14, 2024
acd7f6a
Add function moveFile
Allen-Cherian Apr 29, 2024
f6fadf7
Add api and cmd : quorum-setup-check
Allen-Cherian Apr 29, 2024
5031ea3
Fix: flag quorumAddr not found [Add debug : WIP-Breaking]
Allen-Cherian Apr 30, 2024
a3c18d4
Fix: Quorom Status Check [Working]
Allen-Cherian Apr 30, 2024
b24fa9c
Update quorumlist to support Alternate quorum
Allen-Cherian Apr 30, 2024
17da864
Fix : Consensus request to selected quorums only- Alternate Quorums
Allen-Cherian Apr 30, 2024
5d9a84e
Fix : Consensus request to selected quorums only- Alternate Quorums W…
Allen-Cherian Apr 30, 2024
2bd283e
Fix: minor typo
Allen-Cherian May 2, 2024
0be3476
Add proper error messages
Allen-Cherian May 2, 2024
47cef17
Remove hardcoded quorum count
Allen-Cherian May 3, 2024
093646c
updated Readme
maneeSHA-256 May 6, 2024
babff64
changing variable and function names
maneeSHA-256 May 6, 2024
586b7a5
ping peer to get peer did type
maneeSHA-256 May 8, 2024
f0849cd
tested port-unavailability-fix on MacOs
maneeSHA-256 May 13, 2024
505f3ff
Merge branch 'development' into maneesha/sender-signature-in-block-wi…
maneeSHA-256 May 15, 2024
bd7b94c
change field name SignVersion to SignType
maneeSHA-256 May 15, 2024
de674f7
Modify the condition statement
vaishnav-ch May 15, 2024
a289364
Adding Peer Details Manually
ashi31 May 20, 2024
1cb07f8
Merge remote-tracking branch 'origin/development' into vaishnav/fix/p…
vaishnav-ch May 21, 2024
94f8975
Merge branch 'development' of https://github.com/rubixchain/rubixgopl…
ashi31 May 21, 2024
d635854
feat: added API endpoint and CLI command to fetch a node's peer ID
arnabghose997 Apr 11, 2024
2d02d77
feat: added python tests for RBT transfer
arnabghose997 May 7, 2024
bb850f6
added func to get the build dir based on the target OS
arnabghose997 May 8, 2024
3d12ffa
added checks and instructions to support execution in windows os
arnabghose997 May 9, 2024
026b79a
feat: added test workflow
arnabghose997 May 13, 2024
9e2f1bd
added dockerfile for running tests in ubuntu-amd64 environment
arnabghose997 May 15, 2024
c6ad83e
added script to collect all quorum and non-quorum logs; added step in…
arnabghose997 May 15, 2024
54ae41e
reduced node liveness wait time from 60 seconds to 15 seconds
arnabghose997 May 15, 2024
15c4a5c
increased node liveness wait time to 40 seconds
arnabghose997 May 15, 2024
8e9174b
added OS alias in artifact name
arnabghose997 May 15, 2024
dcf3cd3
changed test swarm key
arnabghose997 May 15, 2024
a37bb4a
non quorums DIDs are now being registered for the RBT transfer transa…
arnabghose997 May 15, 2024
d96cdd6
added node_registry.json config to list all the node server indeces; …
arnabghose997 May 16, 2024
8eb6e5c
renamed test workflow artifiacts name
arnabghose997 May 16, 2024
c425be1
added test scenario for BIP39 and NLSS transfers
arnabghose997 May 17, 2024
70df360
added entry for .sh file extension
arnabghose997 May 17, 2024
460c0f6
created three swarm keys for each os environment
arnabghose997 May 20, 2024
9e9fce9
added timestamp for node log artifacts
arnabghose997 May 20, 2024
dc4e24e
removed unneeded print statement
arnabghose997 May 20, 2024
9de2633
Merge branch 'development' into maneesha/sender-signature-in-block-wi…
maneeSHA-256 May 22, 2024
b8e59a7
fix parse error in dump-token-chain
maneeSHA-256 May 23, 2024
6e0d6cd
Merge pull request #169 from rubixchain/main
arnabghose997 May 24, 2024
4b46439
Add variables and equal distribution
vaishnav-ch May 24, 2024
9f1b5fa
Merge pull request #144 from rubixchain/maneesha/sender-signature-in-…
thewebchap May 24, 2024
dbfb55e
removed manual entering of DIDType
ashi31 May 27, 2024
aef69c2
updating readme
ashi31 May 27, 2024
c1c7c0a
updating Readme
ashi31 May 27, 2024
81dbe08
Fix DID mode compatibility issue
maneeSHA-256 May 28, 2024
dc4c6cf
fix wallet and standard mode issues
maneeSHA-256 May 28, 2024
4429b25
updating test files with addpeerdetails command and removed registerdid
ashi31 May 29, 2024
ef6759d
updating test files to add peer details
ashi31 May 29, 2024
8587afc
read peerid from db and added tests
thewebchap May 29, 2024
cd83262
Merge pull request #153 from rubixchain/vaishnav/fix/partsTokenUnpled…
thewebchap May 30, 2024
5f7d9d5
Merge pull request #170 from rubixchain/maneesha/DIDModeCompatibility
thewebchap May 30, 2024
86ac9de
Merge pull request #171 from rubixchain/hari/change-peeriddid-to-did
thewebchap May 30, 2024
1469f77
Merge branch 'development' into vaishnav/fix/DistributedPledging
vaishnav-ch May 30, 2024
55aa965
Add minimum pledge amount fix
vaishnav-ch May 31, 2024
4af4610
Add missing `MaxDecimalPlaces`
vaishnav-ch May 31, 2024
535fbd1
Remove loggers used for testing
vaishnav-ch Jun 5, 2024
1c555b1
error handling for mnemonicfile
thewebchap Jun 6, 2024
0a8efff
undo unintentional delete
thewebchap Jun 6, 2024
9296650
Merge pull request #174 from rubixchain/hari/mnemonicfile-check
thewebchap Jun 6, 2024
992c505
issue with mnemonickey reading
thewebchap Jun 7, 2024
805d02b
Merge pull request #175 from rubixchain/hari/mnemonicfile-check
thewebchap Jun 7, 2024
f6f667e
register while pinging a peer
maneeSHA-256 May 27, 2024
6e0dc91
sender sharing quorums info with receiver and previous-pledged-quorum…
maneeSHA-256 Jun 6, 2024
0590554
parse did to get cid digest and use this to calc lastchar
thewebchap Jun 11, 2024
9de8aab
Change from single qrm tokens unlock to all qrms tokens unlock
vaishnav-ch Jun 11, 2024
f54bd20
adding ping-peer-improvement test cases to rbt-transfer test cases
maneeSHA-256 Jun 12, 2024
083c9b1
Remove extra codes and optimization
vaishnav-ch Jun 12, 2024
ac7ec7a
Fix typo error
vaishnav-ch Jun 12, 2024
d489e49
Merge pull request #176 from rubixchain/maneesha/ping-peer-improvemen…
thewebchap Jun 12, 2024
d9d5ba4
Merge branch 'development' into ashita/adding-peer-details
ashi31 Jun 12, 2024
c49223a
Merge pull request #179 from rubixchain/main
arnabghose997 Jun 14, 2024
1666237
updated return error
ashi31 Jun 14, 2024
470901d
Merge pull request #177 from rubixchain/hari/type1-quorumselection
thewebchap Jun 14, 2024
a0a4b52
fix smart contract deploy error
maneeSHA-256 Jun 17, 2024
e43aa46
adding pledged token state details at quorum side
ashi31 Jun 18, 2024
35d1998
Add `QuorumRequired` const. and change in `GetFinalQuorumList()` func
vaishnav-ch Jun 19, 2024
9da8b33
Update quorum unavailability error
vaishnav-ch Jun 19, 2024
b3bc97b
Merge pull request #180 from rubixchain/maneesha/fix-smartcontract-de…
maneeSHA-256 Jun 20, 2024
971e794
Add `MinDecimalValue()` function & `minTotalPledgeAmount` variable.
vaishnav-ch Jun 20, 2024
19e19ce
Remove `MinTrnxAmt` constant
vaishnav-ch Jun 24, 2024
1f13749
formatting
ashi31 Jun 24, 2024
3225bde
test
ashi31 Jun 24, 2024
258f12e
Merge branch 'ashita/QuorumCheckforPledgedTokenState' into ashita/tes…
ashi31 Jun 24, 2024
2df83cc
smart contract folder renaming error
KryptSai Jun 25, 2024
9190dbb
informing old quorums about exhausted state post transfer
ashi31 Jun 28, 2024
88b5cad
Merge branch 'development' into ashita/QuorumCheckforPledgedTokenState
ashi31 Jun 28, 2024
5d115f8
resolving re-creation of smartcontract token
KryptSai Jun 28, 2024
eed2610
Merge pull request #161 from rubixchain/ashita/adding-peer-details
thewebchap Jul 1, 2024
c8cb7c3
Updating swagger and readme
ashi31 Jul 1, 2024
b75cbeb
Merge branch 'ashita/QuorumCheckforPledgedTokenState' of https://gith…
ashi31 Jul 1, 2024
63866b5
Update command.go
ashi31 Jul 1, 2024
78af08f
Merge branch 'development' of https://github.com/rubixchain/rubixgopl…
ashi31 Jul 1, 2024
0a303dc
Merge branch 'ashita/QuorumCheckforPledgedTokenState' of https://gith…
ashi31 Jul 1, 2024
3af856a
minor edits
ashi31 Jul 3, 2024
23bf969
code update
ashi31 Jul 4, 2024
af9ccf4
adding token state hash with the receiver
ashi31 Jul 4, 2024
130c3ba
client side parameter validation checks
ashi31 Jul 7, 2024
620cd0b
updating minor changes
ashi31 Jul 8, 2024
8d37820
removing the debug statements
KryptSai Jul 9, 2024
82335a2
adding checks at API side and updating CheckQuorumStatusCmd
ashi31 Jul 9, 2024
6a33374
Merge pull request #183 from rubixchain/sai/sc-rename-error
KryptSai Jul 10, 2024
9ff1a40
remove delay in transfer finality when quorum have insufficient balance.
vaishnav-ch Jul 10, 2024
afabefe
Add typoerror fix
vaishnav-ch Jul 11, 2024
045b632
Merge pull request #173 from rubixchain/vaishnav/fix/DistributedPledging
vaishnav-ch Jul 11, 2024
f269643
feat: periodic pledging implementation
arnabghose997 Jul 11, 2024
5c24a19
Merge branch 'development' of https://github.com/rubixchain/rubixgopl…
arnabghose997 Jul 11, 2024
ef02ead
tests: generation of random test swarmkey when tests are run
arnabghose997 Jul 11, 2024
7f52b6b
fixed pledging period
arnabghose997 Jul 11, 2024
a625f8c
add initiator sign to block and other fixes
maneeSHA-256 Jul 11, 2024
790eec2
shifted the update logic of token state hash of tokens in TokensTable…
arnabghose997 Jul 12, 2024
2599f3e
Merge branch 'development' of https://github.com/rubixchain/rubixgopl…
arnabghose997 Jul 12, 2024
a6074b9
tests: added random swarm key generation
arnabghose997 Jul 12, 2024
f1b8a71
removing unnecessary log
maneeSHA-256 Jul 12, 2024
8a80a32
fix: removed token count check from main initiateRBTTransfer func
arnabghose997 Jul 12, 2024
a782594
token count condition fix
arnabghose997 Jul 12, 2024
1725932
fixed the pledge period variable
arnabghose997 Jul 12, 2024
be28e17
added check to skip tokens, part of PoW pledging, for self transfer o…
arnabghose997 Jul 12, 2024
df642c8
Merge branch 'ashita/QuorumCheckforPledgedTokenState' of https://gith…
arnabghose997 Jul 15, 2024
d566e17
Merge pull request #192 from rubixchain/maneesha/fix-smart-contract-bugs
thewebchap Jul 17, 2024
e3cc03e
fix for quorum length 5 to 7
thewebchap Jul 17, 2024
b98e084
Merge pull request #193 from rubixchain/hari/distribured-pledging-fix
thewebchap Jul 18, 2024
d5d39f6
added CLI/API to unpledge POW based pledge tokens and drop the unpled…
arnabghose997 Jul 22, 2024
da023e8
Merge branch 'development' of https://github.com/rubixchain/rubixgopl…
arnabghose997 Jul 22, 2024
f404a07
fixed the query string for GetUnpledegeSequenceDetails func
arnabghose997 Jul 22, 2024
82763c1
fixed pledging period
arnabghose997 Jul 22, 2024
0a8fc7b
Merge pull request #191 from rubixchain/arnab/periodic-pledging
thewebchap Jul 23, 2024
3fc3244
Add Feature : Pinning as a service
Allen-Cherian Feb 21, 2024
1db36df
Add swagger [initiate-pin-rbt]
Allen-Cherian Feb 27, 2024
b7eaceb
Fix : invalid tokenchain block
Allen-Cherian Feb 29, 2024
7b5520e
Fix : Pinning node able to transfer pinned token
Allen-Cherian Mar 1, 2024
d400d89
Fix: Missed params and checks during rebase
Allen-Cherian May 30, 2024
6b0e2a9
Add feature: Recover token and token chain
Allen-Cherian Jul 8, 2024
c14f3d7
Remove debug and minor fixes
Allen-Cherian Jul 10, 2024
812b27e
Remove debug log
Allen-Cherian Jul 10, 2024
afc9eac
Update cmd and api nomenclature
Allen-Cherian Jul 11, 2024
94c6a46
Add minor fix
Allen-Cherian Jul 11, 2024
1c604dd
Change error message
Allen-Cherian Jul 11, 2024
ffcc77c
Add fix: passing random uuid for signature
Allen-Cherian Jul 19, 2024
91de45e
Fix: when rbtamount is not specified the entire tokens will be pinned
Allen-Cherian Jul 19, 2024
5373cd0
Remove comment
Allen-Cherian Jul 19, 2024
4580632
Increase test script wait time to 80s
Allen-Cherian Jul 22, 2024
74f9cc3
Fix: Changes respective to rebase
Allen-Cherian Jul 23, 2024
17fb83a
fixed the update of transaction_id in TokensTable
arnabghose997 Jul 24, 2024
fea068a
Merge pull request #189 from rubixchain/feat/allen/pinning-service
Allen-Cherian Jul 25, 2024
dc52983
Merge pull request #187 from rubixchain/ashi/parametersvalidation
Allen-Cherian Jul 25, 2024
3cdc4ee
fixed assignment for `rpeerid` variable
arnabghose997 Jul 30, 2024
b4be393
minor fixes
ashi31 Jul 30, 2024
b351d61
Merge pull request #197 from rubixchain/arnab/rpeerid-variable-assign…
arnabghose997 Jul 30, 2024
fe88606
Merge pull request #198 from rubixchain/MinorFixes
thewebchap Jul 31, 2024
331a88c
tests: added generate swarm key inside tests/test_swarm_key dir to ex…
arnabghose997 Jul 31, 2024
064d1dc
Change in `maxDecimalPlaces` and string formatting
vaishnav-ch Jul 31, 2024
9690056
Merge pull request #199 from rubixchain/arnab/change-test-swarm-key-dir
thewebchap Jul 31, 2024
56d4be3
fixed the self transfer command by changing the TransferRBT `client` …
arnabghose997 Jul 31, 2024
e06a858
Merge branch 'arnab/fix-self-transfer-cmd' of https://github.com/rubi…
arnabghose997 Jul 31, 2024
6664705
Merge pull request #201 from rubixchain/arnab/fix-self-transfer-cmd
arnabghose997 Aug 1, 2024
f75ab3d
fixed precision to MaxDecimalPlaces (currently 3) for RBT token value
arnabghose997 Aug 1, 2024
c4a2a6f
fixed the validation to check RBT amount minimum value from 0.00001 t…
arnabghose997 Aug 1, 2024
431f0bf
bump version from 0.0.17 to 0.0.18
arnabghose997 Aug 1, 2024
7974a20
Merge pull request #200 from rubixchain/vaishnav/fix/changeInDecimalP…
arnabghose997 Aug 1, 2024
c8d86bd
Merge pull request #202 from rubixchain/arnab/bump-version-number
arnabghose997 Aug 1, 2024
3c5de7f
fixed swagger input by removing input params which were not necessary…
arnabghose997 Aug 1, 2024
c5679bb
fixed swagger doc for token pinning and recover
arnabghose997 Aug 1, 2024
5ccbd47
Merge pull request #203 from rubixchain/arnab/fix-self-transfer-serve…
arnabghose997 Aug 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ linux/
mac/
windows/
dist/
test_swarm_key/

# used for testing purpose
!node_registry.json
!node_registry.json
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,4 +348,48 @@ To get all explorer urls
This following options are used for this command
-port string
Server/Host port (default "20000")
```
To add the peer details manually
: To add the peer details by providing peerID, did and didType of the peer

```
./rubixgoplatform addpeerdetails

This following options are used for this command
-port string
Server/Host port (default "20000")

-peerID string
Peerd ID

-did string
DID address (default "")

-didType int
DID type (0-Basic Mode, 1-Standard Mode, 2-Wallet Mode, 3-Child Mode, 4-Light Mode) (default 0)
```

To check details about the token states for which pledging has been done
: To check for what token states the pledging has been done, and which tokens are pledged

```
./rubixgoplatform getpledgedtokendetails

This following options are used for this command
-port string
Server/Host port (default "20000")
```

To check tokenstatehash status
: To check if a particular tokenstatehash is exhausted, i.e if it has been transferred further

```
./rubixgoplatform tokenstatehash

This following options are used for this command
-port string
Server/Host port (default "20000")

-tokenstatehash string
TokenState Hash, for which the status needs to be checked
```
56 changes: 46 additions & 10 deletions block/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ const (
TCSmartContractDataKey string = "9"
TCTokenValueKey string = "10"
TCChildTokensKey string = "11"
TCSenderSignatureKey string = "12"
TCEpochKey string = "epoch"
)

const (
Expand All @@ -54,19 +56,22 @@ const (
TokenDeployedType string = "09"
TokenExecutedType string = "10"
TokenContractCommited string = "11"
TokenPinnedAsService string = "12"
)

type TokenChainBlock struct {
TransactionType string `json:"transactionType"`
TokenOwner string `json:"owner"`
GenesisBlock *GenesisBlock `json:"genesisBlock"`
TransInfo *TransInfo `json:"transInfo"`
PledgeDetails []PledgeDetail `json:"pledgeDetails"`
QuorumSignature []string `json:"quorumSignature"`
SmartContract []byte `json:"smartContract"`
SmartContractData string `json:"smartContractData"`
TokenValue float64 `json:"tokenValue"`
ChildTokens []string `json:"childTokens"`
TransactionType string `json:"transactionType"`
TokenOwner string `json:"owner"`
GenesisBlock *GenesisBlock `json:"genesisBlock"`
TransInfo *TransInfo `json:"transInfo"`
PledgeDetails []PledgeDetail `json:"pledgeDetails"`
QuorumSignature []CreditSignature `json:"quorumSignature"`
SmartContract []byte `json:"smartContract"`
SmartContractData string `json:"smartContractData"`
TokenValue float64 `json:"tokenValue"`
ChildTokens []string `json:"childTokens"`
InitiatorSignature *InitiatorSignature `json:"initiatorSignature"`
Epoch int `json:"epoch"`
}

type PledgeDetail struct {
Expand All @@ -83,6 +88,22 @@ type Block struct {
log logger.Logger
}

type CreditSignature struct {
Signature string `json:"signature"`
PrivSignature string `json:"priv_signature"`
DID string `json:"did"`
Hash string `json:"hash"`
SignType string `json:"sign_type"` //represents sign type (PkiSign == 0 or NlssSign==1)
}

type InitiatorSignature struct {
NLSS_share string `json:"nlss_share_signature"`
Private_sign string `json:"priv_signature"`
DID string `json:"initiator_did"`
Hash string `json:"hash"`
SignType int `json:"sign_type"` //represents sign type (PkiSign == 0 or NlssSign==1)
}

type BlockOption func(b *Block)

func NoSignature() BlockOption {
Expand Down Expand Up @@ -151,6 +172,9 @@ func CreateNewBlock(ctcb map[string]*Block, tcb *TokenChainBlock) *Block {
if tcb.SmartContractData != "" {
ntcb[TCSmartContractDataKey] = tcb.SmartContractData
}
if tcb.InitiatorSignature != nil {
ntcb[TCSenderSignatureKey] = tcb.InitiatorSignature
}

if floatPrecisionToMaxDecimalPlaces(tcb.TokenValue) > floatPrecisionToMaxDecimalPlaces(0) {
ntcb[TCTokenValueKey] = floatPrecisionToMaxDecimalPlaces(tcb.TokenValue)
Expand All @@ -162,6 +186,10 @@ func CreateNewBlock(ctcb map[string]*Block, tcb *TokenChainBlock) *Block {
ntcb[TCChildTokensKey] = tcb.ChildTokens
}

if tcb.Epoch != 0 {
ntcb[TCEpochKey] = tcb.Epoch
}

blk := InitBlock(nil, ntcb)
return blk
}
Expand All @@ -170,6 +198,7 @@ func (b *Block) blkDecode() error {
var m map[string]interface{}
err := cbor.Unmarshal(b.bb, &m)
if err != nil {
fmt.Println("failed to decode block", err.Error(), err)
return nil
}
si, sok := m[TCBlockContentSigKey]
Expand Down Expand Up @@ -575,6 +604,9 @@ func (b *Block) GetReceiverDID() string {
func (b *Block) GetDeployerDID() string {
return b.getTrasnInfoString(TIDeployerDIDKey)
}
func (b *Block) GetPinningNodeDID() string {
return b.getTrasnInfoString(TIPinningDIDKey)
}

func (b *Block) GetExecutorDID() string {
return b.getTrasnInfoString(TIExecutorDIDKey)
Expand Down Expand Up @@ -689,3 +721,7 @@ func (b *Block) GetTokenValue() float64 {
func (b *Block) GetChildTokens() []string {
return util.GetStringSliceFromMap(b.bm, TCChildTokensKey)
}

func (b *Block) GetEpoch() int64 {
return int64(util.GetIntFromMap(b.bm, TCEpochKey))
}
23 changes: 14 additions & 9 deletions block/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const (
TIDeployerDIDKey string = "8"
TIExecutorDIDKey string = "9"
TICommitedTokensKey string = "10"
TIPinningDIDKey string = "11"
)

const (
Expand All @@ -69,15 +70,16 @@ type TransTokens struct {
}

type TransInfo struct {
SenderDID string `json:"senderDID"`
ReceiverDID string `json:"receiverDID"`
Comment string `json:"comment"`
TID string `json:"tid"`
Block []byte `json:"block"`
RefID string `json:"refID"`
Tokens []TransTokens `json:"tokens"`
DeployerDID string `json:"deployerDID"`
ExecutorDID string `json:"executorDID"`
SenderDID string `json:"senderDID"`
ReceiverDID string `json:"receiverDID"`
Comment string `json:"comment"`
TID string `json:"tid"`
Block []byte `json:"block"`
RefID string `json:"refID"`
Tokens []TransTokens `json:"tokens"`
DeployerDID string `json:"deployerDID"`
ExecutorDID string `json:"executorDID"`
PinningNodeDID string `json:"pinningNodeDID"`
}

func newTransToken(b *Block, tt *TransTokens) map[string]interface{} {
Expand Down Expand Up @@ -123,6 +125,9 @@ func newTransInfo(ctcb map[string]*Block, ti *TransInfo) map[string]interface{}
if ti.ReceiverDID != "" {
ntib[TIReceiverDIDKey] = ti.ReceiverDID
}
if ti.PinningNodeDID != "" {
ntib[TIPinningDIDKey] = ti.PinningNodeDID
}
if ti.DeployerDID != "" {
ntib[TIDeployerDIDKey] = ti.DeployerDID
}
Expand Down
17 changes: 17 additions & 0 deletions client/addpeer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package client

import (
"github.com/rubixchain/rubixgoplatform/core/model"
"github.com/rubixchain/rubixgoplatform/core/wallet"
"github.com/rubixchain/rubixgoplatform/setup"
)

func (c *Client) AddPeer(peer_detail *wallet.DIDPeerMap) (string, bool) {

var rm model.BasicResponse
err := c.sendJSONRequest("POST", setup.APIAddPeerDetails, nil, &peer_detail, &rm)
if err != nil {
return err.Error(), false
}
return rm.Message, rm.Status
}
10 changes: 9 additions & 1 deletion client/did.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (c *Client) GetAllDIDs() (*model.GetAccountInfo, error) {
}

func (c *Client) CreateDID(cfg *did.DIDCreate) (string, bool) {
if cfg.Type < did.LiteDIDMode && cfg.Type > did.WalletDIDMode {
if cfg.Type < did.BasicDIDMode && cfg.Type > did.LiteDIDMode {
return "Invalid DID mode", false
}
switch cfg.Type {
Expand Down Expand Up @@ -186,6 +186,14 @@ func (c *Client) SetupDID(dc *did.DIDCreate) (string, bool) {
!strings.Contains(dc.QuorumPrivKeyFile, did.QuorumPvtKeyFileName) {
return "Required files are missing", false
}
default:
if !strings.Contains(dc.PubImgFile, did.PubShareFileName) ||
!strings.Contains(dc.DIDImgFileName, did.DIDImgFileName) ||
!strings.Contains(dc.PubKeyFile, did.PubKeyFileName) ||
!strings.Contains(dc.QuorumPubKeyFile, did.QuorumPubKeyFileName) ||
!strings.Contains(dc.QuorumPrivKeyFile, did.QuorumPvtKeyFileName) {
return "Required files are missing", false
}
}
jd, err := json.Marshal(&dc)
if err != nil {
Expand Down
7 changes: 0 additions & 7 deletions client/ping.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package client

import (
"strings"
"time"

"github.com/rubixchain/rubixgoplatform/core/model"
Expand All @@ -21,12 +20,6 @@ func (c *Client) Ping(peerID string) (string, bool) {

func (c *Client) CheckQuorumStatus(quorumAddress string) (string, bool) {
q := make(map[string]string)
// Split the string into two parts based on a delimiter
parts := strings.Split(quorumAddress, ".")
if len(parts) != 2 {
// Handle the case where the string doesn't contain exactly two parts
return "Invalid quorumAddress format", false
}
q["quorumAddress"] = quorumAddress
var rm model.BasicResponse
err := c.sendJSONRequest("GET", setup.APICheckQuorumStatus, q, nil, &rm, 2*time.Minute)
Expand Down
18 changes: 16 additions & 2 deletions client/quorum.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package client

import (
"encoding/json"
"io/ioutil"
"fmt"
"os"
"regexp"
"strings"

"github.com/rubixchain/rubixgoplatform/core"
"github.com/rubixchain/rubixgoplatform/core/model"
Expand All @@ -14,7 +17,7 @@ func (c *Client) AddQuorum(quorumList string) (string, bool) {
c.log.Error("Quorum list required")
return "Quorum list required", false
}
qlb, err := ioutil.ReadFile(quorumList)
qlb, err := os.ReadFile(quorumList)
if err != nil {
c.log.Error("Invalid file", "err", err)
return "Invalid file, failed to add quorum list", false
Expand All @@ -25,6 +28,17 @@ func (c *Client) AddQuorum(quorumList string) (string, bool) {
c.log.Error("Invalid file, failed to add quorum list", "err", err)
return "Invalid file, failed to add quorum list", false
}
if len(ql) < 5 {
c.log.Error("Length of Quorum list should be atleast 5")
return "Length of Quorum list should be atleast 5", false
}
for _, q := range ql {
is_alphanumeric := regexp.MustCompile(`^[a-zA-Z0-9]*$`).MatchString(q.Address)
if !strings.HasPrefix(q.Address, "bafybmi") || len(q.Address) != 59 || !is_alphanumeric {
c.log.Error(fmt.Sprintf("Invalid quorum DID : %s", q.Address))
return fmt.Sprintf("Invalid quorum DID : %s", q.Address), false
}
}
var resp model.BasicResponse
err = c.sendJSONRequest("POST", setup.APIAddQuorum, nil, &ql, &resp)
if err != nil {
Expand Down
18 changes: 18 additions & 0 deletions client/recover.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package client

import (
"time"

"github.com/rubixchain/rubixgoplatform/core/model"
"github.com/rubixchain/rubixgoplatform/setup"
)

func (c *Client) RecoverRBT(rt *model.RBTRecoverRequest) (*model.BasicResponse, error) {
var br model.BasicResponse
err := c.sendJSONRequest("POST", setup.APIRecoverRBT, nil, rt, &br, time.Minute*2)
if err != nil {
c.log.Error("Failed to Recover RBT from the pinning node", "err", err)
return nil, err
}
return &br, nil
}
24 changes: 24 additions & 0 deletions client/token.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package client

import (
"time"

"github.com/rubixchain/rubixgoplatform/core/model"
"github.com/rubixchain/rubixgoplatform/setup"
)
Expand Down Expand Up @@ -29,3 +31,25 @@ func (c *Client) GetAllTokens(didStr string, tokenType string) (*model.TokenResp
}
return &tr, nil
}

func (c *Client) GetPledgedTokenDetails() (*model.TokenStateResponse, error) {
var tr model.TokenStateResponse
err := c.sendJSONRequest("GET", setup.APIGetPledgedTokenDetails, nil, nil, &tr, time.Minute*2)
if err != nil {
c.log.Error("Failed to get pledged token details", "err", err)
return nil, err
}
return &tr, nil
}

func (c *Client) GetPinnedInfo(TokenStateHash string) (*model.BasicResponse, error) {
m := make(map[string]string)
m["tokenstatehash"] = TokenStateHash
var br model.BasicResponse
err := c.sendJSONRequest("DELETE", setup.APICheckPinnedState, m, nil, &br, time.Minute*2)
if err != nil {
c.log.Error("Failed to get Pins", "err", err)
return nil, err
}
return &br, nil
}
20 changes: 20 additions & 0 deletions client/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,23 @@ func (c *Client) TransferRBT(rt *model.RBTTransferRequest) (*model.BasicResponse
}
return &br, nil
}

func (c *Client) SelfTransferRBT(rt *model.RBTTransferRequest) (*model.BasicResponse, error) {
var br model.BasicResponse
err := c.sendJSONRequest("POST", setup.APISelfTransfer, nil, rt, &br, time.Minute*2)
if err != nil {
c.log.Error("Failed RBT Transfer", "err", err)
return nil, err
}
return &br, nil
}

func (c *Client) PinRBT(rt *model.RBTPinRequest) (*model.BasicResponse, error) {
var br model.BasicResponse
err := c.sendJSONRequest("POST", setup.APIInitiatePinRBT, nil, rt, &br, time.Minute*2)
if err != nil {
c.log.Error("Failed to Pin RBT as a service", "err", err)
return nil, err
}
return &br, nil
}
Loading