File tree Expand file tree Collapse file tree
site/src/components/permissions Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 "url" : " https://github.com/MetaMask/snap-7715-permissions.git"
88 },
99 "source" : {
10- "shasum" : " 0TP5ydRCXNvDxWxjTs7Rp1v5C85Ld3tPabxulFWKWHo =" ,
10+ "shasum" : " /p0aPugcJzMS6wNekI/ZtyJUQ/5EsupvbPDiT4cPebg =" ,
1111 "location" : {
1212 "npm" : {
1313 "filePath" : " dist/bundle.js" ,
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ export async function createConfirmationContent({
6262 } ,
6363 {
6464 label : 'Token' ,
65- text : context . accountDetails . symbol ,
65+ text : context . tokenMetadata . symbol ,
6666 } ,
6767 ] ;
6868
@@ -76,6 +76,7 @@ export async function createConfirmationContent({
7676 />
7777 < AccountDetails
7878 account = { context . accountDetails }
79+ tokenMetadata = { context . tokenMetadata }
7980 title = "Stream from"
8081 tooltip = "The account that the token stream comes from."
8182 />
@@ -97,7 +98,7 @@ export async function createConfirmationContent({
9798 < Input
9899 name = "stream-rate"
99100 type = "text"
100- value = { `${ amountPerSecond } ${ context . accountDetails . symbol } /sec` }
101+ value = { `${ amountPerSecond } ${ context . tokenMetadata . symbol } /sec` }
101102 disabled = { true }
102103 />
103104 </ Field >
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ export async function applyContext({
3939} ) : Promise < Erc20TokenStreamPermissionRequest > {
4040 const {
4141 permissionDetails,
42- accountDetails : { decimals } ,
42+ tokenMetadata : { decimals } ,
4343 } = context ;
4444 const expiry = convertReadableDateToTimestamp ( context . expiry ) ;
4545
@@ -136,7 +136,6 @@ export async function buildContext({
136136 decimals ,
137137 ) ;
138138
139- // todo: this should just be BigInt
140139 const balance = toHex ( rawBalance ) ;
141140
142141 const expiry = convertTimestampToReadableDate ( permissionRequest . expiry ) ;
@@ -179,6 +178,8 @@ export async function buildContext({
179178 address,
180179 balance,
181180 balanceFormattedAsCurrency : balanceFormatted ,
181+ } ,
182+ tokenMetadata : {
182183 symbol,
183184 decimals,
184185 } ,
@@ -206,7 +207,7 @@ export async function deriveMetadata({
206207 const {
207208 permissionDetails,
208209 expiry,
209- accountDetails : { decimals } ,
210+ tokenMetadata : { decimals } ,
210211 } = context ;
211212
212213 const validationErrors : Erc20TokenStreamMetadata [ 'validationErrors' ] = { } ;
Original file line number Diff line number Diff line change @@ -24,12 +24,13 @@ export type Erc20TokenStreamMetadata = {
2424 } ;
2525} ;
2626
27- // todo: move accountDetails to the base context so that accountDetails formatting is shared between permissions
2827export type Erc20TokenStreamContext = BaseContext & {
2928 accountDetails : {
3029 address : Hex ;
3130 balanceFormattedAsCurrency : string ;
3231 balance : Hex ;
32+ } ;
33+ tokenMetadata : {
3334 decimals : number ;
3435 symbol : string ;
3536 } ;
Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ export async function createConfirmationContent({
7575 />
7676 < AccountDetails
7777 account = { context . accountDetails }
78+ tokenMetadata = { context . tokenMetadata }
7879 title = "Transfer from"
7980 tooltip = "The account that the token transfers come from."
8081 />
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export async function applyContext({
3636} ) : Promise < NativeTokenPeriodicPermissionRequest > {
3737 const {
3838 permissionDetails,
39- accountDetails : { decimals } ,
39+ tokenMetadata : { decimals } ,
4040 } = context ;
4141 const expiry = convertReadableDateToTimestamp ( context . expiry ) ;
4242
@@ -155,6 +155,8 @@ export async function buildContext({
155155 address,
156156 balance,
157157 balanceFormattedAsCurrency : balanceFormatted ,
158+ } ,
159+ tokenMetadata : {
158160 symbol,
159161 decimals,
160162 } ,
@@ -181,7 +183,7 @@ export async function deriveMetadata({
181183 const {
182184 permissionDetails,
183185 expiry,
184- accountDetails : { decimals } ,
186+ tokenMetadata : { decimals } ,
185187 } = context ;
186188
187189 const validationErrors : NativeTokenPeriodicMetadata [ 'validationErrors' ] = { } ;
Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ export type NativeTokenPeriodicContext = BaseContext & {
2828 address : Hex ;
2929 balanceFormattedAsCurrency : string ;
3030 balance : Hex ;
31+ } ;
32+ tokenMetadata : {
3133 decimals : number ;
3234 symbol : string ;
3335 } ;
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ export async function createConfirmationContent({
7070 } ,
7171 {
7272 label : 'Token' ,
73- text : context . accountDetails . symbol ,
73+ text : context . tokenMetadata . symbol ,
7474 iconUrl : IconUrls . ethereum . token ,
7575 } ,
7676 ] ;
@@ -85,6 +85,7 @@ export async function createConfirmationContent({
8585 />
8686 < AccountDetails
8787 account = { context . accountDetails }
88+ tokenMetadata = { context . tokenMetadata }
8889 title = "Stream from"
8990 tooltip = "The account that the token stream comes from."
9091 />
@@ -106,7 +107,7 @@ export async function createConfirmationContent({
106107 < Box >
107108 < Image
108109 src = { IconUrls . ethereum . token }
109- alt = { `${ context . accountDetails . symbol } token icon` }
110+ alt = { `${ context . tokenMetadata . symbol } token icon` }
110111 />
111112 </ Box >
112113 < Input
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ export async function applyContext({
3939} ) : Promise < NativeTokenStreamPermissionRequest > {
4040 const {
4141 permissionDetails,
42- accountDetails : { decimals } ,
42+ tokenMetadata : { decimals } ,
4343 } = context ;
4444 const expiry = convertReadableDateToTimestamp ( context . expiry ) ;
4545
@@ -171,11 +171,12 @@ export async function buildContext({
171171 expiry,
172172 justification : permissionRequest . permission . data . justification ,
173173 isAdjustmentAllowed : permissionRequest . isAdjustmentAllowed ?? true ,
174- // todo: we should consider removing the accountDetails from the context object, and into it's own object
175174 accountDetails : {
176175 address,
177176 balance,
178177 balanceFormattedAsCurrency : balanceFormatted ,
178+ } ,
179+ tokenMetadata : {
179180 symbol,
180181 decimals,
181182 } ,
@@ -203,7 +204,7 @@ export async function deriveMetadata({
203204 const {
204205 permissionDetails,
205206 expiry,
206- accountDetails : { decimals } ,
207+ tokenMetadata : { decimals } ,
207208 } = context ;
208209
209210 const validationErrors : NativeTokenStreamMetadata [ 'validationErrors' ] = { } ;
Original file line number Diff line number Diff line change @@ -24,12 +24,13 @@ export type NativeTokenStreamMetadata = {
2424 } ;
2525} ;
2626
27- // todo: move accountDetails to the base context so that accountDetails formatting is shared between permissions
2827export type NativeTokenStreamContext = BaseContext & {
2928 accountDetails : {
3029 address : Hex ;
3130 balanceFormattedAsCurrency : string ;
3231 balance : Hex ;
32+ } ;
33+ tokenMetadata : {
3334 decimals : number ;
3435 symbol : string ;
3536 } ;
You can’t perform that action at this time.
0 commit comments