diff --git a/venus-shared/api/wallet/common.go b/venus-shared/api/wallet/common.go index 86b510a57c..1604f85b01 100644 --- a/venus-shared/api/wallet/common.go +++ b/venus-shared/api/wallet/common.go @@ -5,6 +5,7 @@ import ( "github.com/filecoin-project/go-jsonrpc/auth" "github.com/filecoin-project/venus/venus-shared/api" + "github.com/filecoin-project/venus/venus-shared/types" ) type ICommon interface { @@ -15,5 +16,7 @@ type ICommon interface { LogList(context.Context) ([]string, error) //perm:read LogSetLevel(context.Context, string, string) error //perm:write + ListSignedRecord(ctx context.Context, param *types.QuerySignRecordParams) ([]types.SignRecord, error) //perm:read + api.Version } diff --git a/venus-shared/api/wallet/full.go b/venus-shared/api/wallet/full.go index 27b2ee99ef..87f22a6c41 100644 --- a/venus-shared/api/wallet/full.go +++ b/venus-shared/api/wallet/full.go @@ -1,7 +1,6 @@ package wallet type IFullAPI interface { - ILocalStrategy ILocalWallet ICommon IWalletEvent diff --git a/venus-shared/api/wallet/method.md b/venus-shared/api/wallet/method.md index 76478d908f..99982e56cc 100644 --- a/venus-shared/api/wallet/method.md +++ b/venus-shared/api/wallet/method.md @@ -9,41 +9,10 @@ curl http://:/rpc/v0 -X POST -H "Content-Type: application/json" -H " * [Common](#common) * [AuthNew](#authnew) * [AuthVerify](#authverify) + * [ListSignedRecord](#listsignedrecord) * [LogList](#loglist) * [LogSetLevel](#logsetlevel) * [Version](#version) -* [Strategy](#strategy) - * [AddMethodIntoKeyBind](#addmethodintokeybind) - * [AddMsgTypeIntoKeyBind](#addmsgtypeintokeybind) - * [GetGroupByName](#getgroupbyname) - * [GetKeyBindByName](#getkeybindbyname) - * [GetKeyBinds](#getkeybinds) - * [GetMethodTemplateByName](#getmethodtemplatebyname) - * [GetMsgTypeTemplate](#getmsgtypetemplate) - * [GetWalletTokenInfo](#getwallettokeninfo) - * [GetWalletTokensByGroup](#getwallettokensbygroup) - * [ListGroups](#listgroups) - * [ListKeyBinds](#listkeybinds) - * [ListMethodTemplates](#listmethodtemplates) - * [ListMsgTypeTemplates](#listmsgtypetemplates) - * [NewGroup](#newgroup) - * [NewKeyBindCustom](#newkeybindcustom) - * [NewKeyBindFromTemplate](#newkeybindfromtemplate) - * [NewMethodTemplate](#newmethodtemplate) - * [NewMsgTypeTemplate](#newmsgtypetemplate) - * [NewStToken](#newsttoken) - * [RemoveGroup](#removegroup) - * [RemoveKeyBind](#removekeybind) - * [RemoveKeyBindByAddress](#removekeybindbyaddress) - * [RemoveMethodFromKeyBind](#removemethodfromkeybind) - * [RemoveMethodTemplate](#removemethodtemplate) - * [RemoveMsgTypeFromKeyBind](#removemsgtypefromkeybind) - * [RemoveMsgTypeTemplate](#removemsgtypetemplate) - * [RemoveStToken](#removesttoken) -* [StrategyVerify](#strategyverify) - * [ContainWallet](#containwallet) - * [ScopeWallet](#scopewallet) - * [Verify](#verify) * [Wallet](#wallet) * [WalletDelete](#walletdelete) * [WalletExport](#walletexport) @@ -100,735 +69,90 @@ Response: ] ``` -### LogList - - -Perms: read - -Inputs: `[]` - -Response: -```json -[ - "string value" -] -``` - -### LogSetLevel - - -Perms: write - -Inputs: -```json -[ - "string value", - "string value" -] -``` - -Response: `{}` - -### Version -Version provides information about API provider +### ListSignedRecord Perms: read -Inputs: `[]` - -Response: -```json -{ - "Version": "string value", - "APIVersion": 131840 -} -``` - -## Strategy - -### AddMethodIntoKeyBind -AddMethodIntoKeyBind append methods into keyBind - - -Perms: admin - -Inputs: -```json -[ - "string value", - [ - "string value" - ] -] -``` - -Response: -```json -{ - "BindID": 42, - "Name": "string value", - "Address": "string value", - "MetaTypes": 2, - "Methods": [ - "string value" - ] -} -``` - -### AddMsgTypeIntoKeyBind -AddMsgTypeIntoKeyBind append msgTypes into keyBind - - -Perms: admin - -Inputs: -```json -[ - "string value", - [ - 123 - ] -] -``` - -Response: -```json -{ - "BindID": 42, - "Name": "string value", - "Address": "string value", - "MetaTypes": 2, - "Methods": [ - "string value" - ] -} -``` - -### GetGroupByName -GetGroupByName get a group by name - - -Perms: admin - -Inputs: -```json -[ - "string value" -] -``` - -Response: -```json -{ - "GroupID": 42, - "Name": "string value", - "KeyBinds": [ - { - "BindID": 42, - "Name": "string value", - "Address": "string value", - "MetaTypes": 2, - "Methods": [ - "string value" - ] - } - ] -} -``` - -### GetKeyBindByName -GetKeyBindByName get a keyBind by name - - -Perms: admin - Inputs: ```json -[ - "string value" -] -``` - -Response: -```json -{ - "BindID": 42, - "Name": "string value", - "Address": "string value", - "MetaTypes": 2, - "Methods": [ - "string value" - ] -} -``` - -### GetKeyBinds -GetKeyBinds list keyBinds by address - - -Perms: admin - -Inputs: -```json -[ - "f01234" -] -``` - -Response: -```json [ { - "BindID": 42, - "Name": "string value", - "Address": "string value", - "MetaTypes": 2, - "Methods": [ - "string value" - ] - } -] -``` - -### GetMethodTemplateByName -GetMethodTemplateByName get a method template by name - - -Perms: admin - -Inputs: -```json -[ - "string value" -] -``` - -Response: -```json -{ - "MTId": 42, - "Name": "string value", - "Methods": [ - "string value" - ] -} -``` - -### GetMsgTypeTemplate -GetMsgTypeTemplate get a msgType template by name - - -Perms: admin - -Inputs: -```json -[ - "string value" -] -``` - -Response: -```json -{ - "MTTId": 42, - "Name": "string value", - "MetaTypes": 2 -} -``` - -### GetWalletTokenInfo -GetWalletTokenInfo get group details by token - - -Perms: admin - -Inputs: -```json -[ - "string value" -] -``` - -Response: -```json -{ - "Token": "string value", - "GroupID": 42, - "Name": "string value", - "KeyBinds": [ - { - "BindID": 42, - "Name": "string value", - "Address": "string value", - "MetaTypes": 2, - "Methods": [ - "string value" - ] - } - ] -} -``` - -### GetWalletTokensByGroup -GetWalletTokensByGroup list strategy tokens under the group - - -Perms: admin - -Inputs: -```json -[ - "string value" -] -``` - -Response: -```json -[ - "string value" -] -``` - -### ListGroups -ListGroups list groups' simple information - - -Perms: admin - -Inputs: -```json -[ - 123, - 123 -] -``` - -Response: -```json -[ - { - "GroupID": 42, - "Name": "string value", - "KeyBinds": [ - { - "BindID": 42, - "Name": "string value", - "Address": "string value", - "MetaTypes": 2, - "Methods": [ - "string value" - ] - } - ] - } -] -``` - -### ListKeyBinds -ListKeyBinds list keyBinds' details - - -Perms: admin - -Inputs: -```json -[ - 123, - 123 -] -``` - -Response: -```json -[ - { - "BindID": 42, - "Name": "string value", - "Address": "string value", - "MetaTypes": 2, - "Methods": [ - "string value" - ] - } -] -``` - -### ListMethodTemplates -ListMethodTemplates list method templates' details - - -Perms: admin - -Inputs: -```json -[ - 123, - 123 -] -``` - -Response: -```json -[ - { - "MTId": 42, - "Name": "string value", - "Methods": [ - "string value" - ] + "ID": "string value", + "Type": "message", + "Signer": "f01234", + "IsError": true, + "Skip": 123, + "Limit": 123, + "After": "0001-01-01T00:00:00Z", + "Before": "0001-01-01T00:00:00Z" } ] ``` -### ListMsgTypeTemplates -ListMsgTypeTemplates list msgType templates' details - - -Perms: admin - -Inputs: -```json -[ - 123, - 123 -] -``` - Response: ```json [ { - "MTTId": 42, - "Name": "string value", - "MetaTypes": 2 + "ID": "string value", + "Type": "message", + "Signer": "f01234", + "Err": {}, + "RawMsg": "Ynl0ZSBhcnJheQ==", + "Signature": { + "Type": 2, + "Data": "Ynl0ZSBhcnJheQ==" + }, + "CreateAt": "0001-01-01T00:00:00Z" } ] ``` -### NewGroup -NewGroup create a group to group multiple keyBinds together - - -Perms: admin - -Inputs: -```json -[ - "string value", - [ - "string value" - ] -] -``` - -Response: `{}` - -### NewKeyBindCustom -NewKeyBindCustom create a keyBind with custom msyTypes and methods - - -Perms: admin - -Inputs: -```json -[ - "string value", - "f01234", - [ - 123 - ], - [ - "string value" - ] -] -``` - -Response: `{}` - -### NewKeyBindFromTemplate -NewKeyBindFromTemplate create a keyBind form msgType template and method template - - -Perms: admin - -Inputs: -```json -[ - "string value", - "f01234", - "string value", - "string value" -] -``` - -Response: `{}` - -### NewMethodTemplate -NewMethodTemplate create a method template - - -Perms: admin - -Inputs: -```json -[ - "string value", - [ - "string value" - ] -] -``` - -Response: `{}` - -### NewMsgTypeTemplate -NewMsgTypeTemplate create a msgType template - - -Perms: admin - -Inputs: -```json -[ - "string value", - [ - 123 - ] -] -``` - -Response: `{}` - -### NewStToken -NewStToken generate a random token from group - - -Perms: admin - -Inputs: -```json -[ - "string value" -] -``` - -Response: `"string value"` - -### RemoveGroup -RemoveGroup delete group by name - - -Perms: admin - -Inputs: -```json -[ - "string value" -] -``` - -Response: `{}` - -### RemoveKeyBind -RemoveKeyBind delete keyBind by name - - -Perms: admin - -Inputs: -```json -[ - "string value" -] -``` - -Response: `{}` - -### RemoveKeyBindByAddress -RemoveKeyBindByAddress delete some keyBinds by address - - -Perms: admin - -Inputs: -```json -[ - "f01234" -] -``` - -Response: `9` - -### RemoveMethodFromKeyBind -RemoveMethodFromKeyBind remove methods from keyBind +### LogList -Perms: admin +Perms: read -Inputs: -```json -[ - "string value", - [ - "string value" - ] -] -``` +Inputs: `[]` Response: ```json -{ - "BindID": 42, - "Name": "string value", - "Address": "string value", - "MetaTypes": 2, - "Methods": [ - "string value" - ] -} -``` - -### RemoveMethodTemplate -RemoveMethodTemplate delete method template by name - - -Perms: admin - -Inputs: -```json [ "string value" ] ``` -Response: `{}` - -### RemoveMsgTypeFromKeyBind -RemoveMsgTypeFromKeyBind remove msgTypes form keyBind +### LogSetLevel -Perms: admin +Perms: write Inputs: ```json [ "string value", - [ - 123 - ] -] -``` - -Response: -```json -{ - "BindID": 42, - "Name": "string value", - "Address": "string value", - "MetaTypes": 2, - "Methods": [ - "string value" - ] -} -``` - -### RemoveMsgTypeTemplate -RemoveMsgTypeTemplate delete msgType template by name - - -Perms: admin - -Inputs: -```json -[ "string value" ] ``` Response: `{}` -### RemoveStToken -RemoveStToken delete strategy token - - -Perms: admin - -Inputs: -```json -[ - "string value" -] -``` - -Response: `{}` - -## StrategyVerify - -### ContainWallet -ContainWallet Check if it is visible to the wallet - - -Perms: admin - -Inputs: -```json -[ - "f01234" -] -``` - -Response: `true` - -### ScopeWallet -ScopeWallet get the wallet scope +### Version +Version provides information about API provider -Perms: admin +Perms: read Inputs: `[]` Response: ```json { - "Root": true, - "Addresses": [ - "f01234" - ] + "Version": "string value", + "APIVersion": 131840 } ``` -### Verify -Verify verify the address strategy permissions - - -Perms: admin - -Inputs: -```json -[ - "f01234", - "message", - { - "CID": { - "/": "bafy2bzacebbpdegvr3i4cosewthysg5xkxpqfn2wfcz6mv2hmoktwbdxkax4s" - }, - "Version": 42, - "To": "f01234", - "From": "f01234", - "Nonce": 42, - "Value": "0", - "GasLimit": 9, - "GasFeeCap": "0", - "GasPremium": "0", - "Method": 1, - "Params": "Ynl0ZSBhcnJheQ==" - } -] -``` - -Response: `{}` - ## Wallet ### WalletDelete diff --git a/venus-shared/api/wallet/mock/mock_ifullapi.go b/venus-shared/api/wallet/mock/mock_ifullapi.go index 0ac5f014b1..4507bf1935 100644 --- a/venus-shared/api/wallet/mock/mock_ifullapi.go +++ b/venus-shared/api/wallet/mock/mock_ifullapi.go @@ -11,9 +11,7 @@ import ( address "github.com/filecoin-project/go-address" auth "github.com/filecoin-project/go-jsonrpc/auth" crypto "github.com/filecoin-project/go-state-types/crypto" - types "github.com/filecoin-project/venus/venus-shared/actors/types" - types0 "github.com/filecoin-project/venus/venus-shared/types" - wallet "github.com/filecoin-project/venus/venus-shared/types/wallet" + types "github.com/filecoin-project/venus/venus-shared/types" gomock "github.com/golang/mock/gomock" ) @@ -40,36 +38,6 @@ func (m *MockIFullAPI) EXPECT() *MockIFullAPIMockRecorder { return m.recorder } -// AddMethodIntoKeyBind mocks base method. -func (m *MockIFullAPI) AddMethodIntoKeyBind(arg0 context.Context, arg1 string, arg2 []string) (*wallet.KeyBind, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddMethodIntoKeyBind", arg0, arg1, arg2) - ret0, _ := ret[0].(*wallet.KeyBind) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AddMethodIntoKeyBind indicates an expected call of AddMethodIntoKeyBind. -func (mr *MockIFullAPIMockRecorder) AddMethodIntoKeyBind(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddMethodIntoKeyBind", reflect.TypeOf((*MockIFullAPI)(nil).AddMethodIntoKeyBind), arg0, arg1, arg2) -} - -// AddMsgTypeIntoKeyBind mocks base method. -func (m *MockIFullAPI) AddMsgTypeIntoKeyBind(arg0 context.Context, arg1 string, arg2 []int) (*wallet.KeyBind, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddMsgTypeIntoKeyBind", arg0, arg1, arg2) - ret0, _ := ret[0].(*wallet.KeyBind) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AddMsgTypeIntoKeyBind indicates an expected call of AddMsgTypeIntoKeyBind. -func (mr *MockIFullAPIMockRecorder) AddMsgTypeIntoKeyBind(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddMsgTypeIntoKeyBind", reflect.TypeOf((*MockIFullAPI)(nil).AddMsgTypeIntoKeyBind), arg0, arg1, arg2) -} - // AddNewAddress mocks base method. func (m *MockIFullAPI) AddNewAddress(arg0 context.Context, arg1 []address.Address) error { m.ctrl.T.Helper() @@ -128,183 +96,19 @@ func (mr *MockIFullAPIMockRecorder) AuthVerify(arg0, arg1 interface{}) *gomock.C return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AuthVerify", reflect.TypeOf((*MockIFullAPI)(nil).AuthVerify), arg0, arg1) } -// ContainWallet mocks base method. -func (m *MockIFullAPI) ContainWallet(arg0 context.Context, arg1 address.Address) bool { +// ListSignedRecord mocks base method. +func (m *MockIFullAPI) ListSignedRecord(arg0 context.Context, arg1 *types.QuerySignRecordParams) ([]types.SignRecord, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ContainWallet", arg0, arg1) - ret0, _ := ret[0].(bool) - return ret0 -} - -// ContainWallet indicates an expected call of ContainWallet. -func (mr *MockIFullAPIMockRecorder) ContainWallet(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainWallet", reflect.TypeOf((*MockIFullAPI)(nil).ContainWallet), arg0, arg1) -} - -// GetGroupByName mocks base method. -func (m *MockIFullAPI) GetGroupByName(arg0 context.Context, arg1 string) (*wallet.Group, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetGroupByName", arg0, arg1) - ret0, _ := ret[0].(*wallet.Group) + ret := m.ctrl.Call(m, "ListSignedRecord", arg0, arg1) + ret0, _ := ret[0].([]types.SignRecord) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetGroupByName indicates an expected call of GetGroupByName. -func (mr *MockIFullAPIMockRecorder) GetGroupByName(arg0, arg1 interface{}) *gomock.Call { +// ListSignedRecord indicates an expected call of ListSignedRecord. +func (mr *MockIFullAPIMockRecorder) ListSignedRecord(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupByName", reflect.TypeOf((*MockIFullAPI)(nil).GetGroupByName), arg0, arg1) -} - -// GetKeyBindByName mocks base method. -func (m *MockIFullAPI) GetKeyBindByName(arg0 context.Context, arg1 string) (*wallet.KeyBind, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetKeyBindByName", arg0, arg1) - ret0, _ := ret[0].(*wallet.KeyBind) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetKeyBindByName indicates an expected call of GetKeyBindByName. -func (mr *MockIFullAPIMockRecorder) GetKeyBindByName(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetKeyBindByName", reflect.TypeOf((*MockIFullAPI)(nil).GetKeyBindByName), arg0, arg1) -} - -// GetKeyBinds mocks base method. -func (m *MockIFullAPI) GetKeyBinds(arg0 context.Context, arg1 address.Address) ([]*wallet.KeyBind, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetKeyBinds", arg0, arg1) - ret0, _ := ret[0].([]*wallet.KeyBind) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetKeyBinds indicates an expected call of GetKeyBinds. -func (mr *MockIFullAPIMockRecorder) GetKeyBinds(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetKeyBinds", reflect.TypeOf((*MockIFullAPI)(nil).GetKeyBinds), arg0, arg1) -} - -// GetMethodTemplateByName mocks base method. -func (m *MockIFullAPI) GetMethodTemplateByName(arg0 context.Context, arg1 string) (*wallet.MethodTemplate, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetMethodTemplateByName", arg0, arg1) - ret0, _ := ret[0].(*wallet.MethodTemplate) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetMethodTemplateByName indicates an expected call of GetMethodTemplateByName. -func (mr *MockIFullAPIMockRecorder) GetMethodTemplateByName(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMethodTemplateByName", reflect.TypeOf((*MockIFullAPI)(nil).GetMethodTemplateByName), arg0, arg1) -} - -// GetMsgTypeTemplate mocks base method. -func (m *MockIFullAPI) GetMsgTypeTemplate(arg0 context.Context, arg1 string) (*wallet.MsgTypeTemplate, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetMsgTypeTemplate", arg0, arg1) - ret0, _ := ret[0].(*wallet.MsgTypeTemplate) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetMsgTypeTemplate indicates an expected call of GetMsgTypeTemplate. -func (mr *MockIFullAPIMockRecorder) GetMsgTypeTemplate(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMsgTypeTemplate", reflect.TypeOf((*MockIFullAPI)(nil).GetMsgTypeTemplate), arg0, arg1) -} - -// GetWalletTokenInfo mocks base method. -func (m *MockIFullAPI) GetWalletTokenInfo(arg0 context.Context, arg1 string) (*wallet.GroupAuth, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetWalletTokenInfo", arg0, arg1) - ret0, _ := ret[0].(*wallet.GroupAuth) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetWalletTokenInfo indicates an expected call of GetWalletTokenInfo. -func (mr *MockIFullAPIMockRecorder) GetWalletTokenInfo(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWalletTokenInfo", reflect.TypeOf((*MockIFullAPI)(nil).GetWalletTokenInfo), arg0, arg1) -} - -// GetWalletTokensByGroup mocks base method. -func (m *MockIFullAPI) GetWalletTokensByGroup(arg0 context.Context, arg1 string) ([]string, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetWalletTokensByGroup", arg0, arg1) - ret0, _ := ret[0].([]string) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetWalletTokensByGroup indicates an expected call of GetWalletTokensByGroup. -func (mr *MockIFullAPIMockRecorder) GetWalletTokensByGroup(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWalletTokensByGroup", reflect.TypeOf((*MockIFullAPI)(nil).GetWalletTokensByGroup), arg0, arg1) -} - -// ListGroups mocks base method. -func (m *MockIFullAPI) ListGroups(arg0 context.Context, arg1, arg2 int) ([]*wallet.Group, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ListGroups", arg0, arg1, arg2) - ret0, _ := ret[0].([]*wallet.Group) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListGroups indicates an expected call of ListGroups. -func (mr *MockIFullAPIMockRecorder) ListGroups(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGroups", reflect.TypeOf((*MockIFullAPI)(nil).ListGroups), arg0, arg1, arg2) -} - -// ListKeyBinds mocks base method. -func (m *MockIFullAPI) ListKeyBinds(arg0 context.Context, arg1, arg2 int) ([]*wallet.KeyBind, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ListKeyBinds", arg0, arg1, arg2) - ret0, _ := ret[0].([]*wallet.KeyBind) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListKeyBinds indicates an expected call of ListKeyBinds. -func (mr *MockIFullAPIMockRecorder) ListKeyBinds(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListKeyBinds", reflect.TypeOf((*MockIFullAPI)(nil).ListKeyBinds), arg0, arg1, arg2) -} - -// ListMethodTemplates mocks base method. -func (m *MockIFullAPI) ListMethodTemplates(arg0 context.Context, arg1, arg2 int) ([]*wallet.MethodTemplate, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ListMethodTemplates", arg0, arg1, arg2) - ret0, _ := ret[0].([]*wallet.MethodTemplate) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListMethodTemplates indicates an expected call of ListMethodTemplates. -func (mr *MockIFullAPIMockRecorder) ListMethodTemplates(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListMethodTemplates", reflect.TypeOf((*MockIFullAPI)(nil).ListMethodTemplates), arg0, arg1, arg2) -} - -// ListMsgTypeTemplates mocks base method. -func (m *MockIFullAPI) ListMsgTypeTemplates(arg0 context.Context, arg1, arg2 int) ([]*wallet.MsgTypeTemplate, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ListMsgTypeTemplates", arg0, arg1, arg2) - ret0, _ := ret[0].([]*wallet.MsgTypeTemplate) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListMsgTypeTemplates indicates an expected call of ListMsgTypeTemplates. -func (mr *MockIFullAPIMockRecorder) ListMsgTypeTemplates(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListMsgTypeTemplates", reflect.TypeOf((*MockIFullAPI)(nil).ListMsgTypeTemplates), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSignedRecord", reflect.TypeOf((*MockIFullAPI)(nil).ListSignedRecord), arg0, arg1) } // Lock mocks base method. @@ -364,221 +168,6 @@ func (mr *MockIFullAPIMockRecorder) LogSetLevel(arg0, arg1, arg2 interface{}) *g return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogSetLevel", reflect.TypeOf((*MockIFullAPI)(nil).LogSetLevel), arg0, arg1, arg2) } -// NewGroup mocks base method. -func (m *MockIFullAPI) NewGroup(arg0 context.Context, arg1 string, arg2 []string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewGroup", arg0, arg1, arg2) - ret0, _ := ret[0].(error) - return ret0 -} - -// NewGroup indicates an expected call of NewGroup. -func (mr *MockIFullAPIMockRecorder) NewGroup(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewGroup", reflect.TypeOf((*MockIFullAPI)(nil).NewGroup), arg0, arg1, arg2) -} - -// NewKeyBindCustom mocks base method. -func (m *MockIFullAPI) NewKeyBindCustom(arg0 context.Context, arg1 string, arg2 address.Address, arg3 []int, arg4 []string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewKeyBindCustom", arg0, arg1, arg2, arg3, arg4) - ret0, _ := ret[0].(error) - return ret0 -} - -// NewKeyBindCustom indicates an expected call of NewKeyBindCustom. -func (mr *MockIFullAPIMockRecorder) NewKeyBindCustom(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewKeyBindCustom", reflect.TypeOf((*MockIFullAPI)(nil).NewKeyBindCustom), arg0, arg1, arg2, arg3, arg4) -} - -// NewKeyBindFromTemplate mocks base method. -func (m *MockIFullAPI) NewKeyBindFromTemplate(arg0 context.Context, arg1 string, arg2 address.Address, arg3, arg4 string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewKeyBindFromTemplate", arg0, arg1, arg2, arg3, arg4) - ret0, _ := ret[0].(error) - return ret0 -} - -// NewKeyBindFromTemplate indicates an expected call of NewKeyBindFromTemplate. -func (mr *MockIFullAPIMockRecorder) NewKeyBindFromTemplate(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewKeyBindFromTemplate", reflect.TypeOf((*MockIFullAPI)(nil).NewKeyBindFromTemplate), arg0, arg1, arg2, arg3, arg4) -} - -// NewMethodTemplate mocks base method. -func (m *MockIFullAPI) NewMethodTemplate(arg0 context.Context, arg1 string, arg2 []string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewMethodTemplate", arg0, arg1, arg2) - ret0, _ := ret[0].(error) - return ret0 -} - -// NewMethodTemplate indicates an expected call of NewMethodTemplate. -func (mr *MockIFullAPIMockRecorder) NewMethodTemplate(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewMethodTemplate", reflect.TypeOf((*MockIFullAPI)(nil).NewMethodTemplate), arg0, arg1, arg2) -} - -// NewMsgTypeTemplate mocks base method. -func (m *MockIFullAPI) NewMsgTypeTemplate(arg0 context.Context, arg1 string, arg2 []int) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewMsgTypeTemplate", arg0, arg1, arg2) - ret0, _ := ret[0].(error) - return ret0 -} - -// NewMsgTypeTemplate indicates an expected call of NewMsgTypeTemplate. -func (mr *MockIFullAPIMockRecorder) NewMsgTypeTemplate(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewMsgTypeTemplate", reflect.TypeOf((*MockIFullAPI)(nil).NewMsgTypeTemplate), arg0, arg1, arg2) -} - -// NewStToken mocks base method. -func (m *MockIFullAPI) NewStToken(arg0 context.Context, arg1 string) (string, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewStToken", arg0, arg1) - ret0, _ := ret[0].(string) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// NewStToken indicates an expected call of NewStToken. -func (mr *MockIFullAPIMockRecorder) NewStToken(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewStToken", reflect.TypeOf((*MockIFullAPI)(nil).NewStToken), arg0, arg1) -} - -// RemoveGroup mocks base method. -func (m *MockIFullAPI) RemoveGroup(arg0 context.Context, arg1 string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RemoveGroup", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// RemoveGroup indicates an expected call of RemoveGroup. -func (mr *MockIFullAPIMockRecorder) RemoveGroup(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveGroup", reflect.TypeOf((*MockIFullAPI)(nil).RemoveGroup), arg0, arg1) -} - -// RemoveKeyBind mocks base method. -func (m *MockIFullAPI) RemoveKeyBind(arg0 context.Context, arg1 string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RemoveKeyBind", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// RemoveKeyBind indicates an expected call of RemoveKeyBind. -func (mr *MockIFullAPIMockRecorder) RemoveKeyBind(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveKeyBind", reflect.TypeOf((*MockIFullAPI)(nil).RemoveKeyBind), arg0, arg1) -} - -// RemoveKeyBindByAddress mocks base method. -func (m *MockIFullAPI) RemoveKeyBindByAddress(arg0 context.Context, arg1 address.Address) (int64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RemoveKeyBindByAddress", arg0, arg1) - ret0, _ := ret[0].(int64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RemoveKeyBindByAddress indicates an expected call of RemoveKeyBindByAddress. -func (mr *MockIFullAPIMockRecorder) RemoveKeyBindByAddress(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveKeyBindByAddress", reflect.TypeOf((*MockIFullAPI)(nil).RemoveKeyBindByAddress), arg0, arg1) -} - -// RemoveMethodFromKeyBind mocks base method. -func (m *MockIFullAPI) RemoveMethodFromKeyBind(arg0 context.Context, arg1 string, arg2 []string) (*wallet.KeyBind, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RemoveMethodFromKeyBind", arg0, arg1, arg2) - ret0, _ := ret[0].(*wallet.KeyBind) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RemoveMethodFromKeyBind indicates an expected call of RemoveMethodFromKeyBind. -func (mr *MockIFullAPIMockRecorder) RemoveMethodFromKeyBind(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveMethodFromKeyBind", reflect.TypeOf((*MockIFullAPI)(nil).RemoveMethodFromKeyBind), arg0, arg1, arg2) -} - -// RemoveMethodTemplate mocks base method. -func (m *MockIFullAPI) RemoveMethodTemplate(arg0 context.Context, arg1 string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RemoveMethodTemplate", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// RemoveMethodTemplate indicates an expected call of RemoveMethodTemplate. -func (mr *MockIFullAPIMockRecorder) RemoveMethodTemplate(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveMethodTemplate", reflect.TypeOf((*MockIFullAPI)(nil).RemoveMethodTemplate), arg0, arg1) -} - -// RemoveMsgTypeFromKeyBind mocks base method. -func (m *MockIFullAPI) RemoveMsgTypeFromKeyBind(arg0 context.Context, arg1 string, arg2 []int) (*wallet.KeyBind, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RemoveMsgTypeFromKeyBind", arg0, arg1, arg2) - ret0, _ := ret[0].(*wallet.KeyBind) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RemoveMsgTypeFromKeyBind indicates an expected call of RemoveMsgTypeFromKeyBind. -func (mr *MockIFullAPIMockRecorder) RemoveMsgTypeFromKeyBind(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveMsgTypeFromKeyBind", reflect.TypeOf((*MockIFullAPI)(nil).RemoveMsgTypeFromKeyBind), arg0, arg1, arg2) -} - -// RemoveMsgTypeTemplate mocks base method. -func (m *MockIFullAPI) RemoveMsgTypeTemplate(arg0 context.Context, arg1 string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RemoveMsgTypeTemplate", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// RemoveMsgTypeTemplate indicates an expected call of RemoveMsgTypeTemplate. -func (mr *MockIFullAPIMockRecorder) RemoveMsgTypeTemplate(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveMsgTypeTemplate", reflect.TypeOf((*MockIFullAPI)(nil).RemoveMsgTypeTemplate), arg0, arg1) -} - -// RemoveStToken mocks base method. -func (m *MockIFullAPI) RemoveStToken(arg0 context.Context, arg1 string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RemoveStToken", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// RemoveStToken indicates an expected call of RemoveStToken. -func (mr *MockIFullAPIMockRecorder) RemoveStToken(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveStToken", reflect.TypeOf((*MockIFullAPI)(nil).RemoveStToken), arg0, arg1) -} - -// ScopeWallet mocks base method. -func (m *MockIFullAPI) ScopeWallet(arg0 context.Context) (*wallet.AddressScope, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ScopeWallet", arg0) - ret0, _ := ret[0].(*wallet.AddressScope) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ScopeWallet indicates an expected call of ScopeWallet. -func (mr *MockIFullAPIMockRecorder) ScopeWallet(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ScopeWallet", reflect.TypeOf((*MockIFullAPI)(nil).ScopeWallet), arg0) -} - // SetPassword mocks base method. func (m *MockIFullAPI) SetPassword(arg0 context.Context, arg1 string) error { m.ctrl.T.Helper() @@ -607,20 +196,6 @@ func (mr *MockIFullAPIMockRecorder) Unlock(arg0, arg1 interface{}) *gomock.Call return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unlock", reflect.TypeOf((*MockIFullAPI)(nil).Unlock), arg0, arg1) } -// Verify mocks base method. -func (m *MockIFullAPI) Verify(arg0 context.Context, arg1 address.Address, arg2 types0.MsgType, arg3 *types.Message) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Verify", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].(error) - return ret0 -} - -// Verify indicates an expected call of Verify. -func (mr *MockIFullAPIMockRecorder) Verify(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Verify", reflect.TypeOf((*MockIFullAPI)(nil).Verify), arg0, arg1, arg2, arg3) -} - // VerifyPassword mocks base method. func (m *MockIFullAPI) VerifyPassword(arg0 context.Context, arg1 string) error { m.ctrl.T.Helper() @@ -636,10 +211,10 @@ func (mr *MockIFullAPIMockRecorder) VerifyPassword(arg0, arg1 interface{}) *gomo } // Version mocks base method. -func (m *MockIFullAPI) Version(arg0 context.Context) (types0.Version, error) { +func (m *MockIFullAPI) Version(arg0 context.Context) (types.Version, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Version", arg0) - ret0, _ := ret[0].(types0.Version) + ret0, _ := ret[0].(types.Version) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -665,10 +240,10 @@ func (mr *MockIFullAPIMockRecorder) WalletDelete(arg0, arg1 interface{}) *gomock } // WalletExport mocks base method. -func (m *MockIFullAPI) WalletExport(arg0 context.Context, arg1 address.Address) (*types0.KeyInfo, error) { +func (m *MockIFullAPI) WalletExport(arg0 context.Context, arg1 address.Address) (*types.KeyInfo, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "WalletExport", arg0, arg1) - ret0, _ := ret[0].(*types0.KeyInfo) + ret0, _ := ret[0].(*types.KeyInfo) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -695,7 +270,7 @@ func (mr *MockIFullAPIMockRecorder) WalletHas(arg0, arg1 interface{}) *gomock.Ca } // WalletImport mocks base method. -func (m *MockIFullAPI) WalletImport(arg0 context.Context, arg1 *types0.KeyInfo) (address.Address, error) { +func (m *MockIFullAPI) WalletImport(arg0 context.Context, arg1 *types.KeyInfo) (address.Address, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "WalletImport", arg0, arg1) ret0, _ := ret[0].(address.Address) @@ -725,7 +300,7 @@ func (mr *MockIFullAPIMockRecorder) WalletList(arg0 interface{}) *gomock.Call { } // WalletNew mocks base method. -func (m *MockIFullAPI) WalletNew(arg0 context.Context, arg1 types0.KeyType) (address.Address, error) { +func (m *MockIFullAPI) WalletNew(arg0 context.Context, arg1 types.KeyType) (address.Address, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "WalletNew", arg0, arg1) ret0, _ := ret[0].(address.Address) @@ -740,7 +315,7 @@ func (mr *MockIFullAPIMockRecorder) WalletNew(arg0, arg1 interface{}) *gomock.Ca } // WalletSign mocks base method. -func (m *MockIFullAPI) WalletSign(arg0 context.Context, arg1 address.Address, arg2 []byte, arg3 types0.MsgMeta) (*crypto.Signature, error) { +func (m *MockIFullAPI) WalletSign(arg0 context.Context, arg1 address.Address, arg2 []byte, arg3 types.MsgMeta) (*crypto.Signature, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "WalletSign", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*crypto.Signature) diff --git a/venus-shared/api/wallet/proxy_gen.go b/venus-shared/api/wallet/proxy_gen.go index fad48f184c..f2b1c2eb06 100644 --- a/venus-shared/api/wallet/proxy_gen.go +++ b/venus-shared/api/wallet/proxy_gen.go @@ -9,146 +9,8 @@ import ( "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/venus/venus-shared/types" - "github.com/filecoin-project/venus/venus-shared/types/wallet" ) -type IStrategyVerifyStruct struct { - Internal struct { - ContainWallet func(ctx context.Context, address address.Address) bool `perm:"admin"` - ScopeWallet func(ctx context.Context) (*wallet.AddressScope, error) `perm:"admin"` - Verify func(ctx context.Context, address address.Address, msgType types.MsgType, msg *types.Message) error `perm:"admin"` - } -} - -func (s *IStrategyVerifyStruct) ContainWallet(p0 context.Context, p1 address.Address) bool { - return s.Internal.ContainWallet(p0, p1) -} -func (s *IStrategyVerifyStruct) ScopeWallet(p0 context.Context) (*wallet.AddressScope, error) { - return s.Internal.ScopeWallet(p0) -} -func (s *IStrategyVerifyStruct) Verify(p0 context.Context, p1 address.Address, p2 types.MsgType, p3 *types.Message) error { - return s.Internal.Verify(p0, p1, p2, p3) -} - -type IStrategyStruct struct { - Internal struct { - AddMethodIntoKeyBind func(ctx context.Context, name string, methods []string) (*wallet.KeyBind, error) `perm:"admin"` - AddMsgTypeIntoKeyBind func(ctx context.Context, name string, codes []int) (*wallet.KeyBind, error) `perm:"admin"` - GetGroupByName func(ctx context.Context, name string) (*wallet.Group, error) `perm:"admin"` - GetKeyBindByName func(ctx context.Context, name string) (*wallet.KeyBind, error) `perm:"admin"` - GetKeyBinds func(ctx context.Context, address address.Address) ([]*wallet.KeyBind, error) `perm:"admin"` - GetMethodTemplateByName func(ctx context.Context, name string) (*wallet.MethodTemplate, error) `perm:"admin"` - GetMsgTypeTemplate func(ctx context.Context, name string) (*wallet.MsgTypeTemplate, error) `perm:"admin"` - GetWalletTokenInfo func(ctx context.Context, token string) (*wallet.GroupAuth, error) `perm:"admin"` - GetWalletTokensByGroup func(ctx context.Context, groupName string) ([]string, error) `perm:"admin"` - ListGroups func(ctx context.Context, fromIndex, toIndex int) ([]*wallet.Group, error) `perm:"admin"` - ListKeyBinds func(ctx context.Context, fromIndex, toIndex int) ([]*wallet.KeyBind, error) `perm:"admin"` - ListMethodTemplates func(ctx context.Context, fromIndex, toIndex int) ([]*wallet.MethodTemplate, error) `perm:"admin"` - ListMsgTypeTemplates func(ctx context.Context, fromIndex, toIndex int) ([]*wallet.MsgTypeTemplate, error) `perm:"admin"` - NewGroup func(ctx context.Context, name string, keyBindNames []string) error `perm:"admin"` - NewKeyBindCustom func(ctx context.Context, name string, address address.Address, codes []int, methods []wallet.MethodName) error `perm:"admin"` - NewKeyBindFromTemplate func(ctx context.Context, name string, address address.Address, mttName, mtName string) error `perm:"admin"` - NewMethodTemplate func(ctx context.Context, name string, methods []string) error `perm:"admin"` - NewMsgTypeTemplate func(ctx context.Context, name string, codes []int) error `perm:"admin"` - NewStToken func(ctx context.Context, groupName string) (token string, err error) `perm:"admin"` - RemoveGroup func(ctx context.Context, name string) error `perm:"admin"` - RemoveKeyBind func(ctx context.Context, name string) error `perm:"admin"` - RemoveKeyBindByAddress func(ctx context.Context, address address.Address) (int64, error) `perm:"admin"` - RemoveMethodFromKeyBind func(ctx context.Context, name string, methods []string) (*wallet.KeyBind, error) `perm:"admin"` - RemoveMethodTemplate func(ctx context.Context, name string) error `perm:"admin"` - RemoveMsgTypeFromKeyBind func(ctx context.Context, name string, codes []int) (*wallet.KeyBind, error) `perm:"admin"` - RemoveMsgTypeTemplate func(ctx context.Context, name string) error `perm:"admin"` - RemoveStToken func(ctx context.Context, token string) error `perm:"admin"` - } -} - -func (s *IStrategyStruct) AddMethodIntoKeyBind(p0 context.Context, p1 string, p2 []string) (*wallet.KeyBind, error) { - return s.Internal.AddMethodIntoKeyBind(p0, p1, p2) -} -func (s *IStrategyStruct) AddMsgTypeIntoKeyBind(p0 context.Context, p1 string, p2 []int) (*wallet.KeyBind, error) { - return s.Internal.AddMsgTypeIntoKeyBind(p0, p1, p2) -} -func (s *IStrategyStruct) GetGroupByName(p0 context.Context, p1 string) (*wallet.Group, error) { - return s.Internal.GetGroupByName(p0, p1) -} -func (s *IStrategyStruct) GetKeyBindByName(p0 context.Context, p1 string) (*wallet.KeyBind, error) { - return s.Internal.GetKeyBindByName(p0, p1) -} -func (s *IStrategyStruct) GetKeyBinds(p0 context.Context, p1 address.Address) ([]*wallet.KeyBind, error) { - return s.Internal.GetKeyBinds(p0, p1) -} -func (s *IStrategyStruct) GetMethodTemplateByName(p0 context.Context, p1 string) (*wallet.MethodTemplate, error) { - return s.Internal.GetMethodTemplateByName(p0, p1) -} -func (s *IStrategyStruct) GetMsgTypeTemplate(p0 context.Context, p1 string) (*wallet.MsgTypeTemplate, error) { - return s.Internal.GetMsgTypeTemplate(p0, p1) -} -func (s *IStrategyStruct) GetWalletTokenInfo(p0 context.Context, p1 string) (*wallet.GroupAuth, error) { - return s.Internal.GetWalletTokenInfo(p0, p1) -} -func (s *IStrategyStruct) GetWalletTokensByGroup(p0 context.Context, p1 string) ([]string, error) { - return s.Internal.GetWalletTokensByGroup(p0, p1) -} -func (s *IStrategyStruct) ListGroups(p0 context.Context, p1, p2 int) ([]*wallet.Group, error) { - return s.Internal.ListGroups(p0, p1, p2) -} -func (s *IStrategyStruct) ListKeyBinds(p0 context.Context, p1, p2 int) ([]*wallet.KeyBind, error) { - return s.Internal.ListKeyBinds(p0, p1, p2) -} -func (s *IStrategyStruct) ListMethodTemplates(p0 context.Context, p1, p2 int) ([]*wallet.MethodTemplate, error) { - return s.Internal.ListMethodTemplates(p0, p1, p2) -} -func (s *IStrategyStruct) ListMsgTypeTemplates(p0 context.Context, p1, p2 int) ([]*wallet.MsgTypeTemplate, error) { - return s.Internal.ListMsgTypeTemplates(p0, p1, p2) -} -func (s *IStrategyStruct) NewGroup(p0 context.Context, p1 string, p2 []string) error { - return s.Internal.NewGroup(p0, p1, p2) -} -func (s *IStrategyStruct) NewKeyBindCustom(p0 context.Context, p1 string, p2 address.Address, p3 []int, p4 []wallet.MethodName) error { - return s.Internal.NewKeyBindCustom(p0, p1, p2, p3, p4) -} -func (s *IStrategyStruct) NewKeyBindFromTemplate(p0 context.Context, p1 string, p2 address.Address, p3, p4 string) error { - return s.Internal.NewKeyBindFromTemplate(p0, p1, p2, p3, p4) -} -func (s *IStrategyStruct) NewMethodTemplate(p0 context.Context, p1 string, p2 []string) error { - return s.Internal.NewMethodTemplate(p0, p1, p2) -} -func (s *IStrategyStruct) NewMsgTypeTemplate(p0 context.Context, p1 string, p2 []int) error { - return s.Internal.NewMsgTypeTemplate(p0, p1, p2) -} -func (s *IStrategyStruct) NewStToken(p0 context.Context, p1 string) (string, error) { - return s.Internal.NewStToken(p0, p1) -} -func (s *IStrategyStruct) RemoveGroup(p0 context.Context, p1 string) error { - return s.Internal.RemoveGroup(p0, p1) -} -func (s *IStrategyStruct) RemoveKeyBind(p0 context.Context, p1 string) error { - return s.Internal.RemoveKeyBind(p0, p1) -} -func (s *IStrategyStruct) RemoveKeyBindByAddress(p0 context.Context, p1 address.Address) (int64, error) { - return s.Internal.RemoveKeyBindByAddress(p0, p1) -} -func (s *IStrategyStruct) RemoveMethodFromKeyBind(p0 context.Context, p1 string, p2 []string) (*wallet.KeyBind, error) { - return s.Internal.RemoveMethodFromKeyBind(p0, p1, p2) -} -func (s *IStrategyStruct) RemoveMethodTemplate(p0 context.Context, p1 string) error { - return s.Internal.RemoveMethodTemplate(p0, p1) -} -func (s *IStrategyStruct) RemoveMsgTypeFromKeyBind(p0 context.Context, p1 string, p2 []int) (*wallet.KeyBind, error) { - return s.Internal.RemoveMsgTypeFromKeyBind(p0, p1, p2) -} -func (s *IStrategyStruct) RemoveMsgTypeTemplate(p0 context.Context, p1 string) error { - return s.Internal.RemoveMsgTypeTemplate(p0, p1) -} -func (s *IStrategyStruct) RemoveStToken(p0 context.Context, p1 string) error { - return s.Internal.RemoveStToken(p0, p1) -} - -type ILocalStrategyStruct struct { - IStrategyVerifyStruct - IStrategyStruct -} - type IWalletStruct struct { Internal struct { WalletDelete func(ctx context.Context, addr address.Address) error `perm:"admin"` @@ -212,11 +74,12 @@ type ILocalWalletStruct struct { type ICommonStruct struct { Internal struct { - AuthNew func(ctx context.Context, perms []auth.Permission) ([]byte, error) `perm:"admin"` - AuthVerify func(ctx context.Context, token string) ([]auth.Permission, error) `perm:"read"` - LogList func(context.Context) ([]string, error) `perm:"read"` - LogSetLevel func(context.Context, string, string) error `perm:"write"` - Version func(ctx context.Context) (types.Version, error) `perm:"read"` + AuthNew func(ctx context.Context, perms []auth.Permission) ([]byte, error) `perm:"admin"` + AuthVerify func(ctx context.Context, token string) ([]auth.Permission, error) `perm:"read"` + ListSignedRecord func(ctx context.Context, param *types.QuerySignRecordParams) ([]types.SignRecord, error) `perm:"read"` + LogList func(context.Context) ([]string, error) `perm:"read"` + LogSetLevel func(context.Context, string, string) error `perm:"write"` + Version func(ctx context.Context) (types.Version, error) `perm:"read"` } } @@ -226,6 +89,9 @@ func (s *ICommonStruct) AuthNew(p0 context.Context, p1 []auth.Permission) ([]byt func (s *ICommonStruct) AuthVerify(p0 context.Context, p1 string) ([]auth.Permission, error) { return s.Internal.AuthVerify(p0, p1) } +func (s *ICommonStruct) ListSignedRecord(p0 context.Context, p1 *types.QuerySignRecordParams) ([]types.SignRecord, error) { + return s.Internal.ListSignedRecord(p0, p1) +} func (s *ICommonStruct) LogList(p0 context.Context) ([]string, error) { return s.Internal.LogList(p0) } func (s *ICommonStruct) LogSetLevel(p0 context.Context, p1 string, p2 string) error { return s.Internal.LogSetLevel(p0, p1, p2) @@ -249,7 +115,6 @@ func (s *IWalletEventStruct) AddSupportAccount(p0 context.Context, p1 string) er } type IFullAPIStruct struct { - ILocalStrategyStruct ILocalWalletStruct ICommonStruct IWalletEventStruct diff --git a/venus-shared/api/wallet/strategy.go b/venus-shared/api/wallet/strategy.go deleted file mode 100644 index b19f643fdb..0000000000 --- a/venus-shared/api/wallet/strategy.go +++ /dev/null @@ -1,82 +0,0 @@ -package wallet - -import ( - "context" - - "github.com/filecoin-project/go-address" - "github.com/filecoin-project/venus/venus-shared/types" - "github.com/filecoin-project/venus/venus-shared/types/wallet" -) - -type ILocalStrategy interface { - IStrategyVerify - IStrategy -} - -type IStrategyVerify interface { - // Verify verify the address strategy permissions - Verify(ctx context.Context, address address.Address, msgType types.MsgType, msg *types.Message) error //perm:admin - // ScopeWallet get the wallet scope - ScopeWallet(ctx context.Context) (*wallet.AddressScope, error) //perm:admin - // ContainWallet Check if it is visible to the wallet - ContainWallet(ctx context.Context, address address.Address) bool //perm:admin -} - -type IStrategy interface { - // NewMsgTypeTemplate create a msgType template - NewMsgTypeTemplate(ctx context.Context, name string, codes []int) error //perm:admin - // NewMethodTemplate create a method template - NewMethodTemplate(ctx context.Context, name string, methods []string) error //perm:admin - // NewKeyBindCustom create a keyBind with custom msyTypes and methods - NewKeyBindCustom(ctx context.Context, name string, address address.Address, codes []int, methods []wallet.MethodName) error //perm:admin - // NewKeyBindFromTemplate create a keyBind form msgType template and method template - NewKeyBindFromTemplate(ctx context.Context, name string, address address.Address, mttName, mtName string) error //perm:admin - // NewGroup create a group to group multiple keyBinds together - NewGroup(ctx context.Context, name string, keyBindNames []string) error //perm:admin - // NewStToken generate a random token from group - NewStToken(ctx context.Context, groupName string) (token string, err error) //perm:admin - // GetMsgTypeTemplate get a msgType template by name - GetMsgTypeTemplate(ctx context.Context, name string) (*wallet.MsgTypeTemplate, error) //perm:admin - // GetMethodTemplateByName get a method template by name - GetMethodTemplateByName(ctx context.Context, name string) (*wallet.MethodTemplate, error) //perm:admin - // GetKeyBindByName get a keyBind by name - GetKeyBindByName(ctx context.Context, name string) (*wallet.KeyBind, error) //perm:admin - // GetKeyBinds list keyBinds by address - GetKeyBinds(ctx context.Context, address address.Address) ([]*wallet.KeyBind, error) //perm:admin - // GetGroupByName get a group by name - GetGroupByName(ctx context.Context, name string) (*wallet.Group, error) //perm:admin - // GetWalletTokensByGroup list strategy tokens under the group - GetWalletTokensByGroup(ctx context.Context, groupName string) ([]string, error) //perm:admin - // GetWalletTokenInfo get group details by token - GetWalletTokenInfo(ctx context.Context, token string) (*wallet.GroupAuth, error) //perm:admin - // ListGroups list groups' simple information - ListGroups(ctx context.Context, fromIndex, toIndex int) ([]*wallet.Group, error) //perm:admin - // ListKeyBinds list keyBinds' details - ListKeyBinds(ctx context.Context, fromIndex, toIndex int) ([]*wallet.KeyBind, error) //perm:admin - // ListMethodTemplates list method templates' details - ListMethodTemplates(ctx context.Context, fromIndex, toIndex int) ([]*wallet.MethodTemplate, error) //perm:admin - // ListMsgTypeTemplates list msgType templates' details - ListMsgTypeTemplates(ctx context.Context, fromIndex, toIndex int) ([]*wallet.MsgTypeTemplate, error) //perm:admin - - // AddMsgTypeIntoKeyBind append msgTypes into keyBind - AddMsgTypeIntoKeyBind(ctx context.Context, name string, codes []int) (*wallet.KeyBind, error) //perm:admin - // AddMethodIntoKeyBind append methods into keyBind - AddMethodIntoKeyBind(ctx context.Context, name string, methods []string) (*wallet.KeyBind, error) //perm:admin - // RemoveMsgTypeFromKeyBind remove msgTypes form keyBind - RemoveMsgTypeFromKeyBind(ctx context.Context, name string, codes []int) (*wallet.KeyBind, error) //perm:admin - // RemoveMethodFromKeyBind remove methods from keyBind - RemoveMethodFromKeyBind(ctx context.Context, name string, methods []string) (*wallet.KeyBind, error) //perm:admin - - // RemoveMsgTypeTemplate delete msgType template by name - RemoveMsgTypeTemplate(ctx context.Context, name string) error //perm:admin - // RemoveGroup delete group by name - RemoveGroup(ctx context.Context, name string) error //perm:admin - // RemoveMethodTemplate delete method template by name - RemoveMethodTemplate(ctx context.Context, name string) error //perm:admin - // RemoveKeyBind delete keyBind by name - RemoveKeyBind(ctx context.Context, name string) error //perm:admin - // RemoveKeyBindByAddress delete some keyBinds by address - RemoveKeyBindByAddress(ctx context.Context, address address.Address) (int64, error) //perm:admin - // RemoveStToken delete strategy token - RemoveStToken(ctx context.Context, token string) error //perm:admin -} diff --git a/venus-shared/types/msg_meta.go b/venus-shared/types/msg_meta.go index 2efb4e7e8a..9f59b2f86e 100644 --- a/venus-shared/types/msg_meta.go +++ b/venus-shared/types/msg_meta.go @@ -1,9 +1,17 @@ package types +import ( + "time" + + "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-state-types/crypto" +) + type MsgType string const ( - MTUnknown = MsgType("unknown") + MTUndefined = MsgType("") + MTUnknown = MsgType("unknown") // Signing message CID. MsgMeta.Extra contains raw cbor message bytes MTChainMsg = MsgType("message") @@ -39,3 +47,24 @@ type MsgMeta struct { // signed bytes (e.g. CID(Extra).Bytes() == toSign) Extra []byte } + +type QuerySignRecordParams struct { + ID string + Type MsgType + Signer address.Address + IsError bool + Skip int + Limit int + After time.Time + Before time.Time +} + +type SignRecord struct { + ID string + Type MsgType + Signer address.Address + Err error + RawMsg []byte + Signature *crypto.Signature + CreateAt time.Time +}