Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding wallet sign in needed methods
- Loading branch information
1 parent
cd0c48f
commit b92b792
Showing
5 changed files
with
176 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { MethodMetadata, Parameter } from '..'; | ||
import { useMasaMutation, useRestCall } from '../../helpers/rest-calls'; | ||
|
||
const path = 'session/check-signature'; | ||
|
||
export function useMethod({ body }: any) { | ||
const { data, error, loading, getData } = useRestCall({ | ||
headers: Headers, | ||
metadata, | ||
body, | ||
}); | ||
|
||
return { data, error, loading, getData }; | ||
} | ||
|
||
export function useSimpleMethod({ pathParameters, body, settings }: any) { | ||
const masaQuery = useMasaMutation( | ||
'check-challenge-signature', | ||
{ | ||
pathParameters, | ||
headers: Headers, | ||
body, | ||
metadata, | ||
}, | ||
settings | ||
); | ||
return masaQuery; | ||
} | ||
|
||
const parameters: Parameter[] = [ | ||
{ | ||
key: 1, | ||
name: 'signature', | ||
description: 'Challenge signature', | ||
required: 'yes', | ||
default: '', | ||
dataType: 'string', | ||
}, | ||
{ | ||
key: 2, | ||
name: 'address', | ||
description: 'User address', | ||
required: 'yes', | ||
default: '', | ||
dataType: 'string', | ||
}, | ||
]; | ||
|
||
export const metadata: MethodMetadata = { | ||
author: 'Hide on bush', | ||
authorPicture: '', | ||
description: 'Send signed challenge to backend for authentication', | ||
name: path, | ||
method: 'POST', | ||
parameters: parameters, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { MethodMetadata } from '..'; | ||
import { Headers } from '../../helpers/axios'; | ||
import { useMasaQuery, useRestCall } from '../../helpers/rest-calls'; | ||
|
||
const path = 'session/get-challenge'; | ||
|
||
export function useMethod() { | ||
const { data, error, loading, getData } = useRestCall({ | ||
headers: Headers, | ||
metadata, | ||
}); | ||
return { data, error, loading, getData }; | ||
} | ||
|
||
export function useSimpleMethod({ pathParameters, body, settings }: any) { | ||
const masaQuery = useMasaQuery( | ||
'get-challenge', | ||
{ | ||
pathParameters, | ||
headers: Headers, | ||
body, | ||
metadata, | ||
}, | ||
settings | ||
); | ||
return masaQuery; | ||
} | ||
|
||
export const metadata: MethodMetadata = { | ||
author: 'Hide on bush', | ||
authorPicture: '', | ||
description: 'Get challenge', | ||
name: path, | ||
method: 'GET', | ||
parameters: [], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { MethodMetadata } from '..'; | ||
import { Headers } from '../../helpers/axios'; | ||
import { useMasaQuery, useRestCall } from '../../helpers/rest-calls'; | ||
|
||
const path = 'session/check'; | ||
|
||
export function useMethod() { | ||
const { data, error, loading, getData } = useRestCall({ | ||
headers: Headers, | ||
metadata, | ||
}); | ||
return { data, error, loading, getData }; | ||
} | ||
|
||
export function useSimpleMethod({ pathParameters, body, settings }: any) { | ||
const masaQuery = useMasaQuery( | ||
'get-session', | ||
{ | ||
pathParameters, | ||
headers: Headers, | ||
body, | ||
metadata, | ||
}, | ||
settings | ||
); | ||
return masaQuery; | ||
} | ||
|
||
export const metadata: MethodMetadata = { | ||
author: 'Hide on bush', | ||
authorPicture: '', | ||
description: 'Get session', | ||
name: path, | ||
method: 'GET', | ||
parameters: [], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { MethodMetadata, Parameter } from '..'; | ||
import { useMasaMutation, useRestCall } from '../../helpers/rest-calls'; | ||
|
||
const path = 'session/logout'; | ||
|
||
export function useMethod({ body }: any) { | ||
const { data, error, loading, getData } = useRestCall({ | ||
headers: Headers, | ||
metadata, | ||
body, | ||
}); | ||
|
||
return { data, error, loading, getData }; | ||
} | ||
|
||
export function useSimpleMethod({ pathParameters, body, settings }: any) { | ||
const masaQuery = useMasaMutation( | ||
'logout', | ||
{ | ||
pathParameters, | ||
headers: Headers, | ||
body, | ||
metadata, | ||
}, | ||
settings | ||
); | ||
return masaQuery; | ||
} | ||
|
||
const parameters: Parameter[] = []; | ||
|
||
export const metadata: MethodMetadata = { | ||
author: 'Hide on bush', | ||
authorPicture: '', | ||
description: 'Logout and remove user sesison from backend', | ||
name: path, | ||
method: 'POST', | ||
parameters: parameters, | ||
}; |