@farcaster/hub-web 0.8.3 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +282 -98
- package/dist/index.js +20 -7
- package/dist/index.mjs +27 -14
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -2700,7 +2700,7 @@ __reExport(src_exports, require("@farcaster/core"), module.exports);
|
|
2700
2700
|
|
2701
2701
|
// src/generated/rpc.ts
|
2702
2702
|
init_cjs_shims();
|
2703
|
-
var import_grpc_web =
|
2703
|
+
var import_grpc_web = require("@improbable-eng/grpc-web");
|
2704
2704
|
var import_browser_headers = __toESM(require_browser_headers());
|
2705
2705
|
var import_rxjs = require("rxjs");
|
2706
2706
|
var import_operators = require("rxjs/operators");
|
@@ -4244,7 +4244,8 @@ function createBaseFrameActionBody() {
|
|
4244
4244
|
castId: void 0,
|
4245
4245
|
inputText: new Uint8Array(),
|
4246
4246
|
state: new Uint8Array(),
|
4247
|
-
transactionId: new Uint8Array()
|
4247
|
+
transactionId: new Uint8Array(),
|
4248
|
+
address: new Uint8Array()
|
4248
4249
|
};
|
4249
4250
|
}
|
4250
4251
|
var FrameActionBody = {
|
@@ -4267,6 +4268,9 @@ var FrameActionBody = {
|
|
4267
4268
|
if (message.transactionId.length !== 0) {
|
4268
4269
|
writer.uint32(50).bytes(message.transactionId);
|
4269
4270
|
}
|
4271
|
+
if (message.address.length !== 0) {
|
4272
|
+
writer.uint32(58).bytes(message.address);
|
4273
|
+
}
|
4270
4274
|
return writer;
|
4271
4275
|
},
|
4272
4276
|
decode(input, length) {
|
@@ -4312,6 +4316,12 @@ var FrameActionBody = {
|
|
4312
4316
|
}
|
4313
4317
|
message.transactionId = reader.bytes();
|
4314
4318
|
continue;
|
4319
|
+
case 7:
|
4320
|
+
if (tag != 58) {
|
4321
|
+
break;
|
4322
|
+
}
|
4323
|
+
message.address = reader.bytes();
|
4324
|
+
continue;
|
4315
4325
|
}
|
4316
4326
|
if ((tag & 7) == 4 || tag == 0) {
|
4317
4327
|
break;
|
@@ -4327,7 +4337,8 @@ var FrameActionBody = {
|
|
4327
4337
|
castId: isSet2(object.castId) ? CastId.fromJSON(object.castId) : void 0,
|
4328
4338
|
inputText: isSet2(object.inputText) ? bytesFromBase642(object.inputText) : new Uint8Array(),
|
4329
4339
|
state: isSet2(object.state) ? bytesFromBase642(object.state) : new Uint8Array(),
|
4330
|
-
transactionId: isSet2(object.transactionId) ? bytesFromBase642(object.transactionId) : new Uint8Array()
|
4340
|
+
transactionId: isSet2(object.transactionId) ? bytesFromBase642(object.transactionId) : new Uint8Array(),
|
4341
|
+
address: isSet2(object.address) ? bytesFromBase642(object.address) : new Uint8Array()
|
4331
4342
|
};
|
4332
4343
|
},
|
4333
4344
|
toJSON(message) {
|
@@ -4340,13 +4351,14 @@ var FrameActionBody = {
|
|
4340
4351
|
message.transactionId !== void 0 && (obj.transactionId = base64FromBytes2(
|
4341
4352
|
message.transactionId !== void 0 ? message.transactionId : new Uint8Array()
|
4342
4353
|
));
|
4354
|
+
message.address !== void 0 && (obj.address = base64FromBytes2(message.address !== void 0 ? message.address : new Uint8Array()));
|
4343
4355
|
return obj;
|
4344
4356
|
},
|
4345
4357
|
create(base) {
|
4346
4358
|
return FrameActionBody.fromPartial(base != null ? base : {});
|
4347
4359
|
},
|
4348
4360
|
fromPartial(object) {
|
4349
|
-
var _a, _b, _c, _d, _e;
|
4361
|
+
var _a, _b, _c, _d, _e, _f;
|
4350
4362
|
const message = createBaseFrameActionBody();
|
4351
4363
|
message.url = (_a = object.url) != null ? _a : new Uint8Array();
|
4352
4364
|
message.buttonIndex = (_b = object.buttonIndex) != null ? _b : 0;
|
@@ -4354,6 +4366,7 @@ var FrameActionBody = {
|
|
4354
4366
|
message.inputText = (_c = object.inputText) != null ? _c : new Uint8Array();
|
4355
4367
|
message.state = (_d = object.state) != null ? _d : new Uint8Array();
|
4356
4368
|
message.transactionId = (_e = object.transactionId) != null ? _e : new Uint8Array();
|
4369
|
+
message.address = (_f = object.address) != null ? _f : new Uint8Array();
|
4357
4370
|
return message;
|
4358
4371
|
}
|
4359
4372
|
};
|
@@ -9906,14 +9919,14 @@ var GrpcWebImpl = class {
|
|
9906
9919
|
const request = { ..._request, ...methodDesc.requestType };
|
9907
9920
|
const maybeCombinedMetadata = metadata && this.options.metadata ? new import_browser_headers.BrowserHeaders({ ...(_a = this.options) == null ? void 0 : _a.metadata.headersMap, ...metadata == null ? void 0 : metadata.headersMap }) : metadata || this.options.metadata;
|
9908
9921
|
return new Promise((resolve, reject) => {
|
9909
|
-
import_grpc_web.
|
9922
|
+
import_grpc_web.grpc.unary(methodDesc, {
|
9910
9923
|
request,
|
9911
9924
|
host: this.host,
|
9912
9925
|
metadata: maybeCombinedMetadata,
|
9913
9926
|
transport: this.options.transport,
|
9914
9927
|
debug: this.options.debug,
|
9915
9928
|
onEnd: function(response) {
|
9916
|
-
if (response.status === import_grpc_web.
|
9929
|
+
if (response.status === import_grpc_web.grpc.Code.OK) {
|
9917
9930
|
resolve(response.message.toObject());
|
9918
9931
|
} else {
|
9919
9932
|
const err2 = new GrpcWebError(response.statusMessage, response.status, response.trailers);
|
@@ -9931,7 +9944,7 @@ var GrpcWebImpl = class {
|
|
9931
9944
|
const maybeCombinedMetadata = metadata && this.options.metadata ? new import_browser_headers.BrowserHeaders({ ...(_a = this.options) == null ? void 0 : _a.metadata.headersMap, ...metadata == null ? void 0 : metadata.headersMap }) : metadata || this.options.metadata;
|
9932
9945
|
return new import_rxjs.Observable((observer) => {
|
9933
9946
|
const upStream = () => {
|
9934
|
-
const client = import_grpc_web.
|
9947
|
+
const client = import_grpc_web.grpc.invoke(methodDesc, {
|
9935
9948
|
host: this.host,
|
9936
9949
|
request,
|
9937
9950
|
transport: this.options.streamingTransport || this.options.transport,
|
package/dist/index.mjs
CHANGED
@@ -2637,7 +2637,7 @@ export * from "@farcaster/core";
|
|
2637
2637
|
// src/generated/rpc.ts
|
2638
2638
|
init_esm_shims();
|
2639
2639
|
var import_browser_headers = __toESM(require_browser_headers());
|
2640
|
-
import
|
2640
|
+
import { grpc } from "@improbable-eng/grpc-web";
|
2641
2641
|
import { Observable } from "rxjs";
|
2642
2642
|
import { share } from "rxjs/operators";
|
2643
2643
|
|
@@ -4180,7 +4180,8 @@ function createBaseFrameActionBody() {
|
|
4180
4180
|
castId: void 0,
|
4181
4181
|
inputText: new Uint8Array(),
|
4182
4182
|
state: new Uint8Array(),
|
4183
|
-
transactionId: new Uint8Array()
|
4183
|
+
transactionId: new Uint8Array(),
|
4184
|
+
address: new Uint8Array()
|
4184
4185
|
};
|
4185
4186
|
}
|
4186
4187
|
var FrameActionBody = {
|
@@ -4203,6 +4204,9 @@ var FrameActionBody = {
|
|
4203
4204
|
if (message.transactionId.length !== 0) {
|
4204
4205
|
writer.uint32(50).bytes(message.transactionId);
|
4205
4206
|
}
|
4207
|
+
if (message.address.length !== 0) {
|
4208
|
+
writer.uint32(58).bytes(message.address);
|
4209
|
+
}
|
4206
4210
|
return writer;
|
4207
4211
|
},
|
4208
4212
|
decode(input, length) {
|
@@ -4248,6 +4252,12 @@ var FrameActionBody = {
|
|
4248
4252
|
}
|
4249
4253
|
message.transactionId = reader.bytes();
|
4250
4254
|
continue;
|
4255
|
+
case 7:
|
4256
|
+
if (tag != 58) {
|
4257
|
+
break;
|
4258
|
+
}
|
4259
|
+
message.address = reader.bytes();
|
4260
|
+
continue;
|
4251
4261
|
}
|
4252
4262
|
if ((tag & 7) == 4 || tag == 0) {
|
4253
4263
|
break;
|
@@ -4263,7 +4273,8 @@ var FrameActionBody = {
|
|
4263
4273
|
castId: isSet2(object.castId) ? CastId.fromJSON(object.castId) : void 0,
|
4264
4274
|
inputText: isSet2(object.inputText) ? bytesFromBase642(object.inputText) : new Uint8Array(),
|
4265
4275
|
state: isSet2(object.state) ? bytesFromBase642(object.state) : new Uint8Array(),
|
4266
|
-
transactionId: isSet2(object.transactionId) ? bytesFromBase642(object.transactionId) : new Uint8Array()
|
4276
|
+
transactionId: isSet2(object.transactionId) ? bytesFromBase642(object.transactionId) : new Uint8Array(),
|
4277
|
+
address: isSet2(object.address) ? bytesFromBase642(object.address) : new Uint8Array()
|
4267
4278
|
};
|
4268
4279
|
},
|
4269
4280
|
toJSON(message) {
|
@@ -4276,13 +4287,14 @@ var FrameActionBody = {
|
|
4276
4287
|
message.transactionId !== void 0 && (obj.transactionId = base64FromBytes2(
|
4277
4288
|
message.transactionId !== void 0 ? message.transactionId : new Uint8Array()
|
4278
4289
|
));
|
4290
|
+
message.address !== void 0 && (obj.address = base64FromBytes2(message.address !== void 0 ? message.address : new Uint8Array()));
|
4279
4291
|
return obj;
|
4280
4292
|
},
|
4281
4293
|
create(base) {
|
4282
4294
|
return FrameActionBody.fromPartial(base != null ? base : {});
|
4283
4295
|
},
|
4284
4296
|
fromPartial(object) {
|
4285
|
-
var _a, _b, _c, _d, _e;
|
4297
|
+
var _a, _b, _c, _d, _e, _f;
|
4286
4298
|
const message = createBaseFrameActionBody();
|
4287
4299
|
message.url = (_a = object.url) != null ? _a : new Uint8Array();
|
4288
4300
|
message.buttonIndex = (_b = object.buttonIndex) != null ? _b : 0;
|
@@ -4290,6 +4302,7 @@ var FrameActionBody = {
|
|
4290
4302
|
message.inputText = (_c = object.inputText) != null ? _c : new Uint8Array();
|
4291
4303
|
message.state = (_d = object.state) != null ? _d : new Uint8Array();
|
4292
4304
|
message.transactionId = (_e = object.transactionId) != null ? _e : new Uint8Array();
|
4305
|
+
message.address = (_f = object.address) != null ? _f : new Uint8Array();
|
4293
4306
|
return message;
|
4294
4307
|
}
|
4295
4308
|
};
|
@@ -9842,14 +9855,14 @@ var GrpcWebImpl = class {
|
|
9842
9855
|
const request = { ..._request, ...methodDesc.requestType };
|
9843
9856
|
const maybeCombinedMetadata = metadata && this.options.metadata ? new import_browser_headers.BrowserHeaders({ ...(_a = this.options) == null ? void 0 : _a.metadata.headersMap, ...metadata == null ? void 0 : metadata.headersMap }) : metadata || this.options.metadata;
|
9844
9857
|
return new Promise((resolve, reject) => {
|
9845
|
-
|
9858
|
+
grpc.unary(methodDesc, {
|
9846
9859
|
request,
|
9847
9860
|
host: this.host,
|
9848
9861
|
metadata: maybeCombinedMetadata,
|
9849
9862
|
transport: this.options.transport,
|
9850
9863
|
debug: this.options.debug,
|
9851
9864
|
onEnd: function(response) {
|
9852
|
-
if (response.status ===
|
9865
|
+
if (response.status === grpc.Code.OK) {
|
9853
9866
|
resolve(response.message.toObject());
|
9854
9867
|
} else {
|
9855
9868
|
const err2 = new GrpcWebError(response.statusMessage, response.status, response.trailers);
|
@@ -9867,7 +9880,7 @@ var GrpcWebImpl = class {
|
|
9867
9880
|
const maybeCombinedMetadata = metadata && this.options.metadata ? new import_browser_headers.BrowserHeaders({ ...(_a = this.options) == null ? void 0 : _a.metadata.headersMap, ...metadata == null ? void 0 : metadata.headersMap }) : metadata || this.options.metadata;
|
9868
9881
|
return new Observable((observer) => {
|
9869
9882
|
const upStream = () => {
|
9870
|
-
const client =
|
9883
|
+
const client = grpc.invoke(methodDesc, {
|
9871
9884
|
host: this.host,
|
9872
9885
|
request,
|
9873
9886
|
transport: this.options.streamingTransport || this.options.transport,
|
@@ -9922,7 +9935,7 @@ var GrpcWebError = class extends tsProtoGlobalThis7.Error {
|
|
9922
9935
|
|
9923
9936
|
// src/client.ts
|
9924
9937
|
init_esm_shims();
|
9925
|
-
import
|
9938
|
+
import grpcWeb from "@improbable-eng/grpc-web";
|
9926
9939
|
|
9927
9940
|
// ../../node_modules/neverthrow/dist/index.es.js
|
9928
9941
|
init_esm_shims();
|
@@ -10335,15 +10348,15 @@ import { HubError } from "@farcaster/core";
|
|
10335
10348
|
import { Observable as Observable2 } from "rxjs";
|
10336
10349
|
var grpcCodeToHubErrorCode = (code) => {
|
10337
10350
|
switch (code) {
|
10338
|
-
case
|
10351
|
+
case grpcWeb.grpc.Code.Unauthenticated:
|
10339
10352
|
return "unauthenticated";
|
10340
|
-
case
|
10353
|
+
case grpcWeb.grpc.Code.PermissionDenied:
|
10341
10354
|
return "unauthorized";
|
10342
|
-
case
|
10355
|
+
case grpcWeb.grpc.Code.InvalidArgument:
|
10343
10356
|
return "bad_request";
|
10344
|
-
case
|
10357
|
+
case grpcWeb.grpc.Code.NotFound:
|
10345
10358
|
return "not_found";
|
10346
|
-
case
|
10359
|
+
case grpcWeb.grpc.Code.Unavailable:
|
10347
10360
|
return "unavailable";
|
10348
10361
|
default:
|
10349
10362
|
return "unknown";
|
@@ -10391,7 +10404,7 @@ var getRpcWebClient = (...args) => {
|
|
10391
10404
|
return new GrpcWebImpl(...args);
|
10392
10405
|
};
|
10393
10406
|
var getAuthMetadata = (username, password) => {
|
10394
|
-
const metadata = new
|
10407
|
+
const metadata = new grpcWeb.grpc.Metadata();
|
10395
10408
|
if (typeof btoa === "undefined") {
|
10396
10409
|
metadata.set("authorization", `Basic ${Buffer.from(`${username}:${password}`).toString("base64")}`);
|
10397
10410
|
} else {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@farcaster/hub-web",
|
3
|
-
"version": "0.8.
|
3
|
+
"version": "0.8.5",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"module": "./dist/index.mjs",
|
6
6
|
"types": "./dist/index.d.ts",
|
@@ -28,7 +28,7 @@
|
|
28
28
|
"ts-proto": "^1.146.0"
|
29
29
|
},
|
30
30
|
"dependencies": {
|
31
|
-
"@farcaster/core": "^0.14.
|
31
|
+
"@farcaster/core": "^0.14.7",
|
32
32
|
"@improbable-eng/grpc-web": "^0.15.0",
|
33
33
|
"rxjs": "^7.8.0"
|
34
34
|
}
|