File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -127,15 +127,31 @@ export class PlatformVMAPI extends JRPCAPI {
127
127
/**
128
128
* Fetches the AVAX AssetID and returns it in a Promise.
129
129
*
130
+ * @param refresh This function caches the response. Refresh = true will bust the cache.
131
+ *
130
132
* @returns The the provided string representing the AVAX AssetID
131
133
*/
132
- getAVAXAssetID = async ( ) :Promise < Buffer > => {
133
- if ( typeof this . AVAXAssetID === 'undefined' ) {
134
+ getAVAXAssetID = async ( refresh : boolean = false ) :Promise < Buffer > => {
135
+ if ( typeof this . AVAXAssetID === 'undefined' || refresh ) {
134
136
const assetID :string = await this . getStakingAssetID ( ) ;
135
137
this . AVAXAssetID = bintools . cb58Decode ( assetID ) ;
136
138
}
137
139
return this . AVAXAssetID ;
138
140
} ;
141
+
142
+ /**
143
+ * Overrides the defaults and sets the cache to a specific AVAX AssetID
144
+ *
145
+ * @param avaxAssetID A cb58 string or Buffer representing the AVAX AssetID
146
+ *
147
+ * @returns The the provided string representing the AVAX AssetID
148
+ */
149
+ setAVAXAssetID = ( avaxAssetID :string | Buffer ) => {
150
+ if ( typeof avaxAssetID === "string" ) {
151
+ avaxAssetID = bintools . cb58Decode ( avaxAssetID ) ;
152
+ }
153
+ this . AVAXAssetID = avaxAssetID ;
154
+ }
139
155
140
156
/**
141
157
* Gets the default tx fee for this chain.
You can’t perform that action at this time.
0 commit comments