Compare commits

..

No commits in common. "be6c0d6afbe764a42ab07679c2746ef071fc09b3" and "7ba5815375a3e54b19bf16e03f9a3b90f5671a6a" have entirely different histories.

4 changed files with 23 additions and 49 deletions

View File

@ -23,7 +23,6 @@ const (
USERFLAG_ACCOUNT_CREATED USERFLAG_ACCOUNT_CREATED
USERFLAG_ACCOUNT_PENDING USERFLAG_ACCOUNT_PENDING
USERFLAG_ACCOUNT_SUCCESS USERFLAG_ACCOUNT_SUCCESS
USERFLAG_ACCOUNT_UNLOCKED
) )
const ( const (
@ -55,7 +54,6 @@ type trackStatusResponse struct {
type fsData struct { type fsData struct {
path string path string
st *state.State
} }
func (fsd *fsData) SetLanguageSelected(ctx context.Context, sym string, input []byte) (resource.Result, error) { func (fsd *fsData) SetLanguageSelected(ctx context.Context, sym string, input []byte) (resource.Result, error) {
@ -85,24 +83,12 @@ func (fsd *fsData) create_account(ctx context.Context, sym string, input []byte)
} }
f.Close() f.Close()
// accountResp, err := createAccount() accountResp, err := createAccount()
// if err != nil { if err != nil {
// fmt.Println("Failed to create account:", err) fmt.Println("Failed to create account:", err)
// return res, err return res, err
// } }
accountResp := accountResponse{
Ok: true,
Result: struct {
CustodialId json.Number `json:"custodialId"`
PublicKey string `json:"publicKey"`
TrackingId string `json:"trackingId"`
}{
CustodialId: "636",
PublicKey: "0x8d86F9D4A4eae41Dc3B68034895EA97BcA90e8c1",
TrackingId: "45c67314-7995-4890-89d6-e5af987754ac",
}}
accountData := map[string]string{ accountData := map[string]string{
"TrackingId": accountResp.Result.TrackingId, "TrackingId": accountResp.Result.TrackingId,
@ -145,18 +131,6 @@ func (fsd *fsData) checkIdentifier(ctx context.Context, sym string, input []byte
return res, nil return res, nil
} }
func (fsd *fsData) unlock(ctx context.Context,sym string,input []byte) (resource.Result,error){
res := resource.Result{}
//res.FlagSet = []uint32{USERFLAG_ACCOUNT_UNLOCKED}
if fsd.st.MatchFlag(USERFLAG_ACCOUNT_UNLOCKED, false) {
res.FlagSet = append(res.FlagSet, USERFLAG_ACCOUNT_UNLOCKED)
} else {
res.FlagReset = append(res.FlagReset, USERFLAG_ACCOUNT_UNLOCKED)
}
return res,nil
}
func (fsd *fsData) check_account_status(ctx context.Context, sym string, input []byte) (resource.Result, error) { func (fsd *fsData) check_account_status(ctx context.Context, sym string, input []byte) (resource.Result, error) {
res := resource.Result{} res := resource.Result{}
fp := fsd.path + "_data" fp := fsd.path + "_data"
@ -182,15 +156,13 @@ func (fsd *fsData) check_account_status(ctx context.Context, sym string, input [
accountData["Status"] = status accountData["Status"] = status
if status == "SUCCESS" { if status == "SUCCESS" {
res.FlagSet = append(res.FlagSet, USERFLAG_ACCOUNT_SUCCESS) res.FlagSet = []uint32{USERFLAG_ACCOUNT_SUCCESS}
res.FlagReset = append(res.FlagReset,USERFLAG_ACCOUNT_PENDING) res.FlagReset = []uint32{USERFLAG_ACCOUNT_PENDING}
} else { } else {
res.FlagReset = append(res.FlagSet, USERFLAG_ACCOUNT_SUCCESS) res.FlagSet = []uint32{USERFLAG_ACCOUNT_PENDING}
res.FlagSet = append(res.FlagReset,USERFLAG_ACCOUNT_PENDING) res.FlagReset = []uint32{USERFLAG_ACCOUNT_SUCCESS}
} }
updatedJsonData, err := json.Marshal(accountData) updatedJsonData, err := json.Marshal(accountData)
if err != nil { if err != nil {
return res, err return res, err
@ -249,17 +221,9 @@ func checkAccountStatus(trackingId string) (string, error) {
} }
func (fsd *fsData) quit(ctx context.Context, sym string, input []byte) (resource.Result, error) { func (fsd *fsData) quit(ctx context.Context, sym string, input []byte) (resource.Result, error) {
res := resource.Result{ return resource.Result{
Content: "", Content: "",
} }, nil
st := fsd.st
if(st.MatchFlag(USERFLAG_ACCOUNT_UNLOCKED,true)){
//res.FlagReset = []uint32{USERFLAG_ACCOUNT_UNLOCKED}
// res.FlagReset = append(res.FlagReset, USERFLAG_ACCOUNT_UNLOCKED)
}else {
res.FlagReset = append(res.FlagReset, USERFLAG_ACCOUNT_UNLOCKED)
}
return res, nil
} }
@ -319,13 +283,11 @@ func main() {
fp := path.Join(dp, sessionId) fp := path.Join(dp, sessionId)
fs := &fsData{ fs := &fsData{
path: fp, path: fp,
st: &st,
} }
rfs.AddLocalFunc("select_language", fs.SetLanguageSelected) rfs.AddLocalFunc("select_language", fs.SetLanguageSelected)
rfs.AddLocalFunc("create_account", fs.create_account) rfs.AddLocalFunc("create_account", fs.create_account)
rfs.AddLocalFunc("check_identifier", fs.checkIdentifier) rfs.AddLocalFunc("check_identifier", fs.checkIdentifier)
rfs.AddLocalFunc("check_account_status", fs.check_account_status) rfs.AddLocalFunc("check_account_status", fs.check_account_status)
rfs.AddLocalFunc("unlock_account", fs.unlock)
rfs.AddLocalFunc("quit",fs.quit) rfs.AddLocalFunc("quit",fs.quit)
cont, err := en.Init(ctx) cont, err := en.Init(ctx)

View File

@ -0,0 +1,2 @@
Balance: 0.00 SRF

View File

@ -0,0 +1,9 @@
LOAD check_identifier 64
RELOAD check_identifier
MAP check_identifier
MOUT send 1
MOUT vouchers 2
MOUT account 3
MOUT help 4
HALT

View File

@ -0,0 +1 @@
Salio: 0.00 SRF